Command Proxy

CommandProxy is a stateless session Enterprise Java Bean. It is used to run generic commands within an EJB container, but which are dispatched from a client. This can be useful, for instance, in performing unit tests. These are the relevant interfaces and classes:

public interface Command {

  public CommandReport run() throws CommandException;
}

public interface CommandProxy

  extends EJBObject, CommandProxyBusiness {
}

public interface CommandProxyBusiness {

  public CommandReport runCommand(Command command)
    throws CommandException, RemoteException;
}

public interface CommandReport extends Serializable {

  public Object getReportContents();
}

public class CommandException extends RemoteException {

  public CommandException(String message) {
    super(message);
  }
}


Haaa, EnterpriseJavaBeans in all their glory: 4 interfaces and 1 class to implement a basic pattern, half of them leaking things that are completely unrelated, such as RemoteException or Serializable. -- PhilippeDetournay


EditText of this page (last edited March 10, 2010) or FindPage with title or text search