br.shob
Class Message

java.lang.Object
  |
  +--br.shob.Message
All Implemented Interfaces:
Serializable

public class Message
extends Object
implements Serializable

represents all the messages exchanged by hosts.

Since:
August 30, 2002
Version:
$Revision: 1.8 $
Author:
crolmos, dukejeffrie
See Also:
Serialized Form
Created:
20 de Março de 2003

Field Summary
static int BEGIN_TRANS
          Description of the Field
static int COMMIT
          Description of the Field
static int GET
          Description of the Field
static int GET_CLASS
          Description of the Field
static int IDENTIFY
          Description of the Field
static int LOGIN
          Description of the Field
static int LOGOUT
          Description of the Field
static int PING
          Description of the Field
static String protocolVersion
          Description of the Field
static int RELOAD
          Description of the Field
static int REQUEST
          Description of the Field
static int ROLLBACK
          Description of the Field
static int SHARE
          Description of the Field
static int UNLOCK
          Description of the Field
static int UNSHARE
          Description of the Field
static int UPDATE
          Description of the Field
static int VALIDATE
          Description of the Field
 
Method Summary
static Message createBeginTrans(String globalName)
          creates a message of this type.
static Message createCommit(String globalName)
          creates a message of this type.
static Message createError(int type, HostId hostId, Throwable error)
          creates a message of this type.
static Message createError(int type, Throwable error)
          creates a message of this type.
static Message createGet(String globalName, HostId hostId)
          creates a message of this type.
static Message createGetClass(String globalName, String className)
          Description of the Method
static Message createIdentify(URL url)
          creates a message of this type.
static Message createLogin(HostId hostId)
          creates a message of this type.
static Message createLogout()
          creates a message of this type.
static Message createOK(int type)
          creates a message of this type.
static Message createOK(int type, byte[] classArray)
          Description of the Method
static Message createOK(int type, HostId hostId)
          creates a message of this type.
static Message createOK(int type, HostId hostId, TimeStamp timeStamp)
          creates a message of this type.
static Message createOK(int type, String globalName, SharedObject data)
          creates a message of this type.
static Message createOK(int type, TimeStamp timeStamp)
          creates a message of this type.
static Message createPing()
          creates a message of this type.
static Message createReload(String globalName, HostId hostId)
          creates a message of this type.
static Message createRequest(String globalName)
          creates a message of this type.
static Message createRollback(String globalName)
          creates a message of this type.
static Message createShare(String globalName)
          creates a message of this type.
static Message createUnlock(String globalName, HostId writer, TimeStamp timeStamp)
          creates a message of this type.
static Message createUnshare(String globalName)
          creates a message of this type.
static Message createUpdate(String globalName, HostId hostId)
          creates a message of this type.
static Message createValidate(String globalName, TimeStamp timeStamp)
          creates a message of this type.
 byte[] getClassArray()
          Gets the objectClass attribute of the Message object
 String getClassName()
          Gets the className attribute of the Message object
 SharedObject getData()
          accesor for the data of the object.
 Throwable getError()
          Gets the error attribute of the Message object
 String getGlobalName()
          accesor for the global name of the object.
 HostId getHostId()
          accesor for the host id of the object.
 TimeStamp getTimeStamp()
          accesor for the time stamp of the object.
 int getType()
          accesor for the type of the message.
 URL getURL()
          accesor for the url of the object.
 boolean isError()
          true if the message indicates an error, false otherwise.
 String toString()
          Description of the Method
static String toTypeName(int type)
          Description of the Method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BEGIN_TRANS

public static final int BEGIN_TRANS
Description of the Field

See Also:
Constant Field Values

COMMIT

public static final int COMMIT
Description of the Field

See Also:
Constant Field Values

GET

public static final int GET
Description of the Field

See Also:
Constant Field Values

GET_CLASS

public static final int GET_CLASS
Description of the Field

See Also:
Constant Field Values

IDENTIFY

public static final int IDENTIFY
Description of the Field

See Also:
Constant Field Values

LOGIN

public static final int LOGIN
Description of the Field

See Also:
Constant Field Values

LOGOUT

public static final int LOGOUT
Description of the Field

See Also:
Constant Field Values

PING

public static final int PING
Description of the Field

See Also:
Constant Field Values

RELOAD

public static final int RELOAD
Description of the Field

See Also:
Constant Field Values

REQUEST

public static final int REQUEST
Description of the Field

See Also:
Constant Field Values

ROLLBACK

public static final int ROLLBACK
Description of the Field

See Also:
Constant Field Values

SHARE

public static final int SHARE
Description of the Field

See Also:
Constant Field Values

UNLOCK

public static final int UNLOCK
Description of the Field

See Also:
Constant Field Values

UNSHARE

public static final int UNSHARE
Description of the Field

See Also:
Constant Field Values

UPDATE

public static final int UPDATE
Description of the Field

See Also:
Constant Field Values

VALIDATE

public static final int VALIDATE
Description of the Field

See Also:
Constant Field Values

protocolVersion

public static final String protocolVersion
Description of the Field

See Also:
Constant Field Values
Method Detail

createBeginTrans

public static Message createBeginTrans(String globalName)
creates a message of this type.

Parameters:
globalName - the name of the object in the global space.
Returns:
Description of the Return Value

createCommit

public static Message createCommit(String globalName)
creates a message of this type.

Parameters:
globalName - the name of the object in the global space.
Returns:
Description of the Return Value

createError

public static Message createError(int type,
                                  Throwable error)
