You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by go...@apache.org on 2012/01/09 17:59:23 UTC
svn commit: r1229253 -
/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentRegistry.java
Author: gokturk
Date: Mon Jan 9 16:59:22 2012
New Revision: 1229253
URL: http://svn.apache.org/viewvc?rev=1229253&view=rev
Log:
* Added new retrieval method for ADSComponent by IPojo's ComponentFactory.
Modified:
directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentRegistry.java
Modified: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentRegistry.java?rev=1229253&r1=1229252&r2=1229253&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentRegistry.java (original)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentRegistry.java Mon Jan 9 16:59:22 2012
@@ -26,6 +26,7 @@ import java.util.Hashtable;
import java.util.List;
import org.apache.directory.server.component.ADSComponent;
+import org.apache.felix.ipojo.Factory;
/*
@@ -39,6 +40,11 @@ public class ComponentRegistry
private Dictionary<String, ADSComponent> nameToComponentMap;
/*
+ * Used to map IPojo factory to ADSComponent
+ */
+ private Dictionary<Factory, ADSComponent> factoryToComponentMap;
+
+ /*
* Used to map component type to all ADSComponents of that type
*/
private Dictionary<String, List<ADSComponent>> typeToComponentsMap;
@@ -52,6 +58,7 @@ public class ComponentRegistry
public ComponentRegistry()
{
nameToComponentMap = new Hashtable<String, ADSComponent>();
+ factoryToComponentMap = new Hashtable<Factory, ADSComponent>();
typeToComponentsMap = new Hashtable<String, List<ADSComponent>>();
components = new ArrayList<ADSComponent>();
}
@@ -77,6 +84,7 @@ public class ComponentRegistry
}
nameToComponentMap.put( component.getComponentName().toLowerCase(), component );
+ factoryToComponentMap.put( component.getFactory(), component );
}
@@ -97,6 +105,7 @@ public class ComponentRegistry
}
nameToComponentMap.remove( component.getComponentName().toLowerCase() );
+ factoryToComponentMap.remove( component.getFactory() );
}
@@ -124,6 +133,18 @@ public class ComponentRegistry
/**
+ * Retrieve the component by its IPojo Factory
+ *
+ * @param componentFactory IPojo component factory to fetch its component.
+ * @return ADSComponent reference.
+ */
+ public ADSComponent getCompoentByFactory( Factory componentFactory )
+ {
+ return factoryToComponentMap.get( componentFactory );
+ }
+
+
+ /**
* Gets all the components under specified type.
*
* @param componentType Component type to look for