orca.shirako.common
Class UpdateData

java.lang.Object
  extended by orca.shirako.common.UpdateData
All Implemented Interfaces:
ISerialize

public class UpdateData
extends java.lang.Object
implements ISerialize

UpdateData wraps state passed with a ticket or lease update. Server-side code registers status of operations as they execute; client-side code queries for status, and may also post status.


Field Summary
protected  java.lang.String events
          Printable list of events leading up to the last update.
protected  boolean failed
          Did the last operation fail?
protected  java.lang.String message
          Status message reflecting the result of this update.
static java.lang.String PropertyEvents
           
static java.lang.String PropertyFailed
           
static java.lang.String PropertyMessage
           
 
Constructor Summary
UpdateData()
          Creates a new default instace.
UpdateData(java.lang.String message)
          Creates a new instance using the specified message.
 
Method Summary
 void absorb(UpdateData update)
          Merges passed UpdateData into this.
 void clear()
          Clears all events.
 void error(java.lang.String message)
          Indicates that an error has occurred.
 boolean failed()
          Checks if the operation represented by the object has failed.
 java.lang.String getEvents()
          Returns all events stored in the object.
 java.lang.String getMessage()
          Returns the message attached to the object.
 void post(java.lang.String event)
          Posts a human-readable string describing an event that the user may wish to know about.
 void postError(java.lang.String event)
          Posts a human-readable string describing an event that the user may wish to know about, and also marks the UpdateData in a failed state.
 void reset(java.util.Properties p)
          De-serializes the object from the given properties list.
 java.util.Properties save()
          Serializes the object into a properties list.
 void save(java.util.Properties p)
          Serializes the object into the given properties list.
 boolean successful()
          Checks if the operation represented by the object has succeeded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PropertyMessage

public static final java.lang.String PropertyMessage
See Also:
Constant Field Values

PropertyEvents

public static final java.lang.String PropertyEvents
See Also:
Constant Field Values

PropertyFailed

public static final java.lang.String PropertyFailed
See Also:
Constant Field Values

message

protected java.lang.String message
Status message reflecting the result of this update.


events

protected java.lang.String events
Printable list of events leading up to the last update.


failed

protected boolean failed
Did the last operation fail?

Constructor Detail

UpdateData

public UpdateData()
Creates a new default instace.


UpdateData

public UpdateData(java.lang.String message)
Creates a new instance using the specified message.

Parameters:
message - message to use
Method Detail

error

public void error(java.lang.String message)
Indicates that an error has occurred.

Parameters:
message - error message

post

public void post(java.lang.String event)
Posts a human-readable string describing an event that the user may wish to know about. If the object already contains messages, the new message is prepended to the existing messages. Messages are separated using "\n".

Parameters:
event - message describing event

postError

public void postError(java.lang.String event)
Posts a human-readable string describing an event that the user may wish to know about, and also marks the UpdateData in a failed state.

Parameters:
event - message describing event

absorb

public void absorb(UpdateData update)
Merges passed UpdateData into this. Posted events are extracted and merged into this. The status message from this is overwritten with the status message from the absorbed UpdateData.

Parameters:
update - absorbed update data

clear

public void clear()
Clears all events.


failed

public boolean failed()
Checks if the operation represented by the object has failed.

Returns:
true if the operation has failed

successful

public boolean successful()
Checks if the operation represented by the object has succeeded.

Returns:
true if the operation has succeeded

getEvents

public java.lang.String getEvents()
Returns all events stored in the object.

Returns:
list of events. Event items are separated by "\n".

getMessage

public java.lang.String getMessage()
Returns the message attached to the object.

Returns:
message

save

public java.util.Properties save()
                          throws java.lang.Exception
Description copied from interface: ISerialize
Serializes the object into a properties list.

Specified by:
save in interface ISerialize
Returns:
properties list representing this object
Throws:
java.lang.Exception

save

public void save(java.util.Properties p)
          throws java.lang.Exception
Description copied from interface: ISerialize
Serializes the object into the given properties list.

Specified by:
save in interface ISerialize
Parameters:
p - properties list to serialize the object into
Throws:
java.lang.Exception

reset

public void reset(java.util.Properties p)
           throws java.lang.Exception
Description copied from interface: ISerialize
De-serializes the object from the given properties list.

Specified by:
reset in interface ISerialize
Parameters:
p - properties list containing the serialized version of the object
Throws:
java.lang.Exception


Copyright © 2007 Network/Internet Computing Lab. All Rights Reserved.