Search in sources :

Example 6 with ServerRuntime

use of org.eclipse.jst.server.generic.servertype.definition.ServerRuntime 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 7 with ServerRuntime

use of org.eclipse.jst.server.generic.servertype.definition.ServerRuntime 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 8 with ServerRuntime

use of org.eclipse.jst.server.generic.servertype.definition.ServerRuntime 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 9 with ServerRuntime

use of org.eclipse.jst.server.generic.servertype.definition.ServerRuntime in project webtools.servertools by eclipse.

the class ServerDefinitionTypeTest method testResolve.

public void testResolve() {
    ServerTypeDefinitionManager serverTypeDefinitionManager = CorePlugin.getDefault().getServerTypeDefinitionManager();
    assertNotNull(serverTypeDefinitionManager);
    ServerRuntime[] types = serverTypeDefinitionManager.getServerTypeDefinitions();
    assertNotNull(types);
    assertTrue(types.length > 0);
    for (int i = 0; i < types.length; i++) {
        ServerRuntime definition = types[i];
        String wd = definition.getStart().getWorkingDirectory();
        String resolved = definition.getResolver().resolveProperties(wd);
        assertFalse(resolved.indexOf("${") >= 0);
    }
}
Also used : ServerTypeDefinitionManager(org.eclipse.jst.server.generic.core.internal.ServerTypeDefinitionManager) ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime)

Example 10 with ServerRuntime

use of org.eclipse.jst.server.generic.servertype.definition.ServerRuntime in project webtools.servertools by eclipse.

the class ServerDefinitionTypeTest method testGetTypes.

public void testGetTypes() {
    IExtension[] extensions = ExtensionPointUtil.getGenericServerDefinitionExtensions();
    int noOfExtensions = 0;
    for (int i = 0; i < extensions.length; i++) {
        noOfExtensions += ExtensionPointUtil.getConfigurationElements(extensions[i]).length;
    }
    ServerTypeDefinitionManager serverTypeDefinitionManager = CorePlugin.getDefault().getServerTypeDefinitionManager();
    assertNotNull(serverTypeDefinitionManager);
    ServerRuntime[] types = serverTypeDefinitionManager.getServerTypeDefinitions();
    assertNotNull(types);
    assertEquals(noOfExtensions, types.length);
}
Also used : ServerTypeDefinitionManager(org.eclipse.jst.server.generic.core.internal.ServerTypeDefinitionManager) IExtension(org.eclipse.core.runtime.IExtension) ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime)

Aggregations

ServerRuntime (org.eclipse.jst.server.generic.servertype.definition.ServerRuntime)23 Map (java.util.Map)8 GenericServerRuntime (org.eclipse.jst.server.generic.core.internal.GenericServerRuntime)8 GenericServer (org.eclipse.jst.server.generic.core.internal.GenericServer)4 Iterator (java.util.Iterator)3 List (java.util.List)3 IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)3 ArrayList (java.util.ArrayList)2 IExtension (org.eclipse.core.runtime.IExtension)2 IStatus (org.eclipse.core.runtime.IStatus)2 ServerTypeDefinitionManager (org.eclipse.jst.server.generic.core.internal.ServerTypeDefinitionManager)2 Resolver (org.eclipse.jst.server.generic.internal.xml.Resolver)2 HashMap (java.util.HashMap)1 Properties (java.util.Properties)1 StringTokenizer (java.util.StringTokenizer)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 Status (org.eclipse.core.runtime.Status)1 URI (org.eclipse.emf.common.util.URI)1 WrappedException (org.eclipse.emf.common.util.WrappedException)1