com.ibm.websphere.command
Interface CommandTarget

All Known Implementing Classes:
LocalTarget

public interface CommandTarget

The CommandTarget interface describes the object that handles the execution of a targetable command. This object represents the server that runs the command.

The CommandTarget interface declares one method, executeCommand(). The command package provides an implementation of this interface in the com.ibm.websphere.command.LocalTarget class. This class can be used when the client and server reside in the same JVM. For convenience, this target's name is aliased to the global (public static) variable LOCAL in the TargetableCommandImpl class.

Applications that need to run commands remotely must override this local implementation of the CommandTarget interface. An implementation of the executeCommand() method has three tasks:

The CommandTarget interface can be implemented in a variety of ways. One technique makes the target object a client-side adapter that deals with the server's protocol. A technique that offers more transparent local/remote communication makes the target a server-side object with a client-side stub. An example of this technique uses an enterprise bean's remote interface as the target. In this case, the target can be used to run the command in the same server as another object.


Method Summary
 TargetableCommand executeCommand(TargetableCommand command)
          Submits the command for execution.
 

Method Detail

executeCommand

public TargetableCommand executeCommand(TargetableCommand command)
                                 throws java.rmi.RemoteException,
                                        CommandException
Submits the command for execution. This method must copy the command to the server, invoke the command on the server, and return any output properties to the client.

Parameters:
command - The targetable command to be run.
Returns:
The command after it has been run. If the hasOutputProperties() method on the command returns false, this method can return null as a performance optimization.
Throws:
java.rmi.RemoteException - The superclass for all remote exceptions. This type is thrown in case a remote server (like an EJB server) throws an RMI remote exception.
CommandException - The superclass for all command exceptions.


 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.