|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.syndication.util.PlugableClasses
Loads and instantiates classes indicated in property files.
The PlugableClasses is useful for handling collection of classes that are not known or fixed at development time.
It reads the class names from a default properties file and from an additional properties file indicated through a System property. The additional properties file does not override the default properties file, the classes are aggregated.
Constructor Summary | |
PlugableClasses(java.lang.String defaultFile,
java.lang.String systemPropertyFile,
java.lang.String propertyKey)
Creates a PlugableClasses instance that will load the classes indicated in properties files. |
|
PlugableClasses(java.lang.String defaultFile,
java.lang.String systemPropertyFile,
java.lang.String propertyKey,
boolean hardFailure,
java.lang.ClassLoader classLoader)
Creates a PlugableClasses instance that will load the classes indicated in properties files. |
Method Summary | |
java.lang.Object[] |
createInstances()
Loads, instanciates and returns the classes defined in the properties files. |
java.lang.Class[] |
getClasses()
Loads and returns the classes defined in the properties files. |
boolean |
isHardFailure()
Returns the hard failure mode for the PlugableClasses instance. |
void |
setHardFailure(boolean hardFailure)
Sets the hard failure mode for the PlugableClasses instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PlugableClasses(java.lang.String defaultFile, java.lang.String systemPropertyFile, java.lang.String propertyKey)
It uses the same ClassLoader of the PlugableClasses and it is set for hard failure (a RuntimeException will be thrown if one or more of the classes cannot be loaded or instanciated).
defaultFile
- properties file that defines the classes to loadsystemPropertyFile
- system property that if present it should be indicate an additional
properties file to look for classes to load. The additional properties file does not
override the default properties file, the classes are aggregated.propertyKey
- property name that contains the list of classes to load. The class names
must be separated with white spaces.public PlugableClasses(java.lang.String defaultFile, java.lang.String systemPropertyFile, java.lang.String propertyKey, boolean hardFailure, java.lang.ClassLoader classLoader)
defaultFile
- properties file that defines the classes to loadsystemPropertyFile
- system property that if present it should be indicate an additional
properties file to look for classes to load. The additional properties file does not
override the default properties file, the classes are aggregated.propertyKey
- property name that contains the list of classes to load. The class names
must be separated with white spaces.hardFailure
- indicates if a RuntimeException will be thrown if one or more of the classes
cannot be loaded or instanciated. Otherwise it will ignore the failure and continue with
the other classes.classLoader
- ClassLoader to use for loading the properties files and classes.Method Detail |
public void setHardFailure(boolean hardFailure)
If a hard failure mode is OFF, a ClassNotFoundException will be thrown if one of the classes cannot be loaded or instanciated. Otherwise it will ignore the failure and continue with the other classes.
hardFailure
- true to set hard failure to ON, false to set it to OFF.public boolean isHardFailure()
If a hard failure mode is OFF, a RuntimeException will be thrown if one of the classes cannot be loaded or instanciated. Otherwise it will ignore the failure and continue with the other classes.
public java.lang.Class[] getClasses() throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
- thrown if the properties files cannot be found or read, and hard failure is ON.
java.lang.ClassNotFoundException
- thrown if one of the classes defined in the properties file cannot be loaded
and hard failure is ON.public java.lang.Object[] createInstances() throws java.io.IOException, java.lang.ClassNotFoundException, java.lang.InstantiationException
java.io.IOException
- thrown if the properties files cannot be found or read, and hard failure is ON.
java.lang.ClassNotFoundException
- thrown if one of the classes defined in the properties files cannot be loaded
and hard failure is ON.
java.lang.InstantiationException
- thrown if one of the classes defined in the properties files cannot be
instantiated and hard failure is ON.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |