...
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?> <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1"> <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1"> <dep:moduleId> <dep:groupId>default</dep:groupId> <dep:artifactId>BankEJB</dep:artifactId> <dep:version>1.0</dep:version> <dep:type>car</dep:type> </dep:moduleId> <dep:dependencies/> <dep:hidden-classes/> <dep:non-overridable-classes/> </dep:environment> <cmp-connection-factory> <resource-link>BankPool</resource-link> </cmp-connection-factory> <enterprise-beans> <session> <ejb-name>BankManagerFacadeBean</ejb-name> <jndi-name>org.apache.geronimo.samples.bank.ejb.BankManagerFacadeBean</jndi-name> <ejb-ref> <ref-name>ejb/Customer</ref-name> <ejb-link>Customer</ejb-link> </ejb-ref> <ejb-ref> <ref-name>ejb/Account</ref-name> <ejb-link>Account</ejb-link> </ejb-ref> <ejb-ref> <ref-name>ejb/ExchangeRate</ref-name> <ejb-link>ExchangeRate</ejb-link> </ejb-ref> </session> <entity> <ejb-name>Account</ejb-name> <local-jndi-name>AccountLocalEntity</local-jndi-name> <table-name>Account</table-name> <cmp-field-mapping> <cmp-field-name>accountNumber</cmp-field-name> <table-column>ACC_NO</table-column> </cmp-field-mapping> <cmp-field-mapping> <cmp-field-name>accountType</cmp-field-name> <table-column>ACC_TYPE</table-column> </cmp-field-mapping> <cmp-field-mapping> <cmp-field-name>customer</cmp-field-name> <table-column>CUSTID_FK</table-column> </cmp-field-mapping> <cmp-field-mapping> <cmp-field-name>balance</cmp-field-name> <table-column>BALANCE</table-column> </cmp-field-mapping> <resource-ref> <ref-name>jdbc/BankDataSource</ref-name> <resource-link>BankPool</resource-link> </resource-ref> </entity> <entity> <ejb-name>Customer</ejb-name> <local-jndi-name>CustomerLocalEntity</local-jndi-name> <table-name>Customer</table-name> <cmp-field-mapping> <cmp-field-name>customerId</cmp-field-name> <table-column>CUST_ID</table-column> </cmp-field-mapping> <cmp-field-mapping> <cmp-field-name>customerName</cmp-field-name> <table-column>CUST_NAME</table-column> </cmp-field-mapping> <resource-ref> <ref-name>jdbc/BankDataSource</ref-name> <resource-link>BankPool</resource-link> </resource-ref> </entity> <entity> <ejb-name>ExchangeRate</ejb-name> <local-jndi-name>ExchangeRate</local-jndi-name> <resource-ref> <ref-name>jdbc/BankDataSource</ref-name> <resource-link>BankPool</resource-link> </resource-ref> </entity> </enterprise-beans> <relationships> <ejb-relation> <ejb-relation-name>Customer-Account</ejb-relation-name> <ejb-relationship-role> <ejb-relationship-role-name>Account-to-Customer</ejb-relationship-role-name> <relationship-role-source> <ejb-name>Account</ejb-name> </relationship-role-source> <cmr-field> <cmr-field-name>customer</cmr-field-name> </cmr-field> <foreign-key-column-on-source/> <role-mapping> <cmr-field-mapping> <key-column>CUST_ID</key-column> <foreign-key-column>CUSTID_FK</foreign-key-column> </cmr-field-mapping> </role-mapping> </ejb-relationship-role> </ejb-relation> </relationships> </openejb-jar> |
The Structural over view of EJB Deployment Plan
In a Ejb Deployment plan there are main attributes defined in the top.
configIdrequiting
A unique name identifying this module. If deployed as a standalone EJB JAR, this name is used to identify the module to the deployment tool (to start, stop, undeploy, or redeploy the EJB JAR).
parentId
Identifies the parent configuration for this EJB JAR (the value specified here should match the configId for that module). If deployed as a standalone EJB JAR, this can be used to make the EJB JAR depend on another module such as another standalone EJB JAR or a J2EE Connector (or it should otherwise be omitted or set to the usual parent for J2EE modules, geronimo/j2ee-server/1.0/car).
inverseClassloading
If set to true, the class loader for the EJB JAR tries to load a class before checking whether the class is available from its parent class loader. configId
A unique name identifying this module. If deployed as a standalone EJB JAR, this name is used to identify the module to the deployment tool (to start, stop, undeploy, or redeploy the EJB JAR).
parentId
Identifies the parent configuration for this EJB JAR (the value specified here should match the configId for that module). If deployed as a standalone EJB JAR, this can be used to make the EJB JAR depend on another module such as another standalone EJB JAR or a J2EE Connector (or it should otherwise be omitted or set to the usual parent for J2EE modules, geronimo/j2ee-server/1.0/car). If deployed as part of an EAR this is usually not necessary, as EAR configuration will be the parent of this module.
inverseClassloading
If set to true, the class loader for the EJB JAR tries to load a class before checking whether the class is available from its parent class loader. If omitted or set to false, the normal (check parent first) class loader delegation behavior is used
There are some typical contents of the Geronimo EJB Deployment Plan has been identified as and it has described follows.
Security settings indicating which users and roles should be able to access secure EJBs or secure EJB methods
Details to resolve EJB references, resource references, and web services references declared by EJBs in the ejb-jar.xml deployment descriptor. This isn't always necessary for EJB references (which may be resolved using an ejb-link in the ejb-jar.xml) but generally is for the other types of references.
JNDI names for each EJB, used by remote clients attempting to connect to the EJB.
Web Services settings, for session beans exposed as web services.
Database pool, table, column, query, and relationship information for CMP Entity Beans.
JMS mapping information for Message-Driven Beans.
For the simplest EJB JARs these settings may not be required or the defaults may be sufficient, but in most cases the Geronimo EJB deployment plan will need a substantial amount of information.
As usual in other geronimo deployment plans open-ejb.jar has specific structure and element followed in an order.
Geronimo class path settings
The elements in the classloader-infoGroup are used to customized the EJB JAR's class.There are four elements need to be discussed under class path settings.
import
Refers to another configuration deployed in the server. That configuration will be added as a parent of this one (a configuration may have more than one parent). The main effect is that the class loader for the EJB JAR will add the class loader for that configuration as a parent. Additionally, the parent configuration will be started before the EJB JAR.
dependency
Adds a third-party library to the class path for the EJB JAR. Any common libraries used in this manner should be located in a subdirectory of the repository/ directory of the main Geronimo installation.
hidden-classes
Lists packages or classes that may be in a parent class loader, but should not be exposed from there to the EJB JAR. This is typically used when the EJB JAR wants to use a different version of a library that one of its parent configurations (or Geronimo itself) uses.
non-overridable-classes
Lists packages or classes that the EJB JAR should always load from a parent class loader, and never load from its own class loader. This might be used to force an EJB to share the same instance of a common library with other applications or modules, even if they each include it in their own class path.
filter
Used to list classes or packages. The format is a comma-separated list of packages or fully-qualified class names (for example: javax.servlet,javax.ejb).
When Considering the JMS and MDB Sample given(link the sample application) and it dosen't have any dependencies and imports .
Code Block |
---|
<openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1" xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1" xmlns:security="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"> <sys:environment> <sys:moduleId> <sys:groupId>samples</sys:groupId> <sys:artifactId>OrderEjb</sys:artifactId> <sys:version>1.0</sys:version> <sys:type>car</sys:type> </sys:moduleId> h3. Deploying JAR containing Simple EJB application |
...
This section will cover Geronimo v1.1 deployment plan for the simple helloworld ejb. |
...
Here is the folder structure for the above simple application.Sample Application is available to download here |
...
[HelloWorld ejb |
...
Code Block | ||
---|---|---|
java | java | Sample|^HelloWorld.tar.gz]
{code:java}
HelloWorld
|_ejbModule
| |_org.geronimo.ejbsample
| | |_HelloBean
| | |_HelloHome
| | |_HelloObject
| |
| |_org.geronimo.ejbsample.client
| |_HelloWorld
|_META-INF
| |_ejb-jar.xml
| |_openejb-jar.xml
|
|_dist
|_build
|_build.xml
|
...