User: oleg    
  Date: 00/09/13 08:04:00

  Added:       castorjdo README.txt
  Log:
  Castor JDO MBean (public draft :-)
  
  Revision  Changes    Path
  1.1                  contrib/castorjdo/README.txt
  
  Index: README.txt
  ===================================================================
  This is a MBean for jBoss 2.0 that makes it possible to use Castor JDO
  DataObjects factories as bean resources.
  
  o--------------------o
  
  HOW TO BUILD IT :
  
  * Checkout modules "jboss" and "contrib" from CVS.
  
  * Build jBoss: go to jboss\src\build and run build.bat or build.sh
  
  * Build the CastorJDO MBean: go to contrib\castorjdo\src\build
  and run build.bat or build.sh
  
  * The result is a jar file contrib\castorjdo\dist\jboss-castorjdo.jar 
  You will also need a Castor jar contrib\castorjdo\lib\castor-0.8.8.jar
  
  
  o--------------------o
  
  HOW TO USE IT :
  
  * Put the castor jar (available from http://castor.exolab.org) and
  the CastorJDO MBean jar in lib/ext directory .
  By now you also have to put there the xerces.jar.
  
  * Add the Mlet in jboss.conf
  
  <MLET CODE = "org.jboss.jdo.castor.CastorJDOImpl" 
ARCHIVE="jboss.jar,castor-0.8.8.jar" CODEBASE="../lib/ext/">
     <ARG TYPE="java.lang.String" VALUE="../conf/database.xml">
     <ARG TYPE="java.lang.String" VALUE="dataObjectsJndiName">
     <ARG TYPE="java.lang.Integer" VALUE="0">
     <ARG TYPE="java.lang.Boolean" VALUE="false">
  </MLET>
  
  where:
   - the first parameter is the database configuration file needed by
     the Castor JDO, it contains JNDI name of JDBC DataSource and
     reference(s) to mapping configuration file(s), e.g.:
  
      <database name="test" engine="oracle" >
          <jndi name="dataSourceJndiName"/>
          <mapping href="../conf/mapping.xml" />
      </database>
  
  
     It is recommended to place it in "conf" directory or in one of its
     subdirectories as well as mapping configuration file(s). 
     At least, don't place them to your EJB jar files.
     See Castor documentation for further info on the content of the
     Castor configuration files.
   - the second parameter is the JNDI name that is used for binding bean
     resource references. See below.
   - the third parameter is a lock timeout in seconds, value "0" means
     "use the Castor default value" (which now equals 10 seconds).
   - the fourth parameter flag of logging. When you set it to true,
     the CastorJDO MBean sends information messages and warnings to
     jBoss loggers. 
  
  * Declare the resource managers in your jboss.xml besides your 
  ejb-jar.xml, e.g.:
       <resource-managers>
          <resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
              <res-name>dataSourceNameForBean</res-name>
              <res-jndi-name>dataSourceJndiName</res-jndi-name>
          </resource-manager>
          <resource-manager res-class="org.jboss.ejb.deployment.CastorJDOResource">
              <res-name>dataObjectsNameForBean</res-name>
              <res-jndi-name>dataObjectsJndiName</res-jndi-name>
         </resource-manager>
       </resource-managers>
  
  
  * Declare the resource manager JNDI ENC for the beans in ejb-jar.xml, e.g.:
  
       <resource-ref>
          <description>DataObjects factory</description>
          <res-ref-name>dataObjectsNameForBean</res-ref-name>
          <res-type>org.exolab.castor.jdo.DataObjects</res-type>
          <res-auth>Container</res-auth>
       </resource-ref>
  
  It is recommended to start JNDI names for JDO resources with "jdo/"
  (e.g, the bean JNDI name might be "java:comp/env/jdo/myjdo").
  
  * Get the JDO object in your Session bean as :
  
  a_method () {
      InitialContext ic = new InitialContext();
      DataObjects jdo = (DataObjects) ic.lookup("java:comp/env/jdo/myjdo");
      Database db = jdo.getDatabase();
      db.create (obj1);
      [...]
      db.remove(obj2);
      [...] 
      whatever action on db
      db.close();
  }
  
  
  o--------------------o
  
  AUTHORS
  
  Oleg Nitz <[EMAIL PROTECTED]>
  Sebastien Sahuc <[EMAIL PROTECTED]>
  
  
  
  

Reply via email to