nl.astron.lofar.odtb.mom2otdbadapter.mom2listener
Class ProcessMom2Connection

java.lang.Object
  extended by java.lang.Thread
      extended by nl.astron.lofar.odtb.mom2otdbadapter.mom2listener.ProcessMom2Connection
All Implemented Interfaces:
java.lang.Runnable

public class ProcessMom2Connection
extends java.lang.Thread

Process a mom2 connection

Author:
Bastiaan Verhoef

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  java.net.Socket client
           
private  java.io.BufferedReader in
           
private  org.apache.commons.logging.Log log
           
private  java.io.PrintWriter out
           
private  OTDBRepository repository
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ProcessMom2Connection(OTDBRepository repository, java.net.Socket client)
          Constructor
 
Method Summary
protected  org.w3c.dom.Document convertStringToDocument(java.lang.String myXML)
          Convert a xml-string to a Document
protected  void finalize()
           
 java.lang.String getResultXml(java.lang.String errors)
          Creates a result xml by given erros
protected  java.lang.String processInput(java.lang.String input)
          It process the input and stores it to repository
 void run()
          Starts the thread ProcessMom2Connection.
 
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, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private org.apache.commons.logging.Log log

in

private java.io.BufferedReader in

out

private java.io.PrintWriter out

client

private java.net.Socket client

repository

private OTDBRepository repository
Constructor Detail

ProcessMom2Connection

public ProcessMom2Connection(OTDBRepository repository,
                             java.net.Socket client)
Constructor

Parameters:
repository - OTDBRepository with connection to jotdb
client - Socket with the connection to mom
Method Detail

run

public void run()
Starts the thread ProcessMom2Connection. It processes mom2 input and writes output to mom2.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

processInput

protected java.lang.String processInput(java.lang.String input)
It process the input and stores it to repository

Parameters:
input - input xml
Returns:
result xml

convertStringToDocument

protected org.w3c.dom.Document convertStringToDocument(java.lang.String myXML)
                                                throws java.lang.Exception
Convert a xml-string to a Document

Parameters:
myXML - xml string
Returns:
Document
Throws:
java.lang.Exception

getResultXml

public java.lang.String getResultXml(java.lang.String errors)
Creates a result xml by given erros

Parameters:
errors - Errors
Returns:
result xml

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object