com.sun.jini.compat.admin2
Class ExecServiceAdmin

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

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

This class implements the BasicServiceAdmin and BasicLookupAdmin interfaces to automate the testing of any transient or persistent programs. Some methods document properties that they support.


Field Summary
 
Fields inherited from interface com.sun.jini.compat.harness.BasicServiceAdmin
CATEGORY
 
Fields inherited from interface com.sun.jini.compat.harness.BasicLookupAdmin
CATEGORY
 
Constructor Summary
ExecServiceAdmin()
          Basic no-arg constructor.
 
Method Summary
 java.net.InetAddress getAddress()
          Returns the address of this host.
 ServiceRegistrar getServiceRegistrar()
          Returns the ServiceRegistrar from an already started Lookup.
 ServiceTemplate getTemplate()
          Return a blank ServiceTemplate.
 ServiceItem pickService(ServiceItem[] services)
          Given an array of service proxy objects, this method returns the first one that contains a proxy that implements the interface specified by the property com.sun.jini.compat.admin2.execServiceAdmin.interface.
 void setConfig(Config conf)
          See comments for BasicAdmin.
 void start()
          Using the Runtime.exe() method, starts the program(s) by running the command given by the property com.sun.jini.compat.admin2.execServiceAdmin.startCommand.
 void stop()
          Stops the program.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecServiceAdmin

public ExecServiceAdmin()
Basic no-arg constructor.

Method Detail

setConfig

public void setConfig(Config conf)
See comments for BasicAdmin.

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

getAddress

public java.net.InetAddress getAddress()
                                throws java.rmi.RemoteException
Returns the address of this host. The program must be running on this host.

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 Runtime.exe() method, starts the program(s) by running the command given by the property com.sun.jini.compat.admin2.execServiceAdmin.startCommand.

Specified by:
start in interface BasicAdmin
Throws:
java.rmi.RemoteException - if problem starting the program

stop

public void stop()
          throws java.rmi.RemoteException
Stops the program. This method does not need to wait for the program to stop. In addition, this method may be called safely even if the start() method threw an exception or was never called.

Specified by:
stop in interface BasicAdmin
Throws:
java.rmi.RemoteException - problem stopping the program

pickService

public ServiceItem pickService(ServiceItem[] services)
                        throws java.rmi.RemoteException
Given an array of service proxy objects, this method returns the first one that contains a proxy that implements the interface specified by the property com.sun.jini.compat.admin2.execServiceAdmin.interface. If the specified interface is not implemented by any of the listed services, then null is returned.

Specified by:
pickService in interface BasicServiceAdmin
Parameters:
services - the array ServiceItem objects from which to choose
Returns:
the ServiceItem for the service being tested, or null
Throws:
java.rmi.RemoteException

getTemplate

public ServiceTemplate getTemplate()
                            throws java.rmi.RemoteException
Return a blank ServiceTemplate.

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

getServiceRegistrar

public ServiceRegistrar getServiceRegistrar()
                                     throws java.rmi.RemoteException
Returns the ServiceRegistrar from an already started Lookup. If there are any problems getting the ServiceRegistrar it throws a RemoteException. It uses a property called: com.sun.jini.compat.admin2.execServiceAdmin.lookupPort. Using that port and the address of the lookup provided by the getAddress method it generates a LookupLocator to get the ServiceRegistrar for the lookup service being tested.

Specified by:
getServiceRegistrar in interface BasicLookupAdmin
Returns:
the ServiceRegistrar for the lookup being tested.
Throws:
java.rmi.RemoteException


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