net.officefloor.plugin.ejb
Class OfficeFloorEjb

java.lang.Object
  extended by net.officefloor.plugin.ejb.OfficeFloorEjb
All Implemented Interfaces:
EjbOrchestrator, EjbOrchestratorRemote

public class OfficeFloorEjb
extends Object
implements EjbOrchestrator, EjbOrchestratorRemote

Stateless SessionBean along with utility methods for integrating OfficeFloor into an Application Server.

The deployment descriptor for using this SessionBean is as follows (replacing the contents of the square brackets - [...]):

 <ejb-jar>
     ...
     <enterprise-beans>
         ...
         <session>
             <ejb-name>[EJB Name]</ejb-name>
             <ejb-class>net.officefloor.plugin.ejb.OfficeFloorEjb</ejb-class>
             <env-entry>
                 <env-entry-name>officeFloorJndiName</env-entry-name>
                 <env-entry-value>[JNDI resource path to OfficeFloor configuration]</env-entry-value>
             </env-entry>
             <env-entry>
                 <env-entry-name>officeName</env-entry-name>
                 <env-entry-value>[Name of Office]</env-entry-value>
             </env-entry>
             <env-entry>
                 <env-entry-name>workName</env-entry-name>
                 <env-entry-value>[Name of Work]</env-entry-value>
             </env-entry>
         </session>
         ...
     </enterprise-beans>
     ...
 </ejb-jar>
 

The EjbOrchestrator and EjbOrchestratorRemote provide a generic interface for orchestration. It is also possible to extend this class to provide a typed interface:

Local interface:

 @Local
 public interface TypedEjbOrchestrator {
        public void typedOrchestration(String parameter) throws NamingException;
 }
 

Bean implementation:

 @Stateless
 public class TypedOfficeFloorEjb extends OfficeFloorEjb implements
                TypedEjbOrchestrator {
        public void typedOrchestration(String parameter) throws NamingException {
                this.orchestrate(parameter);
        }
 }
 

Author:
Daniel Sagenschneider

Field Summary
protected  String officeFloorJndiName
          JDNI name for the OfficeFloor.
protected  String officeName
          Name of the Office within the OfficeFloor.
protected  String workName
          Name of the Work to be invoked.
 
Constructor Summary
OfficeFloorEjb()
           
 
Method Summary
static void doOrchestration(String officeFloorJndiName, String officeName, String workName, Object parameter)
          Does the orchestration.
 void ejbCreate()
          Validates the dependency injection of configuration available.
 void orchestrate(Object parameter)
          Orchestrates the EJBs.
<P> P
orchestrateRemotely(P parameter)
          Remotely orchestrates EJBs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

officeFloorJndiName

protected String officeFloorJndiName
JDNI name for the OfficeFloor.


officeName

protected String officeName
Name of the Office within the OfficeFloor.


workName

protected String workName
Name of the Work to be invoked.

Constructor Detail

OfficeFloorEjb

public OfficeFloorEjb()
Method Detail

doOrchestration

public static void doOrchestration(String officeFloorJndiName,
                                   String officeName,
                                   String workName,
                                   Object parameter)
                            throws NamingException
Does the orchestration.

Parameters:
officeFloorJndiName - OfficeFloor JNDI name.
officeName - Name of the Office within the OfficeFloor.
workName - Name of Work within the Office.
parameter - Parameter for the Work.
Throws:
NamingException - If fails to instigate the orchestration.

ejbCreate

@PostConstruct
public void ejbCreate()
               throws javax.ejb.EJBException
Validates the dependency injection of configuration available.

Throws:
javax.ejb.EJBException - If configuration is not dependency injected.

orchestrateRemotely

public <P> P orchestrateRemotely(P parameter)
                      throws NamingException
Description copied from interface: EjbOrchestratorRemote
Remotely orchestrates EJBs.

Specified by:
orchestrateRemotely in interface EjbOrchestratorRemote
Parameters:
parameter - Parameter for the initial Work of the OfficeFloor initiating the orchestration of the EJBs.
Returns:
As Remote invocations pass by value (serialised), the input parameter is returned to allow changes to the parameter to be obtained by the caller.
Throws:
NamingException

orchestrate

public void orchestrate(Object parameter)
                 throws NamingException
Description copied from interface: EjbOrchestrator
Orchestrates the EJBs.

Specified by:
orchestrate in interface EjbOrchestrator
Parameters:
parameter - Parameter for the initial Work of the OfficeFloor initiating the orchestration of the EJBs.
Throws:
NamingException


Copyright © 2005-2013. All Rights Reserved.