You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2005/09/08 00:38:26 UTC
svn commit: r279448 - in /directory/standalone/trunk/osgi/changepw: ./
src/main/java/org/apache/changepw/
Author: erodriguez
Date: Wed Sep 7 15:38:10 2005
New Revision: 279448
URL: http://svn.apache.org/viewcvs?rev=279448&view=rev
Log:
Rewrote the Change Password OSGi wrapper to use the declarative Service Binder.
Added:
directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/metadata.xml (with props)
Removed:
directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangePasswordConfiguration.java
Modified:
directory/standalone/trunk/osgi/changepw/project.xml
directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/Activator.java
directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwConfig.java
directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwServer.java
directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwServerFactory.java
Modified: directory/standalone/trunk/osgi/changepw/project.xml
URL: http://svn.apache.org/viewcvs/directory/standalone/trunk/osgi/changepw/project.xml?rev=279448&r1=279447&r2=279448&view=diff
==============================================================================
--- directory/standalone/trunk/osgi/changepw/project.xml (original)
+++ directory/standalone/trunk/osgi/changepw/project.xml Wed Sep 7 15:38:10 2005
@@ -6,7 +6,7 @@
<currentVersion>0.1.1</currentVersion>
<properties>
<osgi.bundle.category>Network Service</osgi.bundle.category>
- <osgi.import.package>org.apache.ldap.server.configuration,org.osgi.framework,org.apache.mina.registry,org.apache.mina.protocol,org.apache.mina.common,org.osgi.service.cm,org.osgi.util.tracker</osgi.import.package>
+ <osgi.import.package>org.ungoverned.gravity.servicebinder,org.apache.ldap.server.configuration,org.osgi.framework,org.apache.mina.registry,org.apache.mina.protocol,org.apache.mina.common,org.osgi.service.cm</osgi.import.package>
</properties>
<package>org.apache.changepw</package>
<shortDescription>Apache Change Password Network Service</shortDescription>
@@ -43,12 +43,6 @@
<properties>
<osgi.jar.bundle>true</osgi.jar.bundle>
</properties>
- </dependency>
- <dependency>
- <!-- required to load Configuration base class -->
- <groupId>directory</groupId>
- <artifactId>apacheds-core</artifactId>
- <version>0.9.2-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Modified: directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/Activator.java
URL: http://svn.apache.org/viewcvs/directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/Activator.java?rev=279448&r1=279447&r2=279448&view=diff
==============================================================================
--- directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/Activator.java (original)
+++ directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/Activator.java Wed Sep 7 15:38:10 2005
@@ -17,210 +17,8 @@
package org.apache.changepw;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Properties;
+import org.ungoverned.gravity.servicebinder.GenericActivator;
-import javax.naming.CompoundName;
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-import javax.naming.ldap.LdapContext;
-import javax.naming.spi.InitialContextFactory;
-
-import org.apache.kerberos.store.JndiPrincipalStoreImpl;
-import org.apache.kerberos.store.PrincipalStore;
-import org.apache.mina.registry.ServiceRegistry;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.cm.ConfigurationException;
-import org.osgi.service.cm.ManagedServiceFactory;
-import org.osgi.util.tracker.ServiceTracker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class implements a simple bundle that starts and stops the Apache Change Password service.
- */
-public class Activator implements BundleActivator
+public class Activator extends GenericActivator
{
- /** the log for this class */
- private static final Logger log = LoggerFactory.getLogger( Activator.class );
-
- public static final String FACTORY_PID = "org.apache.changepw";
-
- private ServiceRegistry registry;
- private ServiceTracker tracker;
-
- private ChangepwServerFactory serverFactory = null;
- private ServiceRegistration registration = null;
-
- private PrincipalStore principalStore;
-
- /**
- * The key of the property specifying where Kerberos users are stored. If this
- * property is not set the store defaults to performing a subtree search
- * from the DN in the {@link Context#PROVIDER_URL}. If it is present a more
- * efficient search is conducted on the more specific DN.
- */
- public static final String KDC_ENTRY_BASEDN_KEY = "kdc.entry.basedn";
-
- /**
- * Implements BundleActivator.start().
- * Logs that this service is starting and starts this service.
- * @param context the framework context for the bundle.
- */
- public void start( BundleContext context ) throws BundleException
- {
- log.debug( "Starting Apache Change Password." );
-
- tracker = new ServiceTracker( context, ServiceRegistry.class.getName(), null );
- tracker.open();
-
- registry = (ServiceRegistry) tracker.getService();
-
- ServiceReference storeReference = context.getServiceReference( InitialContextFactory.class.getName() );
-
- InitialContextFactory factory = (InitialContextFactory) context.getService( storeReference );
-
- Hashtable env = new Hashtable( new ChangePasswordConfiguration().toJndiEnvironment() );
- loadEnvironment( env );
-
- LdapContext ctx = null;
-
- try
- {
- ctx = (LdapContext) factory.getInitialContext( env );
- }
- catch ( NamingException ne )
- {
- ne.printStackTrace();
- throw new BundleException( "Initial context load failed." );
- }
-
- Name searchBaseDn = null;
-
- if ( env.containsKey( KDC_ENTRY_BASEDN_KEY ) )
- {
- String baseDn = (String) env.get( KDC_ENTRY_BASEDN_KEY );
- searchBaseDn = getRelativeName( ctx, baseDn );
- }
-
- principalStore = new JndiPrincipalStoreImpl( ctx, searchBaseDn );
-
- serverFactory = new ChangepwServerFactory( registry, principalStore );
-
- Dictionary parameters = new Hashtable();
- parameters.put( ConfigurationAdmin.SERVICE_FACTORYPID, FACTORY_PID );
- registration = context.registerService( ManagedServiceFactory.class.getName(), serverFactory, parameters );
-
- ServiceReference adminRef = null;
- try
- {
- ConfigurationAdmin admin = null;
- Configuration[] configs = null;
- try
- {
- adminRef = context.getServiceReference( ConfigurationAdmin.class.getName() );
-
- // Potential start order problem!
- if ( adminRef != null )
- {
- admin = (ConfigurationAdmin) context.getService( adminRef );
- String filter = "(&(service.factoryPid=" + FACTORY_PID + ")" + "(|(service.bundleLocation="
- + context.getBundle().getLocation() + ")" + "(service.bundleLocation=NULL)"
- + "(!(service.bundleLocation=*))))";
- configs = admin.listConfigurations( filter );
- }
- }
- catch ( Exception e )
- {
- e.printStackTrace();
- }
-
- if ( admin == null || configs == null || configs.length == 0 )
- {
- serverFactory.updated( ChangepwServerFactory.DEFAULT_PID, ChangepwConfig.getDefaultConfig() );
- }
- }
- catch ( ConfigurationException ce )
- {
- ce.printStackTrace();
- }
- finally
- {
- if ( adminRef != null )
- {
- context.ungetService( adminRef );
- }
- }
- }
-
- /**
- * Implements BundleActivator.stop().
- * Logs that this service has stopped.
- * @param context the framework context for the bundle.
- */
- public void stop( BundleContext context )
- {
- log.debug( "Stopping Apache Change Password." );
-
- principalStore = null;
-
- registration.unregister();
- registration = null;
-
- serverFactory.destroy();
- serverFactory = null;
-
- registry = null;
- }
-
- private Name getRelativeName( DirContext ctx, String baseDn ) throws BundleException
- {
- Properties props = new Properties();
- props.setProperty( "jndi.syntax.direction", "right_to_left" );
- props.setProperty( "jndi.syntax.separator", "," );
-
- Name searchBaseDn = null;
-
- try
- {
- Name ctxRoot = new CompoundName( ctx.getNameInNamespace(), props );
- searchBaseDn = new CompoundName( baseDn, props );
-
- if ( !searchBaseDn.startsWith( ctxRoot ) )
- {
- throw new BundleException( "Invalid search base for Apache profiles." );
- }
-
- for ( int ii = 0; ii < ctxRoot.size(); ii++ )
- {
- searchBaseDn.remove( 0 );
- }
- }
- catch ( NamingException e )
- {
- throw new BundleException( "Failed to initialize search base for Apache profiles." );
- }
-
- return searchBaseDn;
- }
-
- private void loadEnvironment( Hashtable env )
- {
- env.put( "java.naming.provider.url", "dc=example,dc=com" );
- env.put( "java.naming.security.principal", "uid=admin,ou=system" );
- env.put( "java.naming.security.authentication", "simple" );
- env.put( "java.naming.security.credentials", "secret" );
- env.put( "java.naming.factory.initial", "org.apache.ldap.server.jndi.CoreContextFactory" );
-
- env.put( "kdc.entry.basedn", "ou=Users,dc=example,dc=com" );
- }
}
Modified: directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwConfig.java
URL: http://svn.apache.org/viewcvs/directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwConfig.java?rev=279448&r1=279447&r2=279448&view=diff
==============================================================================
--- directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwConfig.java (original)
+++ directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwConfig.java Wed Sep 7 15:38:10 2005
@@ -20,27 +20,45 @@
import java.util.Dictionary;
import java.util.Hashtable;
+import org.apache.ldap.server.configuration.Configuration;
+import org.apache.ldap.server.jndi.ContextFactoryService;
+import org.osgi.service.cm.ConfigurationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class ChangepwConfig
+public class ChangepwConfig extends Configuration
{
/** the log for this class */
private static final Logger log = LoggerFactory.getLogger( ChangepwConfig.class );
- private static String SERVICE_PID = "service.pid";
-
- static String PID = "org.apache.changepw";
- static String CHANGEPW_PORT_KEY = "changepw.port";
- static int CHANGEPW_PORT_DEFAULT = 464;
- static String name = "Apache Change Password Service";
+ private static final String SERVICE_PID = "service.pid";
+ private static final String PID = "org.apache.changepw";
+ private static final String CHANGEPW_PORT_KEY = "changepw.port";
+ private static final int CHANGEPW_DEFAULT_PORT = 464;
+ private static final String name = "Apache Change Password Service";
private int port;
- public ChangepwConfig( Dictionary configuration )
+ /**
+ * Creates a new instance with default settings.
+ */
+ public ChangepwConfig() throws ConfigurationException
+ {
+ this( getDefaultConfig() );
+ }
+
+ /**
+ * Creates a new instance with default settings that operates on the
+ * {@link ContextFactoryService} with the specified ID.
+ */
+ public ChangepwConfig( String instanceId ) throws ConfigurationException
{
- log.debug( "Got props " + configuration );
+ this( getDefaultConfig() );
+ setInstanceId( instanceId );
+ }
+ public ChangepwConfig( Dictionary configuration ) throws ConfigurationException
+ {
if ( configuration == null )
{
configuration = getDefaultConfig();
@@ -48,7 +66,10 @@
port = ( (Integer) configuration.get( CHANGEPW_PORT_KEY ) ).intValue();
- log.debug( "Change Password got port " + port );
+ if ( port < 1 || port > 0xFFFF )
+ {
+ throw new ConfigurationException( CHANGEPW_PORT_KEY, "invalid value=" + port );
+ }
}
boolean isDifferent( Dictionary config )
@@ -61,12 +82,12 @@
return true;
}
- String getName()
+ public String getName()
{
return name;
}
- int getPort()
+ public int getPort()
{
log.debug( "Config returning " + port );
@@ -78,7 +99,7 @@
Dictionary defaults = new Hashtable();
defaults.put( SERVICE_PID, PID );
- defaults.put( CHANGEPW_PORT_KEY, Integer.getInteger( CHANGEPW_PORT_KEY, new Integer( CHANGEPW_PORT_DEFAULT ) ) );
+ defaults.put( CHANGEPW_PORT_KEY, Integer.getInteger( CHANGEPW_PORT_KEY, new Integer( CHANGEPW_DEFAULT_PORT ) ) );
return defaults;
}
Modified: directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwServer.java
URL: http://svn.apache.org/viewcvs/directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwServer.java?rev=279448&r1=279447&r2=279448&view=diff
==============================================================================
--- directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwServer.java (original)
+++ directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwServer.java Wed Sep 7 15:38:10 2005
@@ -52,11 +52,6 @@
this.registry = registry;
this.store = store;
- init();
- }
-
- protected void init()
- {
port = config.getPort();
name = config.getName();
@@ -64,7 +59,7 @@
{
log.debug( name + " starting on " + port );
- provider = new ChangePasswordProtocolProvider( new ChangePasswordConfiguration(), store );
+ provider = new ChangePasswordProtocolProvider( new ChangePasswordConfiguration(), this.store );
udpService = new Service( name, TransportType.DATAGRAM, port );
tcpService = new Service( name, TransportType.SOCKET, port );
@@ -76,7 +71,7 @@
}
catch ( IOException ioe )
{
- ioe.printStackTrace();
+ log.error( ioe.getMessage(), ioe );
}
}
@@ -95,6 +90,6 @@
udpService = null;
tcpService = null;
- log.debug( name + " has stopped listening on " + port );
+ log.debug( name + " has stopped listening on port " + port );
}
}
Modified: directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwServerFactory.java
URL: http://svn.apache.org/viewcvs/directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwServerFactory.java?rev=279448&r1=279447&r2=279448&view=diff
==============================================================================
--- directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwServerFactory.java (original)
+++ directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/ChangepwServerFactory.java Wed Sep 7 15:38:10 2005
@@ -19,47 +19,57 @@
import java.util.Dictionary;
import java.util.HashMap;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
+import java.util.Properties;
+import javax.naming.CompoundName;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.ldap.LdapContext;
+import javax.naming.spi.InitialContextFactory;
+
+import org.apache.kerberos.store.JndiPrincipalStoreImpl;
import org.apache.kerberos.store.PrincipalStore;
import org.apache.mina.registry.ServiceRegistry;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.cm.ConfigurationException;
import org.osgi.service.cm.ManagedServiceFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.ungoverned.gravity.servicebinder.Lifecycle;
-public class ChangepwServerFactory implements ManagedServiceFactory
+public class ChangepwServerFactory implements ManagedServiceFactory, Lifecycle
{
- final static String DEFAULT_PID = Activator.FACTORY_PID + ".default";
-
- private final PrincipalStore store;
- private final ServiceRegistry registry;
- private final Map servers = new HashMap();
-
- Object updateLock = new Object();
+ /** the log for this class */
+ private static final Logger log = LoggerFactory.getLogger( ChangepwServerFactory.class );
- ChangepwServerFactory( ServiceRegistry registry, PrincipalStore store )
- {
- this.registry = registry;
- this.store = store;
- }
+ private static final String FACTORY_PID = "org.apache.changepw";
+ private static final String DEFAULT_PID = FACTORY_PID + ".default";
- public void destroy()
- {
- Iterator it = servers.keySet().iterator();
- while ( it.hasNext() )
- {
- deleted( (String) it.next() );
- }
- }
+ private Map servers = new HashMap();
+ private Object updateLock = new Object();
+ private ServiceRegistry registry;
+ private ConfigurationAdmin cm;
+ private InitialContextFactory factory;
+
+ /**
+ * The key of the property specifying where Kerberos users are stored. If this
+ * property is not set the store defaults to performing a subtree search
+ * from the DN in the {@link Context#PROVIDER_URL}. If it is present a more
+ * efficient search is conducted on the more specific DN.
+ */
+ public static final String KDC_ENTRY_BASEDN_KEY = "kdc.entry.basedn";
public void updated( String pid, Dictionary config ) throws ConfigurationException
{
- int port = ( (Integer) config.get( ChangepwConfig.CHANGEPW_PORT_KEY ) ).intValue();
+ log.debug( getName() + " updating with " + config );
- if ( port < 1 || port > 0xFFFF )
- {
- throw new ConfigurationException( ChangepwConfig.CHANGEPW_PORT_KEY, "invalid value=" + port );
- }
+ ChangepwConfig changepwConfig = new ChangepwConfig( config );
synchronized ( updateLock )
{
@@ -69,33 +79,94 @@
}
// As soon as we get a "non-default"-config, delete default
- if ( !DEFAULT_PID.equals( pid ) && ( null != servers.get( DEFAULT_PID ) ) )
+ if ( !pid.equals( DEFAULT_PID ) )
{
deleted( DEFAULT_PID );
}
- // for a given pid-config, do we have the service?
- // if not, create it with the config
- ChangepwServer server = (ChangepwServer) servers.get( pid );
- if ( server == null )
- {
- server = new ChangepwServer( new ChangepwConfig( config ), registry, store );
- servers.put( pid, server );
- }
- else
- {
- // we have the service, so ...
- // for a given config, is the config different?
- if ( server.isDifferent( config ) )
- {
- // the config for this service is different, so ...
- // destroy the listener and recreate it with the new config.
- deleted( pid );
- server = new ChangepwServer( new ChangepwConfig( config ), registry, store );
- servers.put( pid, server );
- }
+ // For a given pid, do we have the service?
+ ChangepwServer changepwServer = (ChangepwServer) servers.get( pid );
+
+ // If we don't have the service, create it with the config.
+ // Or, if we do have the service, re-create it if the config is different.
+ if ( changepwServer == null || changepwServer.isDifferent( config ) )
+ {
+ deleted( pid );
+ PrincipalStore store = getStore();
+ changepwServer = new ChangepwServer( changepwConfig, registry, store );
+ servers.put( pid, changepwServer );
+ }
+ }
+ }
+
+ private PrincipalStore getStore() throws ConfigurationException
+ {
+ Hashtable env = new Hashtable( new ChangepwConfig().toJndiEnvironment() );
+ loadEnvironment( env );
+
+ LdapContext ctx = null;
+
+ try
+ {
+ ctx = (LdapContext) factory.getInitialContext( env );
+ }
+ catch ( NamingException ne )
+ {
+ log.error( ne.getMessage(), ne );
+ throw new ConfigurationException( (String) env.get( Context.PROVIDER_URL ), "Initial context load failed." );
+ }
+
+ Name searchBaseDn = null;
+
+ if ( env.containsKey( KDC_ENTRY_BASEDN_KEY ) )
+ {
+ String baseDn = (String) env.get( KDC_ENTRY_BASEDN_KEY );
+ searchBaseDn = getRelativeName( ctx, baseDn );
+ }
+
+ return new JndiPrincipalStoreImpl( ctx, searchBaseDn );
+ }
+
+ private Name getRelativeName( DirContext ctx, String baseDn ) throws ConfigurationException
+ {
+ Properties props = new Properties();
+ props.setProperty( "jndi.syntax.direction", "right_to_left" );
+ props.setProperty( "jndi.syntax.separator", "," );
+
+ Name searchBaseDn = null;
+
+ try
+ {
+ Name ctxRoot = new CompoundName( ctx.getNameInNamespace(), props );
+ searchBaseDn = new CompoundName( baseDn, props );
+
+ if ( !searchBaseDn.startsWith( ctxRoot ) )
+ {
+ throw new ConfigurationException( baseDn, "Invalid search base for Kerberos principals." );
+ }
+
+ for ( int ii = 0; ii < ctxRoot.size(); ii++ )
+ {
+ searchBaseDn.remove( 0 );
}
}
+ catch ( NamingException e )
+ {
+ throw new ConfigurationException( baseDn, "Failed to initialize search base for Kerberos principals." );
+ }
+
+ return searchBaseDn;
+ }
+
+ private void loadEnvironment( Hashtable env )
+ {
+ env.put( Context.PROVIDER_URL, "dc=example,dc=com" );
+ env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
+ env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+ env.put( Context.SECURITY_CREDENTIALS, "secret" );
+ env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.ldap.server.jndi.CoreContextFactory" );
+
+ env.put( KDC_ENTRY_BASEDN_KEY, "ou=Users,dc=example,dc=com" );
}
public void deleted( String pid )
@@ -111,5 +182,91 @@
public String getName()
{
return "Apache Change Password Service Factory";
+ }
+
+ /**
+ * All required services have been bound, but our service(s) are not yet
+ * registered. So, we check the Config Admin service for configs or we
+ * start a server with its default properties.
+ */
+ public void activate()
+ {
+ try
+ {
+ Configuration[] configs = null;
+
+ if ( cm != null )
+ {
+ String filter = "(service.factoryPid=" + FACTORY_PID + ")";
+ configs = cm.listConfigurations( filter );
+
+ log.debug( "filter: " + filter );
+ log.debug( "configs.length: " + configs.length );
+ log.debug( "configs[ 0 ]: " + configs[ 0 ] );
+ }
+
+ if ( cm == null || configs == null || configs.length == 0 )
+ {
+ updated( ChangepwServerFactory.DEFAULT_PID, ChangepwConfig.getDefaultConfig() );
+ }
+ }
+ catch ( Exception e )
+ {
+ log.error( e.getMessage(), e );
+ }
+ finally
+ {
+ cm = null;
+ }
+ }
+
+ /**
+ * Invalidation has started and our services have been unregistered, but
+ * any required services have not been unbound yet.
+ */
+ public void deactivate()
+ {
+ Iterator it = servers.keySet().iterator();
+
+ while ( it.hasNext() )
+ {
+ deleted( (String) it.next() );
+ }
+ }
+
+ public void setInitialContextFactory( InitialContextFactory factory )
+ {
+ this.factory = factory;
+ log.debug( getName() + " has bound to " + factory );
+ }
+
+ public void unsetInitialContextFactory( InitialContextFactory factory )
+ {
+ this.factory = null;
+ log.debug( getName() + " has unbound from " + factory );
+ }
+
+ public void setServiceRegistry( ServiceRegistry registry )
+ {
+ this.registry = registry;
+ log.debug( getName() + " has bound to " + registry );
+ }
+
+ public void unsetServiceRegistry( ServiceRegistry registry )
+ {
+ this.registry = null;
+ log.debug( getName() + " has unbound from " + registry );
+ }
+
+ public void setConfigurationAdmin( ConfigurationAdmin cm )
+ {
+ this.cm = cm;
+ log.debug( getName() + " has bound to " + cm );
+ }
+
+ public void unsetConfigurationAdmin( ConfigurationAdmin cm )
+ {
+ this.cm = null;
+ log.debug( getName() + " has unbound from " + cm );
}
}
Added: directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/metadata.xml
URL: http://svn.apache.org/viewcvs/directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/metadata.xml?rev=279448&view=auto
==============================================================================
--- directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/metadata.xml (added)
+++ directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/metadata.xml Wed Sep 7 15:38:10 2005
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--<!DOCTYPE bundle SYSTEM "metadata.dtd">-->
+<bundle>
+ <component class="org.apache.changepw.ChangepwServerFactory">
+ <provides service="org.osgi.service.cm.ManagedServiceFactory"/>
+ <property name="service.factoryPid" value="org.apache.changepw" type="string"/>
+ <requires
+ service="org.apache.mina.registry.ServiceRegistry"
+ filter=""
+ cardinality="1..1"
+ policy="static"
+ bind-method="setServiceRegistry"
+ unbind-method="unsetServiceRegistry"
+ />
+ <requires
+ service="org.osgi.service.cm.ConfigurationAdmin"
+ filter=""
+ cardinality="0..n"
+ policy="dynamic"
+ bind-method="setConfigurationAdmin"
+ unbind-method="unsetConfigurationAdmin"
+ />
+ <requires
+ service="javax.naming.spi.InitialContextFactory"
+ filter=""
+ cardinality="1..1"
+ policy="static"
+ bind-method="setInitialContextFactory"
+ unbind-method="unsetInitialContextFactory"
+ />
+ </component>
+</bundle>
Propchange: directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/metadata.xml
------------------------------------------------------------------------------
svn:eol-style = native