com.sun.jini.compat.admin1
Class TransientServiceAdmin

java.lang.Object
  extended bycom.sun.jini.compat.admin1.TransientServiceAdmin
All Implemented Interfaces:
BasicAdmin, BasicServiceAdmin

public class TransientServiceAdmin
extends java.lang.Object
implements BasicServiceAdmin

This class implements the BasicServiceAdmin interface to automate the testing of a transient service. A transient service by definition of this admin is one that is started using the following command line.

java -jar -Djava.security.policy=security_policy_file_arg
     -Djava.rmi.server.codebase=codebase_arg
     [optional_jvm_options] executable_jar_file

Where the arguments are :
-jar
-jar is a java command-line option that tells the interpreter to execute a program encapsulated in a JAR file. The following links provide more detail on this option.
http://java.sun.com/products/jdk/1.2/docs/tooldocs/solaris/java.html#-jar http://java.sun.com/products/jdk/1.2/docs/tooldocs/win32/java.html#-jar

security_policy_file_arg
This argument is used to specify the security policy file that the TransientService will run under.

codebase_arg
This argument is used to specify the URL of the service-dl.jar that will be downloaded to clients. This JAR file contains the classes required by clients in order to interact with the TransientService server.

optional_jvm_options
These are optional arguments for the VM that the TransientService will run in. The following links give more detail on what arguments can be passed to a VM.
http://java.sun.com/products/jdk/1.2/docs/tooldocs/solaris/java.html http://java.sun.com/products/jdk/1.2/docs/tooldocs/win32/java.html
executable_jar_file
This JAR file contains a program that is identified by the manifest as having a main method. In this case, this argument would be the absolute path to the service.jar file, which has its Main-Class attribute. For more information on the -jar option of the java command, you can take a look at:
http://java.sun.com/products/jdk/1.2/docs/tooldocs/solaris/java.html http://java.sun.com/products/jdk/1.2/docs/tooldocs/win32/java.html http://java.sun.com/products/jdk/1.2/docs/guide/jar/manifest.html http://java.sun.com/products/jdk/1.2/docs/tooldocs/solaris/jar.html http://java.sun.com/products/jdk/1.2/docs/tooldocs/win32/jar.html

Because transient services are not activatable, it is necessary to start them in a separate VM to avoid codebase and classpath problems in certain LDJ Kit tests.

In order to use this Admin several properties must be defined in the LDJ Kit config file. See the documentation for the start method below for more information.


Field Summary
 
Fields inherited from interface com.sun.jini.compat.harness.BasicServiceAdmin
CATEGORY
 
Constructor Summary
TransientServiceAdmin()
          Default Constructor with no arguments.
TransientServiceAdmin(java.lang.String codebase)
          Constructor that takes in the codebase for the service implementation that is being tested.
 
Method Summary
 java.net.InetAddress getAddress()
          Returns the address of the machine that the service process is running on.
 ServiceTemplate getTemplate()
          Provides a service template with the service's ServiceID to filter out uninteresting services.
 ServiceItem pickService(ServiceItem[] services)
          Given a list of objects which are ServiceItems this method determines if any of them are the service we are testing.
 void setConfig(Config conf)
          Sets the Config object for this test run that the implementation can get access to property files and other config information.
 void start()
          Properly configures and starts the service.
 void stop()
          Stops the service, removes it from activation and removes it's log directory using remote administration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransientServiceAdmin

public TransientServiceAdmin()
Default Constructor with no arguments.


TransientServiceAdmin

public TransientServiceAdmin(java.lang.String codebase)
Constructor that takes in the codebase for the service implementation that is being tested.

Method Detail

setConfig

public void setConfig(Config conf)
Sets the Config object for this test run that the implementation can get access to property files and other config information.

Specified by:
setConfig in interface BasicAdmin
Parameters:
conf - the Config object for this test run

start

public void start()
           throws java.rmi.RemoteException
Properly configures and starts the service. This method sets the codebase and policy for the service. It then starts the service in a separate VM. Optional service arguments can be included after if desired.

Below is a table describing all required and optional properties used by this admin.

PropertyUsageStatus
com.sun.jini.compat.service.proxyclass The fully qualified class name of the service's proxy Mandatory
com.sun.jini.compat.service.jarfile The full path of executable JAR file for starting service Mandatory
com.sun.jini.compat.service.codebase The codebase for any code published by the service under test Mandatory
com.sun.jini.compat.service.policy The location of a policy file for use in starting the service Mandatory
com.sun.jini.compat.service.optional_jvm_args Any additional args passed to the VM (must include -D) Optional
com.sun.jini.compat.service.optional_service_args Any additional arguments passed to the service Optional
com.sun.jini.compat.service.java The full path of the VM that is used to start service Optional

Specified by:
start in interface BasicAdmin
Throws:
java.rmi.RemoteException

pickService

public ServiceItem pickService(ServiceItem[] services)
                        throws java.rmi.RemoteException
Given a list of objects which are ServiceItems this method determines if any of them are the service we are testing. It does this by comparing the class name and the codebase of the object to the codebase and class name we are looking for. If they match it returns the matching ServiceItem; otherwise it returns null.

Specified by:
pickService in interface BasicServiceAdmin
Parameters:
services - the array of ServiceItems that need to be picked from
Returns:
the ServiceItem for the service being tested or null
Throws:
java.rmi.RemoteException

getAddress

public java.net.InetAddress getAddress()
                                throws java.rmi.RemoteException
Returns the address of the machine that the service process is running on.

Specified by:
getAddress in interface BasicAdmin
Returns:
the address
Throws:
java.rmi.RemoteException

getTemplate

public ServiceTemplate getTemplate()
                            throws java.rmi.RemoteException
Provides a service template with the service's ServiceID to filter out uninteresting services.

Specified by:
getTemplate in interface BasicServiceAdmin
Returns:
the template
Throws:
java.rmi.RemoteException

stop

public void stop()
          throws java.rmi.RemoteException
Stops the service, removes it from activation and removes it's log directory using remote administration.

Specified by:
stop in interface BasicAdmin
Throws:
java.rmi.RemoteException


Copyright 2005, Sun Microsystems, Inc.
Licensed under the Apache License, Version 2.0.