com.tivoli.twg.alertmgr
Class TWGPublish

java.lang.Object
  extended bycom.tivoli.twg.alertmgr.TWGPublish
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
TWGPublishDetail, TWGPublishEventType, TWGPublishTextTemplate

public class TWGPublish
extends java.lang.Object
implements java.lang.Cloneable

TWGPublish is the base class for all publishing api's. This abstract base class is used as a container for those things that are common to all publish records. The family and qualifier strings are combined to create the event type. Version allows the publish database (in the event server) to be overwritten/updated. Locale pertains to the data being published.


Field Summary
static int VERSION_ONE
           
 
Constructor Summary
TWGPublish(IntelByteBuffer buf)
          Constructor for interpreting a provided IntelByteBuffer.
TWGPublish(IntelByteBuffer buf, int off)
          Constructor for interpreting a provided IntelByteBuffer at a given offset.
TWGPublish(java.lang.String family, java.lang.String[] qualifiers, int version, java.util.Locale locale)
          Constructor.
TWGPublish(java.lang.String family, java.lang.String[] qualifiers, java.util.Locale locale)
          Constructor with default version.
TWGPublish(TWGPublish pub)
          Copy Constructor.
 
Method Summary
 java.lang.Object clone()
          Copy object.
 java.util.Locale getLocale()
          Get the locale of the data being published.
 int getNumTypeQualifiers()
          Get the number of qualifiers in the event type (not including family).
 java.lang.String getType()
          Get the event type to which this publication in defined.
 java.lang.String[] getTypeArray()
          Get the fully qualified event type (defined publish's scope) as an array.
 java.lang.String getTypeFamily()
          Get the highest level qualifier of the event type.
 int getTypeId()
          Get type ID.
 java.lang.String[] getTypeQualifiers()
          Get the array of event type qualifiers.
 int getVersion()
          Get the version of the data being published.
 void print()
          Print the contents of the TWGPublish object.
 int readTWGPublish(IntelByteBuffer buf, int off)
          Method for interpreting a provided IntelByteBuffer at a given offset.
 void setLocale(java.util.Locale locale)
          Set the locale for which this publication in defined.
 void setVersion(int version)
          Set the version of the data being published.
 int sizeOf()
          Determine the size of the entire TWGPublish object.
static int sizeOfHdr()
          Determine the size of the TWGPublish header.
 int sizeOfTWGPublish()
          Determine the size of the entire TWGPublish object.
 IntelByteBuffer toIntelByteBuffer()
          Convert the object into IntelByteBuffer representation.
 int writeIntelByteBuffer(IntelByteBuffer buf)
          Write contents of this object into an IntelByteBuffer.
 int writeIntelByteBuffer(IntelByteBuffer buf, int off)
          Write contents of this object into provided IntelByteBuffer starting at a given offset.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_ONE

public static final int VERSION_ONE
See Also:
Constant Field Values
Constructor Detail

TWGPublish

public TWGPublish(java.lang.String family,
                  java.lang.String[] qualifiers,
                  int version,
                  java.util.Locale locale)
Constructor.

Parameters:
family - String representing the highest level qualifier of the event type
qualifiers - Array of strings comprising the remainder of the event type
version - Version of data being published
locale - Locale of data being published

TWGPublish

public TWGPublish(java.lang.String family,
                  java.lang.String[] qualifiers,
                  java.util.Locale locale)
Constructor with default version.

Parameters:
family - String representing the highest level qualifier of the event type
qualifiers - Array of strings comprising the remainder of the event type
locale - Locale of data being published

TWGPublish

public TWGPublish(TWGPublish pub)
Copy Constructor.

Parameters:
pub - TWGPublish object to be copied

TWGPublish

public TWGPublish(IntelByteBuffer buf)
Constructor for interpreting a provided IntelByteBuffer. Use the current offset and start ptrs within the provided IntelByteBuffer; upon return the buffer's offset ptr is advanced to reflect the number of bytes read.

Parameters:
buf - IntelByteBuffer from which data should be read

TWGPublish

public TWGPublish(IntelByteBuffer buf,
                  int off)
Constructor for interpreting a provided IntelByteBuffer at a given offset.

Parameters:
buf - IntelByteBuffer from which data should be read
off - offset from the current relative start of the provided IntelByteBuffer
Method Detail

clone

public java.lang.Object clone()
Copy object.

Returns:
copy of the TWGPublish object

getType

public java.lang.String getType()
Get the event type to which this publication in defined.

Returns:
programmatic event type

setLocale

public void setLocale(java.util.Locale locale)
Set the locale for which this publication in defined.

Parameters:
locale - for which publication is defined

getNumTypeQualifiers

public int getNumTypeQualifiers()
Get the number of qualifiers in the event type (not including family).

Returns:
number of type qualifiers in the event type (not including family)

getTypeQualifiers

public java.lang.String[] getTypeQualifiers()
Get the array of event type qualifiers.

Returns:
array of type qualifiers

getTypeArray

public java.lang.String[] getTypeArray()
Get the fully qualified event type (defined publish's scope) as an array.

Returns:
event type string array

setVersion

public void setVersion(int version)
Set the version of the data being published.

Parameters:
version - version of data being published

getVersion

public int getVersion()
Get the version of the data being published.

Returns:
version of data being published

getLocale

public java.util.Locale getLocale()
Get the locale of the data being published.

Returns:
locale of data being published

getTypeFamily

public java.lang.String getTypeFamily()
Get the highest level qualifier of the event type.

Returns:
string representing the source of the event

toIntelByteBuffer

public IntelByteBuffer toIntelByteBuffer()
Convert the object into IntelByteBuffer representation.

Returns:
IntelByteBuffer representing the encoded object

writeIntelByteBuffer

public int writeIntelByteBuffer(IntelByteBuffer buf)
Write contents of this object into an IntelByteBuffer. Use the current offset and start ptrs within the provided IntelByteBuffer; upon return the buffer's offset ptr is advanced to reflect the number of bytes written.

Parameters:
buf - IntelByteBuffer into which data should be written
Returns:
original offset plus number of bytes written

writeIntelByteBuffer

public int writeIntelByteBuffer(IntelByteBuffer buf,
                                int off)
Write contents of this object into provided IntelByteBuffer starting at a given offset. Use the current offset and start ptrs within the provided IntelByteBuffer to determine a relative start ptr and begin writing off bytes from that location. Return the buffer's offset ptr advanced to reflect the number of bytes written.

Parameters:
buf - IntelByteBuffer into which data should be written
off - offset from the current relative start of the provided IntelByteBuffer
Returns:
number of bytes written

readTWGPublish

public int readTWGPublish(IntelByteBuffer buf,
                          int off)
Method for interpreting a provided IntelByteBuffer at a given offset.

Parameters:
buf - IntelByteBuffer from which data should be read
off - offset from the current relative start of the provided IntelByteBuffer
Returns:
number of bytes read while interpreting the buffer

sizeOfHdr

public static int sizeOfHdr()
Determine the size of the TWGPublish header.

Returns:
number of bytes that comprise the header

sizeOfTWGPublish

public int sizeOfTWGPublish()
Determine the size of the entire TWGPublish object.

Returns:
number of bytes that comprise the object

sizeOf

public int sizeOf()
Determine the size of the entire TWGPublish object.

Returns:
number of bytes that comprise the object

print

public void print()
Print the contents of the TWGPublish object.


getTypeId

public int getTypeId()
Get type ID. Used by engine to match publish and unpublish.

Returns:
an ID.