raccoon.tibco.tibrv.uitest.recorder
Class TibrvMsgWriter

java.lang.Object
  extended by raccoon.tibco.tibrv.uitest.recorder.TibrvMsgWriter
All Implemented Interfaces:
IEventHandler

public class TibrvMsgWriter
extends java.lang.Object
implements IEventHandler

Writes all incoming events to the hard drive.

Since:
Raccoon v0.7
Version:
$Id: TibrvMsgWriter.java,v 1.3 2003/07/01 19:21:00 crouvrais Exp $
Author:
Cedric ROUVRAIS

Constructor Summary
TibrvMsgWriter(TibrvRecorder pRecorder, java.lang.String pName, java.lang.String pSaveFolder, IFactory pFactory, IXmlToMessage pXmlParser, ILogger pLogger)
          Convenience constructor.
 
Method Summary
 java.io.File createNewFile(java.lang.String pSendSubject, long pTimeStamp)
          Creates a new file with a unique name.
 java.lang.String getHandlerName()
          Returns the unique logical name of this event handler.
 boolean isRunning()
          Should return true if this instance is active
 void onEvent(java.lang.Object pEventObject, ITracking pEventTracking)
          Handles the incoming EAI Event.
 void setLogger(ILogger pLogger)
          Assigns the logger that this writer should use.
 void start()
          Invoked by the subscribing application to inform the handler that it must load itself.
 void stop()
          Invoked by the subscribing application to inform the handle that it must shut down.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TibrvMsgWriter

public TibrvMsgWriter(TibrvRecorder pRecorder,
                      java.lang.String pName,
                      java.lang.String pSaveFolder,
                      IFactory pFactory,
                      IXmlToMessage pXmlParser,
                      ILogger pLogger)
Convenience constructor.

Parameters:
pRecorder - the recording instance to which this instance is attached.
pName - the first part of the file names containing the messages received.
pSaveFolder - the output folder where this instance should store the messages.
pFactory - the factory used to create IMessage instances from a TIB/Rendezvous message.
pXmlParser - the IMessage to XML Stream conversion utility.
Method Detail

onEvent

public void onEvent(java.lang.Object pEventObject,
                    ITracking pEventTracking)
             throws RaccoonException
Handles the incoming EAI Event. This method, to be implemented by all EventHandlers, will be invoked each time a message arrives on the subject/topic

Specified by:
onEvent in interface IEventHandler
Parameters:
pEventObject - the java object that was received by the subscriber
pEventTracking - the tracking element related to this event.
Throws:
RaccoonException - the only type of exception you have the right to throw.

getHandlerName

public java.lang.String getHandlerName()
Returns the unique logical name of this event handler. This logical name is used to selectively start/stop event handlers, it must be unique per subscriber.

Specified by:
getHandlerName in interface IEventHandler
Returns:
the logical name of this event handled

start

public void start()
           throws RaccoonException
Invoked by the subscribing application to inform the handler that it must load itself.

Specified by:
start in interface IEventHandler
Throws:
RaccoonException - if the handler couldn't load itself.

stop

public void stop()
          throws RaccoonException
Invoked by the subscribing application to inform the handle that it must shut down.

Specified by:
stop in interface IEventHandler
Throws:
RaccoonException - if the event handler can't shut down.

isRunning

public boolean isRunning()
Should return true if this instance is active

Specified by:
isRunning in interface IEventHandler
Returns:
boolean the state of this event handler.

createNewFile

public java.io.File createNewFile(java.lang.String pSendSubject,
                                  long pTimeStamp)
Creates a new file with a unique name.

The name of the file is generated as follows:

handlerName_IBusMessage.getMsgSend() sendSubject}_timeStamp.xml

This file will be placed under the directory specified at the instanciation of this class or the default directory.

Parameters:
pSendSubject - the send subject of the message that will be put into this file.
pTimeStamp - the time that the message was received
Returns:
the new file

setLogger

public void setLogger(ILogger pLogger)
Assigns the logger that this writer should use.

Parameters:
pLogger - the logging instance.


Copyright null null. All Rights Reserved.