The default target policy

The command package provides a default implementation of the TargetPolicy interface in the TargetPolicyDefault class.

Relevant variables and the methods in the TargetPolicyDefault class

If you use this default implementation, the command determines the target by looking through an ordered sequence of four options:
  • The CommandTarget value
  • The CommandTargetName value
  • A registered mapping of a target for a specific command
  • A defined default target
If the command finds no target, it returns null.

The TargetPolicyDefault class provides methods for managing the assignment of commands with targets (registerCommand, unregisterCommand, and listMappings), and a method for setting a default name for the target (setDefaultTargetName). The default target name is com.ibm.websphere.command.LocalTarget, where LocalTarget is a class that runs the command’s performExecute method locally.

...
public class TargetPolicyDefault implements TargetPolicy, Serializable
{
...
protected String defaultTargetName = "com.ibm.websphere.command.LocalTarget";
public CommandTarget getCommandTarget(TargetableCommand command) {
... }
public Dictionary listMappings() {
... }
public void registerCommand(String commandName, String targetName) {
... }
public void unregisterCommand(String commandName) {
... }
public void seDefaultTargetName(String defaultTargetName) {
... }
}



Subtopics
Setting the command target
Setting the command target name
Example: Mapping the command to a target name
Related concepts
Targets and target policies
Related tasks
Writing command interfaces
Reference topic Reference topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Aug 30, 2013 4:53:43 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=pix&product=was-base-dist&topic=rcmd_deftargpol
File name: rcmd_deftargpol.html