Setting the command target name

If a client needs to set the target of the command by name, it can use the setCommandTargetName method for the command.

Identifying a target with CommandTargetName

This example compares with the example in Using a command as follows:
  • Both explicitly set the command target in the constructor to null.
  • Both use the setCheckingAccount method to indicate the account on which the command should operate.
  • This example sets the target name explicitly by using the setCommandTargetName method. When the default target policy traverses its choices, it finds a null for the first choice and a name for the second.
{
...
CheckingAccount checkingAccount
....
try {
ModifyCheckingAccountCmd cmd =
new ModifyCheckingAccountCmdImpl(null, 1000);
cmd.setCheckingAccount(checkingAccount);
cmd.setCommandTargetName("com.ibm.sfc.cmd.test.CheckingAccountBean");
cmd.execute();
}
catch (Exception e) {
System.out.println(e.getMessage());
}
...
}



Related concepts
Targets and target policies
Related tasks
Using a command
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_setcmdtargname
File name: rcmd_setcmdtargname.html