|
Compoze Software, Inc. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.compoze.util.ServiceRegistry
This class is a generic registry of interfaces that are used to provide services. It maps interfaces to the classes that implement them. By switching the implementing class of a given interface in the registry the runtime behavior of the code may be customized. It can be used to allow for "pluggable" implementations of an interface, configurable at runtime by a passed in Properties object.
| Constructor Summary | |
ServiceRegistry(java.util.Properties props)
Constructor. |
|
| Method Summary | |
java.lang.Class |
get(java.lang.Class interfaceClass)
Get the implementing class of the specified interface. |
java.lang.Class |
get(java.lang.Class interfaceClass,
java.lang.ClassLoader classLoader)
Get the implementing class of the specified interface. |
java.lang.Object |
getInstance(java.lang.Class interfaceClass)
Create an instance of the implementor of the specified interface using its default constructor. |
java.lang.Object |
getInstance(java.lang.Class interfaceClass,
java.lang.Class[] constructorArgTypes,
java.lang.Object[] constructorArgs)
Create an instance of the implementor of the specified interface using the specified constructor. |
java.lang.Object |
getInstance(java.lang.Class interfaceClass,
java.lang.Class[] constructorArgTypes,
java.lang.Object[] constructorArgs,
java.lang.ClassLoader classLoader)
Create an instance of the implementor of the specified interface using the specified constructor. |
java.lang.Object |
getInstance(java.lang.Class interfaceClass,
java.lang.ClassLoader classLoader)
Create an instance of the implementor of the specified interface using its default constructor. |
java.lang.Object |
getMappedInstance(java.lang.Class interfaceClass,
java.lang.Object keyObject)
Create an instance of the implementor of the specified interface using its default constructor. |
java.lang.Object |
getMappedInstance(java.lang.Class interfaceClass,
java.lang.Object keyObject,
java.lang.Class[] constructorArgTypes,
java.lang.Object[] constructorArgs)
Create an instance of the implementor of the specified interface using the specified constructor. |
java.lang.Object |
getMappedInstance(java.lang.Class interfaceClass,
java.lang.Object keyObject,
java.lang.Class[] constructorArgTypes,
java.lang.Object[] constructorArgs,
java.lang.ClassLoader classLoader)
Create an instance of the implementor of the specified interface using the specified constructor. |
java.lang.Object |
getMappedInstance(java.lang.Class interfaceClass,
java.lang.Object keyObject,
java.lang.ClassLoader classLoader)
Create an instance of the implementor of the specified interface using its default constructor. |
java.lang.Class |
getService(java.lang.Class interfaceClass)
Get a service from an interface class. |
java.lang.Class |
getService(java.lang.Class interfaceClass,
java.lang.ClassLoader classLoader)
Get a service from an interface class. |
java.lang.Object |
getSingletonInstance(java.lang.Class interfaceClass)
Create an instance of the implementor of the specified interface using its default constructor. |
java.lang.Object |
getSingletonInstance(java.lang.Class interfaceClass,
java.lang.Class[] constructorArgTypes,
java.lang.Object[] constructorArgs)
Create an instance of the implementor of the specified interface using the specified constructor. |
java.lang.Object |
getSingletonInstance(java.lang.Class interfaceClass,
java.lang.Class[] constructorArgTypes,
java.lang.Object[] constructorArgs,
java.lang.ClassLoader classLoader)
Create an instance of the implementor of the specified interface using the specified constructor. |
java.lang.Object |
getSingletonInstance(java.lang.Class interfaceClass,
java.lang.ClassLoader classLoader)
Create an instance of the implementor of the specified interface using its default constructor. |
static void |
main(java.lang.String[] args)
Exerciser. |
void |
set(java.lang.Class interfaceClass,
java.lang.Class implementingClass)
Set the implementor of the specified interface. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ServiceRegistry(java.util.Properties props)
props - the properties to read the services from| Method Detail |
public java.lang.Class get(java.lang.Class interfaceClass)
interfaceClass - the class of the interface
public java.lang.Class get(java.lang.Class interfaceClass,
java.lang.ClassLoader classLoader)
interfaceClass - the class of the interfaceclassLoader - the class loader to look for class in
public java.lang.Object getInstance(java.lang.Class interfaceClass)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException
interfaceClass - the class of the interfacejava.lang.IllegalAccessException - if the implementing class could not be accessedjava.lang.InstantiationException - if the implementing class could not be instantiatedjava.lang.NoSuchMethodException - if the specified constructor does not existjava.lang.reflect.InvocationTargetException - if the specified constructor could not be invoked
public java.lang.Object getInstance(java.lang.Class interfaceClass,
java.lang.ClassLoader classLoader)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException
interfaceClass - the class of the interfaceclassLoader - the class loader to look for class injava.lang.IllegalAccessException - if the implementing class could not be accessedjava.lang.InstantiationException - if the implementing class could not be instantiatedjava.lang.NoSuchMethodException - if the specified constructor does not existjava.lang.reflect.InvocationTargetException - if the specified constructor could not be invoked
public java.lang.Object getInstance(java.lang.Class interfaceClass,
java.lang.Class[] constructorArgTypes,
java.lang.Object[] constructorArgs)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException
interfaceClass - the class of the interfaceconstructorArgTypes - argument types of the desired constructorconstructorArgs - arguments for the desired constructorjava.lang.IllegalAccessException - if the implementing class could not be accessedjava.lang.InstantiationException - if the implementing class could not be instantiatedjava.lang.NoSuchMethodException - if the specified constructor does not existjava.lang.reflect.InvocationTargetException - if the specified constructor could not be invoked
public java.lang.Object getInstance(java.lang.Class interfaceClass,
java.lang.Class[] constructorArgTypes,
java.lang.Object[] constructorArgs,
java.lang.ClassLoader classLoader)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException
interfaceClass - the class of the interfaceconstructorArgTypes - argument types of the desired constructorconstructorArgs - arguments for the desired constructorclassLoader - the class loader to look for class injava.lang.IllegalAccessException - if the implementing class could not be accessedjava.lang.InstantiationException - if the implementing class could not be instantiatedjava.lang.NoSuchMethodException - if the specified constructor does not existjava.lang.reflect.InvocationTargetException - if the specified constructor could not be invoked
public java.lang.Object getMappedInstance(java.lang.Class interfaceClass,
java.lang.Object keyObject)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException
interfaceClass - the class of the interfacekeyObject - the key object in the mapjava.lang.IllegalAccessException - if the implementing class could not be accessedjava.lang.InstantiationException - if the implementing class could not be instantiatedjava.lang.NoSuchMethodException - if the specified constructor does not existjava.lang.reflect.InvocationTargetException - if the specified constructor could not be invoked
public java.lang.Object getMappedInstance(java.lang.Class interfaceClass,
java.lang.Object keyObject,
java.lang.ClassLoader classLoader)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException
interfaceClass - the class of the interfacekeyObject - the key object in the mapkeyObject - the key object in the mapclassLoader - the class loader to look for class injava.lang.IllegalAccessException - if the implementing class could not be accessedjava.lang.InstantiationException - if the implementing class could not be instantiatedjava.lang.NoSuchMethodException - if the specified constructor does not existjava.lang.reflect.InvocationTargetException - if the specified constructor could not be invoked
public java.lang.Object getMappedInstance(java.lang.Class interfaceClass,
java.lang.Object keyObject,
java.lang.Class[] constructorArgTypes,
java.lang.Object[] constructorArgs)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException
interfaceClass - the class of the interfacekeyObject - the key object in the mapconstructorArgTypes - argument types of the desired constructorconstructorArgs - arguments for the desired constructorjava.lang.IllegalAccessException - if the implementing class could not be accessedjava.lang.InstantiationException - if the implementing class could not be instantiatedjava.lang.NoSuchMethodException - if the specified constructor does not existjava.lang.reflect.InvocationTargetException - if the specified constructor could not be invoked
public java.lang.Object getMappedInstance(java.lang.Class interfaceClass,
java.lang.Object keyObject,
java.lang.Class[] constructorArgTypes,
java.lang.Object[] constructorArgs,
java.lang.ClassLoader classLoader)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException
interfaceClass - the class of the interfacekeyObject - the key object in the mapconstructorArgTypes - argument types of the desired constructorconstructorArgs - arguments for the desired constructorclassLoader - the class loader to look for class injava.lang.IllegalAccessException - if the implementing class could not be accessedjava.lang.InstantiationException - if the implementing class could not be instantiatedjava.lang.NoSuchMethodException - if the specified constructor does not existjava.lang.reflect.InvocationTargetException - if the specified constructor could not be invoked
public java.lang.Object getSingletonInstance(java.lang.Class interfaceClass)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException
interfaceClass - the class of the interfacejava.lang.IllegalAccessException - if the implementing class could not be accessedjava.lang.InstantiationException - if the implementing class could not be instantiatedjava.lang.NoSuchMethodException - if the specified constructor does not existjava.lang.reflect.InvocationTargetException - if the specified constructor could not be invoked
public java.lang.Object getSingletonInstance(java.lang.Class interfaceClass,
java.lang.ClassLoader classLoader)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException
interfaceClass - the class of the interfaceclassLoader - the class loader to look for class injava.lang.IllegalAccessException - if the implementing class could not be accessedjava.lang.InstantiationException - if the implementing class could not be instantiatedjava.lang.NoSuchMethodException - if the specified constructor does not existjava.lang.reflect.InvocationTargetException - if the specified constructor could not be invoked
public java.lang.Object getSingletonInstance(java.lang.Class interfaceClass,
java.lang.Class[] constructorArgTypes,
java.lang.Object[] constructorArgs)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException
interfaceClass - the class of the interfaceconstructorArgTypes - argument types of the desired constructorconstructorArgs - arguments for the desired constructorjava.lang.IllegalAccessException - if the implementing class could not be accessedjava.lang.InstantiationException - if the implementing class could not be instantiatedjava.lang.NoSuchMethodException - if the specified constructor does not existjava.lang.reflect.InvocationTargetException - if the specified constructor could not be invoked
public java.lang.Object getSingletonInstance(java.lang.Class interfaceClass,
java.lang.Class[] constructorArgTypes,
java.lang.Object[] constructorArgs,
java.lang.ClassLoader classLoader)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException
interfaceClass - the class of the interfaceconstructorArgTypes - argument types of the desired constructorconstructorArgs - arguments for the desired constructorclassLoader - the class loader to look for class injava.lang.IllegalAccessException - if the implementing class could not be accessedjava.lang.InstantiationException - if the implementing class could not be instantiatedjava.lang.NoSuchMethodException - if the specified constructor does not existjava.lang.reflect.InvocationTargetException - if the specified constructor could not be invoked
public void set(java.lang.Class interfaceClass,
java.lang.Class implementingClass)
interfaceClass - the class of the interfaceimplementingClass - the class that implements the interfacepublic java.lang.Class getService(java.lang.Class interfaceClass)
interfaceClass -
public java.lang.Class getService(java.lang.Class interfaceClass,
java.lang.ClassLoader classLoader)
interfaceClass - classLoader - the class loader to look for class inpublic static void main(java.lang.String[] args)
args - arguments (first is name of properties file)
|
Compoze Software, Inc. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||