org.jboss.messaging.core.message
Class RoutableSupport

java.lang.Object
  extended byorg.jboss.messaging.core.message.RoutableSupport
All Implemented Interfaces:
java.io.Externalizable, Routable, java.io.Serializable
Direct Known Subclasses:
MessageSupport, SimpleMessageReference

public abstract class RoutableSupport
extends java.lang.Object
implements Routable, java.io.Externalizable

Version:
$Revision: 1354 $ $Id: RoutableSupport.java 1354 2006-09-22 20:33:53Z ovidiu.feodorov@jboss.com $
Author:
Ovidiu Feodorov, Tim Fox
See Also:
Serialized Form

Field Summary
protected static byte BOOLEAN
          A boolean property
protected static byte BYTE
          A byte property
protected static byte BYTES
           
protected  int deliveryCount
           
protected static byte DOUBLE
          A double property
protected  long expiration
          GMT milliseconds at which this message expires.
protected static byte FLOAT
          A float property
protected  java.util.Map headers
           
protected static byte INT
          An integer property
protected static byte LIST
           
protected static byte LONG
          A long property
protected static byte MAP
           
protected  long messageID
           
protected static byte NULL
          A null property
protected static byte OBJECT
          An object property
protected  byte priority
           
protected  boolean redelivered
           
protected  boolean reliable
           
protected static byte SHORT
          A short property
protected static byte STRING
          A string property
protected  long timestamp
           
 
Fields inherited from interface org.jboss.messaging.core.Routable
COLLECTOR_ID, REMOTE_ROUTABLE, REPLICATOR_ID
 
Constructor Summary
  RoutableSupport()
          Required by externalization.
  RoutableSupport(long messageID)
          Constructs a generic Routable that is not reliable and does not expire.
  RoutableSupport(long messageID, boolean reliable)
          Constructs a generic Routable that does not expire.
  RoutableSupport(long messageID, boolean reliable, long timeToLive)
           
  RoutableSupport(long messageID, boolean reliable, long expiration, long timestamp, byte priority, int deliveryCount, java.util.Map headers)
           
protected RoutableSupport(RoutableSupport other)
           
 
Method Summary
 boolean containsHeader(java.lang.String name)
          Returns true if the Routable contains the specified header.
 void decrementDeliveryCount()
           
 int getDeliveryCount()
           
 long getExpiration()
           
 java.io.Serializable getHeader(java.lang.String name)
          Returns the value corresponding to the header name.
 java.util.Set getHeaderNames()
          Returns a copy of the header name set.
 java.util.Map getHeaders()
           
 long getMessageID()
           
 byte getPriority()
           
 long getTimestamp()
           
 void incrementDeliveryCount()
           
protected static java.io.Serializable internalReadObject(java.io.ObjectInput in, boolean longStrings)
           
protected static void internalWriteObject(java.io.ObjectOutput out, java.io.Serializable value, boolean containerTypes, boolean longStrings)
           
 boolean isExpired()
           
 boolean isRedelivered()
           
 boolean isReliable()
           
 java.io.Serializable putHeader(java.lang.String name, java.io.Serializable value)
          Binds a header.
 void readExternal(java.io.ObjectInput in)
           
static java.util.List readList(java.io.ObjectInput in)
           
static java.util.Map readMap(java.io.ObjectInput in, boolean stringKeys)
           
 java.io.Serializable removeHeader(java.lang.String name)
          Removes the header.
 void setDeliveryCount(int deliveryCount)
           
 void setPriority(byte priority)
           
 void setRedelivered(boolean redelivered)
           
 void setReliable(boolean reliable)
           
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
static void writeList(java.io.ObjectOutput out, java.util.List list)
           
static void writeMap(java.io.ObjectOutput out, java.util.Map map, boolean stringKeys)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.messaging.core.Routable
getMessage, isReference
 

Field Detail

BYTE

protected static final byte BYTE
A byte property

See Also:
Constant Field Values

SHORT

protected static final byte SHORT
A short property

See Also:
Constant Field Values

INT

protected static final byte INT
An integer property

See Also:
Constant Field Values

LONG

protected static final byte LONG
A long property

See Also:
Constant Field Values

FLOAT

protected static final byte FLOAT
A float property

See Also:
Constant Field Values

DOUBLE

protected static final byte DOUBLE
A double property

See Also:
Constant Field Values

BOOLEAN

protected static final byte BOOLEAN
A boolean property

See Also:
Constant Field Values

STRING

protected static final byte STRING
A string property

See Also:
Constant Field Values

OBJECT

protected static final byte OBJECT
An object property

See Also:
Constant Field Values

NULL

protected static final byte NULL
A null property

See Also:
Constant Field Values

BYTES

protected static final byte BYTES
See Also:
Constant Field Values

MAP

protected static final byte MAP
See Also:
Constant Field Values

LIST

protected static final byte LIST
See Also:
Constant Field Values

messageID

protected long messageID

reliable

protected boolean reliable

expiration

protected long expiration
GMT milliseconds at which this message expires. 0 means never expires


timestamp

protected long timestamp

headers

protected java.util.Map headers

redelivered

protected boolean redelivered

priority

protected byte priority

deliveryCount

protected int deliveryCount
Constructor Detail

