public class NamedPasswords extends java.lang.Object implements ConfigElement
Modifier and Type | Class and Description |
---|---|
class |
NamedPasswords.NamedPassword
Class encapsulating a named password.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATTR_SECURE
Name for XML attribute 'secure'.
|
static java.lang.String |
TAG_DESCRIPTION
Tag name for XML element 'description'.
|
static java.lang.String |
TAG_KEY
Tag name for XML element 'key'.
|
static java.lang.String |
TAG_NAMED_PASSWORD
Tag name for XML element 'named-password'.
|
static java.lang.String |
TAG_NAMED_PASSWORDS
Tag name for XML element 'named-passwords'.
|
static java.lang.String |
TAG_PASSWORD
Tag name for XML element 'password'.
|
static java.lang.String |
VAL_FALSE
"false"
|
static java.lang.String |
VAL_TRUE
"true"
|
Constructor and Description |
---|
NamedPasswords()
Construct an empty
NamedPasswords instance. |
NamedPasswords(org.w3c.dom.Element namedPasswords,
boolean secure)
Construct a
NamedPasswords instance from an XML representation. |
Modifier and Type | Method and Description |
---|---|
NamedPasswords.NamedPassword |
getNamedPassword(java.lang.String key)
Get a
NamedPassword object by name. |
boolean |
hasBeenModified()
Return
true if this instance has been modified. |
java.util.Iterator |
iterator()
Return an
Iterator that will return all the NamedPassword
objects in this instance. |
NamedPasswords.NamedPassword |
newNamedPassword(java.lang.String key)
Create a new named password entry if one doesn't already exist with the passed name.
|
NamedPasswords.NamedPassword |
removeNamedPassword(java.lang.String key)
Remote named password entry if it exists in this instance.
|
void |
resetModified()
Reset the modified flag for this instance such that
hasBeenModified()
will return false . |
void |
setConfigPassword(char[] configPassword)
Set a password for use by contained
NamedPassword instance for
setting and returning clear-text passwords. |
org.w3c.dom.Element |
toXML(org.w3c.dom.Node parent)
Construct an XML representation of this instance.
|
public static final java.lang.String TAG_NAMED_PASSWORDS
public static final java.lang.String TAG_NAMED_PASSWORD
public static final java.lang.String TAG_KEY
public static final java.lang.String TAG_DESCRIPTION
public static final java.lang.String TAG_PASSWORD
public static final java.lang.String ATTR_SECURE
public static final java.lang.String VAL_TRUE
public static final java.lang.String VAL_FALSE
public NamedPasswords()
NamedPasswords
instance.public NamedPasswords(org.w3c.dom.Element namedPasswords, boolean secure) throws XMLException
NamedPasswords
instance from an XML representation.namedPasswords
- <named-passwords> element containing the
XML representation.secure
- true
if enclosing XML specifies passwords are encryptedXMLException
- if the XML representation is incorrectpublic void setConfigPassword(char[] configPassword)
NamedPassword
instance for
setting and returning clear-text passwords.configPassword
- password characters or null
public boolean hasBeenModified()
true
if this instance has been modified.
The instance is considered to have been modified if a change was made
that affects the persistent representation since:
resetModified()
was last calledhasBeenModified
in interface ConfigElement
true
or false
resetModified()
,
toXML(org.w3c.dom.Node)
public void resetModified()
hasBeenModified()
will return false
.resetModified
in interface ConfigElement
hasBeenModified()
public org.w3c.dom.Element toXML(org.w3c.dom.Node parent)
resetModified()
.toXML
in interface ConfigElement
parent
- Node
under which to build the XML representationhasBeenModified()
,
resetModified()
public java.util.Iterator iterator()
Iterator
that will return all the NamedPassword
objects in this instance.Iterator
public NamedPasswords.NamedPassword getNamedPassword(java.lang.String key)
NamedPassword
object by name.key
- name of passwordNamedPassword
object or null
public NamedPasswords.NamedPassword newNamedPassword(java.lang.String key) throws java.lang.IllegalArgumentException
key
- name of named passwordNamedPassword
instancejava.lang.IllegalArgumentException
- if key
is null
or emptypublic NamedPasswords.NamedPassword removeNamedPassword(java.lang.String key)
key
- name of named passwordNamedPassword
instance, or null