cgl.narada.event.impl
Class EventHeadersImpl

java.lang.Object
  extended by cgl.narada.event.impl.EventHeadersImpl
All Implemented Interfaces:
EventHeaders

public class EventHeadersImpl
extends Object
implements EventHeaders

This class encapsulates various headers which indicate, among other things, if the event is (a) Persistent or transient (b) Has Correlation identifers (c) Security and Integrity related information (d) Fragmentation and Slicing related information (e) Compressed


Constructor Summary
EventHeadersImpl()
           
EventHeadersImpl(byte[] headerBytes)
           
 
Method Summary
 int createHeaderSnapshot()
          Creates a snapshot of the headers contained in the event headers
 String getApplicationType()
          Gets the application type associated with this event
 String getAssertions()
          Retrieve SAML Assertions.
 byte[] getBytes()
          Generate the serialized representation of the event headers
 byte[] getCipherIV()
          Retrieves the IV associated with the encrypted payload.
 String getCipherMode()
          Retrieves the Cipher mode.
 String getCipherPaddingScheme()
          Retrieves the Cipher padding scheme.
 String getCompressionAlgorithm()
          Get information regarding the compresssion algorithm being used
 EventID getCorrelationIdentifier()
          Returns the correlation identifier associated with the event
 EventID getEventId()
          Get the event identifier
 long getFragmentationEpoch()
          Gets the epoch associated with the fragmentation
 String getFragmentationIdentifier()
          Returns the fragmentation identifier associated with this fragment.
 int getFragmentNumber()
          Gets the fragment number associated with this fragment
 void getHeadersFromSnapshot()
          Retrieves the values of headers based on the snapshot
 byte[] getMessageDigest()
          Gets the message digest for the payload.
 String getMessageDigestScheme()
          Returns the message digest scheme used for computing the digest.
 long getOriginalPayloadLength()
          Gets the original payload length prior to compression/fragmentation.
 int getPriority()
          Gets the priority associated with this event
 byte[] getSecurityTimeStampedSeqNo()
           
 byte[] getSignature()
          Retrieve the signature associated with event.
 String getSignatureAlgorithm()
          Retrieves the signature Algorithm.
 byte[] getSignedSecurityToken()
          Get the Security token from the event
 int getSliceEndingPoint()
          Gets the slice ending point
 int getSliceStartingPoint()
          Gets the slice from which point on the payload is included.
 int getSource()
          Returns the generator of this message
 int getTemplateId()
          Indicates the templateId which this event conforms to
 long getTimeStamp()
          Returns the timestamp for this event.
 int getTimeToLive()
          Returns the time to live
 int getTotalNumberOfFragments()
          Gets the fragment number associated with this fragment
 boolean hasAssertions()
          Indicates if there are security assertions encapsulated in this event.
 boolean hasCipherIV()
          Indicates if there is an IV associated with the encrypted payload
 boolean hasEventId()
          Indicates if there is an event id associated with this message
 boolean hasIntegrity()
          Indicates if the event has integerity check information.
 boolean hasPriorityInfo()
          Indicates if this event includes priority information
 boolean hasSignature()
          Indicates if the event has a signature associated with it
 boolean hasSignedSecurityToken()
          Indicates if the event has a signature associated with it
 boolean hasTotalNumberOfFragmentsInfo()
          Indicates if there is information pertaining to the total number of fragments
 boolean isCompressed()
          Indicates if the payload has been compressed.
 boolean isCorrelated()
          Indicates if this event is correlated with any other event.
 boolean isFragmented()
          Indicates if this event is a fragment of a larger event
 boolean isLastFragment()
          Indicates if this is the last fragment in the series of fragmented events
 boolean isModified()
          Indicates if the EventHeader has been modified since the last time that it was serialized.
 boolean isPayloadCompressionFinalStep()
          Indicates if the payload was compressed after operations such as securing, computing message digests were performed
 boolean isPersistent()
          Indicates if the event is a persistent one.
 boolean isSecure()
          Indicates if this event is a secure event
 boolean isSliced()
           
 boolean isTransient()
          Indicates if this event is a transient event.
static void main(String[] args)
          A test routine to test the functionality
 void printHeaders()
           
protected  void setAssertionsInformation(String assertions)
           
protected  void setCorrelationId(EventID correlationId)
           
 void setEncryptedPayloadInformation(byte[] cipherIV, String cipherMode, String cipherPaddingScheme)
           
protected  void setEventId(EventID eventId)
           
protected  void setFragmentationInformation(String fragmentationId, int fragmentNumber, boolean isLastFragment)
           
protected  void setFragmentationInformation(String fragmentationId, long originalPayloadLength, int fragmentNumber, int totalNumberOfFragments, long fragmentationEpoch)
           
protected  void setIntegrityInformation(String digestScheme, byte[] messageDigest)
           
protected  void setPayloadCompressionInformation(String compressionAlgo, long originalPayloadLength, boolean isPayloadCompressionFinalStep)
           
protected  void setPersistent()
           
protected  void setPriorityInformation(int priority)
           
 void setSecurityTimeStampedSequenceNo(byte[] obj)
           
 void setSecurityToken(byte[] tokenBytes)
          Set the signed security token
 void setSignatureInformation(String signatureAlgorithm, byte[] signature)
           
protected  void setSlicedInformation(int sliceStartingPoint, int sliceEndingPoint)
           
protected  void setSourceInformation(int source, boolean supressDistributionToSource)
           
protected  void setTemplateInfo(int templateId)
           
protected  void setTimestamp(long timestamp)
           
protected  void setTimeToLive(int timeToLive)
           
 boolean supressDistributionToSource()
          Indicates that the message should not be rerouted to it source, that is contained in the event headers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventHeadersImpl

public EventHeadersImpl()

EventHeadersImpl

public EventHeadersImpl(byte[] headerBytes)
Method Detail

getTemplateId

public int getTemplateId()
Indicates the templateId which this event conforms to

Specified by:
getTemplateId in interface EventHeaders

getTimeStamp

public long getTimeStamp()
Returns the timestamp for this event. This timestamp corresponds to the value assigned by the time service

Specified by:
getTimeStamp in interface EventHeaders

getSource

public int getSource()
Returns the generator of this message

Specified by:
getSource in interface EventHeaders

supressDistributionToSource

public boolean supressDistributionToSource()
Indicates that the message should not be rerouted to it source, that is contained in the event headers

Specified by:
supressDistributionToSource in interface EventHeaders

hasEventId

public boolean hasEventId()
Indicates if there is an event id associated with this message

Specified by:
hasEventId in interface EventHeaders

getEventId

public EventID getEventId()
Get the event identifier

Specified by:
getEventId in interface EventHeaders

isCorrelated

public boolean isCorrelated()
Indicates if this event is correlated with any other event. Casual constraints may entail that the correlated event be delivered prior to the delivery of this event.

Specified by:
isCorrelated in interface EventHeaders

getCorrelationIdentifier

public EventID getCorrelationIdentifier()
Returns the correlation identifier associated with the event

Specified by:
getCorrelationIdentifier in interface EventHeaders

getTimeToLive

public int getTimeToLive()
Returns the time to live

Specified by:
getTimeToLive in interface EventHeaders

isSecure

public boolean isSecure()
Indicates if this event is a secure event

Specified by:
isSecure in interface EventHeaders

hasSignedSecurityToken

public boolean hasSignedSecurityToken()
Indicates if the event has a signature associated with it


hasSignature

public boolean hasSignature()
Indicates if the event has a signature associated with it

Specified by:
hasSignature in interface EventHeaders

getSignatureAlgorithm

public String getSignatureAlgorithm()
Retrieves the signature Algorithm. Available only if this is a secure event.

Specified by:
getSignatureAlgorithm in interface EventHeaders

getSignature

public byte[] getSignature()
Retrieve the signature associated with event. Available only if this is a secure event

Specified by:
getSignature in interface EventHeaders

hasCipherIV

public boolean hasCipherIV()
Indicates if there is an IV associated with the encrypted payload

Specified by:
hasCipherIV in interface EventHeaders

getCipherIV

public byte[] getCipherIV()
Retrieves the IV associated with the encrypted payload. Available only if this is a secure event

Specified by:
getCipherIV in interface EventHeaders

getCipherMode

public String getCipherMode()
Retrieves the Cipher mode. Available only if this is a secure event

Specified by:
getCipherMode in interface EventHeaders

getCipherPaddingScheme

public String getCipherPaddingScheme()
Retrieves the Cipher padding scheme. Available only if this is a secure event

Specified by:
getCipherPaddingScheme in interface EventHeaders

hasAssertions

public boolean hasAssertions()
Indicates if there are security assertions encapsulated in this event.

Specified by:
hasAssertions in interface EventHeaders

getAssertions

public String getAssertions()
Retrieve SAML Assertions. Available only if this is a secure event

Specified by:
getAssertions in interface EventHeaders

hasIntegrity

public boolean hasIntegrity()
Indicates if the event has integerity check information.

Specified by:
hasIntegrity in interface EventHeaders

getMessageDigestScheme

public String getMessageDigestScheme()
Returns the message digest scheme used for computing the digest. Available only if this is a secure event or has integrity

Specified by:
getMessageDigestScheme in interface EventHeaders

getMessageDigest

public byte[] getMessageDigest()
Gets the message digest for the payload. Available only if this is a secure event or has integrity

Specified by:
getMessageDigest in interface EventHeaders

isFragmented

public boolean isFragmented()
Indicates if this event is a fragment of a larger event

Specified by:
isFragmented in interface EventHeaders

getFragmentationIdentifier

public String getFragmentationIdentifier()
Returns the fragmentation identifier associated with this fragment. Fragments that are part of the same event have the same fragmentation identifier, though each of them might have different event identifiers

Specified by:
getFragmentationIdentifier in interface EventHeaders

isLastFragment

public boolean isLastFragment()
Indicates if this is the last fragment in the series of fragmented events

Specified by:
isLastFragment in interface EventHeaders

getFragmentNumber

public int getFragmentNumber()
Gets the fragment number associated with this fragment

Specified by:
getFragmentNumber in interface EventHeaders

hasTotalNumberOfFragmentsInfo

public boolean hasTotalNumberOfFragmentsInfo()
Indicates if there is information pertaining to the total number of fragments

Specified by:
hasTotalNumberOfFragmentsInfo in interface EventHeaders

getTotalNumberOfFragments

public int getTotalNumberOfFragments()
Gets the fragment number associated with this fragment

Specified by:
getTotalNumberOfFragments in interface EventHeaders

getFragmentationEpoch

public long getFragmentationEpoch()
Gets the epoch associated with the fragmentation

Specified by:
getFragmentationEpoch in interface EventHeaders

isSliced

public boolean isSliced()
Specified by:
isSliced in interface EventHeaders

getSliceStartingPoint

public int getSliceStartingPoint()
Gets the slice from which point on the payload is included. For example one may be interested in the payload from size 90026 to 190000

Specified by:
getSliceStartingPoint in interface EventHeaders

getSliceEndingPoint

public int getSliceEndingPoint()
Gets the slice ending point

Specified by:
getSliceEndingPoint in interface EventHeaders

hasPriorityInfo

public boolean hasPriorityInfo()
Indicates if this event includes priority information

Specified by:
hasPriorityInfo in interface EventHeaders

getPriority

public int getPriority()
Gets the priority associated with this event

Specified by:
getPriority in interface EventHeaders

getApplicationType

public String getApplicationType()
Gets the application type associated with this event

Specified by:
getApplicationType in interface EventHeaders

isPersistent

public boolean isPersistent()
Indicates if the event is a persistent one. If it is, the event needs to be archived on storage. It is of course assumed that the event corresponds to a template that supports reliable delivery

Specified by:
isPersistent in interface EventHeaders

isTransient

public boolean isTransient()
Indicates if this event is a transient event. If this is a transient event it need not be archived on any storage

Specified by:
isTransient in interface EventHeaders

isCompressed

public boolean isCompressed()
Indicates if the payload has been compressed. Such events are specifically used in cases where the device's network utilization costs might be at a premium.

Specified by:
isCompressed in interface EventHeaders

getCompressionAlgorithm

public String getCompressionAlgorithm()
Get information regarding the compresssion algorithm being used

Specified by:
getCompressionAlgorithm in interface EventHeaders

getOriginalPayloadLength

public long getOriginalPayloadLength()
Gets the original payload length prior to compression/fragmentation. Will return ZERO if the event doesn't have a compressed/fragmented payload

Specified by:
getOriginalPayloadLength in interface EventHeaders

isPayloadCompressionFinalStep

public boolean isPayloadCompressionFinalStep()
Indicates if the payload was compressed after operations such as securing, computing message digests were performed

Specified by:
isPayloadCompressionFinalStep in interface EventHeaders

setTemplateInfo

protected void setTemplateInfo(int templateId)

setSourceInformation

protected void setSourceInformation(int source,
                                    boolean supressDistributionToSource)

setTimestamp

protected void setTimestamp(long timestamp)

setEventId

protected void setEventId(EventID eventId)

setCorrelationId

protected void setCorrelationId(EventID correlationId)

setTimeToLive

protected void setTimeToLive(int timeToLive)

setPriorityInformation

protected void setPriorityInformation(int priority)

setSignatureInformation

public void setSignatureInformation(String signatureAlgorithm,
                                    byte[] signature)
Specified by:
setSignatureInformation in interface EventHeaders

setEncryptedPayloadInformation

public void setEncryptedPayloadInformation(byte[] cipherIV,
                                           String cipherMode,
                                           String cipherPaddingScheme)
Specified by:
setEncryptedPayloadInformation in interface EventHeaders

setAssertionsInformation

protected void setAssertionsInformation(String assertions)

setIntegrityInformation

protected void setIntegrityInformation(String digestScheme,
                                       byte[] messageDigest)

setFragmentationInformation

protected void setFragmentationInformation(String fragmentationId,
                                           int fragmentNumber,
                                           boolean isLastFragment)

setFragmentationInformation

protected void setFragmentationInformation(String fragmentationId,
                                           long originalPayloadLength,
                                           int fragmentNumber,
                                           int totalNumberOfFragments,
                                           long fragmentationEpoch)

setSlicedInformation

protected void setSlicedInformation(int sliceStartingPoint,
                                    int sliceEndingPoint)

setPayloadCompressionInformation

protected void setPayloadCompressionInformation(String compressionAlgo,
                                                long originalPayloadLength,
                                                boolean isPayloadCompressionFinalStep)

setPersistent

protected void setPersistent()

getSignedSecurityToken

public byte[] getSignedSecurityToken()
Get the Security token from the event

Specified by:
getSignedSecurityToken in interface EventHeaders

setSecurityToken

public void setSecurityToken(byte[] tokenBytes)
Set the signed security token

Specified by:
setSecurityToken in interface EventHeaders

getSecurityTimeStampedSeqNo

public byte[] getSecurityTimeStampedSeqNo()
Specified by:
getSecurityTimeStampedSeqNo in interface EventHeaders

setSecurityTimeStampedSequenceNo

public void setSecurityTimeStampedSequenceNo(byte[] obj)
Specified by:
setSecurityTimeStampedSequenceNo in interface EventHeaders

getBytes

public byte[] getBytes()
Generate the serialized representation of the event headers

Specified by:
getBytes in interface EventHeaders

isModified

public boolean isModified()
Description copied from interface: EventHeaders
Indicates if the EventHeader has been modified since the last time that it was serialized.

Specified by:
isModified in interface EventHeaders

createHeaderSnapshot

public int createHeaderSnapshot()
Creates a snapshot of the headers contained in the event headers


getHeadersFromSnapshot

public void getHeadersFromSnapshot()
Retrieves the values of headers based on the snapshot


printHeaders

public void printHeaders()

main

public static void main(String[] args)
A test routine to test the functionality



For comments and suggestions please send e-mail to The NaradaBrokering Project