ostore.client
Class OSUpdate

java.lang.Object
  |
  +--ostore.client.OSRequest
        |
        +--ostore.client.OSUpdate
All Implemented Interfaces:
QueueElementIF, QuickSerializable

public class OSUpdate
extends OSRequest

An application uses the OSUpdate to modify a data object in OceanStore. In response to this request, the application will receive an OSUpdateResult. To create an update, the system requires the principal's public key, the principal's private key, and one or more OSUpdateTuples that describe the update.

The principal's public key is used to identify the creator of the update. The principal's private key is used to sign the update. The signed update asserts that the signing principal requests the included update.

The principal's private key is used only by the ClientStage to sign the update. It is not transmitted further to the system and is discarded after the result of the request is known.

To enable the ClientStage to manage the encryption of users' data, the OSUpdate contains a boolean flag to be set by the application to indicate whether the update should be encrypted.

OceanStore applications request modifications to data objects by submitting an OSUpdate. An OSUpdate is an ordered list of update tuples which are represented by OSUpdateTuple objects. Each tuple contains one OSPredicate and one OSAction. The OSPredicate is the root of a boolean expression of predicates. An OSAction is the first of a list of actions.

An OSUpdate is evaluated by examining each tuple in turn. If the predicate of a tuple evaluates to true, the action in the tuple is applied and the update is said to have committed. After an update has committed, no other tuples are examined. If the predicates of all tuples evaluate to false, no action is applied, and the update is said to have aborted.

Version:
$Id: OSUpdate.java,v 1.24 2004/02/13 23:14:42 rrubin Exp $
Author:
Patrick R. Eaton
See Also:
OSUpdateTuple, OSPredicate, OSAction, OSUpdateResult

Field Summary
 
Fields inherited from class ostore.client.OSRequest
app_id
 
Constructor Summary
OSUpdate(InputBuffer buffer)
           
OSUpdate(OSAppId app_id, SecureHash principal, QSPrivateKey principal_skey)
          Creates a new OSUpdate.
OSUpdate(OSAppId app_id, SecureHash principal, QSPrivateKey principal_skey, OSUpdateTuple tuple)
          Creates a new OSUpdate and inserts one tuple into the update.
OSUpdate(OSAppId app_id, SecureHash principal, QSPrivateKey principal_skey, OSUpdateTuple tuple, boolean return_type)
           
 
Method Summary
 void appendTuple(OSUpdateTuple tuple)
          Appends a tuple to the end of the ordered tuple list for this update.
 boolean getEncrypt()
          Returns the value of the encryption flag.
 Iterator getTuples()
          Returns an Iterator of the tuples in this update.
 void serialize(OutputBuffer buffer)
          Add the object to the buffer.
 void setEncrypt(boolean encrypt)
          Sets the value of the encryption flag.
 String toString()
           
 
Methods inherited from class ostore.client.OSRequest
clone, getAppId, getDispatchTime, getSeqNum, getUserTag, setUserTag
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OSUpdate

public OSUpdate(OSAppId app_id,
                SecureHash principal,
                QSPrivateKey principal_skey)
Creates a new OSUpdate. Tuples can be added to the update using the appendTuple() method.

Parameters:
app_id - the OSAppId to identify the requesting application
principal - the secure hash of the principal's public key
principal_skey - the principal's private key

OSUpdate

public OSUpdate(OSAppId app_id,
                SecureHash principal,
                QSPrivateKey principal_skey,
                OSUpdateTuple tuple)
Creates a new OSUpdate and inserts one tuple into the update.

Parameters:
app_id - the OSAppId to identify the requesting application
principal - the secure hash of the principal's public key
principal_skey - the principal's private key
tuple - the tuple to add to the update

OSUpdate

public OSUpdate(OSAppId app_id,
                SecureHash principal,
                QSPrivateKey principal_skey,
                OSUpdateTuple tuple,
                boolean return_type)

OSUpdate

public OSUpdate(InputBuffer buffer)
         throws QSException
Method Detail

serialize

public void serialize(OutputBuffer buffer)
Description copied from interface: QuickSerializable
Add the object to the buffer.

Specified by:
serialize in interface QuickSerializable
Overrides:
serialize in class OSRequest
Parameters:
buffer - the output buffer to add the object to

setEncrypt

public void setEncrypt(boolean encrypt)
Sets the value of the encryption flag. If the flag is set to true, the ClientStage will encrypt the data in the update before submitting it to the system.

Parameters:
encrypt - the value of the encryption flag

getEncrypt

public boolean getEncrypt()
Returns the value of the encryption flag.

Returns:
the value of the encryption flag

appendTuple

public void appendTuple(OSUpdateTuple tuple)
Appends a tuple to the end of the ordered tuple list for this update.

Parameters:
tuple - the tuple to append to the tuple list

getTuples

public Iterator getTuples()
Returns an Iterator of the tuples in this update.

Returns:
an iterator of the tuples in this update

toString

public String toString()
Overrides:
toString in class Object