Search in sources :

Example 1 with GenericServer

use of org.eclipse.jst.server.generic.core.internal.GenericServer 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 2 with GenericServer

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

the class GenericServerWizardFragment method createContent.

public void createContent(Composite parent, IWizardHandle handle) {
    IServerWorkingCopy server = getServer();
    GenericServer dl = (GenericServer) server.loadAdapter(GenericServer.class, null);
    ServerRuntime definition = getServerTypeDefinitionFor(server);
    fDecorators = new GenericServerCompositeDecorator[1];
    fDecorators[0] = new ServerTypeDefinitionServerDecorator(definition, null, getWizard(), dl);
    new GenericServerComposite(parent, fDecorators);
}
Also used : GenericServerRuntime(org.eclipse.jst.server.generic.core.internal.GenericServerRuntime) ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) GenericServer(org.eclipse.jst.server.generic.core.internal.GenericServer)

Example 3 with GenericServer

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

the class GenericServerWizardFragment method isComplete.

/**
 */
public boolean isComplete() {
    ServerRuntime serverRuntime = getServerTypeDefinitionFor(getServer());
    if (serverRuntime == null)
        return false;
    IServerWorkingCopy server = getServer();
    GenericServer dl = (GenericServer) server.loadAdapter(GenericServer.class, null);
    IStatus status = dl.validate();
    return (status != null && status.isOK());
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) GenericServerRuntime(org.eclipse.jst.server.generic.core.internal.GenericServerRuntime) ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) GenericServer(org.eclipse.jst.server.generic.core.internal.GenericServer)

Example 4 with GenericServer

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

the class GenericServerTest method testServerAndRuntimeInfoForServerDefAndRuntimeDef.

/**
 * serverTypeId used as a key to the .serverdef file, then
 * the runtimeTypeId used as key to .runtimedef
 *
 * @throws Exception
 */
public void testServerAndRuntimeInfoForServerDefAndRuntimeDef() throws Exception {
    GenericServerRuntime runtime = ServerRuntimeUtils.getGenericServerRuntime(TEST_RUNTIMETYPE_ID);
    GenericServer server = ServerRuntimeUtils.getGenericServer(TEST_SERVERTYPE_ID, runtime.getRuntime());
    assertNotNull(server);
    ServerRuntime serverRuntime = server.getServerDefinition();
    // Verify Server and Runtime info: properties from runtimedef and serverdef are available
    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.runtime.classpath");
    ServerRuntimeUtils.verifyClasspath(serverRuntime.getClasspath(), "foo.server.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 5 with GenericServer

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

the class ServerRuntimeUtils method getGenericServer.

public static GenericServer getGenericServer(String serverTypeId, IRuntime runtime) throws Exception {
    GenericServer serverDelegate = null;
    IServerType[] sTypes = ServerCore.getServerTypes();
    for (int i = 0; i < sTypes.length; i++) {
        IServerType serverType = sTypes[i];
        if (serverTypeId.equals(serverType.getId())) {
            IServerWorkingCopy serverWorkingCopy = serverType.createServer(serverTypeId, null, runtime, null);
            assertNotNull("Could not create server", serverWorkingCopy);
            serverDelegate = (GenericServer) serverWorkingCopy.loadAdapter(GenericServer.class, new NullProgressMonitor());
        }
    }
    return serverDelegate;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IServerType(org.eclipse.wst.server.core.IServerType) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) GenericServer(org.eclipse.jst.server.generic.core.internal.GenericServer)

Aggregations

GenericServer (org.eclipse.jst.server.generic.core.internal.GenericServer)5 GenericServerRuntime (org.eclipse.jst.server.generic.core.internal.GenericServerRuntime)4 ServerRuntime (org.eclipse.jst.server.generic.servertype.definition.ServerRuntime)4 IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)3 IStatus (org.eclipse.core.runtime.IStatus)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 IServerType (org.eclipse.wst.server.core.IServerType)1