RoutableSupport

public RoutableSupport()
Required by externalization.


RoutableSupport

public RoutableSupport(long messageID)
Constructs a generic Routable that is not reliable and does not expire.


RoutableSupport

public RoutableSupport(long messageID,
                       boolean reliable)
Constructs a generic Routable that does not expire.


RoutableSupport

public RoutableSupport(long messageID,
                       boolean reliable,
                       long timeToLive)

RoutableSupport

public RoutableSupport(long messageID,
                       boolean reliable,
                       long expiration,
                       long timestamp,
                       byte priority,
                       int deliveryCount,
                       java.util.Map headers)

RoutableSupport

protected RoutableSupport(RoutableSupport other)
Method Detail

writeList

public static void writeList(java.io.ObjectOutput out,
                             java.util.List list)
                      throws java.io.IOException
Throws:
java.io.IOException

readList

public static java.util.List readList(java.io.ObjectInput in)
                               throws java.lang.ClassNotFoundException,
                                      java.io.IOException
Throws:
java.lang.ClassNotFoundException
java.io.IOException

internalReadObject

protected static java.io.Serializable internalReadObject(java.io.ObjectInput in,
                                                         boolean longStrings)
                                                  throws java.io.IOException,
                                                         java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

internalWriteObject

protected static void internalWriteObject(java.io.ObjectOutput out,
                                          java.io.Serializable value,
                                          boolean containerTypes,
                                          boolean longStrings)
                                   throws java.io.IOException
Throws:
java.io.IOException

writeMap

public static void writeMap(java.io.ObjectOutput out,
                            java.util.Map map,
                            boolean stringKeys)
                     throws java.io.IOException
Throws:
java.io.IOException

readMap

public static java.util.Map readMap(java.io.ObjectInput in,
                                    boolean stringKeys)
                             throws java.io.IOException,
                                    java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

getMessageID

public long getMessageID()
Specified by:
getMessageID in interface Routable

isReliable

public boolean isReliable()
Specified by:
isReliable in interface Routable
Returns:
true if the delivery must be guaranteed for this routable, false othewise.

getExpiration

public long getExpiration()
Specified by:
getExpiration in interface Routable
Returns:
the time (in GMT milliseconds) when this routable expires and must be removed from the system. A zero value means this routable never expires.

getTimestamp

public long getTimestamp()
Specified by:
getTimestamp in interface Routable
Returns:
the time (in GMT milliseconds) when this routable was delivered to the provider.

isRedelivered

public boolean isRedelivered()
Specified by:
isRedelivered in interface Routable
Returns:
true if the delivery of this message had to be repeated at least once.

setRedelivered

public void setRedelivered(boolean redelivered)
Specified by:
setRedelivered in interface Routable

setReliable

public void setReliable(boolean reliable)
Specified by:
setReliable in interface Routable

getDeliveryCount

public int getDeliveryCount()
Specified by:
getDeliveryCount in interface Routable
Returns:
the number of times delivery has been attempted for this routable

incrementDeliveryCount

public void incrementDeliveryCount()
Specified by:
incrementDeliveryCount in interface Routable

decrementDeliveryCount

public void decrementDeliveryCount()
Specified by:
decrementDeliveryCount in interface Routable

setDeliveryCount

public void setDeliveryCount(int deliveryCount)
Specified by:
setDeliveryCount in interface Routable

putHeader

public java.io.Serializable putHeader(java.lang.String name,
                                      java.io.Serializable value)
Description copied from interface: Routable
Binds a header. If the header map previously contained a mapping for this name, the old value is replaced by the specified value.

Specified by:
putHeader in interface Routable
Returns:
the value associated with the name or null if there is no mapping for the name. A null can also indicate that the header map previously associated null with the specified name.

getHeader

public java.io.Serializable getHeader(java.lang.String name)
Description copied from interface: Routable
Returns the value corresponding to the header name. Returns null if the map contains no mapping for the name. A return value of null does not necessarily indicate that the map contains no mapping for the name; it's also possible that the map explicitly maps the name to null. The containsHeader() operation may be used to distinguish these two cases.

Specified by:
getHeader in interface Routable
Returns:
the value associated with the header, or null if there is no mapping for the header.

removeHeader

public java.io.Serializable removeHeader(java.lang.String name)
Description copied from interface: Routable
Removes the header.

Specified by:
removeHeader in interface Routable
Returns:
previous value associated with the header, or null if there was no mapping.

containsHeader

public boolean containsHeader(java.lang.String name)
Description copied from interface: Routable
Returns true if the Routable contains the specified header.

Specified by:
containsHeader in interface Routable

getHeaderNames

public java.util.Set getHeaderNames()
Description copied from interface: Routable
Returns a copy of the header name set.

Specified by:
getHeaderNames in interface Routable

getHeaders

public java.util.Map getHeaders()
Specified by:
getHeaders in interface Routable

getPriority

public byte getPriority()
Specified by:
getPriority in interface Routable

setPriority

public void setPriority(byte priority)
Specified by:
setPriority in interface Routable

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

isExpired

public boolean isExpired()
Specified by:
isExpired in interface Routable

toString

public java.lang.String toString()


Copyright © 2006 JBoss Inc. All Rights Reserved.