|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jp.protection.pub.PreferencesSecretStorage
public class PreferencesSecretStorage
Implementation of SecretStorage
that stores properties using the
Preferences
API. Clients provide their own instance of Preferences
.
Clients can also specify whether or not to encrypt the properties. Encryption is enabled
by default.
Nested Class Summary | |
---|---|
static class |
PreferencesSecretStorage.Provider
Provider responsible of creation new PreferencesSecretStorage instances |
Field Summary | |
---|---|
protected boolean |
fVerbose
|
Constructor Summary | |
---|---|
PreferencesSecretStorage(java.util.prefs.Preferences preferences)
Creates a new PreferencesSecretStorage that uses the specified preferences. |
|
PreferencesSecretStorage(java.util.prefs.Preferences preferences,
boolean skipEncryption)
Creates a new PreferencesSecretStorage that uses the specified preferences and
encryption scheme. |
|
PreferencesSecretStorage(java.lang.String aNodeName,
boolean isUserPreferences)
Creates a new PreferencesSecretStorage that uses the specified preferences. |
|
PreferencesSecretStorage(java.lang.String aNodeName,
boolean isUserPreferences,
boolean skipEncryption)
Creates a new PreferencesSecretStorage that uses the specified preferences. |
Method Summary | |
---|---|
protected void |
error(java.lang.Throwable ex)
|
java.util.prefs.Preferences |
getPreferences()
Returns the preferences in which this secret storage's properties are stored. |
java.lang.String |
getProperty(java.lang.String key)
Gets property value by its key |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Gets property value by its key |
boolean |
isSkipEncryption()
Returns true if this secret storage does not encrypt its properties. |
boolean |
isVerbose()
Checks whether verbose output is enabled. |
void |
load()
Loads the storage from some persistent state |
void |
save()
Saves the storage to some persistent state |
void |
setPreferences(java.util.prefs.Preferences preferences)
Sets the preferences in which this secret storage's properties are stored to the specified preferences. |
java.lang.Object |
setProperty(java.lang.String key,
java.lang.String value)
Specifies property value for the given key |
void |
setVerbose(boolean aVerbose)
Specifies that verbose output is enabled. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean fVerbose
Constructor Detail |
---|
public PreferencesSecretStorage(java.lang.String aNodeName, boolean isUserPreferences, boolean skipEncryption)
PreferencesSecretStorage
that uses the specified preferences.
aNodeName
- name of the node to put preferences to. The "." denotes path names used
to employ hierarchical preferences. For example "com.acme.app" defines node with the
"/com/acme/app" absolute path.isUserPreferences
- specifies whether User of System preferences should be usedskipEncryption
- true
to not use encryption and false
to use it.public PreferencesSecretStorage(java.lang.String aNodeName, boolean isUserPreferences)
PreferencesSecretStorage
that uses the specified preferences.
This constructor just calls this(aNodeName, isUserPreferences, false)
.
aNodeName
- name of the node to put preferences to. The "." denotes path names used
to employ hierarchical preferences. For example "com.acme.app" defines node with the
"/com/acme/app" absolute path.isUserPreferences
- specifies whether User of System preferences should be usedpublic PreferencesSecretStorage(java.util.prefs.Preferences preferences)
PreferencesSecretStorage
that uses the specified preferences.
This constructor just calls this(preferences, false)
.
preferences
- preferences in which to store the properties.
java.lang.NullPointerException
- if the specified preferences is null
.public PreferencesSecretStorage(java.util.prefs.Preferences preferences, boolean skipEncryption)
PreferencesSecretStorage
that uses the specified preferences and
encryption scheme.
preferences
- preferences in which to store the properties.skipEncryption
- true
to not use encryption and false
to use it.
java.lang.NullPointerException
- if the specified preferences is null
.Method Detail |
---|
public java.lang.String getProperty(java.lang.String key)
SecretStorage
getProperty
in interface SecretStorage
key
- identifies value to return
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
SecretStorage
getProperty
in interface SecretStorage
key
- identifies value to be returndefaultValue
- a value should be returned if there is no value for the given key
public java.lang.Object setProperty(java.lang.String key, java.lang.String value)
SecretStorage
setProperty
in interface SecretStorage
key
- identifies value to specifyvalue
- value to be associated with the key
public void load()
SecretStorage
load
in interface SecretStorage
public void save()
SecretStorage
save
in interface SecretStorage
public java.util.prefs.Preferences getPreferences()
public void setPreferences(java.util.prefs.Preferences preferences)
preferences
- preferences in which to store the properties.
java.lang.NullPointerException
- if the specified preferences is null
.public boolean isSkipEncryption()
true
if this secret storage does not encrypt its properties.
true
if this secret storage does not encrypt its properties.public boolean isVerbose()
true
if verbose output is enabled;
false
otherwise.public void setVerbose(boolean aVerbose)
aVerbose
- true
if verbose output should be enabled;
false
otherwise.protected void error(java.lang.Throwable ex)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |