cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r155367 - in cocoon/trunk/src/blocks/ojb: WEB-INF/xconf/ java/org/apache/cocoon/ojb/ java/org/apache/cocoon/ojb/broker/ java/org/apache/cocoon/ojb/jdo/components/ java/org/apache/cocoon/ojb/odmg/components/ java/org/apache/cocoon/ojb/samples/ samples/forms/ samples/jdo/xsp/ samples/odmg/xsp/
Date Fri, 25 Feb 2005 20:22:17 GMT
Author: vgritsenko
Date: Fri Feb 25 12:22:13 2005
New Revision: 155367

URL: http://svn.apache.org/viewcvs?view=rev&rev=155367
Log:
stabilizing ojb

Added:
    cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDO.java   (props
changed)
      - copied unchanged from r155366, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDO.java
    cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDOImpl.java   (props
changed)
      - copied unchanged from r155366, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDOImpl.java
    cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMG.java   (props
changed)
      - copied unchanged from r155366, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMG.java
    cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMGImpl.java 
 (props changed)
      - copied unchanged from r155366, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMGImpl.java
Removed:
    cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/broker/
    cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMF.java
    cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMFImpl.java
    cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementation.java
    cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementationImpl.java
Modified:
    cocoon/trunk/src/blocks/ojb/WEB-INF/xconf/cocoon-ojb.xconf
    cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/ojb.roles
    cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/samples/EmployeeDAO.java
    cocoon/trunk/src/blocks/ojb/samples/forms/employee.js
    cocoon/trunk/src/blocks/ojb/samples/forms/success.xsp
    cocoon/trunk/src/blocks/ojb/samples/jdo/xsp/demo1.xsp
    cocoon/trunk/src/blocks/ojb/samples/odmg/xsp/demo1.xsp

Modified: cocoon/trunk/src/blocks/ojb/WEB-INF/xconf/cocoon-ojb.xconf
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/ojb/WEB-INF/xconf/cocoon-ojb.xconf?view=diff&r1=155366&r2=155367
==============================================================================
--- cocoon/trunk/src/blocks/ojb/WEB-INF/xconf/cocoon-ojb.xconf (original)
+++ cocoon/trunk/src/blocks/ojb/WEB-INF/xconf/cocoon-ojb.xconf Fri Feb 25 12:22:13 2005
@@ -33,12 +33,11 @@
              class="org.apache.cocoon.ojb.components.ConnectionFactoryImpl"
              logger="core.ojb"/>
 
-  <!-- OJB PersistenceBroker Interface -->
-  <ojb-pb logger="core.ojb.pb"/>
   <!-- OJB Persistent Manager Factory for JDO.
        Requires javax.jdo package.
-  <ojb-jdo class="org.apache.cocoon.ojb.jdo.components.JdoPMFImpl" logger="core.ojb.jdo"/>
+  <ojb-jdo logger="core.ojb.jdo"/>
   -->
+
   <!-- OJB ODMG Implementation Interface -->
   <ojb-odmg logger="core.ojb.odmg"/>
 

Copied: cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDO.java (from
r155366, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDO.java)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDO.java?view=diff&rev=155367&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDO.java&r1=155366&p2=cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDO.java&r2=155367
==============================================================================
    (empty)

Propchange: cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDO.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDO.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDOImpl.java
(from r155366, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDOImpl.java)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDOImpl.java?view=diff&rev=155367&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDOImpl.java&r1=155366&p2=cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDOImpl.java&r2=155367
==============================================================================
    (empty)

Propchange: cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDOImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDOImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMG.java (from
r155366, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMG.java)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMG.java?view=diff&rev=155367&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMG.java&r1=155366&p2=cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMG.java&r2=155367
==============================================================================
    (empty)

Propchange: cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMG.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMG.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMGImpl.java
(from r155366, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMGImpl.java)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMGImpl.java?view=diff&rev=155367&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMGImpl.java&r1=155366&p2=cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMGImpl.java&r2=155367
==============================================================================
    (empty)

Propchange: cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMGImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMGImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/ojb.roles
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/ojb.roles?view=diff&r1=155366&r2=155367
==============================================================================
--- cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/ojb.roles (original)
+++ cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/ojb.roles Fri Feb 25 12:22:13 2005
@@ -14,17 +14,14 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
+
 <!-- $Id$ -->
 <role-list>
-  <role name="org.apache.cocoon.ojb.broker.components.PBFactory"
-        shorthand="ojb-pb"
-        default-class="org.apache.cocoon.ojb.broker.components.PBFactoryImpl"/>
-
-  <role name="org.apache.cocoon.ojb.odmg.components.OdmgImplementation"
+  <role name="org.apache.cocoon.ojb.odmg.components.ODMG"
         shorthand="ojb-odmg"
-        default-class="org.apache.cocoon.ojb.odmg.components.OdmgImplementationImpl"/>
+        default-class="org.apache.cocoon.ojb.odmg.components.ODMGImpl"/>
 
-  <role name="org.apache.cocoon.ojb.jdo.components.JdoPMF"
+  <role name="org.apache.cocoon.ojb.jdo.components.JDO"
         shorthand="ojb-jdo"
-        default-class="org.apache.cocoon.ojb.jdo.components.JdoPMFImpl"/>
-</role-list>
\ No newline at end of file
+        default-class="org.apache.cocoon.ojb.jdo.components.JDOImpl"/>
+</role-list>

Modified: cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/samples/EmployeeDAO.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/samples/EmployeeDAO.java?view=diff&r1=155366&r2=155367
==============================================================================
--- cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/samples/EmployeeDAO.java (original)
+++ cocoon/trunk/src/blocks/ojb/java/org/apache/cocoon/ojb/samples/EmployeeDAO.java Fri Feb
25 12:22:13 2005
@@ -18,24 +18,25 @@
 import javax.jdo.PersistenceManager;
 import javax.jdo.Transaction;
 
-import org.apache.cocoon.ojb.jdo.components.JdoPMF;
+import org.apache.cocoon.ojb.jdo.components.JDO;
 import org.apache.cocoon.ojb.samples.bean.Employee;
 import org.apache.ojb.broker.Identity;
 import org.apache.ojb.broker.PersistenceBroker;
 import org.apache.ojb.broker.PersistenceBrokerFactory;
+
 /**
  *  Employee's Impl
  *
  * @author <a href="mailto:antonio@apache.org">Antonio Gallardo</a>
- * @version CVS $Id: EmployeeDAO.java,v 1.3 2004/03/05 13:02:02 bdelacretaz Exp $
+ * @version CVS $Id$
 */
 public class EmployeeDAO {
 
     public EmployeeDAO(){}
 
-    public void retrieve(Employee bean, JdoPMF pmf) {
-        /* 1. Get the PersistenceManager */
-        PersistenceManager persistenceManager = pmf.getPersistenceManager();
+    public void retrieve(Employee bean, JDO jdo) {
+        // 1. Get the PersistenceManager
+        PersistenceManager persistenceManager = jdo.getPersistenceManager();
         
         Employee e = new Employee();
         e.setId(bean.getId());
@@ -43,7 +44,7 @@
         Identity oid = new Identity(e, broker);
         
         Employee b = new Employee();
-        //	2. start transaction
+        // 2. start transaction
         persistenceManager.currentTransaction().begin();
         // 3. Get the Object based on the primary key
         b = (Employee) persistenceManager.getObjectById(oid, false);
@@ -53,9 +54,9 @@
         persistenceManager.currentTransaction().commit();
     }
 
-    public void insert(Employee e, JdoPMF pmf) {
-        /* 1. Get the PersistenceManager */
-        PersistenceManager persistenceManager = pmf.getPersistenceManager();
+    public void insert(Employee e, JDO jdo) {
+        // 1. Get the PersistenceManager
+        PersistenceManager persistenceManager = jdo.getPersistenceManager();
         // 2. Get current transaction
         Transaction tx = persistenceManager.currentTransaction();
         // 3. Start a Transaction
@@ -66,9 +67,9 @@
         tx.commit();
     }
 
-    public void update(Employee bean, JdoPMF pmf) {
-        /* 1. Get the PersistenceManager */
-        PersistenceManager persistenceManager = pmf.getPersistenceManager();
+    public void update(Employee bean, JDO jdo) {
+        // 1. Get the PersistenceManager
+        PersistenceManager persistenceManager = jdo.getPersistenceManager();
         
         Employee e = new Employee();
         e.setId(bean.getId());
@@ -76,7 +77,7 @@
         Identity oid = new Identity(e, broker);
         
         Employee b = new Employee();
-        //	2. start transaction
+        // 2. start transaction
         persistenceManager.currentTransaction().begin();
         // 3. Get the Object based on the primary key
         b = (Employee) persistenceManager.getObjectById(oid, false);
@@ -88,9 +89,9 @@
         persistenceManager.currentTransaction().commit();
     }
 
-    public void remove(Employee bean, JdoPMF pmf) {
-        /* 1. Get the PersistenceManager */
-        PersistenceManager persistenceManager = pmf.getPersistenceManager();
+    public void remove(Employee bean, JDO jdo) {
+        // 1. Get the PersistenceManager
+        PersistenceManager persistenceManager = jdo.getPersistenceManager();
         
         Employee e = new Employee();
         e.setId(bean.getId());
@@ -98,7 +99,7 @@
         Identity oid = new Identity(e, broker);
         
         Employee b = new Employee();
-        //	2. start transaction
+        // 2. start transaction
         persistenceManager.currentTransaction().begin();
         // 3. Get the Object based on the primary key
         b = (Employee) persistenceManager.getObjectById(oid, false);

Modified: cocoon/trunk/src/blocks/ojb/samples/forms/employee.js
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/ojb/samples/forms/employee.js?view=diff&r1=155366&r2=155367
==============================================================================
--- cocoon/trunk/src/blocks/ojb/samples/forms/employee.js (original)
+++ cocoon/trunk/src/blocks/ojb/samples/forms/employee.js Fri Feb 25 12:22:13 2005
@@ -17,7 +17,7 @@
 
 function employeeform_jdo(form) {
     // Get OJB factory
-    var factory = cocoon.getComponent(Packages.org.apache.cocoon.ojb.jdo.components.JdoPMF.ROLE);
+    var factory = cocoon.getComponent(Packages.org.apache.cocoon.ojb.jdo.components.JDO.ROLE);
 
     // Create a empty Bean
     var bean = new Packages.org.apache.cocoon.ojb.samples.bean.Employee();

Modified: cocoon/trunk/src/blocks/ojb/samples/forms/success.xsp
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/ojb/samples/forms/success.xsp?view=diff&r1=155366&r2=155367
==============================================================================
--- cocoon/trunk/src/blocks/ojb/samples/forms/success.xsp (original)
+++ cocoon/trunk/src/blocks/ojb/samples/forms/success.xsp Fri Feb 25 12:22:13 2005
@@ -17,7 +17,7 @@
 <xsp:page language="java" xmlns:xsp="http://apache.org/xsp">
 
   <xsp:structure>
-    <xsp:include>org.apache.cocoon.ojb.jdo.components.JdoPMF</xsp:include>
+    <xsp:include>org.apache.cocoon.ojb.jdo.components.JDO</xsp:include>
     <xsp:include>org.apache.cocoon.ojb.samples.EmployeeDAO</xsp:include>
     <xsp:include>org.apache.cocoon.ojb.samples.bean.Employee</xsp:include>
     <xsp:include>org.apache.cocoon.forms.formmodel.*</xsp:include>
@@ -27,10 +27,10 @@
     <title>Storing employee in database succeeded.</title>
     <content>
       <xsp:logic>
-        Form form = (Form)request.getAttribute("employeeform");
-        Field fid = (Field)form.lookupWidget("id");
-        Field fname = (Field)form.lookupWidget("name");
-        Field fdepartment_id = (Field)form.lookupWidget("department_id");
+        Form form = (Form) request.getAttribute("employeeform");
+        Field fid = (Field) form.lookupWidget("id");
+        Field fname = (Field) form.lookupWidget("name");
+        Field fdepartment_id = (Field) form.lookupWidget("department_id");
       </xsp:logic>
       <p>The values of the form:</p>
       ID: <xsp:expr>fid.getValue()</xsp:expr>
@@ -43,10 +43,10 @@
 
       <p>The values retrieved from the database:</p>
       <xsp:logic>
-        JdoPMF factory = null;
+        JDO factory = null;
         Employee bean = null;
         try {
-            factory = (JdoPMF)manager.lookup(JdoPMF.ROLE);
+            factory = (JDO) manager.lookup(JDO.ROLE);
 
             bean = new Employee();
             EmployeeDAO dao = new EmployeeDAO();

Modified: cocoon/trunk/src/blocks/ojb/samples/jdo/xsp/demo1.xsp
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/ojb/samples/jdo/xsp/demo1.xsp?view=diff&r1=155366&r2=155367
==============================================================================
--- cocoon/trunk/src/blocks/ojb/samples/jdo/xsp/demo1.xsp (original)
+++ cocoon/trunk/src/blocks/ojb/samples/jdo/xsp/demo1.xsp Fri Feb 25 12:22:13 2005
@@ -24,54 +24,51 @@
 
 <xsp:page language="java" xmlns:xsp="http://apache.org/xsp">
 
-	<xsp:structure>
-		<xsp:include>javax.jdo.PersistenceManager</xsp:include>
-		<xsp:include>javax.jdo.Transaction</xsp:include>
-		<xsp:include>org.apache.cocoon.ojb.jdo.components.JdoPMF</xsp:include>
-		<xsp:include>javax.jdo.Transaction</xsp:include>
-		<xsp:include>org.apache.cocoon.ojb.samples.bean.Department</xsp:include>
-	</xsp:structure>
+  <xsp:structure>
+    <xsp:include>javax.jdo.PersistenceManager</xsp:include>
+    <xsp:include>javax.jdo.Transaction</xsp:include>
+    <xsp:include>org.apache.cocoon.ojb.jdo.components.JDO</xsp:include>
+    <xsp:include>javax.jdo.Transaction</xsp:include>
+    <xsp:include>org.apache.cocoon.ojb.samples.bean.Department</xsp:include>
+  </xsp:structure>
 
-	<xsp:init-page>
-		JdoPMF pmf = null;
-		PersistenceManager persistenceManager = null;
-		Department bean = new Department();
-		String s;
-	</xsp:init-page>
+  <page>
+    <content>
+      <title>Hello</title>
+      <para>This is my first Cocoon page with OJB!</para>
+      <xsp:logic>
+        JDO jdo = null;
+        try {
+          /* Get the PersistenceManager */
+          PersistenceManager persistenceManager = null;
+          try {
+            jdo = (JDO) manager.lookup(JDO.ROLE);
+            persistenceManager = jdo.getPersistenceManager();
+          } catch (ComponentException cme) {
+            getLogger().error("Could not look up the PersistenceManager", cme);
+          }
 
-	<page>
-		<content>
-			<title>Hello</title>
-			<para>This is my first Cocoon page with OJB!</para>
-			<xsp:logic>
-			try {
-				/* Get the PersistenceManager */
-				try {
-					pmf = (JdoPMF) manager.lookup(JdoPMF.ROLE);
-					persistenceManager = pmf.getPersistenceManager();
-				} catch (ServiceException cme) {
-					getLogger().error("Could not look up the PersistenceManager", cme);
-				}
-				<!-- Setting up the Bean -->
-				bean.setId(5);
-				bean.setName("JDO Development");
-				<!-- 2. Get current transaction -->
-				Transaction tx = persistenceManager.currentTransaction();
-				<!-- 3. Start a Transaction -->
-				tx.begin();
-				<!-- 4. now perform persistence operations. Store the new user -->
-				persistenceManager.makePersistent(bean);
-				<!-- 5. Commit the transaction  -->
-				tx.commit();
-                s = bean.getId() + " : " + bean.getName();
-			</xsp:logic>
-			<p> Inserted data: <xsp:expr>s</xsp:expr> </p>
-			<xsp:logic>
-			}
-			finally {
-				manager.release((Component)pmf);
-			}
-		</xsp:logic>
-		</content>
-	</page>
+          <!-- Setting up the Bean -->
+          Department bean = new Department();
+          bean.setId(5);
+          bean.setName("JDO Development");
+          <!-- 2. Get current transaction -->
+          Transaction tx = persistenceManager.currentTransaction();
+          <!-- 3. Start a Transaction -->
+          tx.begin();
+          <!-- 4. now perform persistence operations. Store the new user -->
+          persistenceManager.makePersistent(bean);
+          <!-- 5. Commit the transaction  -->
+          tx.commit();
+
+          <p>
+            Inserted data: <xsp:expr>bean.getId() + " : " + bean.getName()</xsp:expr>
+          </p>
+
+        } finally {
+          manager.release(jdo);
+        }
+      </xsp:logic>
+    </content>
+  </page>
 </xsp:page>

Modified: cocoon/trunk/src/blocks/ojb/samples/odmg/xsp/demo1.xsp
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/ojb/samples/odmg/xsp/demo1.xsp?view=diff&r1=155366&r2=155367
==============================================================================
--- cocoon/trunk/src/blocks/ojb/samples/odmg/xsp/demo1.xsp (original)
+++ cocoon/trunk/src/blocks/ojb/samples/odmg/xsp/demo1.xsp Fri Feb 25 12:22:13 2005
@@ -16,7 +16,7 @@
 -->
 
 <!--
- * Simple demo that insert a row into hsqldb using OJB with JDO
+ * Simple demo that insert a row into hsqldb using OJB with ODMG
  *
  * @author <a href="mailto:antonio@apache.org>Antonio Gallardo</a>
  * @version CVS $Revision: 1.3 $ $Date: 2004/03/17 11:28:20 $
@@ -24,56 +24,53 @@
 
 <xsp:page language="java" xmlns:xsp="http://apache.org/xsp">
 
-	<xsp:structure>
-		<xsp:include>org.apache.cocoon.ojb.odmg.components.OdmgImplementation</xsp:include>
-		<xsp:include>org.apache.cocoon.ojb.samples.bean.Department</xsp:include>
-		<xsp:include>org.odmg.Implementation</xsp:include>
-		<xsp:include>org.odmg.Transaction</xsp:include>
-		<xsp:include>org.odmg.ODMGException</xsp:include>
-	</xsp:structure>
-
-	<xsp:init-page>
-		OdmgImplementation odmgImpl = null;
-		Implementation impl = null;
-		Department bean = new Department();
-		String s;
-	</xsp:init-page>
-
-	<page>
-		<content>
-			<title>Hello</title>
-			<para>This is my first Cocoon page with OJB!</para>
-			<xsp:logic>
-			try {
-				/* Get the PersistenceManager */
-				try {
-          odmgImpl = (OdmgImplementation)manager.lookup( OdmgImplementation.ROLE );
-          impl = odmgImpl.getInstance( "personnel" );
-				} catch (ServiceException cme) {
-					getLogger().error("Could not look up the ODMG Implementation", cme);
-				} catch (ODMGException oe) {
-					getLogger().error("Failed to instantiate ODMG Implementation", oe);
-				}
-				<!-- Setting up the Bean -->
-				bean.setId(6);
-				bean.setName("ODMG Development");
-				<!-- 2. Get current transaction -->
-				Transaction tx = impl.newTransaction();
-				<!-- 3. Start a Transaction -->
-				tx.begin();
-				<!-- 4. now perform persistence operations. Store the new Department -->
-				tx.lock(bean, Transaction.WRITE);;
-				<!-- 5. Commit the transaction  -->
-				tx.commit();
-        s = bean.getId() + " : " + bean.getName();
-			</xsp:logic>
-			<p> Inserted data: <xsp:expr>s</xsp:expr> </p>
-			<xsp:logic>
-			}
-			finally {
-				manager.release(odmgImpl);
-			}
-		</xsp:logic>
-		</content>
-	</page>
+  <xsp:structure>
+    <xsp:include>org.apache.cocoon.ojb.odmg.components.ODMG</xsp:include>
+    <xsp:include>org.apache.cocoon.ojb.samples.bean.Department</xsp:include>
+    <xsp:include>org.odmg.Implementation</xsp:include>
+    <xsp:include>org.odmg.Transaction</xsp:include>
+    <xsp:include>org.odmg.ODMGException</xsp:include>
+  </xsp:structure>
+
+  <page>
+    <content>
+      <title>Hello</title>
+      <para>This is my first Cocoon page with OJB!</para>
+      <xsp:logic>
+        ODMG odmg = null;
+        try {
+          /* Get the implementation */
+          Implementation impl = null;
+          try {
+            odmg = (ODMG) manager.lookup(ODMG.ROLE);
+            impl = odmg.getInstance("personnel");
+          } catch (ComponentException cme) {
+            getLogger().error("Could not look up the ODMG Implementation", cme);
+          } catch (ODMGException oe) {
+            getLogger().error("Failed to instantiate ODMG Implementation", oe);
+          }
+
+          <!-- Setting up the Bean -->
+          Department bean = new Department();
+          bean.setId(6);
+          bean.setName("ODMG Development");
+          <!-- 2. Get current transaction -->
+          Transaction tx = impl.newTransaction();
+          <!-- 3. Start a Transaction -->
+          tx.begin();
+          <!-- 4. now perform persistence operations. Store the new Department -->
+          tx.lock(bean, Transaction.WRITE);;
+          <!-- 5. Commit the transaction  -->
+          tx.commit();
+
+          <p>
+            Inserted data: <xsp:expr>bean.getId() + " : " + bean.getName()</xsp:expr>
+          </p>
+
+        } finally {
+          manager.release(odmg);
+        }
+      </xsp:logic>
+    </content>
+  </page>
 </xsp:page>



Mime
View raw message