import java.io.IOException; |
import java.io.Serializable; public interface Command extends Serializable{ public void excute() throws Exception; } |
import
java.io.Externalizable; import org.dmdf.dmt.DMT; import org.dmdf.dmt.DMTCart; public class GetUserAccountCommand implements Command { private String userId; private DMTCart cart; private GetUserAccountCommand() { super(); } public GetUserAccountCommand(String userId) { this.userId = userId; } public void excute() throws Exception { // get object from your server interface e.g Hibernate or EJB Externalizable userAccount = null; this.cart = new DMT().encode(userAccount); } public UserAccount getUserAccount() throws Exception { return (UserAccount) new DMT().decode(this.cart); } } |