cgl.narada.service.client.impl
Class EventProducerImpl

java.lang.Object
  extended by cgl.narada.service.client.impl.EventProducerImpl
All Implemented Interfaces:
EventProducer

public class EventProducerImpl
extends Object
implements EventProducer

The Event producer implements the interface for the generation of events


Constructor Summary
protected EventProducerImpl(int entityId, int producerId, QosServiceImpl qosServiceImpl)
           
 
Method Summary
 void close()
          Close the Event Producer
 ProducerConstraints createProducerConstraints(TemplateInfo templateInfo)
          Create producer constraints associated with a certain template
 NBEvent generateEvent(byte[] payload)
          Generate NBEvent based on the specified information
 NBEvent generateEvent(int contentSynopsisType, Object contentSynopsis, byte[] payload)
          Generate NBEvent based on the specified information
 NBEvent generateEvent(int contentSynopsisType, Object contentSynopsis, EventID correlationId, byte[] payload)
          Generate NBEvent based on the specified information
 NBEvent generateEvent(int contentSynopsisType, Object contentSynopsis, int templateId, byte[] payload)
          Generate NBEvent based on the specified information
 void generateEventIdentifier(boolean generateEventId)
          Enable the generation of event identifiers for published events
 Properties getCompressionParameters()
          Get the compression parameters
 Object getContentSynopsis()
          Get the content synopsis
 int getContentSynopsisType()
          Get the content synopsis type
 boolean getDisableTimestamp()
          Determine if generation of timestamps is disabled on the event
 int getEntityId()
          Get the entity identifier
 Properties getFragmentationParameters()
          Get the fragmentation parameters
 Properties getIntegrityParameters()
          Set the integrity parameters
 boolean getNTPTimestamp()
          Determine if the generation of NTP timestamps has been enabled.
 int getNumberOfEventsToBePublished()
          Check number of events to be published
 int getPriority()
          gets the priority of the generated events
 Properties getSecurityParameters()
          Get the security parameters
 boolean getSuppressRedistributionToSource()
          Checks if redistribution of an event back to its source is specified
 int getTemplateId()
          Get the template identifier
 int getTimeToLive()
          Get the time to live
 boolean hasEventsToBePublished()
          CHeck if there are pending events to be published
 boolean isPersistent()
          Checks if producer generate persistent events
 boolean isTransient()
          Checks if producer generate transient events
 void propagateRecoveryNotification(NBRecoveryNotification recoveryNotification)
           
 void publishEvent(NBEvent nbEvent)
          Publish an event
 void publishEvent(NBEvent nbEvent, ProducerConstraints producerConstraints)
          Publish an event based on the specified Qos constraints
 long recover(int templateId, NBRecoveryListener recoveryListener)
          This is called by an entity to recover from failures or prolonged disconnects
 void setCompressionParameters(Properties props)
          Set the compression parameters
 void setContentSynopsisInfo(int contentSynopsisType, Object contentSynopsis)
          Set the content synopsis information
 void setDisableTimestamp(boolean disableTimestamp)
          Disables the generation of timestamps on the event
 void setFragmentationParameters(Properties props)
          Set the fragmentation parameters
 void setHighResolutionTimestamp(boolean useHRtimestamp)
          Enable or disable the use of high-resolution timers for timestamps.
 void setIntegrityParameters(Properties props)
          Set the integrity parameters
 void setNBNotificationListener(NBNotificationListener nbNotificationListener)
          Sets the notification listener for this producer
 void setNTPTimestamp(boolean useNtpTimestamp)
          Enable or disable the generation of NTP timestamps for messages.
 void setPersistent(boolean isPersistent)
          Sets the producer to generate persistent events
 void setPriority(int priority)
          Sets the priority of the event
 void setSecurityParameters(Properties props)
          Set the security parameters
 void setSuppressRedistributionToSource(boolean routeToSource)
          Prevents the redistribution of an event back to its source
 void setTemplateId(int templateId)
          Set the template identifier
 void setTimeToLive(int timeToLive)
          Set the time to live
 void setTransient(boolean isTransient)
          Sets the producer to generate transient events
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventProducerImpl

