Class ModFactory

java.lang.Object
  |
  +--ModFactory

public final class ModFactory
extends java.lang.Object

This class is used to load modules, register these modules with the appropriate registry, and to get instances of the modules for use with the program.


Constructor Summary
ModFactory()
           
 
Method Summary
static ModFactory getInstance()
          This method returns an instance of this class.
 java.lang.Object getInstance(java.lang.Class type, java.lang.String key)
          This method is used to get an instance of a particular class, with the appropriate key.
 java.util.List getKeys()
          This method is used to return the List of all the modules keys that are currently loaded.
 java.net.URL getModUrl(java.lang.String key)
          This method is used to get the location of the module's jar file.
 java.lang.String getName(java.lang.String key)
          This method is used to get the name of the class that is used for this module.
 void loadModules(java.io.File path)
          This method loads the modules in the specified path and registers them with the registry.
 void loadModules(java.io.File[] paths)
          This method loads and registers modules in the specified paths.
 void register(ModSpec spec)
          This method registers the module with the registry for later retrieval.
 void register(ModSpec[] specs)
          This method registers the module specs with the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModFactory

public ModFactory()
Method Detail

loadModules

public void loadModules(java.io.File path)
                 throws java.io.IOException
This method loads the modules in the specified path and registers them with the registry.

Throws:
java.io.IOException - from the file scanning.

getModUrl

public java.net.URL getModUrl(java.lang.String key)
This method is used to get the location of the module's jar file. This can be used if it is necessary to extract any physical files located in the jar file (ie: get the class file for the ability to read and write data)

Returns:
URL the URL object that defines the location of the specified module.

getName

public java.lang.String getName(java.lang.String key)
This method is used to get the name of the class that is used for this module. It can be used if a new instance needs to be created, but the original framework cannot be included.

Returns:
String the name of the class that is used for the module.

getInstance

public java.lang.Object getInstance(java.lang.Class type,
                                    java.lang.String key)
This method is used to get an instance of a particular class, with the appropriate key.

Returns:
returns the instance of the Object that meets the criteria.

getInstance

public static ModFactory getInstance()
This method returns an instance of this class.

Returns:
returns an instance of this class.

loadModules

public void loadModules(java.io.File[] paths)
                 throws java.io.IOException
This method loads and registers modules in the specified paths.

Throws:
java.io.IOException - from the scan operation.

getKeys

public java.util.List getKeys()
This method is used to return the List of all the modules keys that are currently loaded. This allows the class encrypt program the ability to locate the different modules.


register

public void register(ModSpec spec)
This method registers the module with the registry for later retrieval.


register

public void register(ModSpec[] specs)
This method registers the module specs with the registry.