creates a message of this type.

Parameters:
type - one of the static constants defined above.
error - Description of the Parameter
Returns:
Description of the Return Value

createError

public static Message createError(int type,
                                  HostId hostId,
                                  Throwable error)
creates a message of this type.

Parameters:
type - one of the static constants defined above.
hostId - the remote host's id.
error - Description of the Parameter
Returns:
Description of the Return Value

createGet

public static Message createGet(String globalName,
                                HostId hostId)
creates a message of this type.

Parameters:
globalName - the name of the object in the global space.
hostId - the remote host's id.
Returns:
Description of the Return Value

createGetClass

public static Message createGetClass(String globalName,
                                     String className)
Description of the Method

Parameters:
globalName - Description of the Parameter
className - Description of the Parameter
Returns:
Description of the Return Value

createIdentify

public static Message createIdentify(URL url)
creates a message of this type.

Parameters:
url - Description of the Parameter
Returns:
Description of the Return Value

createLogin

public static Message createLogin(HostId hostId)
creates a message of this type.

Parameters:
hostId -
Returns:
a login message

createLogout

public static Message createLogout()
creates a message of this type.

Returns:
Description of the Return Value

createOK

public static Message createOK(int type,
                               String globalName,
                               SharedObject data)
creates a message of this type.

Parameters:
globalName - the name of the object in the global space.
data - the serializable object to be sent.
type - Description of the Parameter
Returns:
Description of the Return Value

createOK

public static Message createOK(int type)
creates a message of this type.

Parameters:
type - one of the static constants defined above.
Returns:
Description of the Return Value

createOK

public static Message createOK(int type,
                               HostId hostId)
creates a message of this type.

Parameters:
type - one of the static constants defined above.
hostId - the remote host's id.
Returns:
Description of the Return Value

createOK

public static Message createOK(int type,
                               HostId hostId,
                               TimeStamp timeStamp)
creates a message of this type.

Parameters:
type - one of the static constants defined above.
hostId - the remote host's id.
timeStamp - the timestamp of the object.
Returns:
Description of the Return Value

createOK

public static Message createOK(int type,
                               TimeStamp timeStamp)
creates a message of this type.

Parameters:
type - one of the static constants defined above.
timeStamp - the timestamp of the object.
Returns:
Description of the Return Value

createOK

public static Message createOK(int type,
                               byte[] classArray)
Description of the Method

Parameters:
type - Description of the Parameter
classArray - Description of the Parameter
Returns:
Description of the Return Value

createPing

public static Message createPing()
creates a message of this type.

Returns:
Description of the Return Value

createReload

public static Message createReload(String globalName,
                                   HostId hostId)
creates a message of this type.

Parameters:
globalName - the name of the object in the global space.
hostId - the remote host's id.
Returns:
Description of the Return Value

createRequest

public static Message createRequest(String globalName)
creates a message of this type.

Parameters:
globalName - the name of the object in the global space.
Returns:
Description of the Return Value

createRollback

public static Message createRollback(String globalName)
creates a message of this type.

Parameters:
globalName - the name of the object in the global space.
Returns:
Description of the Return Value

createShare

public static Message createShare(String globalName)
creates a message of this type.

Parameters:
globalName - the name of the object in the global space.
Returns:
Description of the Return Value

createUnlock

public static Message createUnlock(String globalName,
                                   HostId writer,
                                   TimeStamp timeStamp)
creates a message of this type.

Parameters:
globalName - the name of the object in the global space.
timeStamp - the timestamp of the object.
writer - Description of the Parameter
Returns:
Description of the Return Value

createUnshare

public static Message createUnshare(String globalName)
creates a message of this type.

Parameters:
globalName - the name of the object in the global space.
Returns:
Description of the Return Value

createUpdate

public static Message createUpdate(String globalName,
                                   HostId hostId)
creates a message of this type.

Parameters:
globalName - the name of the object in the global space.
hostId - the remote host's id.
Returns:
Description of the Return Value

createValidate

public static Message createValidate(String globalName,
                                     TimeStamp timeStamp)
creates a message of this type.

Parameters:
globalName - the name of the object in the global space.
timeStamp - the timestamp of the object to be validated.
Returns:
Description of the Return Value

getClassArray

public byte[] getClassArray()
Gets the objectClass attribute of the Message object

Returns:
The objectClass value

getClassName

public String getClassName()
Gets the className attribute of the Message object

Returns:
The className value

getData

public SharedObject getData()
accesor for the data of the object.

Returns:
The data value
See Also:
Serializable

getError

public Throwable getError()
Gets the error attribute of the Message object

Returns:
The error value

getGlobalName

public String getGlobalName()
accesor for the global name of the object.

Returns:
The globalName value

getHostId

public HostId getHostId()
accesor for the host id of the object.

Returns:
The hostId value
See Also:
HostId

getTimeStamp

public TimeStamp getTimeStamp()
accesor for the time stamp of the object.

Returns:
The timeStamp value
See Also:
TimeStamp

getType

public int getType()
accesor for the type of the message. A valid type is one of the static constants defined above.

Returns:
The type value

getURL

public URL getURL()
accesor for the url of the object.

Returns:
The uRL value

isError

public boolean isError()
true if the message indicates an error, false otherwise.

Returns:
The error value

toString

public String toString()
Description of the Method

Overrides:
toString in class Object
Returns:
Description of the Return Value

toTypeName

public static String toTypeName(int type)
Description of the Method

Parameters:
type - Description of the Parameter
Returns:
Description of the Return Value