Date: 2004-01-20T12:55:26
   Editor: JacekLaskowski <[EMAIL PROTECTED]>
   Wiki: Apache Geronimo Wiki
   Page: OpenJCA
   URL: http://wiki.apache.org/geronimo/OpenJCA

   More details

Change Log:

------------------------------------------------------------------------------
@@ -1,19 +1,82 @@
- = "About" =
+= ''About'' =
 OpenJCA is a JCA JDBC Implementation. 
 
- = Building =
+= Building =
 
-* Get the source code of OpenJCA (openjca.tar.gz) from 
[http://sourceforge.net/tracker/index.php?func=detail&aid=880282&group_id=44351&atid=439277
 JCA Impl for OpenEJB] 
+ * Get the source code of OpenJCA version of openejb jca-jdbc wrapper from 
[http://sourceforge.net/tracker/index.php?func=detail&aid=880282&group_id=44351&atid=439277
 JCA Impl for OpenEJB] 
 
-* run {{{gzip -d openjca.tar.gz}}} followed by {{{tar -xvf openjca.tar}}} to 
extract the sources
+ * run {{{gzip -d openjca.tar.gz}}} followed by {{{tar -xvf openjca.tar}}} to 
extract the sources or simply {{{tar zxvf openjca\[1\].tar.gz}}} if you're 
lucky enough to work with GNU tar 
 
-* Go to openjca directory and run {{{maven build}}}
+ * Go to openjca directory and run {{{maven build}}}
 
-
- = Installing =
-
-* drop ''openjca\target\openejb-jca-DEV.jar'' into your 
''incubator-geronimo\target\geronimo-DEV\deploy'' and 
''incubator-geronimo\target\geronimo-DEV\lib'' directories
-
-* Start up Geronimo
-
-* Open up Geronimo web console (http://localhost:8080/geronimo-web-console) 
and enter ''geronimo.management:*'' as a filter. You should see 2 entries with 
petstoredb in the name.
+= Installing =
+
+NOTE: Unless stated otherwise, it's assumed the commands are performed from 
'''openjca''' directory.
+
+ * drop '''target/openejb-jca-DEV.jar''' into Geronimo's 
'''target/geronimo-DEV/lib''' 
+
+ * copy '''src/resources/META-INF''' directory to Geronimo's 
'''target/geronimo-DEV/deploy''' directory (or 
'''target/geronimo-DEV/petstore''' if you're installing PetStore, so it will 
become logically connected)
+
+ * Edit '''META-INF/geronimo-ra.xml''', which has already been copied to 
Geronimo's target/geronimo-DEV/deploy or other monitored directory (see step 
above), to reflect your requirements.
+
+META-INF/geronimo-ra.xml for PetStore that sets up a datasource to HSQL 
database with ''sa'' as a username and empty password. The name of the 
datasource is ''petstoredb'':
+
+ {{{
+<?xml version="1.0" encoding="UTF-8"?>
+
+<connector xmlns="http://org.apache.geronimo/xml/ns/j2ee";
+  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+  xsi:SchemaLocation="http://org.apache.geronimo/xml/ns/j2ee 
geronimo-connector_1_5.xsd">
+  <resourceadapter>
+    <outbound-resourceadapter>
+      <connection-definition>
+        
<connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
+        <name>petstoredb</name>
+        <config-property-setting name="DefaultUserName" 
>sa</config-property-setting>
+        <config-property-setting name="DefaultPassword" ><!-- empty 
--></config-property-setting>
+        <config-property-setting name="JdbcDriver" 
>org.hsqldb.jdbcDriver</config-property-setting>
+        <config-property-setting name="JdbcUrl" 
>jdbc:hsqldb:.</config-property-setting>
+        <connectionmanager-factory>
+          
<connectionmanagerfactory-descriptor>org.apache.geronimo.connector.outbound.ConnectionManagerDeployment</connectionmanagerfactory-descriptor>
+          <config-property-setting 
name="UseConnectionRequestInfo">false</config-property-setting>
+          <config-property-setting 
name="UseSubject">false</config-property-setting>
+          <config-property-setting 
name="UseTransactionCaching">true</config-property-setting>
+          <config-property-setting 
name="UseTransactions">true</config-property-setting>
+          <config-property-setting 
name="UseLocalTransactions">true</config-property-setting>
+          <config-property-setting name="MaxSize">100</config-property-setting>
+          <config-property-setting 
name="BlockingTimeout">5000</config-property-setting>
+          <config-property-setting 
name="Name">petstoredb</config-property-setting>
+        </connectionmanager-factory>
+      </connection-definition>
+    </outbound-resourceadapter>
+  </resourceadapter>
+</connector>}}}
+
+Using the datasource in an application boils down to declare the name of that 
datasource in Geronimo deployment descriptor, i.e. 
META-INF/geronimo-ejb-jar.xml for EJBs and WEB-INF/geronimo-web.xml for WARs.
+
+  i. Declaring a datasource in web applications is done using <jndi-name> 
element. It expects the name of a connection factory's JMX MBean. In other 
words, unless the name is visible in 
[http://localhost:8080/geronimo-web-console Geronimo Web Console], the 
datasource won't work for the web app.
+
+ {{{
+  <resource-ref>
+    <description>Allow the Fast Lane Reader Pattern to Read Catalog Data 
Directly via JDBC in the Web Tier</description>
+    <res-ref-name>jdbc/CatalogDB</res-ref-name>
+    <res-type>javax.sql.DataSource</res-type>
+    <res-auth>Container</res-auth>
+    
<jndi-name>geronimo.management:j2eeType=JCAManagedConnectionFactory,name=petstoredb</jndi-name>
+  </resource-ref>}}}
+
+  i. Declaring a datasource for CMP Entity EJBs is done using 
<datasource-name> element of <ejb-jar>. It expects the name of a datasource as 
declared in META-INF/geronimo-ra.xml of J2EECA JDBC implementation.
+
+ {{{
+  <datasource-name>petstoredb</datasource-name>
+}}}
+
+ * Start up Geronimo
+
+ * Open up Geronimo web console (http://localhost:8080/geronimo-web-console) 
and enter ''geronimo.management:*'' as a filter. You should see 2 entries with 
petstoredb in the name.
+
+ {{{
+geronimo.management
+  j2eeType=ConnectionManager,name=petstoredb 
+  j2eeType=JCAManagedConnectionFactory,name=petstoredb
+}}}

Reply via email to