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

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

public class ResourceClient
extends Object

a client used to access ACTF configurations and other resources. This class is used in inter-JVM valaidations to provide the launched (i.e. validating) JVM with access to resources in the launching JVM. An "inter-JVM" validation is one in which the application or content to be validated is launched in a distinct JVM from that in which ACTF is running.

Author:
Mike Squillace
See Also:
ResourceServer

Field Summary
 Object client_lock
           
 
Constructor Summary
ResourceClient(int port)
          create a client that connects to the ACTF ResourceServer on the specified port.
ResourceClient(String hostName, int port)
          create a client that connects to the specified host and port.
 
Method Summary
 SocketChannel getChannel()
           
 Map requestAccessibilityServices()
           
 void requestClose()
          request an end to the session
 IConfiguration requestConfiguration()
          request the active ACTF configuration object from the resource server
 Object requestConfigurationParameter(String pool, String id)
          request a configuration parameter from the server
 InputStream requestResource(String id, String base, String ext)
          request a resource from the resource server.
 IRuleBaseDescriptor[] requestRuleBaseDescriptors()
          request the active rule base descriptors from the resource server
 void sendMessage(String msg)
          send a message to the resource server.
 void sendReportElements(SocketChannel client, Object reportElements)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

client_lock

public Object client_lock
Constructor Detail

ResourceClient

public ResourceClient(int port)
               throws IOException
create a client that connects to the ACTF ResourceServer on the specified port. This client can be used during an inter-JVM validation to request configurations and other resources from the source JVM.

Parameters:
port -
Throws:
IOException

ResourceClient

public ResourceClient(String hostName,
                      int port)
               throws IOException
create a client that connects to the specified host and port. This client can be used during an inter-JVM validation to request configurations and other resources from the source JVM

Parameters:
hostName -
port -
Throws:
IOException
Method Detail

requestConfiguration

public IConfiguration requestConfiguration()
                                    throws Exception
request the active ACTF configuration object from the resource server

Returns:
active ACTF configuration object
Throws:
Exception

requestRuleBaseDescriptors

public IRuleBaseDescriptor[] requestRuleBaseDescriptors()
                                                 throws Exception
request the active rule base descriptors from the resource server

Returns:
array of rule bases descriptors
Throws:
Exception

requestAccessibilityServices

public Map requestAccessibilityServices()
                                 throws Exception
Throws:
Exception

requestResource

public InputStream requestResource(String id,
                                   String base,
                                   String ext)
                            throws IOException
request a resource from the resource server. The method is directly called from the org.eclipse.actf.validation.javapp.resources.InterJvmResourceLocator in order to fetch resources on the client-side of an inter-JVM validation.

Parameters:
id -
base -
ext -
Returns:
stream to resource
Throws:
IOException
See Also:
InterJvmResourceLocator

requestConfigurationParameter

public Object requestConfigurationParameter(String pool,
                                            String id)
                                     throws Exception
request a configuration parameter from the server

Parameters:
pool - pool id
id - id of parameter
Returns:
parameter corresponding to pool/id combination
Throws:
Exception
See Also:
IConfiguration

requestClose

public void requestClose()
                  throws IOException
request an end to the session

Throws:
IOException

sendMessage

public void sendMessage(String msg)
send a message to the resource server. The message should be one of the pre-defined messages in the ResourceServer class else the message will be ignored.

Parameters:
msg - message to resource server
See Also:
ResourceServer

sendReportElements

public void sendReportElements(SocketChannel client,
                               Object reportElements)

getChannel

public SocketChannel getChannel()