protected EventProducerImpl(int entityId,
                            int producerId,
                            QosServiceImpl qosServiceImpl)
Method Detail

setTemplateId

public void setTemplateId(int templateId)
Set the template identifier

Specified by:
setTemplateId in interface EventProducer

setDisableTimestamp

public void setDisableTimestamp(boolean disableTimestamp)
Disables the generation of timestamps on the event

Specified by:
setDisableTimestamp in interface EventProducer

setNTPTimestamp

public void setNTPTimestamp(boolean useNtpTimestamp)
Enable or disable the generation of NTP timestamps for messages. The default is false. Note that this feature may not work depending on the location of your firewall or the availability of NTP servers in your country/continent.

Specified by:
setNTPTimestamp in interface EventProducer

setHighResolutionTimestamp

public void setHighResolutionTimestamp(boolean useHRtimestamp)
Enable or disable the use of high-resolution timers for timestamps. This is especially true on systems such as NT, XP where the Java system call returns a time that can be off by several milliseconds. Any client that uses this needs to ensure that the ServiceConfiguration.txt is appropriately specified with right setting for the NB_HOME variable

Specified by:
setHighResolutionTimestamp in interface EventProducer

generateEventIdentifier

public void generateEventIdentifier(boolean generateEventId)
Enable the generation of event identifiers for published events

Specified by:
generateEventIdentifier in interface EventProducer

setSuppressRedistributionToSource

public void setSuppressRedistributionToSource(boolean routeToSource)
Prevents the redistribution of an event back to its source

Specified by:
setSuppressRedistributionToSource in interface EventProducer

setTimeToLive

public void setTimeToLive(int timeToLive)
Set the time to live

Specified by:
setTimeToLive in interface EventProducer

setPersistent

public void setPersistent(boolean isPersistent)
Sets the producer to generate persistent events

Specified by:
setPersistent in interface EventProducer

setTransient

public void setTransient(boolean isTransient)
Sets the producer to generate transient events

Specified by:
setTransient in interface EventProducer

setPriority

public void setPriority(int priority)
Sets the priority of the event

Specified by:
setPriority in interface EventProducer

setFragmentationParameters

public void setFragmentationParameters(Properties props)
Set the fragmentation parameters

Specified by:
setFragmentationParameters in interface EventProducer

setSecurityParameters

public void setSecurityParameters(Properties props)
Set the security parameters

Specified by:
setSecurityParameters in interface EventProducer

setCompressionParameters

public void setCompressionParameters(Properties props)
Set the compression parameters

Specified by:
setCompressionParameters in interface EventProducer

setIntegrityParameters

public void setIntegrityParameters(Properties props)
Set the integrity parameters

Specified by:
setIntegrityParameters in interface EventProducer

setContentSynopsisInfo

public void setContentSynopsisInfo(int contentSynopsisType,
                                   Object contentSynopsis)
Set the content synopsis information

Specified by:
setContentSynopsisInfo in interface EventProducer

generateEvent

public NBEvent generateEvent(byte[] payload)
                      throws ServiceException
Generate NBEvent based on the specified information

Specified by:
generateEvent in interface EventProducer
Throws:
ServiceException

generateEvent

public NBEvent generateEvent(int contentSynopsisType,
                             Object contentSynopsis,
                             byte[] payload)
                      throws ServiceException
Generate NBEvent based on the specified information

Specified by:
generateEvent in interface EventProducer
Throws:
ServiceException

generateEvent

public NBEvent generateEvent(int contentSynopsisType,
                             Object contentSynopsis,
                             EventID correlationId,
                             byte[] payload)
                      throws ServiceException
Generate NBEvent based on the specified information

Specified by:
generateEvent in interface EventProducer
Throws:
ServiceException

generateEvent

