|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jp.protection.pub.FileSecretStorage
public class FileSecretStorage
Default implementation of the SecretStorage interface that stores
data in a local file using very simple encoding
| Nested Class Summary | |
|---|---|
protected static class |
FileSecretStorage.DecodeInputStream
|
protected static class |
FileSecretStorage.EncodeOutputStream
|
static class |
FileSecretStorage.Provider
|
| Field Summary | |
|---|---|
protected boolean |
fDirty
|
protected java.lang.String |
fFileName
|
protected java.lang.String |
fFolder
|
protected boolean |
fLoaded
|
protected java.util.Properties |
fProperties
|
protected boolean |
fSkipEncryption
|
protected boolean |
fUserHomeRelative
|
protected boolean |
fVerbose
|
| Constructor Summary | |
|---|---|
FileSecretStorage()
Creates a new instance of FileSecretStorage |
|
FileSecretStorage(java.lang.String aFolder,
java.lang.String aFileName)
Creates a new instance of FileSecretStorage and initializes it |
|
FileSecretStorage(java.lang.String aFolder,
java.lang.String aFileName,
boolean aUserHomeRelative)
Creates a new instance of FileSecretStorage and initializes it |
|
| Method Summary | |
|---|---|
protected void |
error(java.lang.Throwable ex)
|
protected long |
generateTimestamp(java.io.File aFile)
|
java.io.File |
getFile()
Returns the secret storage file |
java.lang.String |
getFileName()
Returns the name of the storage file |
java.lang.String |
getFolder()
Returns the folder of the storage file |
protected java.io.InputStream |
getInputStream()
|
protected java.io.OutputStream |
getOutputStream()
|
protected java.util.Properties |
getProperties()
|
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 |
protected long |
getTimestamp(java.io.File aFile)
|
boolean |
isDirty()
Checks whether secret storage is changed |
protected boolean |
isLoaded()
|
boolean |
isSkipEncryption()
Checks whether encryption should be skipped during storage saving |
boolean |
isUserHomeRelative()
Checks whether folder to find storage file is relative to the user home. |
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 |
setDirty(boolean aDirty)
Specifies that secret storage is changed |
void |
setFileName(java.lang.String aFileName)
Specifies the name of the storage file |
void |
setFolder(java.lang.String aFolder)
Specifies the folder of the storage file |
protected void |
setLoaded(boolean aLoaded)
|
java.lang.Object |
setProperty(java.lang.String key,
java.lang.String value)
Specifies property value for the given key |
void |
setSkipEncryption(boolean aSkipEncryption)
Specifies that encryption should be skipped during storage saving |
void |
setUserHomeRelative(boolean aUserHomeRelative)
Specifies that folder to find storage file is relative to the user home. |
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 java.lang.String fFileName
protected java.lang.String fFolder
protected boolean fUserHomeRelative
protected java.util.Properties fProperties
protected boolean fDirty
protected boolean fLoaded
protected boolean fVerbose
protected boolean fSkipEncryption
| Constructor Detail |
|---|
public FileSecretStorage()
public FileSecretStorage(java.lang.String aFolder,
java.lang.String aFileName)
aFolder - a folder to locate secret storage fileaFileName - a name of secret storage file
public FileSecretStorage(java.lang.String aFolder,
java.lang.String aFileName,
boolean aUserHomeRelative)
aFolder - folder to locate secret storage fileaFileName - a name of secret storage fileaUserHomeRelative - specifies whether a folder is user HOME folder relative| Method Detail |
|---|
public boolean isUserHomeRelative()
true if folder to find storage file is
relative to the user home; false otherwise.public java.lang.String getFileName()
public void setFileName(java.lang.String aFileName)
aFileName - a name of the storage file to assignpublic java.lang.String getFolder()
public void setFolder(java.lang.String aFolder)
aFolder - a folder of the storage file to assignpublic void setUserHomeRelative(boolean aUserHomeRelative)
aUserHomeRelative - true if folder to find storage file is
relative to the user home; false otherwise.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 setLoaded(boolean aLoaded)
protected java.util.Properties getProperties()
public java.lang.String getProperty(java.lang.String key)
SecretStorage
getProperty in interface SecretStoragekey - identifies value to return
public java.lang.String getProperty(java.lang.String key,
java.lang.String defaultValue)
SecretStorage
getProperty in interface SecretStoragekey - 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 SecretStoragekey - identifies value to specifyvalue - value to be associated with the key
protected boolean isLoaded()
public boolean isDirty()
true if secret storage is changed; false
otherwisepublic void setDirty(boolean aDirty)
aDirty - true if secret storage should be marked as changed;
false otherwisepublic void load()
SecretStorage
load in interface SecretStorageprotected long generateTimestamp(java.io.File aFile)
protected long getTimestamp(java.io.File aFile)
public void save()
SecretStorage
save in interface SecretStoragepublic boolean isSkipEncryption()
true if encryption should be skipped during storage
saving; false otherwisepublic void setSkipEncryption(boolean aSkipEncryption)
aSkipEncryption - true if encryption should be skipped
during storage saving; false otherwisepublic java.io.File getFile()
protected java.io.InputStream getInputStream()
protected java.io.OutputStream getOutputStream()
protected void error(java.lang.Throwable ex)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||