Search in sources :

Example 1 with JndiLaunchable

use of org.eclipse.jst.server.core.JndiLaunchable 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)

Aggregations

Iterator (java.util.Iterator)1 List (java.util.List)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 ArgumentPair (org.eclipse.jst.server.generic.servertype.definition.ArgumentPair)1 ServerRuntime (org.eclipse.jst.server.generic.servertype.definition.ServerRuntime)1