EJB design: mapping request type to the EJB method - Design question

  1. is there any design pattern to map an incoming request to the EJB method ? What's the best way to implement it ? I don't have any user-facing JSPs . I want to call the service which is implemented using EJBs. The service must invoke the right method based upon the client request.

    For e.g. I want to implement the following

    public class myEJB implements IBizInterface
        public Vector processRequestA() throws RemoteException, ServiceException;
         public Vector processRequestB() throws RemoteException, ServiceException;

    & i can have a business delegate that calls the bean based on the request type. Something like

    if (reqType == 0) return myEHBHome.create().processRequestA();
    else if (reqType = 1) return myEJBHome.create().processRequestB()
    else ....

    The approach i mentioned here is tightly-coupled. What's the right approach to de-couple ?

  2. Here is one option:

    1) Identify the request type by the EJB method name.
    2) Use reflection to map it to the EJB method.

    A variation on this is to define the request-type to EJB-method mapping in a configuration file (again, using reflection to invoke the EJB method).

    If you need to map request type to EJB-Class+method, expand these schemes to include the class name.
  3. I thought of using reflection, but have been reading conflicting things about using reflection in the EJB env. Does EJB support reflections ? Are there any real issues ? Any pointers ?

    Thanks again
  4. Don't do the reflection in the EJB layer. Do the reflection in the web layer or the client layer (reflecting on the home and remote interfaces, not the EJB classes).