Search in sources :

Example 26 with IRuntimeType

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

the class GenericServerClasspathRuntimeHandlerTest method setUp.

/*
     * @see TestCase#setUp()
     */
protected void setUp() throws Exception {
    super.setUp();
    IRuntimeType type = ServerCore.findRuntimeType("org.eclipse.jst.server.generic.runtime.jonas4");
    IRuntimeWorkingCopy wc = type.createRuntime("testRuntime", null);
    GenericServerRuntime delegate = (GenericServerRuntime) wc.loadAdapter(GenericServerRuntime.class, new NullProgressMonitor());
    HashMap props = new HashMap();
    props.put("mappernames", "");
    props.put("classPathVariableName", "JONAS");
    props.put("serverAddress", "127.0.0.1");
    props.put("jonasBase", SERVER_ROOT);
    props.put("jonasRoot", SERVER_ROOT);
    props.put("protocols", "jrmp");
    props.put("port", "9000");
    delegate.setServerInstanceProperties(props);
    delegate.setServerDefinitionId(SERVER_DEF_NAME);
    wc.save(false, null);
    fRuntime = wc.getOriginal();
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) GenericServerRuntime(org.eclipse.jst.server.generic.core.internal.GenericServerRuntime) HashMap(java.util.HashMap) IRuntimeType(org.eclipse.wst.server.core.IRuntimeType) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy)

Example 27 with IRuntimeType

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

the class ServerCreationTest method setUp.

/*
	 * @see TestCase#setUp()
	 */
protected void setUp() throws Exception {
    super.setUp();
    IRuntimeType[] listAll = ServerCore.getRuntimeTypes();
    if (listAll != null) {
        for (int i = 0; i < listAll.length; i++) {
            IRuntimeType runtimeType = listAll[i];
            if ("J2EE Runtime Library".equals(runtimeType.getName()))
                j2eeRuntimeType = (RuntimeType) runtimeType;
        }
    }
}
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 28 with IRuntimeType

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

the class ServerCreationTest method testCreateServer.

public void testCreateServer() throws Exception {
    // Finds the generic server type
    IServerType[] sTypes = ServerCore.getServerTypes();
    IServerType serverType = null;
    for (int i = 0; i < sTypes.length; i++) {
        IServerType sType = sTypes[i];
        if (ID.equals(sType.getId()))
            serverType = sType;
    }
    assertNotNull("Could not find org.eclipse.jst.server.generic.jonas4 server type", serverType);
    // Finds the generic server runtime type
    IRuntimeType runtimeType = serverType.getRuntimeType();
    assertNotNull("Could not find runtime type for the generic server type", runtimeType);
    // Create a new runtime instance from the type
    IRuntime runtime = runtimeType.createRuntime(ID + ".Jonas.Runtime", null);
    assertNotNull("Could not create runtime", runtime);
    // Create a new server instance from the type
    IServerWorkingCopy server = serverType.createServer(ID + ".Jonas.Server", null, runtime, null);
    assertNotNull("Could not create server", server);
    // Save the server
    server.save(false, null);
    // Set properties for the runtime
    IRuntimeWorkingCopy runtimeWorkingCopy = runtime.createWorkingCopy();
    assertNotNull("Could not create runtime working copy", runtimeWorkingCopy);
    // Set the JONAS runtime as the default runtime
    ServerUtil.setRuntimeDefaultName(runtimeWorkingCopy);
    assertNotNull("Runtime working copy has no name", runtimeWorkingCopy.getName());
    // Set properties for the JONAS runtime
    GenericServerRuntime runtimeDelegate = (GenericServerRuntime) runtimeWorkingCopy.loadAdapter(GenericServerRuntime.class, new NullProgressMonitor());
    assertNotNull("Could not obtain runtime delegate", runtimeDelegate);
    HashMap props = new HashMap();
    props.put("mappernames", "");
    props.put("classPathVariableName", "JONAS");
    props.put("serverAddress", "127.0.0.1");
    props.put("jonasBase", "C:\\nmd\\dev\\java\\appservers\\JOnAS-4.1.4");
    props.put("jonasRoot", "C:\\nmd\\dev\\java\\appservers\\JOnAS-4.1.4");
    props.put("classPath", "C:\\nmd\\dev\\java\\appservers\\JOnAS-4.1.4");
    props.put("protocols", "C:\\nmd\\dev\\java\\appservers\\JOnAS-4.1.4");
    props.put("port", "9000");
    runtimeDelegate.setServerInstanceProperties(props);
    // Save the runtime working copy
    runtimeWorkingCopy.save(false, null);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) GenericServerRuntime(org.eclipse.jst.server.generic.core.internal.GenericServerRuntime) IServerType(org.eclipse.wst.server.core.IServerType) HashMap(java.util.HashMap) IRuntimeType(org.eclipse.wst.server.core.IRuntimeType) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy) IRuntime(org.eclipse.wst.server.core.IRuntime)

Example 29 with IRuntimeType

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

the class TomcatRuntimeTestCase method createRuntime.

protected IRuntimeWorkingCopy createRuntime(String runtimeTypeId) throws Exception {
    IRuntimeType rt = ServerCore.findRuntimeType(runtimeTypeId);
    IRuntimeWorkingCopy wc = rt.createRuntime("a", null);
    wc.setLocation(new Path("c://test"));
    return wc;
}
Also used : Path(org.eclipse.core.runtime.Path) IRuntimeType(org.eclipse.wst.server.core.IRuntimeType) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy)

Example 30 with IRuntimeType

use of org.eclipse.wst.server.core.IRuntimeType in project liferay-ide by liferay.

the class CustomJspPage method _getLiferay62ServerLocation.

private String _getLiferay62ServerLocation() {
    String liferay62ServerLocation = dataModel.getLiferay62ServerLocation().content(true);
    if (liferay62ServerLocation == null) {
        Set<IRuntime> liferayRuntimes = ServerUtil.getAvailableLiferayRuntimes();
        for (IRuntime liferayRuntime : liferayRuntimes) {
            IRuntimeType runtimeType = liferayRuntime.getRuntimeType();
            if (runtimeType.getId().startsWith("com.liferay.ide.server.62.")) {
                IPath runtimeLocation = liferayRuntime.getLocation();
                liferay62ServerLocation = runtimeLocation.removeLastSegments(1).toString();
                return liferay62ServerLocation;
            }
        }
        if (liferay62ServerLocation == null) {
            Boolean openAddLiferaryServerDialog = MessageDialog.openConfirm(UIUtil.getActiveShell(), "Could not find Liferay 6.2 Runtime", "This process requires Liferay 6.2 Runtime. Click OK to add Liferay 6.2 Runtime.");
            if (openAddLiferaryServerDialog) {
                ServerUIUtil.showNewRuntimeWizard(UIUtil.getActiveShell(), null, null, "com.liferay.");
                return _getLiferay62ServerLocation();
            }
        }
    }
    return liferay62ServerLocation;
}
Also used : IPath(org.eclipse.core.runtime.IPath) IRuntimeType(org.eclipse.wst.server.core.IRuntimeType) StyledString(org.eclipse.jface.viewers.StyledString) 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