|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.smartlab.config.Element net.smartlab.config.Node net.smartlab.config.Configuration net.smartlab.config.XMLConfiguration
public final class XMLConfiguration
Represents a configuration expressed through an XML document.
Nested Class Summary | |
---|---|
protected static class |
XMLConfiguration.XMLHandler
SAX Handler implementation to provide the in-memory representation of an XML configuration file. |
Field Summary |
---|
Fields inherited from class net.smartlab.config.Configuration |
---|
listeners, monitor |
Fields inherited from class net.smartlab.config.Node |
---|
attributes, children, content, resolved |
Fields inherited from class net.smartlab.config.Element |
---|
name, parent |
Constructor Summary | |
---|---|
XMLConfiguration(java.io.File source)
Constructs a configuration structure from an XML file. |
|
XMLConfiguration(java.io.File source,
javax.crypto.Cipher cipher)
Constructs a configuration structure from an encrypted XML file. |
|
XMLConfiguration(java.lang.String source)
Constructs a configuration structure from an XML file accessible through a file system dependent string representation of a path. |
|
XMLConfiguration(java.lang.String source,
javax.crypto.Cipher cipher)
Constructs a configuration structure from an encrypted XML file accessible through a file system dependent string representation of a path. |
|
XMLConfiguration(java.net.URL source)
Constructs a configuration structure from an XML stream of characters. |
|
XMLConfiguration(java.net.URL source,
javax.crypto.Cipher cipher)
Constructs a configuration structure from an encrypted XML stream of characters. |
Method Summary | |
---|---|
static void |
encrypt(java.io.File plain,
java.io.File symKey,
java.io.File ciphered,
java.lang.String algorithm)
TODO documentation |
boolean |
isChanged()
This method checks if the source from the configuration structure was modified since it was last read. |
void |
update()
Ensures the in memory representation of the configuration matches with the underlying representation. |
Methods inherited from class net.smartlab.config.Configuration |
---|
addListener, check, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getListeners, getResolve, init, removeListener, resolve, setResolve |
Methods inherited from class net.smartlab.config.Node |
---|
getAttribute, getAttributeNames, getAttributes, getContent, getElement, getElements, getElements, getId, resolve, setContent |
Methods inherited from class net.smartlab.config.Element |
---|
getAttributeValues, getElement, getElement, getName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public XMLConfiguration(java.io.File source) throws ConfigurationException
source
- a File
object pointing to the underlying
represantation of the configuration.
ConfigurationException
- if the file specified is not a valid
XML file or is no more readable.public XMLConfiguration(java.lang.String source) throws ConfigurationException
source
- a String
representation of a system
dependant path pointing to a valid configuration representation.
ConfigurationException
- if the file is not a valid XML file or
is no more accessible through the specified path.public XMLConfiguration(java.net.URL source) throws ConfigurationException
isChanged
method returns always false
source
- a stream of characters representing a valid XML document.
ConfigurationException
- if the stream doesn't represent a valid
XML document or if an IO error were generated while accessing
the stream.public XMLConfiguration(java.io.File source, javax.crypto.Cipher cipher) throws ConfigurationException
Cipher
reference correctly initialized
for the appropriate encoding scheme.
source
- a File
object pointing to the underlying
represantation of the configuration.cipher
- an appropriately initialized instance of a
Cipher
to be used to decrypt the document.
ConfigurationException
- if the file specified is not a valid XML
file or is no more readable.public XMLConfiguration(java.lang.String source, javax.crypto.Cipher cipher) throws ConfigurationException
Cipher
reference correctly
initialized for the appropriate encoding scheme.
source
- a String
representation of a system
dependant path pointing to a valid configuration representation.cipher
- an appropriately initialized instance of a
Cipher
to be used to decrypt the document.
ConfigurationException
- if the file is not a valid XML file or
is no more accessible through the specified path.public XMLConfiguration(java.net.URL source, javax.crypto.Cipher cipher) throws ConfigurationException
Cipher
reference
correctly initialized for the appropriate encoding scheme. The
isChanged
method returns true
only if the
update
method was never called.
source
- a stream of characters representing a valid XML document.cipher
- an appropriately initialized instance of a
Cipher
to be used to decrypt the document.
ConfigurationException
- if the stream doesn't represent a valid
XML document or if an IO error were generated while accessing
the stream.Method Detail |
---|
public boolean isChanged() throws ConfigurationException
Configuration
isChanged
in class Configuration
true
if the underlying representation of the
structure was modified since last read.
ConfigurationException
- if something wrong occurred while
checking the underlaying structure like the file is no more
readable or the stream no more available.Configuration.isChanged()
public void update() throws ConfigurationException
Configuration
update
in class Configuration
ConfigurationException
- if the underlying representation of the
structure is no more accessible or the decoding process fails
due to an unappropriately initialized Cipher
.Configuration.update()
public static void encrypt(java.io.File plain, java.io.File symKey, java.io.File ciphered, java.lang.String algorithm) throws java.io.IOException, java.lang.ClassNotFoundException, java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, java.security.InvalidKeyException
plain
- symKey
- ciphered
- algorithm
-
java.io.IOException
java.lang.ClassNotFoundException
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
java.security.InvalidKeyException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |