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 C''''''ommandReport run() throws C''''''ommandException;
}

public interface C''''''ommandProxy
  extends EJBObject, C''''''ommandProxyBusiness {
}

public interface C''''''ommandProxyBusiness {
  public C''''''ommandReport runCommand(Command command)
    throws C''''''ommandException, R''''''emoteException;
}

public interface C''''''ommandReport extends Serializable {
  public Object getReportContents();
}

public class C''''''ommandException extends R''''''emoteException {
  public C''''''ommandException(String message) {
    super(message);
  }
}

----

Haaa, EnterpriseJavaBean''''''s 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