jpl.mipl.mdms.FileService.spider.util
Class ProductGenerator

java.lang.Object
  extended by java.lang.Thread
      extended by jpl.mipl.mdms.FileService.spider.util.ProductGenerator
All Implemented Interfaces:
java.lang.Runnable

public class ProductGenerator
extends java.lang.Thread

Purpose: Test class for the Spider API that attempts to loosely mimic the MRO telemproc. Essentially, it polls two filetypes, (one for DAT files, the other for DTL files). When a pair is found, they are processed, with results placed in filetypes for process initialized, product accountable, and sigevents.

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

 Date              Who              What
 ----------------------------------------------------------------------------
 10/17/2004        Costin           Initial Release
 08/24/2005        Nick             Fixes associated with AR112305, utilized
                                    new logger API, made more flexible by 
                                    caching results until pairs are found and 
                                    processed. Handles server groups.
 ============================================================================
 

Version:
$Id: ProductGenerator.java,v 1.15 2008/01/24 18:46:52 awt Exp $
Author:
Costin Radulescu (Costin.Radulescu@jpl.nasa.gov), Nicholas Toole (Nicholas.T.Toole@jpl.nasa.gov)

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  java.text.DateFormat _formatter
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ProductGenerator(java.lang.String feiUser, java.lang.String feiPasswd, java.lang.String localpath, java.lang.String datFt, java.lang.String dtlFt, java.lang.String piFt, java.lang.String paFt, java.lang.String seFt, boolean spiderMultiThreaded)
          Constructor.
 
Method Summary
protected  boolean checkPair(java.lang.String root)
          Checks if DAT and DTL collections share a root, in which case, the entries are removed and then processed.
 java.lang.String createProcessInitXML(java.lang.String datFN, java.lang.String dtlFN)
           
 java.lang.String createProductAccountableXML(java.lang.String datFN, java.lang.String dtlFN)
           
 java.lang.String createSigEventXML(java.lang.String datFN, java.lang.String dtlFN)
           
protected  java.lang.String formatDate(java.util.Date date)
           
protected  long getNextUtc()
           
static void main(java.lang.String[] args)
           
 void process()
           
protected  void processPair(Result datResult, Result dtlResult)
          Performs the processing when a DAT and DTL result are found.
protected static java.lang.String stripExtension(java.lang.String filename)
          Returns the substring of argument, removing the last "." character and all other following characters.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_formatter

protected java.text.DateFormat _formatter
Constructor Detail

ProductGenerator

public ProductGenerator(java.lang.String feiUser,
                        java.lang.String feiPasswd,
                        java.lang.String localpath,
                        java.lang.String datFt,
                        java.lang.String dtlFt,
                        java.lang.String piFt,
                        java.lang.String paFt,
                        java.lang.String seFt,
                        boolean spiderMultiThreaded)
Constructor.

Parameters:
feiUser - FEI username
feiPasswd - FEI user password
localPath - Local repository
datFt - DAT filetype, source of DAT files
dtlFt - DTL filetype, source of DTL files
piFt - Process init filetype, target for process init messages
paFt - Product acct filetype, target for product acct messages
seFt - Sig Event filetype, target for sig event messages
spiderMultiThreaded - Flag indicating whether Spider calls should be asynchronous (true) or synchronous (false).
Method Detail

process

public void process()
             throws SessionException
Throws:
SessionException

checkPair

protected boolean checkPair(java.lang.String root)
Checks if DAT and DTL collections share a root, in which case, the entries are removed and then processed.

Parameters:
Filename - root to check for
Returns:
True if a pair was found and processed, false otherwise.

processPair

protected void processPair(Result datResult,
                           Result dtlResult)
Performs the processing when a DAT and DTL result are found.

Parameters:
datResult - Result from subscription to DAT filetype.
dtlResult - Result from subscription to DTL filetype.

stripExtension

protected static java.lang.String stripExtension(java.lang.String filename)
Returns the substring of argument, removing the last "." character and all other following characters. If no "." is found, or if it is only found as first character, then original string is returned.

Parameters:
filename - Filename whose extension is to be removed
Returns:
Version of filename without extension or same string.

createProcessInitXML

public java.lang.String createProcessInitXML(java.lang.String datFN,
                                             java.lang.String dtlFN)

formatDate

protected java.lang.String formatDate(java.util.Date date)

createProductAccountableXML

public java.lang.String createProductAccountableXML(java.lang.String datFN,
                                                    java.lang.String dtlFN)

createSigEventXML

public java.lang.String createSigEventXML(java.lang.String datFN,
                                          java.lang.String dtlFN)

getNextUtc

protected long getNextUtc()

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception