raccoon.tibco.tibrv.endpoint
Class TibrvSubscriber

java.lang.Object
  extended by raccoon.core.types.AbsComponent
      extended by raccoon.core.types.AbsLoadable
          extended by raccoon.core.types.AbsConfigurableLoadable
              extended by raccoon.tibco.tibrv.endpoint.TibrvSubscriber
All Implemented Interfaces:
ISubscriber, IBaseComponent, IConfigurable, ILoadable, ILogable

public class TibrvSubscriber
extends AbsConfigurableLoadable
implements ISubscriber

The implementation of ISubscriber over TIB/Rendezvous.

Since:
Raccoon v1.0
Version:
$Id:$
Author:
Cedric ROUVRAIS

Field Summary
 
Fields inherited from class raccoon.core.types.AbsConfigurableLoadable
mConfigurableManager
 
Fields inherited from class raccoon.core.types.AbsLoadable
mIsLoaded
 
Fields inherited from class raccoon.core.types.AbsComponent
mIsInError
 
Constructor Summary
TibrvSubscriber()
          Default constructor, required for dynamic instanciation.
 
Method Summary
 void addEventHandler(IEventHandler pNewHandler)
          Adds an Event Handler to this subscriber.
 void configureParameters()
          Configures the various parameters for this component.
 IPublisher getErrorPublisher()
          Extracts the publisher used for publising internal errors.
 java.lang.String getEventSubject()
          The subject/topic to which this instance is subscribed to.
 java.lang.Object getNativeSub()
          Returns the embedded subscriber.
 long getNbMsgReceived()
          The number of messages received by this subscriber since it has been started
 java.lang.String getSubject()
          The subject to which this subscriber is listening to.
 com.tibco.tibrv.TibrvQueue getTibrvQueue()
          The queue which contains the messages of this subscriber.
 com.tibco.tibrv.TibrvTransport getTransport()
          The TIB/Rendezvous transport used by this subscriber.
 void load()
          Initializes dependant TIB/Rendezvous components.
 void removeEventHandler(java.lang.String pHandlerName)
          Removes an EventHandler from this subscriber.
 void setErrorPublisher(IPublisher pErrorPublisher)
          Defines the error publisher to be used by this instance.
 void setNativeSub(java.lang.Object pSubscriber)
          Assigns the native subscriber to this element
 void setSubject(java.lang.String pSubject)
          Defines the TIB/Rendezvous subject for this subscriber.
 void setTibrvQueue(com.tibco.tibrv.TibrvQueue pTibrvQueue)
          Defines the queue that will contain the incoming events.
 void setTransport(com.tibco.tibrv.TibrvTransport pTransport)
          Defines the transport used by this subscriber.
 void unload()
          Invoked by the service manager to stop this component.
 
Methods inherited from class raccoon.core.types.AbsConfigurableLoadable
isStable, setConfigurableManager, setLogger
 
Methods inherited from class raccoon.core.types.AbsLoadable
getLog, isInError, isInitialised, isRunning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TibrvSubscriber

public TibrvSubscriber()
Default constructor, required for dynamic instanciation.

Method Detail

configureParameters

public void configureParameters()
Configures the various parameters for this component. This method should configure the instance of IConfigurableManager provided during the invocation of AbsConfigurableLoadable.setConfigurableManager(raccoon.api.types.IConfigurableManager).

Specified by:
configureParameters in interface IConfigurable
Overrides:
configureParameters in class AbsConfigurableLoadable

load

public void load()
          throws LoadableException
Initializes dependant TIB/Rendezvous components.

Specified by:
load in interface ILoadable
Overrides:
load in class AbsConfigurableLoadable
Throws:
LoadableException - if this component is unable to correctly start TIB components.

unload

public void unload()
            throws LoadableException
Invoked by the service manager to stop this component. When extended bare in mind that the member variable mIsLoaded should be set to true and then set to false once all the init code has been performed.

Specified by:
unload in interface ILoadable
Overrides:
unload in class AbsLoadable
Throws:
LoadableException - if the composant isn't running or if it isn't an initialisable component.

getNbMsgReceived

public long getNbMsgReceived()
The number of messages received by this subscriber since it has been started

Specified by:
getNbMsgReceived in interface ISubscriber
Returns:
the number of received messages.

getTransport

public com.tibco.tibrv.TibrvTransport getTransport()
The TIB/Rendezvous transport used by this subscriber.

Returns:
the transport.

setTransport

public void setTransport(com.tibco.tibrv.TibrvTransport pTransport)
                  throws RaccoonException,
                         java.lang.IllegalArgumentException
Defines the transport used by this subscriber.

Parameters:
pTransport - the native transport to use.
Throws:
RaccoonException - if this component is already running: the component can't be changed. Error code is ErrorCodes.COMPONENT_INITIALISED
java.lang.IllegalArgumentException - if the parameter is null, the message is obtained via MsgHelper.formatNullParamter(java.lang.String, java.lang.Class)

getEventSubject

public java.lang.String getEventSubject()
The subject/topic to which this instance is subscribed to.

Specified by:
getEventSubject in interface ISubscriber
Returns:
the string that is the native subject.
See Also:
getSubject()

getSubject

public java.lang.String getSubject()
The subject to which this subscriber is listening to.

Returns:
the TIB/Rendezvous subject.

setSubject

public void setSubject(java.lang.String pSubject)
                throws RaccoonException,
                       java.lang.IllegalArgumentException
Defines the TIB/Rendezvous subject for this subscriber.

Parameters:
pSubject - the TIB/Rendezvous subject
Throws:
RaccoonException - if this component is already running: the component can't be changed. Error code is ErrorCodes.COMPONENT_INITIALISED
java.lang.IllegalArgumentException - if the parameter is null, the message is obtained via MsgHelper.formatNullParamter(java.lang.String, java.lang.Class)

getTibrvQueue

public com.tibco.tibrv.TibrvQueue getTibrvQueue()
The queue which contains the messages of this subscriber.

Returns:
the queue containing the messages.

setTibrvQueue

public void setTibrvQueue(com.tibco.tibrv.TibrvQueue pTibrvQueue)
                   throws RaccoonException,
                          java.lang.IllegalArgumentException
Defines the queue that will contain the incoming events.

Parameters:
pTibrvQueue - the TIB/Rendezvous queue.
Throws:
RaccoonException - if this component is already running: the component can't be changed. Error code is ErrorCodes.COMPONENT_INITIALISED
java.lang.IllegalArgumentException - if the parameter is null, the message is obtained via MsgHelper.formatNullParamter(java.lang.String, java.lang.Class)

addEventHandler

public void addEventHandler(IEventHandler pNewHandler)
                     throws RaccoonException
Adds an Event Handler to this subscriber. Take note: the logical name of the Event Handler (or key) must unique per instance for internal management reasons.

Specified by:
addEventHandler in interface ISubscriber
Parameters:
pNewHandler - the new event handler
Throws:
RaccoonException - if the key of the Event Handler has already been inserted into this subscriber.
See Also:
IEventHandler

removeEventHandler

public void removeEventHandler(java.lang.String pHandlerName)
                        throws RaccoonException
Removes an EventHandler from this subscriber. First it stops the embedded EventHandler and then it removes it from this Subscriber.

Specified by:
removeEventHandler in interface ISubscriber
Parameters:
pHandlerName - the logical name of the handler
Throws:
RaccoonException - if the handler couldn't be found.

getNativeSub

public java.lang.Object getNativeSub()
Returns the embedded subscriber. To be used in very special circumstances and only if you know what you are doing!

Specified by:
getNativeSub in interface ISubscriber
Returns:
embedded subscriber.

setNativeSub

public void setNativeSub(java.lang.Object pSubscriber)
                  throws RaccoonException,
                         java.lang.IllegalArgumentException
Assigns the native subscriber to this element

Specified by:
setNativeSub in interface ISubscriber
Parameters:
pSubscriber - the native subscriber.
Throws:
RaccoonException - if this component is already running: the component can't be changed. Error code is ErrorCodes.COMPONENT_INITIALISED
java.lang.IllegalArgumentException - if the parameter is null, the message is obtained via MsgHelper.formatNullParamter(java.lang.String, java.lang.Class)

getErrorPublisher

public IPublisher getErrorPublisher()
Extracts the publisher used for publising internal errors.

Specified by:
getErrorPublisher in interface ISubscriber
Returns:
the error publisher used by this instance.

setErrorPublisher

public void setErrorPublisher(IPublisher pErrorPublisher)
                       throws RaccoonException,
                              java.lang.IllegalArgumentException,
                              java.lang.InternalError
Defines the error publisher to be used by this instance.

Specified by:
setErrorPublisher in interface ISubscriber
Parameters:
pErrorPublisher - the error publisher instance
Throws:
RaccoonException - if this component is already running: the component can't be changed. Error code is ErrorCodes.COMPONENT_INITIALISED
java.lang.IllegalArgumentException - if the parameter is null, the message is obtained via MsgHelper.formatNullParamter(java.lang.String, java.lang.Class)
java.lang.InternalError - if the property pParamName hasn't been defined.


Copyright null null. All Rights Reserved.