Search in sources :

Example 1 with GenericServerRuntime

use of org.eclipse.jst.server.generic.core.internal.GenericServerRuntime in project webtools.servertools by eclipse.

the class GenericServerWizardFragment method getServerTypeDefinitionFor.

/**
 * @param server
 * @return
 */
private ServerRuntime getServerTypeDefinitionFor(IServerWorkingCopy server) {
    GenericServerRuntime runtime = (GenericServerRuntime) server.getRuntime().getAdapter(GenericServerRuntime.class);
    if (runtime == null) {
        IRuntime wc = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
        runtime = (GenericServerRuntime) wc.getAdapter(GenericServerRuntime.class);
        if (runtime == null)
            runtime = (GenericServerRuntime) wc.loadAdapter(GenericServerRuntime.class, new NullProgressMonitor());
    }
    String serverTyepId = server.getServerType().getId();
    String runtimeTypeId = runtime.getRuntime().getRuntimeType().getId();
    if (runtimeTypeId == null) {
        return null;
    }
    Map runtimeProperties = runtime.getServerInstanceProperties();
    ServerRuntime definition = getServerTypeDefinition(serverTyepId, runtimeTypeId, runtimeProperties);
    return definition;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) GenericServerRuntime(org.eclipse.jst.server.generic.core.internal.GenericServerRuntime) GenericServerRuntime(org.eclipse.jst.server.generic.core.internal.GenericServerRuntime) ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime) Map(java.util.Map) IRuntime(org.eclipse.wst.server.core.IRuntime)

Example 2 with GenericServerRuntime

use of org.eclipse.jst.server.generic.core.internal.GenericServerRuntime in project webtools.servertools by eclipse.

the class GenericServerTest method testServerAndRuntimeInfoForServerDefOnly.

public void testServerAndRuntimeInfoForServerDefOnly() throws Exception {
    GenericServerRuntime runtime = ServerRuntimeUtils.getGenericServerRuntime(TEST_SERVERDEFONLY_RUNTIMETYPE_ID);
    GenericServer server = ServerRuntimeUtils.getGenericServer(TEST_SERVERDEFONLY_SERVERTYPE_ID, runtime.getRuntime());
    assertNotNull(server);
    ServerRuntime serverRuntime = server.getServerDefinition();
    // Verify Server and Runtime info
    ServerRuntimeUtils.verifyProperty(serverRuntime.getProperty(), "foo.prop.a", "a runtime property value");
    ServerRuntimeUtils.verifyProperty(serverRuntime.getProperty(), "foo.prop.b", "a server property value");
    ServerRuntimeUtils.verifyClasspath(serverRuntime.getClasspath(), "foo.classpath");
}
Also used : GenericServerRuntime(org.eclipse.jst.server.generic.core.internal.GenericServerRuntime) GenericServerRuntime(org.eclipse.jst.server.generic.core.internal.GenericServerRuntime) ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime) GenericServer(org.eclipse.jst.server.generic.core.internal.GenericServer)

Example 3 with GenericServerRuntime

use of org.eclipse.jst.server.generic.core.internal.GenericServerRuntime in project webtools.servertools by eclipse.

the class ServerRuntimeUtils method getGenericServerRuntime.

public static GenericServerRuntime getGenericServerRuntime(String runtimeTypeId) throws CoreException {
    GenericServerRuntime runtimeDelegate = null;
    IRuntimeType[] runtimesTypes = ServerCore.getRuntimeTypes();
    for (int i = 0; i < runtimesTypes.length; i++) {
        IRuntimeType runtimeType = runtimesTypes[i];
        if (runtimeType.getId().equals(runtimeTypeId)) {
            IRuntime runtimeWorkingCopy = runtimeType.createRuntime(runtimeTypeId, null);
            runtimeDelegate = (GenericServerRuntime) runtimeWorkingCopy.loadAdapter(GenericServerRuntime.class, new NullProgressMonitor());
            break;
        }
    }
    return runtimeDelegate;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) GenericServerRuntime(org.eclipse.jst.server.generic.core.internal.GenericServerRuntime) IRuntimeType(org.eclipse.wst.server.core.IRuntimeType) IRuntime(org.eclipse.wst.server.core.IRuntime)

Example 4 with GenericServerRuntime

use of org.eclipse.jst.server.generic.core.internal.GenericServerRuntime in project webtools.servertools by eclipse.

the class GenericServerRuntimeTest method testServerAndRuntimeInfo.

/**
 * runtimeTypeId used as key to .serverdef
 */
public void testServerAndRuntimeInfo() throws Exception {
    GenericServerRuntime runtime = ServerRuntimeUtils.getGenericServerRuntime(TEST_SERVERDEFONLY_RUNTIMETYPE_ID);
    assertNotNull(runtime);
    ServerRuntime serverRuntime = runtime.getServerTypeDefinition();
    assertNotNull(serverRuntime);
    // Verify runtime info, and server info
    ServerRuntimeUtils.verifyProperty(serverRuntime.getProperty(), "foo.prop.a", "a runtime property value");
    ServerRuntimeUtils.verifyProperty(serverRuntime.getProperty(), "foo.prop.b", "a server property value");
}
Also used : GenericServerRuntime(org.eclipse.jst.server.generic.core.internal.GenericServerRuntime) GenericServerRuntime(org.eclipse.jst.server.generic.core.internal.GenericServerRuntime) ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime)

Example 5 with GenericServerRuntime

use of org.eclipse.jst.server.generic.core.internal.GenericServerRuntime 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)

Aggregations

GenericServerRuntime (org.eclipse.jst.server.generic.core.internal.GenericServerRuntime)8 ServerRuntime (org.eclipse.jst.server.generic.servertype.definition.ServerRuntime)5 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)4 IRuntime (org.eclipse.wst.server.core.IRuntime)3 IRuntimeType (org.eclipse.wst.server.core.IRuntimeType)3 HashMap (java.util.HashMap)2 GenericServer (org.eclipse.jst.server.generic.core.internal.GenericServer)2 IRuntimeWorkingCopy (org.eclipse.wst.server.core.IRuntimeWorkingCopy)2 Map (java.util.Map)1 IServerType (org.eclipse.wst.server.core.IServerType)1 IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)1