org.apache.yoko.osgi.locator
Class ProviderRegistryImpl

java.lang.Object
  extended by org.apache.yoko.osgi.locator.ProviderRegistryImpl
All Implemented Interfaces:
Register, org.apache.yoko.osgi.ProviderRegistry

public class ProviderRegistryImpl
extends Object
implements org.apache.yoko.osgi.ProviderRegistry, Register

The implementation of the provider registry used to store the bundle registrations.


Constructor Summary
ProviderRegistryImpl()
           
 
Method Summary
 Object getService(String providerId)
          Locate and instantiate an instance of a service provider defined in the META-INF/services directory of tracked bundles.
 Class<?> getServiceClass(String providerId)
          Locate and return the class for a service provider defined in the META-INF/services directory of tracked bundles.
 List<Class<?>> getServiceClasses(String providerId)
          Locate all services that match a given provider id and return the implementation classes
 List<Object> getServices(String providerId)
          Locate all services that match a given provider id and create instances.
 Class<?> locate(String providerId)
          Locate a class by its provider id indicator.
 List<Class<?>> locateAll(String providerId)
          Locate all class files that match a given provider id.
 void registerProvider(BundleProviderLoader provider)
          Register an individual provivider item by its provider identifier.
 void registerService(BundleProviderLoader provider)
          Register an individual provivider item by its provider identifier.
 void start()
           
 void stop()
           
 void unregisterProvider(BundleProviderLoader provider)
          Removed a provider registration for a named provider id.
 void unregisterService(BundleProviderLoader provider)
          Removed a provider registration for a named provider id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProviderRegistryImpl

public ProviderRegistryImpl()
Method Detail

start

public void start()

stop

public void stop()

registerProvider

public void registerProvider(BundleProviderLoader provider)
Register an individual provivider item by its provider identifier.

Specified by:
registerProvider in interface Register
Parameters:
provider - The loader used to resolve the provider class.

unregisterProvider

public void unregisterProvider(BundleProviderLoader provider)
Removed a provider registration for a named provider id.

Specified by:
unregisterProvider in interface Register
Parameters:
provider - The provider registration instance

registerService

public void registerService(BundleProviderLoader provider)
Register an individual provivider item by its provider identifier.

Specified by:
registerService in interface Register
Parameters:
provider - The loader used to resolve the provider class.

unregisterService

public void unregisterService(BundleProviderLoader provider)
Removed a provider registration for a named provider id.

Specified by:
unregisterService in interface Register
Parameters:
provider - The provider registration instance

locate

public Class<?> locate(String providerId)
Locate a class by its provider id indicator. .

Specified by:
locate in interface org.apache.yoko.osgi.ProviderRegistry
Parameters:
providerId - The provider id (generally, a fully qualified class name).
Returns:
The Class corresponding to this provider id. Returns null if this is not registered or the indicated class can't be loaded.

locateAll

public List<Class<?>> locateAll(String providerId)
Locate all class files that match a given provider id.

Specified by:
locateAll in interface org.apache.yoko.osgi.ProviderRegistry
Parameters:
providerId - The target provider identifier.
Returns:
A List containing the class objects corresponding to the provider identifier. Returns an empty list if no matching classes can be located.

getService

public Object getService(String providerId)
                  throws Exception
Locate and instantiate an instance of a service provider defined in the META-INF/services directory of tracked bundles.

Specified by:
getService in interface org.apache.yoko.osgi.ProviderRegistry
Parameters:
providerId - The name of the target interface class.
Returns:
The service instance. Returns null if no service defintions can be located.
Throws:
Exception - Any classloading or other exceptions thrown during the process of creating this service instance.

getServices

public List<Object> getServices(String providerId)
Locate all services that match a given provider id and create instances.

Specified by:
getServices in interface org.apache.yoko.osgi.ProviderRegistry
Parameters:
providerId - The target provider identifier.
Returns:
A List containing the instances corresponding to the provider identifier. Returns an empty list if no matching classes can be located or created

getServiceClasses

public List<Class<?>> getServiceClasses(String providerId)
Locate all services that match a given provider id and return the implementation classes

Specified by:
getServiceClasses in interface org.apache.yoko.osgi.ProviderRegistry
Parameters:
providerId - The target provider identifier.
Returns:
A List containing the classes corresponding to the provider identifier. Returns an empty list if no matching classes can be located.

getServiceClass

public Class<?> getServiceClass(String providerId)
                         throws ClassNotFoundException
Locate and return the class for a service provider defined in the META-INF/services directory of tracked bundles.

Specified by:
getServiceClass in interface org.apache.yoko.osgi.ProviderRegistry
Parameters:
providerId - The name of the target interface class.
Returns:
The provider class. Returns null if no service defintions can be located.
Throws:
ClassNotFoundException - Any classloading or other exceptions thrown during the process of loading this service provider class.


Copyright © 2006-2013 The Apache Software Foundation. All Rights Reserved.