Command interface example application

ModifyCheckingAccountCmd command interface

This example uses an entity bean with container-managed persistence (CMP), called CheckingAccountBean, which enables a client to deposit money, withdraw money, set a balance, get a balance, and retrieve the name on the account. This entity bean also accepts commands from the client. The code examples illustrate the command-related programming. For a servlet-based example, see Example: Writing a command target (client-side adapter)

This command is both targetable and compensable, so the interface extends both TargetableCommand and CompensableCommand interfaces.

...
import com.ibm.websphere.exception.*;
import com.ibm.websphere.command.*;
public interface ModifyCheckingAccountCmd
extends TargetableCommand, CompensableCommand {
float getAmount();
float getBalance();
float getOldBalance(); // Used for compensating
float setBalance(float amount);
float setBalance(int amount);
CheckingAccount getCheckingAccount();
void setCheckingAccount(CheckingAccount newCheckingAccount);
TargetPolicy getCmdTargetPolicy();
...
}



Related tasks
Writing command interfaces
Related reference
TargetableCommand interface
CompensableCommand interface
Reference topic Reference topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Aug 31, 2013 12:02:36 AM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=pix&product=was-nd-zos&topic=rcmd_exampleapp
File name: rcmd_exampleapp.html