Show
Ignore:
Timestamp:
08/19/08 00:55:11 (4 years ago)
Author:
kohlhaas
Message:

closes #57

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/org/rapla/plugin/jndi/JNDIPlugin.java

    r1091 r1332  
    1717import org.rapla.framework.PluginDescriptor; 
    1818import org.rapla.plugin.RaplaExtensionPoints; 
     19import org.rapla.plugin.jndi.internal.JNDIOption; 
     20import org.rapla.plugin.jndi.internal.JNDITest; 
     21import org.rapla.plugin.jndi.internal.RaplaJNDITestOnLocalhost; 
     22import org.rapla.plugin.jndi.internal.RaplaJNDITestOnServer; 
     23import org.rapla.plugin.jndi.internal.RaplaJNDITestRemoteServiceFactory; 
     24import org.rapla.server.RaplaRemoteServiceFactory; 
     25import org.rapla.server.ServerService; 
    1926import org.rapla.storage.AuthenticationStore; 
    2027 
    2128public class JNDIPlugin implements PluginDescriptor { 
    2229    public static final String PLUGIN_CLASS = JNDIPlugin.class.getName(); 
    23     static final String PLUGIN_NAME = "Ldap or other JNDI Authentication"; 
     30    public static final String PLUGIN_NAME = "Ldap or other JNDI Authentication"; 
    2431 
    25      
     32    public static final String JNDI_ON_SERVER = JNDIPlugin.class.getPackage().getName() + ".JNDIOnServer"; 
     33    public static final String JNDI_ON_LOCALHOST = JNDIPlugin.class.getPackage().getName() + ".JNDIOnLocalhost"; 
     34    
    2635    public String toString() { 
    2736        return PLUGIN_NAME; 
    2837    } 
    2938     
    30     public void provideServices(Container container, Configuration config) { 
     39    public void provideServices(Container container, Configuration config)  
     40    { 
     41        if ( container.getContext().has( ServerService.ROLE) ){ 
     42            container.addContainerProvidedComponent( RaplaRemoteServiceFactory.ROLE, RaplaJNDITestRemoteServiceFactory.class.getName()); 
     43            // only add mail service on localhost 
     44            container.addContainerProvidedComponent( JNDITest.ROLE, RaplaJNDITestOnLocalhost.class.getName(), JNDI_ON_LOCALHOST , config); 
     45        } else { 
     46            // the following order is important for resolving, 
     47            // first add the service on the server 
     48            // then on localhost 
     49    //        container.addContainerProvidedComponent( JNDITest.ROLE, RaplaJNDITestOnLocalhost.class.getName(), JNDI_ON_LOCALHOST , config); 
     50            container.addContainerProvidedComponent( JNDITest.ROLE, RaplaJNDITestOnServer.class.getName(), JNDI_ON_SERVER , config); 
     51        } 
    3152        container.addContainerProvidedComponent( RaplaExtensionPoints.PLUGIN_OPTION_PANEL_EXTENSION,JNDIOption.class.getName(),JNDIPlugin.class.getName(), config); 
    32          
     53            
    3354        if ( !config.getAttributeAsBoolean("enabled", false) ) 
    3455                return;