jSyncManager Simple Java Server

org.jSyncManager.SJS.Adapters.TestAdapter
Class TestAdapter

java.lang.Object
  extended by java.lang.Thread
      extended by org.jSyncManager.SJS.API.AbstractAdapter
          extended by org.jSyncManager.SJS.API.AbstractRequestResponseAdapter
              extended by org.jSyncManager.SJS.Adapters.TestAdapter.TestAdapter
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
TestAdapterTester

public class TestAdapter
extends AbstractRequestResponseAdapter

A simple Test Adapter to demonstrate the Internet Server Service. This is a very simple Internet Server application built upon the AbstractRequestResponseAdapter in order to create a simple server which accepts requests, and uses them to increment a counter, completing when the user enters the word "QUIT".

Version:
0.1
Author:
Brad BARCLAY <bbarclay@jsyncmanager.org>

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 DISCONNECT_MESSAGE
          A static field to hold the disconnect message for this adapter.
 
Fields inherited from class org.jSyncManager.SJS.API.AbstractAdapter
props
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TestAdapter()
          Constructs a new instance of this TestAdapter.
 
Method Summary
protected  java.lang.String getConnectionHeaderString()
          The Connection Header method.
protected  java.lang.String getTimeoutMessage()
          The timeout error message.
protected  java.lang.String processRequest(java.lang.String request)
          The processRequest method.
 
Methods inherited from class org.jSyncManager.SJS.API.AbstractRequestResponseAdapter
disconnect, processConnection
 
Methods inherited from class org.jSyncManager.SJS.API.AbstractAdapter
connectionPermitted, getConnectionManagerInterface, getInetAddress, getLogManager, getProperty, processConnection, run, setLogManager, setThreadGroup
 
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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DISCONNECT_MESSAGE

public static final java.lang.String DISCONNECT_MESSAGE
A static field to hold the disconnect message for this adapter.

See Also:
Constant Field Values
Constructor Detail

TestAdapter

public TestAdapter()
Constructs a new instance of this TestAdapter.

Method Detail

processRequest

protected java.lang.String processRequest(java.lang.String request)
                                   throws java.lang.Exception
The processRequest method. In this implementation, this method simply returns "+OK" followed by an incrementing value, unless the request "QUIT" is received.

Specified by:
processRequest in class AbstractRequestResponseAdapter
Parameters:
request - the request to be processed.
Returns:
the response to be sent.
Throws:
java.lang.Exception - any checked exception that goes unhandled.

getConnectionHeaderString

protected java.lang.String getConnectionHeaderString()
The Connection Header method. This method returns a sample header string.

Overrides:
getConnectionHeaderString in class AbstractRequestResponseAdapter
Returns:
the sample connection header string.

getTimeoutMessage

protected java.lang.String getTimeoutMessage()
The timeout error message. This method returns the message to display when the connection times out.

Overrides:
getTimeoutMessage in class AbstractRequestResponseAdapter
Returns:
the timeout error message "+BYE"

jSyncManager Simple Java Server

Copyright (c) 2004 Brad BARCLAY. All Rights Reserved.