org.eclipse.actf.validation.javapp.server
Class ResourceServer

java.lang.Object
  extended by org.eclipse.actf.validation.javapp.server.AbstractSingletonServer
      extended by org.eclipse.actf.validation.javapp.server.ResourceServer

public class ResourceServer
extends AbstractSingletonServer

a server to provide resources to the launched JVM during an inter-JVM validation. This server will also keep track of a variety of events occurring during the validation process, notifying any registered listeners of these events.

Author:
Mike Squillace
See Also:
org.eclipse.actf.core.server.ResourceClient

Field Summary
static String CREATION_CONTEXT_COMPLETED
           
static String CREATION_CONTEXT_STARTED
           
static String NULL_STRING
           
static String REPORT_COMPLETED
           
static String REPORT_STARTED
           
static String REQUEST_ACCESSIBILITY_SERVICES
           
static String REQUEST_CONFIGURATION
           
static String REQUEST_CONFIGURATION_PARAMETER
           
static String REQUEST_RESOURCE
           
static String REQUEST_RULEBASE_DESCRIPTORS
           
static String VALIDATION_JVM_TERMINATING
           
 
Fields inherited from class org.eclipse.actf.validation.javapp.server.AbstractSingletonServer
CHARSET, CHARSET_DECODER, CHARSET_ENCODER, REQUEST_CLOSE, RESOURCE_SERVER_HOST_DEFAULT, RESOURCE_SERVER_HOST_KEY, RESOURCE_SERVER_PORT_DEFAULT, RESOURCE_SERVER_PORT_KEY, transaction_id
 
Method Summary
 void addReportListener(IReportListener listener)
          add a ReportListener to be notified when a report has started or completed
protected  void finalize()
           
protected  void fireCreationContextCompletedE()
           
protected  void fireCreationContextStarted()
           
protected  void fireReportCompleted()
           
protected  void fireReportStarted()
           
static ResourceServer getInstance()
          get a resource server for fetching resources from the launching JVM.
protected  void handleRequest(String request, SocketChannel client)
           
 void removeAllReportListeners()
          remove all report listeners
 void removeReportListener(IReportListener listener)
          remove the specified listener from the list of listeners to be notified when report events take place.
 CreationContext[] requestCreationContexts(SocketChannel client)
           
 ValidationReportRecord[] requestReport(SocketChannel client)
           
protected  void send(SocketChannel client, Object obj)
           
 void startServer()
          bind the server to a socket and start the server.
protected  ByteBuffer toByteBuffer(String msg)
           
 
Methods inherited from class org.eclipse.actf.validation.javapp.server.AbstractSingletonServer
getHostName, getPort, isShutdown, isSuspended, receiveMessage, requestAsBytes, sendResource, setHostName, setPort, setSuspended, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_STRING

public static final String NULL_STRING
See Also:
Constant Field Values

REQUEST_CONFIGURATION

public static final String REQUEST_CONFIGURATION
See Also:
Constant Field Values

REQUEST_RULEBASE_DESCRIPTORS

public static final String REQUEST_RULEBASE_DESCRIPTORS
See Also:
Constant Field Values

REQUEST_CONFIGURATION_PARAMETER

public static final String REQUEST_CONFIGURATION_PARAMETER
See Also:
Constant Field Values

REQUEST_RESOURCE

public static final String REQUEST_RESOURCE
See Also:
Constant Field Values

REPORT_STARTED

public static final String REPORT_STARTED
See Also:
Constant Field Values

REPORT_COMPLETED

public static final String REPORT_COMPLETED
See Also:
Constant Field Values

CREATION_CONTEXT_STARTED

public static final String CREATION_CONTEXT_STARTED
See Also:
Constant Field Values

CREATION_CONTEXT_COMPLETED

public static final String CREATION_CONTEXT_COMPLETED
See Also:
Constant Field Values

VALIDATION_JVM_TERMINATING

public static final String VALIDATION_JVM_TERMINATING
See Also:
Constant Field Values

REQUEST_ACCESSIBILITY_SERVICES

public static final String REQUEST_ACCESSIBILITY_SERVICES
See Also:
Constant Field Values
Method Detail

getInstance

public static ResourceServer getInstance()
                                  throws IOException
get a resource server for fetching resources from the launching JVM. The server is automatically started.

Returns:
resource server instance
Throws:
IOException

startServer

public void startServer()
bind the server to a socket and start the server. Once this method is invoked successfully, use the isSuspended method to monitor whether or not any data is being read.

See Also:
org.eclipse.actf.core.server.AbstractSingletonServer#isSuspended()

toByteBuffer

protected ByteBuffer toByteBuffer(String msg)
                           throws CharacterCodingException
Throws:
CharacterCodingException

handleRequest

protected void handleRequest(String request,
                             SocketChannel client)
                      throws Exception
Throws:
Exception

requestReport

public ValidationReportRecord[] requestReport(SocketChannel client)
                                       throws Exception
Throws:
Exception

requestCreationContexts

public CreationContext[] requestCreationContexts(SocketChannel client)
                                          throws Exception
Throws:
Exception

send

protected void send(SocketChannel client,
                    Object obj)
             throws IOException
Throws:
IOException

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

fireReportStarted

protected void fireReportStarted()

fireReportCompleted

protected void fireReportCompleted()

fireCreationContextStarted

protected void fireCreationContextStarted()

fireCreationContextCompletedE

protected void fireCreationContextCompletedE()

addReportListener

public void addReportListener(IReportListener listener)
add a ReportListener to be notified when a report has started or completed

Parameters:
listener - - listener to be called upon report event

removeReportListener

public void removeReportListener(IReportListener listener)
remove the specified listener from the list of listeners to be notified when report events take place.

Parameters:
listener - - listener to be removed

removeAllReportListeners

public void removeAllReportListeners()
remove all report listeners