| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This class provides a mechanism to obtain an instance of a particular class that
implements a particular Interface. In general these are classes implementing
Factory paterns - this centralised Factory location point enables seemless addition
of new Factory's to be made at runtime
Once this class has been loaded, it will search the classpath for files called
fipaos-factory.properties
. The contents of these file are expected
to be in Java Properties file-format, and each line should be of the form:
<factory-interface-class>=<factory-instance-class>
The class definitions for each of the classes defined in these files will
be created - the static initialisers of these classes should then use
to change the factory associated with
FIPAOSFactory.setFactoryInstance()
an appropriate interface (this enables the factory instance associated to delegate
to the previously assigned factory if necessary, rather than always overwriting)
Method Summary | |
static Object | getFactoryInstance(Class iface) Returns an instance of a class that implements the given interface, or null if one couldn't be found |
static void | loadClasses(Properties properties) Method to enumerate all keys/values in the given Properties object, and invoke Class.forName() on them to force a class of the name given to be loaded |
static void | main(String[] args) |
static synchronized void | populateFactories() |
static Object | setFactoryInstance(Class iface, Object instance) Adds an instance of a class that implements the given interface to the list of known instances |
Method Detail |
public static Object getFactoryInstance(Class iface)
public static void loadClasses(Properties properties)
public static void main(String[] args)
public static synchronized void populateFactories()
throws java.io.IOException
public static Object setFactoryInstance(Class iface, Object instance)
Association Links |
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |