jpl.mipl.pgs.core
Class PGS_Stream

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended byjava.rmi.server.UnicastRemoteObject
              extended byjpl.mipl.pgs.core.PGS_Stream
All Implemented Interfaces:
PGS_FEIErrorHandler, PGS_PersistentServerBase_IF, PGS_ServerBase_IF, PGS_Stream_IF, PGS_WorkerHelper, Remote, Serializable

public class PGS_Stream
extends UnicastRemoteObject
implements PGS_WorkerHelper, PGS_FEIErrorHandler, PGS_Stream_IF

Purpose: The stream class.


     Copyright 2002, California Institute of Technology. 
     ALL RIGHTS RESERVED.
     U.S. Government Sponsorship acknowledge.2004.

 
 ==========================================================================
 Modification History :
 --------------------

 Date          Who            What
 --------------------------------------------------------------------------

 ==========================================================================

Version:
1.0
Author:
Raj Patel (rrp@mipl.jpl.nasa.gov)
See Also:
Serialized Form

Field Summary
protected  String className
           
protected  String instrument
           
protected  Logger logger
           
protected  String mission
           
protected  String streamId
           
protected  PGS_UPF upf
           
protected  PGS_WorkerObject wo
           
protected  PGS_WorkerObjectRunner wor
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface jpl.mipl.pgs.core.PGS_PersistentServerBase_IF
backupFileExtension
 
Constructor Summary
PGS_Stream(PGS_UPF upf, PGS_WorkerObjectFactory woFactory, Properties props)
          Constructor.
 
Method Summary
 void addFilesToFEI(String fileType, String[] fileNames, String comment, boolean waitForResults)
          Adds the given file(s) to the given file type with the given comment.
 int addRequest(Hashtable req)
           
 String getIdentification()
          Returns the correct detailed information about the stream which is used in logging and notification.
 Logger getLogger()
          Returns reference to the logger object.
 PGS_TelemetryDataObject getNextDataObject()
          For obtaining raw telemetry data.
 Hashtable getRequest(int reqId)
           
 Hashtable[] getRequests()
           
 int getRequestStatus(int reqId)
           
 int getStatus()
           
 PGS_UPF getUPFParser()
          Returns reference to an upf parser object.
 boolean handleFEIError(PGS_FEIFileAddException fae)
          For analyzing the FEI error caused when trying to add a file to FEI file type.
 boolean handleFEIError(SessionException se)
          For analyzing a session error.
 void logMessage(String message)
          Logs the given message as INFO message.
 boolean okayToContinue()
          A false value means processing must be stop at once.
 void replaceFilesInFEI(String fileType, String[] fileNames, String comment, boolean waitForResults)
          Replace the given file(s) to the given file type with the given comment.
 void setActual(PGS_PersistentServerBase_IF pbs)
           
 void setDataSource(PGS_TelemetryDataSource psb)
          Set the data source to be used by this stream.
 boolean shutdown(String userID, String OWHP, int reason, String explanation)
           
 int start()
           
 void stop(int stopCode, String stopReason)
          Indicates that the processing needs to be stopped immediately.
 void stopRequest(int requestId)
           
 void updateRequest(Hashtable req)
           
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

wo

protected PGS_WorkerObject wo

upf

protected PGS_UPF upf

logger

protected Logger logger

mission

protected String mission

instrument

protected String instrument

streamId

protected String streamId

className

protected final String className

wor

protected PGS_WorkerObjectRunner wor
Constructor Detail

PGS_Stream

public PGS_Stream(PGS_UPF upf,
                  PGS_WorkerObjectFactory woFactory,
                  Properties props)
           throws PGS_MissingParameterException,
                  IllegalArgumentException,
                  PGS_Exception,
                  RemoteException
Constructor. The constructor creates a logging utility as follows: If PGS_LOGGER is defined it is used else if PGS_LOG_HANDLER is defined it is used else use jpl.mipl.pgs.utils.logging.PGS_LogHandler if PGS_LOG_MESSAGE_FORMATTER is defined then use it else use jpl.mipl.pgs.utils.logging.PGS_Msg_Message_Formatter if PGS_LOG_MESSAGE_FILTER is definted then it is used else no filter is performed. each of this parameter is obtained by System.getProperty(paramName) call and any specified class adhere to java.lang.Class::newInstance() method

Parameters:
upf - The UPF parser to be used for obtaining paramters.
woFactory - The worker object factory to be utilized for creating worker objects.
props - Contains the following configuration parameters:
Throws:
PGS_MissingParameterException - If either the MISSION or INSTRUMENT keywords are missing from the UPF.
IllegalArgumentException - If any value specified in the UPF for use by the stream class (e.g., PGS_LOGGER) is not usable.
PGS_Exception - If an exception is caught while create and initilizing worker object.
RemoteException
See Also:
for more detail.
Method Detail

setDataSource

public void setDataSource(PGS_TelemetryDataSource psb)
Set the data source to be used by this stream.


