jpl.mipl.mdms.FileService.komodo.api
Class ServerProxy

java.lang.Object
  extended by jpl.mipl.mdms.FileService.komodo.api.ServerProxy
All Implemented Interfaces:
Runnable

public class ServerProxy
extends Object
implements Runnable

Purpose: The sever proxy class that implements the Komodo server proxy class. This class handles requests queued to file types muliplexed onto this proxy. Must be public to implement runnable.

   Copyright 2005, California Institute of Technology.
   ALL RIGHTS RESERVED.
   U.S. Government Sponsorship acknowledge. 2005.
   
 ============================================================================
 Modification History :
 ----------------------

 Date              Who              What
 ----------------------------------------------------------------------------
 00/00/2000        Thomas           Initial release. 
 07/13/2005        Nick             Initial documentation.
 10/11/2005        Nick             Introducted new constructor that accepts
                                    a login flag that, if set, performs the
                                    original login sequence.
                                    Added _authenticateServerGroupUser() to
                                    perform user authentication without 
                                    connecting to specific filetype.
                                    Updated _closeConn to check if filetype 
                                    is associated with the request.
 06/28/2006        Nick             New pulse thread to keep connection 
                                    alive.
 ============================================================================
 

Version:
$Id: ServerProxy.java,v 1.101 2009/09/22 21:17:28 ntt Exp $
Author:
Thomas Huang (Thomas.Huang@jpl.nasa.gov), Nicholas Toole (Nicholas.T.Toole@jpl.nasa.gov)

Field Summary
protected static int __nextId
           
protected  int _id
           
static long DB_DELTA_MS
           
protected  int INTERNAL_TRANSACTION_ID
           
 
Method Summary
protected  void _sendFileChecksum(BufferedStreamIO io, jpl.mipl.mdms.FileService.komodo.api.Request request, String fileName)
           
 ServerInfo getServerInfo()
          Returns reference to server info object passed-in during construction.
protected  int putInternal(jpl.mipl.mdms.FileService.komodo.api.Request profile)
          Method to put a request to the request queue.
 void run()
          The server proxy run method.
protected  void runControl()
          Run implementation for control service.
protected  void runProxy()
          Run implementation for service proxy.
protected  void runPulse()
          Run implementation for pulse service.
 String toString()
          Returns string representing this serverproxy, including its id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DB_DELTA_MS

public static final long DB_DELTA_MS
See Also:
Constant Field Values

_id

protected final int _id

__nextId

protected static int __nextId

INTERNAL_TRANSACTION_ID

protected final int INTERNAL_TRANSACTION_ID
See Also:
Constant Field Values
Method Detail

run

public void run()
The server proxy run method.
Dispatches based on thread name for servicing general requests and control requests, respectively.

Specified by:
run in interface Runnable

runProxy

protected void runProxy()
Run implementation for service proxy. Performs while loop waiting for next request command. If null, this indicates that server proxy is finished, so terminate will be invoked to alert all threads of this, and then method will return. Otherwise, the request is decoded and executed.


runControl

protected void runControl()
Run implementation for control service. Performs while loop waiting for next control command. If null, this indicates that server proxy is finished and this method should return. Otherwise, the request is decoded and executed.


runPulse

protected void runPulse()
Run implementation for pulse service. First, exchanges pulse period value with server, then enters thread registering no-ops to be exchanged with server to keep connection alive.


putInternal

protected int putInternal(jpl.mipl.mdms.FileService.komodo.api.Request profile)
Method to put a request to the request queue. No transaction id will be created for the request. It is up to the caller to ensure that command will not produce any results. As such, this method should only be called for requests whose transactionId has been set.

Parameters:
profile - the profile record specifies a request command.
Returns:
the transaction id

getServerInfo

public ServerInfo getServerInfo()
Returns reference to server info object passed-in during construction.

Returns:
Server proxy's server info reference

toString

public String toString()
Returns string representing this serverproxy, including its id.

Overrides:
toString in class Object
Returns:
This object's string representation.

_sendFileChecksum

protected void _sendFileChecksum(BufferedStreamIO io,
                                 jpl.mipl.mdms.FileService.komodo.api.Request request,
                                 String fileName)
                          throws SessionException
Throws:
SessionException