TrueUpdate Manager Specification 0.1.5

net.java.trueupdate.manager.spec
Class UpdateMessage

java.lang.Object
  extended by net.java.trueupdate.manager.spec.UpdateMessage
All Implemented Interfaces:
Serializable

@Immutable
public final class UpdateMessage
extends Object
implements Serializable

An immutable Value Object which gets exchanged between update agents and update managers in order to establish a protocol for the automated installation of application updates.

Author:
Christian Schlichtherle
See Also:
UpdateMessage.Type, Serialized Form

Nested Class Summary
static class UpdateMessage.Builder
          A builder for an update message.
static class UpdateMessage.Type
          The update message type.
 
Method Summary
 ApplicationDescriptor applicationDescriptor()
          Vends an application descriptor from the information in this update message.
 ArtifactDescriptor artifactDescriptor()
          Returns the artifact descriptor.
 UpdateMessage artifactDescriptor(ArtifactDescriptor artifactDescriptor)
          Returns an update message with the given artifact descriptor.
static UpdateMessage.Builder builder()
          Returns a new builder for an update message.
 URI currentLocation()
          Returns the current location.
 UpdateMessage currentLocation(URI currentLocation)
          Returns an update message with the given current location.
 boolean equals(Object obj)
          Returns true if and only if the given object is an UpdateMessage with equal properties.
 UpdateMessage failureResponse(Exception ex)
          Returns a failure response for this update message with the string representation of the given exception as the status, swapped from/to URIs and an updated time stamp.
 URI from()
          Returns the update message sender.
 UpdateMessage from(URI from)
          Returns an update message with the given update message sender.
 int hashCode()
          Returns a hash code which is consistent with equals(Object).
 String status()
          Returns the status text.
 UpdateMessage status(String status)
          Returns an update message with the given status text.
 UpdateMessage successResponse()
          Returns a success response for this update message with an empty status, swapped from/to URIs and an updated time stamp.
 long timestamp()
          Returns the update message timestamp.
 UpdateMessage timestamp(long timestamp)
          Returns an update message with the given update message timestamp.
 URI to()
          Returns the update message recipient.
 UpdateMessage to(URI to)
          Returns an update message with the given update message recipient.
 String toString()
          Returns a human readable string representation of this object.
 UpdateMessage.Type type()
          Returns the update message type.
 UpdateMessage type(UpdateMessage.Type type)
          Returns an update message with the given update message type.
 UpdateMessage.Builder update()
          Returns a new builder with all properties set from this instance.
 UpdateDescriptor updateDescriptor()
          Vends an update descriptor from the information in this update message.
 URI updateLocation()
          Returns the update location.
 UpdateMessage updateLocation(URI newLocation)
          Returns an update message with the given update location.
 String updateVersion()
          Returns the update version.
 UpdateMessage updateVersion(String updateVersion)
          Returns an update message with the given update version.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

applicationDescriptor

public ApplicationDescriptor applicationDescriptor()
Vends an application descriptor from the information in this update message.


artifactDescriptor

public ArtifactDescriptor artifactDescriptor()
Returns the artifact descriptor.


artifactDescriptor

public UpdateMessage artifactDescriptor(ArtifactDescriptor artifactDescriptor)
Returns an update message with the given artifact descriptor.


builder

public static UpdateMessage.Builder builder()
Returns a new builder for an update message. The default value for the property timestamp is the creation time of the update message in milliseconds since the epoch. The default value for the properties status and updateVersion is an empty string. The default value for the property location is an empty URI. The default value for the property updateLocation is the effective value of the property location.


currentLocation

public URI currentLocation()
Returns the current location.


currentLocation

public UpdateMessage currentLocation(URI currentLocation)
Returns an update message with the given current location.


equals

public boolean equals(Object obj)
Returns true if and only if the given object is an UpdateMessage with equal properties.

Overrides:
equals in class Object

failureResponse

public UpdateMessage failureResponse(Exception ex)
Returns a failure response for this update message with the string representation of the given exception as the status, swapped from/to URIs and an updated time stamp. First, checks if the type of this update message is a *_REQUEST. If no, then an UnsupportedOperationException gets thrown. If yes, then a new update message of the corresponding type *_FAILURE_RESPONSE gets returned with the string representation of the given exception as the status and an updated time stamp.


from

public URI from()
Returns the update message sender.


from

public UpdateMessage from(URI from)
Returns an update message with the given update message sender.


hashCode

public int hashCode()
Returns a hash code which is consistent with equals(Object).

Overrides:
hashCode in class Object

status

public String status()
Returns the status text.


status

public UpdateMessage status(String status)
Returns an update message with the given status text.


successResponse

public UpdateMessage successResponse()
Returns a success response for this update message with an empty status, swapped from/to URIs and an updated time stamp. First, checks if the type of this update message is a *_REQUEST. If no, then an UnsupportedOperationException gets thrown. If yes, then a new update message of the corresponding type *_SUCCESS_RESPONSE gets returned with an empty status and an updated time stamp.


timestamp

public long timestamp()
Returns the update message timestamp.


timestamp

public UpdateMessage timestamp(long timestamp)
Returns an update message with the given update message timestamp.


to

public URI to()
Returns the update message recipient.


to

public UpdateMessage to(URI to)
Returns an update message with the given update message recipient.


toString

public String toString()
Returns a human readable string representation of this object.

Overrides:
toString in class Object

type

public UpdateMessage.Type type()
Returns the update message type.


type

public UpdateMessage type(UpdateMessage.Type type)
Returns an update message with the given update message type.


update

public UpdateMessage.Builder update()
Returns a new builder with all properties set from this instance.


updateDescriptor

public UpdateDescriptor updateDescriptor()
Vends an update descriptor from the information in this update message.


updateLocation

public URI updateLocation()
Returns the update location. If this equals currentLocation(), then the update should happen in-place.


updateLocation

public UpdateMessage updateLocation(URI newLocation)
Returns an update message with the given update location.


updateVersion

public String updateVersion()
Returns the update version.


updateVersion

public UpdateMessage updateVersion(String updateVersion)
Returns an update message with the given update version.


TrueUpdate Manager Specification 0.1.5

Copyright © 2013 Stimulus Software. All rights reserved.