com.novell.ecb.secretstore
Class UpdateSecret

java.lang.Object
  |
  +--com.novell.ecb.secretstore.SecretBean
        |
        +--com.novell.ecb.secretstore.UpdateSecret
All Implemented Interfaces:
Command, java.io.Serializable

public class UpdateSecret
extends SecretBean

Updates the target Secret with the source Secret.

If source Secret is enhanced protected, enhancedProtection password must be set.

Required Input Properties:
sourceSecret - A SecretInstance object that represents the source SecretInstance to be updated.
targetSecret - A target SecretInstance object.
 
Optional Input Properties:
enhancedProtectionPassword - Password for enhanced protected secret. It is needed if the source Secret is enhanced protected with a password.
flags - The flags for the operation. Currently, no flag is defined for this operation. Property is provided here for future use.
Output Property:
None

Version:
1.0
See Also:
SyncSecret, Serialized Form

Constructor Summary
UpdateSecret()
          Constructs an UpdateSecret command bean.
UpdateSecret(SecretInstance sourceSecret)
          Constructs an UpdateSecret command bean and sets the source SecretInstance for update operation.
UpdateSecret(SecretInstance sourceSecret, SecretInstance targetSecret)
          Constructs an UpdateSecret command bean and sets the source and target SecretInstance for update operation.
 
Method Summary
 void execute()
          Executes this command bean for updating the target Secret with the source Secret.
 SSFlags getFlags()
          Returns the flags set.
 SecretInstance getTargetSecret()
          Returns the target SecretInstance.
 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 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 performing the update operation.
 void setTargetSecret(SecretInstance targetSecret)
          Sets the target SecretInstance to be updated.
 
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

UpdateSecret

public UpdateSecret()
Constructs an UpdateSecret command bean.


UpdateSecret

public UpdateSecret(SecretInstance sourceSecret)
Constructs an UpdateSecret command bean and sets the source SecretInstance for update operation.

Parameters:
sourceSecret - A SecretInstance object that represents the source SecretInstance to be used for updation.

UpdateSecret

public UpdateSecret(SecretInstance sourceSecret,
                    SecretInstance targetSecret)
Constructs an UpdateSecret command bean and sets the source and target SecretInstance for update operation.

Parameters:
sourceSecret - A SecretInstance object that represents the source SecretInstance to be used for updation.
targetSecret - A target SecretInstance object.
Method Detail

setTargetSecret

public void setTargetSecret(SecretInstance targetSecret)
Sets the target SecretInstance to be updated.

Parameters:
targetSecret - A target SecretInstance object.

getTargetSecret

public SecretInstance getTargetSecret()
Returns the target SecretInstance.

Returns:
SecretInstance The target SecretInstance object.

setFlags

public void setFlags(SSFlags flags)
Sets the flags to be used while performing the update operation.

Parameters:
flags - Flags for the operation. Currently, no flag is defined for this bean. Property is provided here for future use.

getFlags

public SSFlags getFlags()
Returns the flags set.

Returns:
SSFlags The flags set.

setEnhancedProtectionPassword

public void setEnhancedProtectionPassword(java.lang.String epPassword)
Deprecated. Replaced by setEnhancedProtectionPassword(char[]).

Sets the enhanced protection password property.

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.

Parameters:
epPassword - EnhancedProtectionPassword for the Secret.

setEnhancedProtectionPassword

public void setEnhancedProtectionPassword(char[] epPassword)
Sets the enhanced protection password property.

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.

Parameters:
epPassword - EnhancedProtectionPassword for the Secret.

isReady

public boolean isReady()
Tests whether the required input properties are set and the bean is in "initialized" state.

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.

Returns:
Boolean True if the bean is in initialized state; else, returns False.

reset

public void reset()
Resets the output properties to the values they had before the execute method was called.

There is no output property to reset.


execute

public void execute()
             throws CommandException
Executes this command bean for updating the target Secret with the source Secret.

Throws:
CommandException - Thrown if the bean fails to execute.

Example: Shows how to use UpdateSecret bean.


     // Get the SecretInstance from GetSecretInstance or EnumerateSecrets bean.
   SecretInstance si = getSI.getSecretInstance();
   try
     {
         // Instantiate the command bean
       UpdateSecret update = new UpdateSecret(si);
         // Set the input properties of the command bean
       getSI.setSecretID("myApp2");
       getSI.execute();
       targetSI = getSI.getSecretInstance();
       update.setTargetSecret(targetSI);
         // If source Secret is enhanced protected, enhancedProtection
         // password must be set. This can be set in GetSecretInstance also.
       update.setEnhancedProtectionPassword("epPassword".toCharArray());
         // Call the execute method of the command bean
       update.execute();
         // There is no output property of this bean
         // Do any further operations
         ...
         ...
      }
     catch(CommandException e)
      {
         // TODO: Handle exception
      }
 
See Also:
GetSecretInstance, EnumerateSecrets


Copyright © 2001-2003 Novell, Inc. All Rights Reserved.