JEE
Using the Imixs JEE Components in a Java Enterprise Application is really simple as all components follow the JEE specification and so these components can be included in any EAR very easy. The following section describes the steps integrating the Imixs JEE Components into an Enterprise Archive (EAR).
Basicly the Imixs JEE Components can be added as simple Java libraries (JARs) to your Java Application. If you are building an Enterprise Archive (EAR) thin can be done by simply adding the libraries into the /lib folder of your archive. So the libraries are available to all components of your application.
So a typical folder structure of an EAR looks like this:
/ +- lib/ | +- imixs-workflow-api-x.x.x.jar | +- imixs-workflow-jee-x.x.x.jar | +- imixs-workflow-jee-impl-x.x.x.jar +- my_ejb_module.jar +- my_web_module.war +- ...
where 'my_ejb_module' and 'my_web_module' represent the main modules of the enterprise Application.
If you are using the Imixs JEE Components there is no need to implement any EJBs by yourself. You can access the Imixs JEE Components easily form your web module without coding any EJB 3.0 stuff!
To activate the Imixs JEE Components and make them visible to your other JEE Modules you need at least to define the JEE EJB Deployment descriptors. These discriptor Files tell the JEE Server that you want to activate the JEE COmponents provided in the /lib folder of your enterprise archive (EAR).
So if you have not an EJB module defined yet you need to add an empty EJB module folder with a META-INF folder were you can place the necessary descriptors
The persistence.xml file describes how the Entities of the Imixs Workflow System will be stored into a Database. This discriptor file depends on the Application Server and Database Server Vendor. The following example shows a typical configuration.
<persistence>
<persistence-unit name="org.imixs.workflow.jee.jpa">
<jta-data-source>jdbc/workflow-db</jta-data-source>
<properties>
<!--Enable the java2db feature drop-and-create-tables create-tables -->
<property name="toplink.ddl-generation"
value="create-tables" />
</properties>
<!-- Make sure that the library version maches the library included in ear/lib -->
<jar-file>lib/imixs-workflow-jee-0.0.2-SNAPSHOT.jar</jar-file>
</persistence-unit>
</persistence>
There are three important tags:
The persistence unit name is fixed defined by the Imixs JEE Workflow Implementation and need to be set to "org.imixs.workflow.jee.jpa" which is the package name of the Entity EJBs provided by the Imixs JEE Implementation.
The jta-data-source points to a JNDI Database resource located on the Application server. This JNDI Name is a JDBC Resource which is provided by the Application Server running the Application. In Glassfish Server a JDBC Resource can be defined in the Section Resources - JDBC
The jar-file defines the java library containing the Entity EJBs to be stored in the Database. This tag should allways point to the imixs-workflow-jee Jar File. Take care about the version number used by your application.
In the example the jta-data-source point to a JDBC Ressource with the JNDI Name 'jdbc/workflow-db' and the jar-file points to the imixs-workflow-jee Implementation with the Version number 0.0.2-SNAPSHOT
The ejb-jar.xml defines wich EJB should be visible to your application modules. If you have not special requriements this is the default descriptor used in any application which is using the Imixs JEE Componets
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
version="3.0">
<enterprise-beans>
<session>
<ejb-name>EntityServiceBean</ejb-name>
<ejb-class>org.imixs.workflow.jee.ejb.EntityServiceBean</ejb-class>
<session-type>Stateless</session-type>
</session>
<session>
<ejb-name>ModelServiceBean</ejb-name>
<ejb-class>org.imixs.workflow.jee.ejb.ModelServiceBean</ejb-class>
<session-type>Stateless</session-type>
</session>
<session>
<ejb-name>WorkflowServiceBean</ejb-name>
<ejb-class>org.imixs.workflow.jee.ejb.WorkflowServiceBean</ejb-class>
<session-type>Stateless</session-type>
</session>
<session>
<ejb-name>ReportServiceBean</ejb-name>
<ejb-class>org.imixs.workflow.jee.ejb.ReportServiceBean</ejb-class>
<session-type>Stateless</session-type>
</session>
<!-- WebServices -->
<session>
<ejb-name>ModelWebServiceBean</ejb-name>
<ejb-class>org.imixs.workflow.jee.ws.ModelWebServiceBean</ejb-class>
<session-type>Stateless</session-type>
</session>
<session>
<ejb-name>WorkflowWebServiceBean</ejb-name>
<ejb-class>org.imixs.workflow.jee.ws.WorkflowWebServiceBean</ejb-class>
<session-type>Stateless</session-type>
</session>
<session>
<ejb-name>ReportWebServiceBean</ejb-name>
<ejb-class>org.imixs.workflow.jee.ws.ReportWebServiceBean</ejb-class>
<session-type>Stateless</session-type>
</session>
</enterprise-beans>
<assembly-descriptor>
</assembly-descriptor>
</ejb-jar>
The sun-ejb-jar.xml is necessary on Glassfish server. This descriptor defines unique JNDI names for all Imixs JEE Components and also makes the WebServices provied by the Imixs JEE Components visible to clients:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
<sun-ejb-jar>
<enterprise-beans>
<!-- Imixs Workflow Service EJBs - JNDI Definition -->
<ejb>
<ejb-name>EntityServiceBean</ejb-name>
<jndi-name> ejb/ImixsAppEntityServiceBean </jndi-name>
</ejb>
<ejb>
<ejb-name>ModelServiceBean</ejb-name>
<jndi-name>ejb/ImixsAppModelServiceBean</jndi-name>
</ejb>
<ejb>
<ejb-name>WorkflowServiceBean</ejb-name>
<jndi-name> ejb/ImixsAppWorkflowServiceBean
</jndi-name>
</ejb>
<ejb>
<ejb-name>ReportServiceBean</ejb-name>
<jndi-name> ejb/ImixsAppReportServiceBean</jndi-name>
</ejb>
<!-- Imixs Workflow WebServices Definition -->
<ejb>
<ejb-name>ModelWebServiceBean</ejb-name>
<jndi-name>ejb/ImixsAppModelWebServiceBean</jndi-name>
<webservice-endpoint>
<port-component-name>WorkflowModelService</port-component-name>
<endpoint-address-uri>ImixsAppWorkflowModelService</endpoint-address-uri>
<login-config>
<auth-method>BASIC</auth-method>
<realm>imixsrealm</realm>
</login-config>
</webservice-endpoint>
</ejb>
<ejb>
<ejb-name>WorkflowWebServiceBean</ejb-name>
<jndi-name> ejb/ImixsAppWorkflowWebServiceBean
</jndi-name>
<webservice-endpoint>
<port-component-name> WorkflowManagerService </port-component-name>
<endpoint-address-uri> ImixsAppWorkflowManagerService
</endpoint-address-uri>
<login-config>
<auth-method>BASIC</auth-method>
<realm>imixsrealm</realm>
</login-config>
</webservice-endpoint>
</ejb>
<ejb>
<ejb-name>ReportWebServiceBean</ejb-name>
<jndi-name> ejb/ImixsAppReportWebServiceBean
</jndi-name>
<webservice-endpoint>
<port-component-name> WorkflowReportService </port-component-name>
<endpoint-address-uri> ImixsAppWorkflowReportService
</endpoint-address-uri>
<login-config>
<auth-method>BASIC</auth-method>
<realm>imixsrealm</realm>
</login-config>
</webservice-endpoint>
</ejb>
</enterprise-beans>
</sun-ejb-jar>
If you want to make the Web Services visible to all clients you need to add the wsdl files into your EJB module because these files can not be read by glassfish form the JARs. You will find the wsdl files in the imixs-workflow.jee-impl JAR. So you can open this jar with something like winzip and copy the wsdl folder into your META-INF dirictory form you EJB module
Finally your EJB module contains only a few xml files unter the META-INF diretory and looks like this example :
/ +- META-INF/ | +- wsdl/ | | +- ix_dataobjects.xsd | | +- ix_modelservice.wsdl | | +- ix_reportervice.wsdl | | +- ix_workflowservice.wsdl | +- ejb-jar.xml | +- persistence.xml | +- sun-ejb-jar.xml
Thats it! No Java source coude is needed.