Search in sources :

Example 11 with IRuntimeType

use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.

the class CreationTestCase method test02CreateServer.

public void test02CreateServer() throws Exception {
    // Find the v6 runtime that can be started (not stub).
    IRuntimeType runtimeType = ServerCore.findRuntimeType("com.ibm.etools.publishing.static.server.runtime");
    assertTrue("V6 runtime type is not found", runtimeType != null);
    // Create the server.
    IServerType serverType = ServerCore.findServerType("com.ibm.etools.publishing.static.server");
    assertTrue("No Static server type has be defined.", serverType != null);
    IServerWorkingCopy serverWc = null;
    serverWc = serverType.createServer("Static Server", null, new NullProgressMonitor());
    server = serverWc.save(true, null);
    assertNotNull("The created server cannot be found.", server);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IServerType(org.eclipse.wst.server.core.IServerType) IRuntimeType(org.eclipse.wst.server.core.IRuntimeType) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy)

Example 12 with IRuntimeType

use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.

the class CreationTestCase method test00CreateServer.

public void test00CreateServer() throws Exception {
    // Find the v6 runtime that can be started (not stub).
    IRuntimeType runtimeType = ServerCore.findRuntimeType("com.ibm.etools.publishing.server.runtime");
    assertTrue("V6 runtime type is not found", runtimeType != null);
    // Find the V6 runtime location.
    // String userWasV6RuntimeLocation = System.getProperty("was.runtime.v6");
    // IPath runtimeLocation = userWasV6RuntimeLocation == null ?
    // WASRuntimeLocator.getRuntimeLocation(WASRuntimeLocator.BASE_V6) : new
    // Path(userWasV6RuntimeLocation);
    // assertTrue("Cannot find the runtime location", runtimeLocation !=
    // null);
    // Create the runtime
    // IRuntimeWorkingCopy curRuntimeWc = runtimeType.createRuntime(null);
    // ServerUtil.setRuntimeDefaultName(curRuntimeWc);
    // //curRuntimeWc.setLocation(runtimeLocation);
    // curRuntimeWc.save(null);
    // Get the created runtime.
    // IRuntime curRuntime = curRuntimeWc.getOriginal();
    // assertTrue("No created runtime is found.", curRuntime != null);
    // 
    // Create the server.
    IServerType serverType = ServerCore.findServerType(HttpServer.ID);
    assertTrue(serverType != null);
    IServerWorkingCopy serverWc = null;
    serverWc = serverType.createServer("HTTP Server", null, new NullProgressMonitor());
    server = serverWc.save(true, null);
    assertNotNull(server);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IServerType(org.eclipse.wst.server.core.IServerType) IRuntimeType(org.eclipse.wst.server.core.IRuntimeType) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy)

Example 13 with IRuntimeType

use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.

the class ServerPropertyPage method createContents.

/**
 * Create the body of the page.
 *
 * @param parent org.eclipse.swt.widgets.Composite
 * @return org.eclipse.swt.widgets.Control
 */
protected Control createContents(Composite parent) {
    try {
        IAdaptable element = getElement();
        server = (IServer) element.getAdapter(IServer.class);
        Composite composite = new Composite(parent, SWT.NONE);
        GridLayout layout = new GridLayout();
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        layout.numColumns = 3;
        composite.setLayout(layout);
        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
        IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
        whs.setHelp(composite, ContextIds.SERVER_PROPERTY_PAGE);
        // name
        Label label = new Label(composite, SWT.NONE);
        label.setText(Messages.propServerInfoName);
        label = new Label(composite, SWT.NONE);
        label.setText(server.getName());
        GridData data = new GridData(GridData.FILL_HORIZONTAL);
        data.horizontalSpan = 2;
        label.setLayoutData(data);
        // type
        label = new Label(composite, SWT.NONE);
        label.setText(Messages.propServerInfoType);
        IServerType serverType = server.getServerType();
        label = new Label(composite, SWT.NONE);
        if (serverType != null)
            label.setText(serverType.getName());
        else
            label.setText(Messages.elementUnknownName);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.horizontalSpan = 2;
        label.setLayoutData(data);
        // vendor
        label = new Label(composite, SWT.NONE);
        label.setText(Messages.propServerInfoVendor);
        IRuntimeType runtimeType = null;
        if (serverType != null)
            runtimeType = serverType.getRuntimeType();
        label = new Label(composite, SWT.NONE);
        if (runtimeType != null)
            label.setText(runtimeType.getVendor());
        else
            label.setText(Messages.elementUnknownName);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.horizontalSpan = 2;
        label.setLayoutData(data);
        // location
        label = new Label(composite, SWT.NONE);
        label.setText(Messages.switchServerLocation);
        label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING));
        final Label serverLocation = new Label(composite, SWT.NONE);
        final Server svr = (Server) server;
        if (svr.getFile() != null)
            serverLocation.setText(svr.getFile().getFullPath().toPortableString());
        else
            serverLocation.setText(Messages.switchServerLocationMetadata);
        serverLocation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
        Button switchLocation = new Button(composite, SWT.PUSH);
        switchLocation.setText(Messages.actionSwitchServerLocation);
        switchLocation.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
        switchLocation.setEnabled(!server.isReadOnly());
        switchLocation.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                try {
                    Server.switchLocation(svr, null);
                } catch (CoreException ce) {
                    if (Trace.SEVERE) {
                        Trace.trace(Trace.STRING_SEVERE, "Error switching server location", ce);
                    }
                }
                if (svr.getFile() != null)
                    serverLocation.setText(svr.getFile().getFullPath().toPortableString());
                else
                    serverLocation.setText(Messages.switchServerLocationMetadata);
            }
        });
        Dialog.applyDialogFont(composite);
        return composite;
    } catch (Exception e) {
        if (Trace.SEVERE) {
            Trace.trace(Trace.STRING_SEVERE, "Error creating property page", e);
        }
        return null;
    }
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) Composite(org.eclipse.swt.widgets.Composite) IServer(org.eclipse.wst.server.core.IServer) Server(org.eclipse.wst.server.core.internal.Server) IRuntimeType(org.eclipse.wst.server.core.IRuntimeType) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) CoreException(org.eclipse.core.runtime.CoreException) GridLayout(org.eclipse.swt.layout.GridLayout) IWorkbenchHelpSystem(org.eclipse.ui.help.IWorkbenchHelpSystem) CoreException(org.eclipse.core.runtime.CoreException) IServerType(org.eclipse.wst.server.core.IServerType) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 14 with IRuntimeType

