Search in sources :

Example 16 with ServerRuntime

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

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

the class XMLUtils method refresh.

/**
 * Load all the serverdefinition and runtimedefinition extensions.
 */
private void refresh() {
    serverDefinitions = new ArrayList<ServerRuntime>();
    IExtension[] serverDefExtensions = ExtensionPointUtil.getGenericServerDefinitionExtensions();
    for (int i = 0; serverDefExtensions != null && i < serverDefExtensions.length; i++) {
        java.net.URI definitionFile = null;
        IExtension extension = serverDefExtensions[i];
        IConfigurationElement[] elements = ExtensionPointUtil.getConfigurationElements(extension);
        for (int j = 0; j < elements.length; j++) {
            IConfigurationElement element = elements[j];
            definitionFile = getDefinitionFile(element);
            ServerRuntime runtime = readFile(definitionFile);
            if (runtime != null) {
                // $NON-NLS-1$
                runtime.setId(element.getAttribute("id"));
                runtime.setConfigurationElementNamespace(element.getNamespaceIdentifier());
                serverDefinitions.add(runtime);
            }
        }
    }
    runtimeDefinitions = new ArrayList<ServerRuntime>();
    IExtension[] runtimeDefExtensions = ExtensionPointUtil.getGenericServerRuntimeDefinitionExtensions();
    for (int i = 0; runtimeDefExtensions != null && i < runtimeDefExtensions.length; i++) {
        java.net.URI definitionFile = null;
        IExtension extension = runtimeDefExtensions[i];
        IConfigurationElement[] elements = ExtensionPointUtil.getConfigurationElements(extension);
        for (int j = 0; j < elements.length; j++) {
            IConfigurationElement element = elements[j];
            definitionFile = getDefinitionFile(element);
            ServerRuntime runtime = readFile(definitionFile);
            if (runtime != null) {
                // $NON-NLS-1$
                runtime.setId(element.getAttribute("id"));
                runtime.setConfigurationElementNamespace(element.getNamespaceIdentifier());
                runtimeDefinitions.add(runtime);
            }
        }
    }
}
Also used : ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime) IExtension(org.eclipse.core.runtime.IExtension) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Example 18 with ServerRuntime

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

the class AntPublisherPropertyTester method test.

public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
    if (receiver instanceof IServerWorkingCopy) {
        IServerWorkingCopy wc = (IServerWorkingCopy) receiver;
        ServerRuntime runtimeDefinition = ServerTypeDefinitionUtil.getServerTypeDefinition(wc.getRuntime());
        if (runtimeDefinition != null) {
            List l = runtimeDefinition.getPublisher();
            Iterator r = l.iterator();
            while (r.hasNext()) {
                Publisher publisher = (Publisher) r.next();
                if (AntPublisher.PUBLISHER_ID.equals(publisher.getId())) {
                    return true;
                }
            }
        }
    }
    ;
    return false;
}
Also used : ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) Iterator(java.util.Iterator) List(java.util.List) AntPublisher(org.eclipse.jst.server.generic.core.internal.publishers.AntPublisher) Publisher(org.eclipse.jst.server.generic.servertype.definition.Publisher)

Example 19 with ServerRuntime

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

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

the class XMLUtilsTest method testLoadDefinitions.

public void testLoadDefinitions() {
    ServerRuntime definition = xmlUtils.getServerTypeDefinition(TestConstants.TEST_SERVERDEFONLY_RUNTIMETYPE_ID);
    assertNotNull(definition);
    definition = xmlUtils.getServerTypeDefinition(TestConstants.TEST_SERVERDEFONLY_SERVERTYPE_ID);
    assertNull(definition);
    definition = xmlUtils.getRuntimeTypeDefinition(TestConstants.TEST_SERVERDEFONLY_RUNTIMETYPE_ID);
    assertNull(definition);
    definition = xmlUtils.getServerTypeDefinition(TestConstants.TEST_SERVERTYPE_ID);
    assertNotNull(definition);
    definition = xmlUtils.getRuntimeTypeDefinition(TestConstants.TEST_RUNTIMETYPE_ID);
    assertNotNull(definition);
}
Also used : 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