com.sun.jini.compat.admin2
Class ServiceStarterAdmin

java.lang.Object
  extended bycom.sun.jini.compat.admin2.ServiceStarterAdmin
All Implemented Interfaces:
BasicAdmin, BasicLookupAdmin, BasicServiceAdmin

public class ServiceStarterAdmin
extends java.lang.Object
implements BasicServiceAdmin, BasicLookupAdmin

This class implements the BasicServiceAdmin and BasicLookupAdmin interfaces to automate the testing of any activatable program that can be started by the ServiceStarter framework. See the start method documentation for config file properties supported by this Admin.


Field Summary
protected  SharedActivatableServiceDescriptor.Created activatableCreated
           
protected  Config compatConfig
           
protected  SysConfig compatSysConfig
           
protected  java.rmi.activation.ActivationGroupID groupCreated
           
protected  java.lang.String groupLog
           
protected  java.io.PrintWriter log
           
protected  NonActivatableServiceDescriptor.Created nonActivatableCreated
           
protected  java.lang.Object proxy
           
protected  SharedActivatableServiceDescriptor.Created sharedCreated
           
 
Fields inherited from interface com.sun.jini.compat.harness.BasicServiceAdmin
CATEGORY
 
Fields inherited from interface com.sun.jini.compat.harness.BasicLookupAdmin
CATEGORY
 
Constructor Summary
ServiceStarterAdmin()
          Default constructor.
 
Method Summary
 java.net.InetAddress getAddress()
          Returns the address of the host the program is running on by looking up the property com.sun.jini.compat.defaultAdmin.address.
 java.lang.String getGroupLog()
          Returns a randomized directory name within the com.sun.jini.compat.scratchDir that can be used as the group log directory.
 java.lang.String getPersistenceDir()
          Returns a randomized directory name within the com.sun.jini.compat.scratchDir that can be used as the program's persistence directory.
 ServiceRegistrar getServiceRegistrar()
          Returns the proxy for the lookup service being tested.
 ServiceTemplate getTemplate()
          Returns a fully wild-carded template.
 ServiceItem pickService(ServiceItem[] services)
          Given a list of objects which are ServiceItems this method determines if any of them are the program we are testing.
 void setConfig(Config config)
          Takes the Config object for this test run so that the implementation can get access to property files and other config information.
 void start()
          Using the ServiceStarter, starts the program(s) specified in the service starter configuration file specified by the property com.sun.jini.compat.admin2.starterConfig.
 void stop()
          Stops the program.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

compatConfig

protected Config compatConfig

compatSysConfig

protected SysConfig compatSysConfig

log

protected java.io.PrintWriter log

nonActivatableCreated

protected NonActivatableServiceDescriptor.Created nonActivatableCreated

sharedCreated

protected SharedActivatableServiceDescriptor.Created sharedCreated

activatableCreated

protected SharedActivatableServiceDescriptor.Created activatableCreated

groupCreated

protected java.rmi.activation.ActivationGroupID groupCreated

proxy

protected java.lang.Object proxy

groupLog

protected java.lang.String groupLog
Constructor Detail

ServiceStarterAdmin

public ServiceStarterAdmin()
Default constructor.

Method Detail

setConfig

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

Specified by:
setConfig in interface BasicAdmin
Parameters:
config - the configuration object

getAddress

public java.net.InetAddress getAddress()
                                throws java.rmi.RemoteException
Returns the address of the host the program is running on by looking up the property com.sun.jini.compat.defaultAdmin.address. If that property is not specified the default is the host the LDJ Kit harness is running on.

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

start

public void start()
           throws java.rmi.RemoteException
Using the ServiceStarter, starts the program(s) specified in the service starter configuration file specified by the property com.sun.jini.compat.admin2.starterConfig. The following strings are passed to this configuration as overrides: See the example configuration files in the configs sub-directory of the LDJ Kit. The *-activatable.config files are used by this Admin to test services in the Jini starter kit.

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

stop

public void stop()
          throws java.rmi.RemoteException
Stops the program. If the program is activatable and implements net.jini.admin.Administrable and com.sun.jini.admin.DestroyAdmin then this method will make certain the program is unregistered with the activation system before returning.

Specified by:
stop 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 program we are testing. It does this by comparing the service field of each ServiceItem to the program's proxy returned from the ServiceStarter framework when the program was started.

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

getTemplate

public ServiceTemplate getTemplate()
                            throws java.rmi.RemoteException
Returns a fully wild-carded template.

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

getServiceRegistrar

public ServiceRegistrar getServiceRegistrar()
                                     throws java.rmi.RemoteException
Returns the proxy for the lookup service being tested.

Specified by:
getServiceRegistrar in interface BasicLookupAdmin
Returns:
lookup service proxy
Throws:
java.rmi.RemoteException

getGroupLog

public java.lang.String getGroupLog()
Returns a randomized directory name within the com.sun.jini.compat.scratchDir that can be used as the group log directory. The returned directory name is saved so that this Admin can remove it later.


getPersistenceDir

public java.lang.String getPersistenceDir()
Returns a randomized directory name within the com.sun.jini.compat.scratchDir that can be used as the program's persistence directory.



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