Search in sources :

Example 11 with ServerRuntime

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

the class GenericServerLaunchableAdapterDelegate method prepareJndiLaunchable.

private Object prepareJndiLaunchable(IModuleArtifact moduleObject, ServerDelegate delegate) {
    JndiLaunchable launchable = null;
    GenericServer genericServer = (GenericServer) delegate;
    ServerRuntime definition = genericServer.getServerDefinition();
    Properties props = new Properties();
    props.put(JAVA_NAMING_FACTORY_INITIAL_PROPKEY, definition.getJndiConnection().getInitialContextFactory());
    props.put(JAVA_NAMING_PROVIDER_URL_PROPKEY, definition.getJndiConnection().getProviderUrl());
    List jps = definition.getJndiConnection().getJndiProperty();
    Iterator propsIt = jps.iterator();
    while (propsIt.hasNext()) {
        ArgumentPair prop = (ArgumentPair) propsIt.next();
        props.put(prop.getName(), prop.getValue());
    }
    if (moduleObject instanceof EJBBean) {
        EJBBean bean = (EJBBean) moduleObject;
        launchable = new JndiLaunchable(props, bean.getJndiName());
    }
    if (moduleObject instanceof JndiObject) {
        JndiObject jndi = (JndiObject) moduleObject;
        launchable = new JndiLaunchable(props, jndi.getJndiName());
    }
    return launchable;
}
Also used : JndiLaunchable(org.eclipse.jst.server.core.JndiLaunchable) JndiObject(org.eclipse.jst.server.core.JndiObject) ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime) Iterator(java.util.Iterator) List(java.util.List) EJBBean(org.eclipse.jst.server.core.EJBBean) Properties(java.util.Properties) ArgumentPair(org.eclipse.jst.server.generic.servertype.definition.ArgumentPair)

Example 12 with ServerRuntime

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

the class ExternalServerBehaviour method setupLaunchConfiguration.

/**
 * Override superclass method to correctly setup the launch configuration for starting an external
 * server.
 * @param workingCopy
 * @param monitor
 * @throws CoreException
 */
public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy, IProgressMonitor monitor) throws CoreException {
    clearDebuggingConfig();
    ServerRuntime serverDef = getServerDefinition();
    Resolver resolver = serverDef.getResolver();
    workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, resolver.resolveProperties(serverDef.getStart().getWorkingDirectory()));
    String external = resolver.resolveProperties(getExternalForOS(serverDef.getStart().getExternal()));
    workingCopy.setAttribute(ExternalLaunchConfigurationDelegate.COMMANDLINE, external);
    workingCopy.setAttribute(ExternalLaunchConfigurationDelegate.DEBUG_PORT, resolver.resolveProperties(serverDef.getStart().getDebugPort()));
    workingCopy.setAttribute(ExternalLaunchConfigurationDelegate.HOST, getServer().getHost());
    // just use the commandline for now
    workingCopy.setAttribute(ExternalLaunchConfigurationDelegate.EXECUTABLE_NAME, external);
    Map environVars = getEnvironmentVariables(getServerDefinition().getStart());
    if (!environVars.isEmpty()) {
        workingCopy.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, environVars);
    }
    String existingProgArgs = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, (String) null);
    String serverProgArgs = getProgramArguments();
    if (existingProgArgs == null || existingProgArgs.indexOf(serverProgArgs) < 0) {
        workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, serverProgArgs);
    }
}
Also used : Resolver(org.eclipse.jst.server.generic.internal.xml.Resolver) ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime) Map(java.util.Map)

Example 13 with ServerRuntime

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

the class PropertyImpl method getLabel.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
public String getLabel() {
    if (label.startsWith("%", 0)) {
        ServerRuntime rt = (ServerRuntime) eResource().getContents().get(0);
        Bundle bundle = Platform.getBundle(rt.getConfigurationElementNamespace());
        return Platform.getResourceString(bundle, label);
    }
    return label;
}
Also used : ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime) Bundle(org.osgi.framework.Bundle)

Example 14 with ServerRuntime

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

the class GenericServerRuntimeWizardFragment method createContent.

public void createContent(Composite parent, IWizardHandle handle) {
    Map properties = null;
    ServerRuntime definition = null;
    if (getRuntimeDelegate() != null) {
        properties = getRuntimeDelegate().getServerInstanceProperties();
        definition = getServerTypeDefinition(getServerDefinitionId(), properties);
    }
    IInstallableRuntime ir = ServerPlugin.findInstallableRuntime(getRuntimeDelegate().getRuntime().getRuntimeType().getId());
    if (ir != null) {
        fDecorators = new GenericServerCompositeDecorator[3];
        fDecorators[0] = new JRESelectDecorator(getRuntimeDelegate(), getWizard());
        fDecorators[1] = new ServerTypeDefinitionRuntimeDecorator(definition, properties, getWizard(), getRuntimeDelegate());
        fDecorators[2] = new InstallableRuntimeDecorator(getWizard(), getRuntimeDelegate());
    } else {
        fDecorators = new GenericServerCompositeDecorator[2];
        fDecorators[0] = new JRESelectDecorator(getRuntimeDelegate(), getWizard());
        fDecorators[1] = new ServerTypeDefinitionRuntimeDecorator(definition, properties, getWizard(), getRuntimeDelegate());
    }
    new GenericServerComposite(parent, fDecorators);
}
Also used : ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime) GenericServerRuntime(org.eclipse.jst.server.generic.core.internal.GenericServerRuntime) IInstallableRuntime(org.eclipse.wst.server.core.internal.IInstallableRuntime) Map(java.util.Map)

Example 15 with ServerRuntime

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

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