start

public int start()
Specified by:
start in interface PGS_WorkerHelper

logMessage

public void logMessage(String message)
Description copied from interface: PGS_WorkerHelper
Logs the given message as INFO message.

Specified by:
logMessage in interface PGS_WorkerHelper

getNextDataObject

public PGS_TelemetryDataObject getNextDataObject()
                                          throws PGS_Exception
For obtaining raw telemetry data.

Specified by:
getNextDataObject in interface PGS_WorkerHelper
Throws:
Any - exception thrown by the Telemetry Data Source object(s).
PGS_Exception

stop

public void stop(int stopCode,
                 String stopReason)
Indicates that the processing needs to be stopped immediately. NOTE: This is just a hint, not a command, to the PGS_WorkerObject. It is upto the worker object to check, by using okayToContinue, and continue processing accordingly.

Specified by:
stop in interface PGS_WorkerHelper

okayToContinue

public boolean okayToContinue()
A false value means processing must be stop at once.

Specified by:
okayToContinue in interface PGS_WorkerHelper

getIdentification

public String getIdentification()
Returns the correct detailed information about the stream which is used in logging and notification. Our recommendation is that any overwritting methods should at least include the mission, instrument and stream name in it.

Specified by:
getIdentification in interface PGS_WorkerHelper

getUPFParser

public PGS_UPF getUPFParser()
Returns reference to an upf parser object.

Specified by:
getUPFParser in interface PGS_WorkerHelper

getLogger

public Logger getLogger()
Returns reference to the logger object.

Specified by:
getLogger in interface PGS_WorkerHelper

handleFEIError

public boolean handleFEIError(SessionException se)
Description copied from interface: PGS_FEIErrorHandler
For analyzing a session error.

Specified by:
handleFEIError in interface PGS_FEIErrorHandler
Returns:
false meaning to stop. True means continue.

handleFEIError

public boolean handleFEIError(PGS_FEIFileAddException fae)
Description copied from interface: PGS_FEIErrorHandler
For analyzing the FEI error caused when trying to add a file to FEI file type.

Specified by:
handleFEIError in interface PGS_FEIErrorHandler
Returns:
false meaning to stop. True means continue.

replaceFilesInFEI

public void replaceFilesInFEI(String fileType,
                              String[] fileNames,
                              String comment,
                              boolean waitForResults)
Description copied from interface: PGS_WorkerHelper
Replace the given file(s) to the given file type with the given comment. This method does not wait for the transaction to finish. It starts a thread that pulls the results from the session object and if an error is indicated by the result set, it calls the continueAfterException method of the PGS_WorkerObject with a PGS_FEIAddException or the FEI5 SessionException exception.

Specified by:
replaceFilesInFEI in interface PGS_WorkerHelper

addFilesToFEI

public void addFilesToFEI(String fileType,
                          String[] fileNames,
                          String comment,
                          boolean waitForResults)
Description copied from interface: PGS_WorkerHelper
Adds the given file(s) to the given file type with the given comment. This method does not wait for the transaction to finish. It starts a thread that pulls the results from the session object and if an error is indicated by the result set, it calls the continueAfterException method of the PGS_WorkerObject with a PGS_FEIAddException or the FEI5 SessionException exception.

Specified by:
addFilesToFEI in interface PGS_WorkerHelper

addRequest

public int addRequest(Hashtable req)
               throws RemoteException
Specified by:
addRequest in interface PGS_PersistentServerBase_IF
Throws:
RemoteException

getRequest

public Hashtable getRequest(int reqId)
                     throws RemoteException
Specified by:
getRequest in interface PGS_PersistentServerBase_IF
Throws:
RemoteException

getRequestStatus

public int getRequestStatus(int reqId)
                     throws RemoteException
Specified by:
getRequestStatus in interface PGS_PersistentServerBase_IF
Throws:
RemoteException

getRequests

public Hashtable[] getRequests()
                        throws RemoteException
Specified by:
getRequests in interface PGS_PersistentServerBase_IF
Throws:
RemoteException

setActual

public void setActual(PGS_PersistentServerBase_IF pbs)
               throws RemoteException
Specified by:
setActual in interface PGS_PersistentServerBase_IF
Throws:
RemoteException

updateRequest

public void updateRequest(Hashtable req)
                   throws RemoteException
Specified by:
updateRequest in interface PGS_PersistentServerBase_IF
Throws:
RemoteException

stopRequest

public void stopRequest(int requestId)
                 throws RemoteException
Specified by:
stopRequest in interface PGS_PersistentServerBase_IF
Throws:
RemoteException

getStatus

public int getStatus()
              throws RemoteException
Specified by:
getStatus in interface PGS_ServerBase_IF
Throws:
RemoteException

shutdown

public boolean shutdown(String userID,
                        String OWHP,
                        int reason,
                        String explanation)
                 throws RemoteException
Specified by:
shutdown in interface PGS_ServerBase_IF
Throws:
RemoteException