org.instrumentmiddleware.cima.plugin.producer.poller
Class RegularIntervalSinglePollerParcelProducer

java.lang.Object
  extended by org.instrumentmiddleware.cima.plugin.impl.AbstractPlugin
      extended by org.instrumentmiddleware.cima.plugin.producer.impl.AbstractProducer
          extended by org.instrumentmiddleware.cima.plugin.producer.poller.AbstractSinglePollerParcelProducer
              extended by org.instrumentmiddleware.cima.plugin.producer.poller.RegularIntervalSinglePollerParcelProducer
All Implemented Interfaces:
ICIMAOperationExtension, ICIMAPlugin, IPlugin, IParcelProducer, IProducer

public class RegularIntervalSinglePollerParcelProducer
extends AbstractSinglePollerParcelProducer

A parcels producer that has a single poller thread. This producer will be asked to produce parcels on a regular interval. In other words the unique poller thread has been instantiated with a data interval. The data interval value is passed as constructor parameter. It is assumed to be in millisecond. This producer can specify how the poller thread will release(send to subscribers) the produced parcels: using a single thread or a pool of threads. This is done with the releaseMode constructor parameter. If set to "multi" the poller thread will use a pool of threads to release the parcels
NOTE: releaseMode should be a boolean as it can only take 2 values, and it should be named something like concurrentRelease, so setting the boolean will give enough information

Author:
Romain

Field Summary
protected  org.instrumentmiddleware.cima.parcel.DataIntervalType dataIntervalObject
           
protected  java.lang.String releaseMode
           
 
Fields inherited from class org.instrumentmiddleware.cima.plugin.producer.poller.AbstractSinglePollerParcelProducer
isThreadStarted, pollerThread
 
Fields inherited from class org.instrumentmiddleware.cima.plugin.producer.impl.AbstractProducer
deliveryStrategy, director, log, parcelCreator
 
Fields inherited from class org.instrumentmiddleware.cima.plugin.impl.AbstractPlugin
startOnLoad, stopped, subscriptions
 
Constructor Summary
RegularIntervalSinglePollerParcelProducer(java.lang.String id, IParcelCreator creator, ICIMADirector director, long dataInterval, java.lang.String releaseMode)
           
 
Method Summary
protected  ParcelProducerPoller getPollerThread()
           
 org.instrumentmiddleware.cima.parcel.CimaOperationResponseType processGetOperation(org.instrumentmiddleware.cima.parcel.CimaVariable[] variables, java.util.Calendar creationTime, ISession session, org.instrumentmiddleware.cima.parcel.CimaOperationResponseType response)
          Gets the given variables value.
 org.instrumentmiddleware.cima.parcel.CimaOperationResponseType processSetOperation(org.instrumentmiddleware.cima.parcel.CimaVariable[] variables, java.util.Calendar creationTime, ISession session, org.instrumentmiddleware.cima.parcel.CimaOperationResponseType response)
          Sets the given variables value.
 org.instrumentmiddleware.cima.parcel.ParcelDocument.Parcel[] produceParcels()
          Ask this producer to produce parcels
 
Methods inherited from class org.instrumentmiddleware.cima.plugin.producer.poller.AbstractSinglePollerParcelProducer
processSubscribeParcel, stop
 
Methods inherited from class org.instrumentmiddleware.cima.plugin.producer.impl.AbstractProducer
getDeliveryStrategy, releaseParcel, setDeliveryStrategy, start
 
Methods inherited from class org.instrumentmiddleware.cima.plugin.impl.AbstractPlugin
doSubscribe, doSubscribe, getBodyHandler, getId, getInformation, getSequenceNumber, internalProcessParcel, processParcel, processSubscribeResponse, setStartOnLoad, setSubscriptions, startOnLoad
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.instrumentmiddleware.cima.plugin.producer.IProducer
getDeliveryStrategy, releaseParcel, setDeliveryStrategy
 
Methods inherited from interface org.instrumentmiddleware.cima.plugin.IPlugin
doSubscribe, getId, getInformation, getSequenceNumber, processParcel, setStartOnLoad, start, startOnLoad
 

Field Detail

dataIntervalObject

protected org.instrumentmiddleware.cima.parcel.DataIntervalType dataIntervalObject

releaseMode

protected java.lang.String releaseMode
Constructor Detail

RegularIntervalSinglePollerParcelProducer

public RegularIntervalSinglePollerParcelProducer(java.lang.String id,
                                                 IParcelCreator creator,
                                                 ICIMADirector director,
                                                 long dataInterval,
                                                 java.lang.String releaseMode)
                                          throws java.lang.Exception
Parameters:
id -
creator -
director -
dataInterval - the interval(in ms) the unique poller thread will be instantiated with. It represents the interval the poller thread will ask this producer to produce parcels
releaseMode - if set to "multi", the poller thread will the use a pool of threads to released the produced parcels. Every other values, means that a single thread will be used by the poller thread to release the parcels.
Throws:
java.lang.Exception
See Also:
ParcelProducerPoller
Method Detail

produceParcels

public org.instrumentmiddleware.cima.parcel.ParcelDocument.Parcel[] produceParcels()
                                                                            throws PluginException
Description copied from interface: IParcelProducer
Ask this producer to produce parcels

Returns:
the produced parcels containing data
Throws:
PluginException - if something goes wrong while producing the parcels

processGetOperation

public org.instrumentmiddleware.cima.parcel.CimaOperationResponseType processGetOperation(org.instrumentmiddleware.cima.parcel.CimaVariable[] variables,
                                                                                          java.util.Calendar creationTime,
                                                                                          ISession session,
                                                                                          org.instrumentmiddleware.cima.parcel.CimaOperationResponseType response)
                                                                                   throws PluginException
Description copied from interface: ICIMAOperationExtension
Gets the given variables value. The result is a parcel containing the value of given variables

Specified by:
processGetOperation in interface ICIMAOperationExtension
Overrides:
processGetOperation in class AbstractProducer
Parameters:
variables - The variables to get the value from
session - The session this communication belongs to
response - response the partly built response
Returns:
a parcel containing the value of given variables
Throws:
PluginException - if something goes wrong while retrieving variables values

processSetOperation

public org.instrumentmiddleware.cima.parcel.CimaOperationResponseType processSetOperation(org.instrumentmiddleware.cima.parcel.CimaVariable[] variables,
                                                                                          java.util.Calendar creationTime,
                                                                                          ISession session,
                                                                                          org.instrumentmiddleware.cima.parcel.CimaOperationResponseType response)
                                                                                   throws PluginException
Description copied from interface: ICIMAOperationExtension
Sets the given variables value.

Specified by:
processSetOperation in interface ICIMAOperationExtension
Overrides:
processSetOperation in class AbstractProducer
Parameters:
variables - The variables to be set
session - The session this communication belongs to
response - The partly built response
Returns:
a parcel containing the result of set execution
Throws:
PluginException - if something goes wrong while setting variables values

getPollerThread

protected ParcelProducerPoller getPollerThread()
Specified by:
getPollerThread in class AbstractSinglePollerParcelProducer


Copyright © 2008. All Rights Reserved.