java.lang.Objectucot.ModuleProperties
public abstract class ModuleProperties
This class implements abstracts methods for handling, saving and loading of module's properties. It is recommended that all UCOT modules extend from this class because all the interfaces require these methods to be implemented anyway and these methods implemented here are sufficient for practically all other modules besides the core.
Field Summary | |
---|---|
protected java.util.Properties |
properties
|
protected java.net.URL |
propertiesURL
|
Constructor Summary | |
---|---|
ModuleProperties()
|
Method Summary | |
---|---|
void |
applyProperties()
Applies current properties for the module. |
java.util.Properties |
getProperties()
Returns module's properties. |
private java.net.URL |
getPropertiesURL()
Method for creating the URL from the properties file, which is the same as the class name with an .xml extension. |
java.util.Properties |
loadDefaultProperties()
Method which returns the factory default properties for the module. |
void |
loadProperties()
Loads settings from the current properties XML file. |
void |
saveProperties()
Saves current properties to the properties XML file. |
void |
setProperties(java.util.Properties properties)
Sets options for the adapter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.net.URL propertiesURL
protected java.util.Properties properties
Constructor Detail |
---|
public ModuleProperties()
Method Detail |
---|
private java.net.URL getPropertiesURL()
Method for creating the URL from the properties file, which is the same as the class name with an .xml extension.
public java.util.Properties getProperties()
ModulePropertyInterface
Returns module's properties.
getProperties
in interface ModulePropertyInterface
ModulePropertyInterface.getProperties()
public void setProperties(java.util.Properties properties)
ModulePropertyInterface
Sets options for the adapter.
Notice that this does not need to be an perfect set of properties for this module because these properties should be merged to the current properties. So it is possible to change only one property value by giving a new property object with the new value for the given key.
setProperties
in interface ModulePropertyInterface
properties
- Properties for the adapter.ModulePropertyInterface.setProperties(java.util.Properties)
public void applyProperties() throws BadPropertyValueException
ModulePropertyInterface
Applies current properties for the module.
applyProperties
in interface ModulePropertyInterface
BadPropertyValueException
- In this case exception
is thrown only if either the given parser or heuristic
does not exist.ModulePropertyInterface.applyProperties()
public void saveProperties() throws java.io.IOException
ModulePropertyInterface
Saves current properties to the properties XML file.
saveProperties
in interface ModulePropertyInterface
java.io.IOException
- Exception is thrown if something went wrong.ModulePropertyInterface.saveProperties()
public void loadProperties() throws java.io.IOException
ModulePropertyInterface
Loads settings from the current properties XML file.
loadProperties
in interface ModulePropertyInterface
java.io.IOException
- Exception is thrown if something went wrong.ModulePropertyInterface.loadProperties()
public java.util.Properties loadDefaultProperties()
ModulePropertyInterface
Method which returns the factory default properties for the module.
loadDefaultProperties
in interface ModulePropertyInterface
ModulePropertyInterface.loadDefaultProperties()