|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.novell.ecb.secretstore.SecretBean
|
+--com.novell.ecb.secretstore.ReadSecret
Provides the functionality for reading an existing Secret.
The default behavior of this bean is to return the secret value that was last retrieved with doRefresh property set to true. In order to refresh the latest information about this secret in SecretStore, set doRefresh property to true explicitly.
Note: Admin cannot read other users' Secrets.ssInstance - A SecretStoreInstance object that represents the Secret to be read.
flags - The flags for the operation. Currently, no flag is defined for this operation. Property is provided here for future use.
enhancedProtectionPassword - Password for enhanced protected Secret. It is needed if Secret is enhanced protected
with a password.
doRefresh Determines whether to get the fresh value from SecretStore. The default value is false.
secretValue - A byte array containing Secret value. Default value is null.
sharedValue - A SharedValue object representing a SharedSecret's value.
Default value is null.
SharedValue,
Serialized Form| Constructor Summary | |
ReadSecret()
Constructs a ReadSecret command bean. |
|
ReadSecret(SecretInstance secretInstance)
Constructs a ReadSecret command bean and sets the SecretInstance to be used. |
|
| Method Summary | |
void |
execute()
Executes this command bean for reading the value of a Secret. |
boolean |
getDoRefresh()
Returns the doRefresh property. |
SSFlags |
getFlags()
Returns the flags set. |
byte[] |
getSecretValue()
Returns the value of the Secret. |
SharedValue |
getSharedValue()
Returns the value of a SharedSecret. |
boolean |
isReady()
Tests whether the required input properties are set and the bean is in "initialized" state. |
void |
reset()
Resets the output properties to the values they had before the execute method was called. |
void |
setDoRefresh(boolean doRefresh)
Sets the doRefresh property. |
void |
setEnhancedProtectionPassword(char[] epPassword)
Sets the enhanced protection password property. |
void |
setEnhancedProtectionPassword(java.lang.String epPassword)
Deprecated. Replaced by setEnhancedProtectionPassword(char[]). |
void |
setFlags(SSFlags flags)
Sets the flags to be used while reading Secrets. |
| Methods inherited from class com.novell.ecb.secretstore.SecretBean |
getSecretInstance, setSecretInstance |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ReadSecret()
public ReadSecret(SecretInstance secretInstance)
secretInstance - A SecretInstance object that represents the Secret to be read.| Method Detail |
public void setFlags(SSFlags flags)
flags - Flags for the operation. Currently, no flag is defined for this operation.
Property is provided here for future use.public SSFlags getFlags()
public void setDoRefresh(boolean doRefresh)
doRefresh - If set to false, cached value is returned. Set to true to get the latest value.
Default value is false.public boolean getDoRefresh()
public void setEnhancedProtectionPassword(java.lang.String epPassword)
setEnhancedProtectionPassword(char[]).
If this password is already set by GetSecretInstance bean, it is not required to set it again as it gets populated inside the SecretInstance object.
epPassword - EnhancedProtectionPassword for the Secret.public void setEnhancedProtectionPassword(char[] epPassword)
If this password is already set by GetSecretInstance bean, it is not required to set it again as it gets populated inside the SecretInstance object.
epPassword - EnhancedProtectionPassword for the Secret.public boolean isReady()
If the user does not set a value for optional input property, default value is used. Therefore, these properties do not affect the readiness of the bean. However, bean will not be in ready state if any of the required input properties is not set.
public void reset()
Sets the output properties, secretValue and sharedValue, to their default values i.e. Null.
public void execute()
throws CommandException
CommandException - Thrown if the bean fails to execute.
Example 1: Shows how to use ReadSecret bean for reading an ordinary Secret.
// Get the SecretInstance from GetSecretInstance or EnumerateSecrets bean.
SecretInstance si = getSI.getSecretInstance();
try
{
// Instantiate the command bean
ReadSecret secretReader = new ReadSecret(si);
// Set the input properties of the command bean
// Set doRefresh to true to force bean to read the
// latest value of Secret, otherwise cached value is returned.
secretReader.setDoRefresh(true);
// Set the EnhancedProtectionPassword for an enhancedProtected
// Secret. It can be set in GetSecretInstance bean also.
// It is enough to set it at one place.
secretReader.setEnhancedProtectionPassword("epPassword".toCharArray());
// Call the execute method of the command bean
secretReader.execute();
// Query the output properties of the command bean
byte[] secretValue = secretReader.getSecretValue();
// Do any further operation
..
..
}
catch(CommandException e)
{
// TODO: Handle exception
}
Example 2: Shows how to use ReadSecret bean for reading a SharedSecret.
// Get the SecretInstance from GetSecretInstance or EnumerateSecrets bean.
// Depending on the secretID, GetSecretInstance bean creates the
// instance of the SecretInstance or SharedSecretInstance.
SecretInstance si = getSI.getSecretInstance();
try
{
// Instantiate the command bean
ReadSecret secretReader = new ReadSecret(si);
// Set the input properties of the command bean
// Set doRefresh to true to force bean to read the
// latest value of Secret, otherwise cached value is returned.
secretReader.setDoRefresh(true);
// Set the EnhancedProtectionPassword for an enhancedProtected
// Secret. It can be set in GetSecretInstance bean also.
// It is enough to set it at one place.
secretReader.setEnhancedProtectionPassword("epPassword".toCharArray());
// Call the execute method of the command bean
secretReader.execute();
// Query the output properties of the command bean
SharedValue val = secretReader.getSharedValue();
// Do further operations
Iterator iter = val.keys();
while(iter.hasNext())
{
String key = (String) iter.next();
System.out.println(key + " = " + val.getValue(key));
}
}
catch(CommandException e)
{
// TODO: Handle exception
}
EnumerateSecrets,
GetSecretInstancepublic byte[] getSecretValue()
public SharedValue getSharedValue()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||