Search in sources :

Example 1 with ArgumentPair

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

the class GenericServerBehaviour method getEnvironmentVariables.

protected Map getEnvironmentVariables(LaunchConfiguration config) {
    List variables = config.getEnvironmentVariable();
    Map<String, String> varsMap = new HashMap<String, String>(variables.size());
    Iterator iterator = variables.iterator();
    while (iterator.hasNext()) {
        ArgumentPair pair = (ArgumentPair) iterator.next();
        varsMap.put(pair.getName(), getServerDefinition().getResolver().resolveProperties(pair.getValue()));
    }
    return varsMap;
}
Also used : HashMap(java.util.HashMap) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) ArgumentPair(org.eclipse.jst.server.generic.servertype.definition.ArgumentPair)

Example 2 with ArgumentPair

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

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

the class ServerTypeDefinitionModelTest method testJNDIConnection.

public void testJNDIConnection() {
    JndiConnection jndi = subject.getJndiConnection();
    assertNotNull(jndi);
    assertTrue(jndi.getProviderUrl() != null && jndi.getProviderUrl().length() > 0);
    assertTrue(jndi.getInitialContextFactory() != null && jndi.getInitialContextFactory().length() > 0);
    assertNotNull(jndi.getJndiProperty());
    if (jndi.getJndiProperty().size() > 0) {
        ArgumentPair property = (ArgumentPair) jndi.getJndiProperty().get(0);
        assertNotNull(property.getName());
        assertNotNull(property.getValue());
    }
}
Also used : JndiConnection(org.eclipse.jst.server.generic.servertype.definition.JndiConnection) ArgumentPair(org.eclipse.jst.server.generic.servertype.definition.ArgumentPair)

Aggregations

ArgumentPair (org.eclipse.jst.server.generic.servertype.definition.ArgumentPair)3 Iterator (java.util.Iterator)2 List (java.util.List)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Properties (java.util.Properties)1 EJBBean (org.eclipse.jst.server.core.EJBBean)1 JndiLaunchable (org.eclipse.jst.server.core.JndiLaunchable)1 JndiObject (org.eclipse.jst.server.core.JndiObject)1 JndiConnection (org.eclipse.jst.server.generic.servertype.definition.JndiConnection)1 ServerRuntime (org.eclipse.jst.server.generic.servertype.definition.ServerRuntime)1