public NBEvent generateEvent(int contentSynopsisType,
                             Object contentSynopsis,
                             int templateId,
                             byte[] payload)
                      throws ServiceException
Generate NBEvent based on the specified information

Specified by:
generateEvent in interface EventProducer
Throws:
ServiceException

getTemplateId

public int getTemplateId()
Get the template identifier

Specified by:
getTemplateId in interface EventProducer

getEntityId

public int getEntityId()
Get the entity identifier

Specified by:
getEntityId in interface EventProducer

getDisableTimestamp

public boolean getDisableTimestamp()
Determine if generation of timestamps is disabled on the event

Specified by:
getDisableTimestamp in interface EventProducer

getNTPTimestamp

public boolean getNTPTimestamp()
Determine if the generation of NTP timestamps has been enabled.

Specified by:
getNTPTimestamp in interface EventProducer

getSuppressRedistributionToSource

public boolean getSuppressRedistributionToSource()
Checks if redistribution of an event back to its source is specified

Specified by:
getSuppressRedistributionToSource in interface EventProducer

getTimeToLive

public int getTimeToLive()
Get the time to live

Specified by:
getTimeToLive in interface EventProducer

isPersistent

public boolean isPersistent()
Checks if producer generate persistent events

Specified by:
isPersistent in interface EventProducer

isTransient

public boolean isTransient()
Checks if producer generate transient events

Specified by:
isTransient in interface EventProducer

getPriority

public int getPriority()
gets the priority of the generated events

Specified by:
getPriority in interface EventProducer

getFragmentationParameters

public Properties getFragmentationParameters()
Get the fragmentation parameters

Specified by:
getFragmentationParameters in interface EventProducer

getSecurityParameters

public Properties getSecurityParameters()
Get the security parameters

Specified by:
getSecurityParameters in interface EventProducer

getCompressionParameters

public Properties getCompressionParameters()
Get the compression parameters

Specified by:
getCompressionParameters in interface EventProducer

getIntegrityParameters

public Properties getIntegrityParameters()
Set the integrity parameters

Specified by:
getIntegrityParameters in interface EventProducer

getContentSynopsisType

public int getContentSynopsisType()
Get the content synopsis type

Specified by:
getContentSynopsisType in interface EventProducer

getContentSynopsis

public Object getContentSynopsis()
Get the content synopsis

Specified by:
getContentSynopsis in interface EventProducer

close

public void close()
Close the Event Producer

Specified by:
close in interface EventProducer

setNBNotificationListener

public void setNBNotificationListener(NBNotificationListener nbNotificationListener)
Sets the notification listener for this producer

Specified by:
setNBNotificationListener in interface EventProducer

createProducerConstraints

public ProducerConstraints createProducerConstraints(TemplateInfo templateInfo)
                                              throws ServiceException
Create producer constraints associated with a certain template

Specified by:
createProducerConstraints in interface EventProducer
Throws:
ServiceException

publishEvent

public void publishEvent(NBEvent nbEvent)
                  throws ServiceException
Publish an event

Specified by:
publishEvent in interface EventProducer
Throws:
ServiceException

publishEvent

public void publishEvent(NBEvent nbEvent,
                         ProducerConstraints producerConstraints)
                  throws ServiceException
Publish an event based on the specified Qos constraints

Specified by:
publishEvent in interface EventProducer
Throws:
ServiceException

hasEventsToBePublished

public boolean hasEventsToBePublished()
CHeck if there are pending events to be published

Specified by:
hasEventsToBePublished in interface EventProducer

getNumberOfEventsToBePublished

public int getNumberOfEventsToBePublished()
Check number of events to be published

Specified by:
getNumberOfEventsToBePublished in interface EventProducer

recover

public long recover(int templateId,
                    NBRecoveryListener recoveryListener)
             throws ServiceException
This is called by an entity to recover from failures or prolonged disconnects

Specified by:
recover in interface EventProducer
Throws:
ServiceException

propagateRecoveryNotification

public void propagateRecoveryNotification(NBRecoveryNotification recoveryNotification)


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