org.jafer.zserver.operations
Class Operation

java.lang.Object
  extended by java.lang.Thread
      extended by org.jafer.zserver.ZServerThread
          extended by org.jafer.zserver.operations.Operation
All Implemented Interfaces:
java.io.Serializable, java.lang.Runnable
Direct Known Subclasses:
Delete, Init, Present, Scan, Search, Sort

public abstract class Operation
extends ZServerThread

Each operation runs in it's own thread and either terminates naturally by sending response PDU (or Diagnostic) or can be stopped by session which forces close of socket. Operations must implement abstract runOp() method. Also includes methods for building diagnostics and handling exceptions.

Version:
1.0
Author:
Antony Corfield; Matthew Dovey; Colin Tatham
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static java.lang.String BIB1_DIAGNOSTIC_OID
           
private  PDUDriver pduDriver
           
private  Session session
           
 
Fields inherited from class org.jafer.zserver.ZServerThread
logger, STATE_RUNNING, STATE_STOPPED, STATE_STOPPING
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Operation(Session session, java.lang.String name)
           
 
Method Summary
 void close()
           
protected  z3950.v3.DefaultDiagFormat getDiagnostic(z3950.v3.DefaultDiagFormat defaultDiagFormat, int condition, java.lang.String addInfo)
           
protected  z3950.v3.DiagRec getDiagnostic(z3950.v3.DiagRec diagRec, int condition, java.lang.String addInfo)
           
protected  z3950.v3.NamePlusRecord_record getDiagnostic(z3950.v3.NamePlusRecord_record name_record, int condition, java.lang.String addInfo)
           
 Session getSession()
           
 void run()
           
abstract  z3950.v3.PDU runOp()
           
private  void sendPDU(z3950.v3.PDU pduResponse)
           
 void start()
           
 
Methods inherited from class org.jafer.zserver.ZServerThread
getActiveThreads, getNumberOfActiveThreads, getServerThreadId, getServerThreadState, getStartTime, getThreads, getUpTime, halt, hasThreads, isStopped, isStopping, purgeThreads, setStartTime, setStopped, setStopping, setThreadName, setThreads, startThread
 
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, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BIB1_DIAGNOSTIC_OID

public static final java.lang.String BIB1_DIAGNOSTIC_OID
See Also:
Constant Field Values

session

private Session session

pduDriver

private PDUDriver pduDriver
Constructor Detail

Operation

public Operation(Session session,
                 java.lang.String name)
Method Detail

start

public final void start()
Overrides:
start in class java.lang.Thread

runOp

public abstract z3950.v3.PDU runOp()
                            throws java.lang.Exception
Throws:
java.lang.Exception

run

public final void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

close

public final void close()
Overrides:
close in class ZServerThread

getSession

public Session getSession()

sendPDU

private void sendPDU(z3950.v3.PDU pduResponse)
              throws ConnectionException
Throws:
ConnectionException

getDiagnostic

protected z3950.v3.DefaultDiagFormat getDiagnostic(z3950.v3.DefaultDiagFormat defaultDiagFormat,
                                                   int condition,
                                                   java.lang.String addInfo)

getDiagnostic

protected z3950.v3.DiagRec getDiagnostic(z3950.v3.DiagRec diagRec,
                                         int condition,
                                         java.lang.String addInfo)

getDiagnostic

protected z3950.v3.NamePlusRecord_record getDiagnostic(z3950.v3.NamePlusRecord_record name_record,
                                                       int condition,
                                                       java.lang.String addInfo)