use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.

the class RuntimeBridge method initialize.

private static void initialize() {
    // add runtime mappings
    IRuntimeType[] runtimeTypes = ServerCore.getRuntimeTypes();
    int size = runtimeTypes.length;
    for (int i = 0; i < size; i++) {
        RuntimeType rt = (RuntimeType) runtimeTypes[i];
        String component = rt.getFacetRuntimeComponent();
        String version = rt.getFacetRuntimeVersion();
        if (component != null && !"".equals(component) && version != null && !"".equals(version))
            addMapping(rt.getId(), component, version);
    }
    // add extension mappings
    RuntimeFacetMapping[] rfms = FacetMappingUtil.getRuntimeFacetMapping();
    size = rfms.length;
    for (int i = 0; i < size; i++) addMapping(rfms[i].getRuntimeTypeId(), rfms[i].getRuntimeComponent(), rfms[i].getVersion());
    // generic runtimes
    addMapping("org.eclipse.jst.server.generic.runtime.jboss323", "org.eclipse.jst.server.generic.runtime.jboss", "3.2.3");
    addMapping("org.eclipse.jst.server.generic.runtime.jonas4", "org.eclipse.jst.server.generic.runtime.jonas", "4.0");
    addMapping("org.eclipse.jst.server.generic.runtime.oracle1013", "org.eclipse.jst.server.generic.runtime.oracle", "10.1.3");
}
Also used : IRuntimeType(org.eclipse.wst.server.core.IRuntimeType) RuntimeType(org.eclipse.wst.server.core.internal.RuntimeType) IRuntimeType(org.eclipse.wst.server.core.IRuntimeType)

Example 15 with IRuntimeType

use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.

the class RuntimeTreeContentProvider method fillTree.

public void fillTree() {
    clean();
    List<TreeElement> list = new ArrayList<TreeElement>();
    IRuntime[] runtimes = ServerCore.getRuntimes();
    if (runtimes != null) {
        int size = runtimes.length;
        for (int i = 0; i < size; i++) {
            IRuntimeType runtimeType = runtimes[i].getRuntimeType();
            try {
                TreeElement ele = getOrCreate(list, runtimeType.getVendor());
                ele.contents.add(runtimes[i]);
                elementToParentMap.put(runtimes[i], ele);
            } catch (Exception e) {
                if (Trace.WARNING) {
                    Trace.trace(Trace.STRING_WARNING, "Error in runtime content provider", e);
                }
            }
        }
    }
    elements = list.toArray();
}
Also used : IRuntimeType(org.eclipse.wst.server.core.IRuntimeType) ArrayList(java.util.ArrayList) IRuntime(org.eclipse.wst.server.core.IRuntime)

Aggregations

IRuntimeType (org.eclipse.wst.server.core.IRuntimeType)35 IRuntime (org.eclipse.wst.server.core.IRuntime)17 IRuntimeWorkingCopy (org.eclipse.wst.server.core.IRuntimeWorkingCopy)12 IServerType (org.eclipse.wst.server.core.IServerType)10 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)9 IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)9 CoreException (org.eclipse.core.runtime.CoreException)8 IPath (org.eclipse.core.runtime.IPath)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Path (org.eclipse.core.runtime.Path)3 GenericServerRuntime (org.eclipse.jst.server.generic.core.internal.GenericServerRuntime)3 Image (org.eclipse.swt.graphics.Image)3 IServer (org.eclipse.wst.server.core.IServer)3 File (java.io.File)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Button (org.eclipse.swt.widgets.Button)2