cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r155366 - in cocoon/branches/BRANCH_2_1_X/src/blocks: javaflow/java/org/apache/cocoon/samples/flow/java/ ojb/conf/ ojb/java/org/apache/cocoon/ojb/broker/ ojb/java/org/apache/cocoon/ojb/jdo/components/ ojb/java/org/apache/cocoon/ojb/odmg/components/ ojb/java/org/apache/cocoon/ojb/samples/ ojb/samples/forms/ ojb/samples/jdo/xsp/ ojb/samples/odmg/xsp/ ojb/samples/pb/xsp/
Date Fri, 25 Feb 2005 19:54:15 GMT
Author: vgritsenko
Date: Fri Feb 25 11:54:12 2005
New Revision: 155366

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

Added:
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDO.java
      - copied, changed from r155331, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMF.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDOImpl.java
      - copied, changed from r155331, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMFImpl.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMG.java
      - copied, changed from r155331, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementation.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMGImpl.java
      - copied, changed from r155331, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementationImpl.java
Removed:
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-pb.xconf
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-pb.xroles
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/broker/
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMF.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMFImpl.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementation.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementationImpl.java
Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/javaflow/java/org/apache/cocoon/samples/flow/java/PersistenceFlow.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-jdo.xroles
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-odmg.xroles
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/samples/EmployeeDAO.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/forms/employee.js
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/forms/success.xsp
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/jdo/xsp/demo1.xsp
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/odmg/xsp/demo1.xsp
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/pb/xsp/demo1.xsp

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/javaflow/java/org/apache/cocoon/samples/flow/java/PersistenceFlow.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/javaflow/java/org/apache/cocoon/samples/flow/java/PersistenceFlow.java?view=diff&r1=155365&r2=155366
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/javaflow/java/org/apache/cocoon/samples/flow/java/PersistenceFlow.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/javaflow/java/org/apache/cocoon/samples/flow/java/PersistenceFlow.java
Fri Feb 25 11:54:12 2005
@@ -15,35 +15,36 @@
  */
 package org.apache.cocoon.samples.flow.java;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-
 import org.apache.cocoon.components.flow.java.AbstractContinuable;
 import org.apache.cocoon.components.flow.java.Continuable;
 import org.apache.cocoon.components.flow.java.VarMap;
 import org.apache.cocoon.forms.binding.BindingException;
 import org.apache.cocoon.forms.flow.java.FormInstance;
-import org.apache.cocoon.ojb.broker.components.PBFactory;
 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;
 import org.apache.ojb.broker.query.Criteria;
 import org.apache.ojb.broker.query.QueryByCriteria;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+
+/**
+ * @version $Id$
+ */
 public class PersistenceFlow extends AbstractContinuable {
 
-    private transient PersistenceBroker broker = null;
+    private transient PersistenceBroker broker;
 
     public PersistenceFlow() {
-        PBFactory factory = (PBFactory)getComponent(PBFactory.ROLE);
-        broker = factory.defaultPersistenceBroker();
-        releaseComponent(factory);
+        this.broker = PersistenceBrokerFactory.defaultPersistenceBroker();
     }
 
     public void doInsertEmployee() throws BindingException {
-
         // Create a empty Bean
         Employee employee = new Employee();
         // Fill some initial data to the bean
@@ -65,11 +66,10 @@
     }
 
     public void doUpdateEmployee() throws BindingException {
-
         // Get id as parameter
         int id = 1;
         if (getRequest().getParameter("id")!=null)
-            id = Integer.parseInt(getRequest().getParameter("id")); 
+            id = Integer.parseInt(getRequest().getParameter("id"));
         else
             throw new IllegalStateException("No parameter 'id'");
 
@@ -98,7 +98,6 @@
     }
 
     public void doRemoveEmployee() {
-
         // Get id as parameter
         int id = 1;
         if (getRequest().getParameter("id")!=null)
@@ -119,7 +118,6 @@
     }
 
     public void doShowEmployee() {
-
         // Query all objects
         ArrayList results = new ArrayList();
         QueryByCriteria query = new QueryByCriteria(Employee.class, new Criteria());
@@ -136,7 +134,7 @@
         public int compare(Object o1, Object o2) {
             return ((Employee)o1).getId()-((Employee)o2).getId();
         }
-      
+
         public boolean equals(Object obj) {
             return true;
         }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-jdo.xroles
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-jdo.xroles?view=diff&r1=155365&r2=155366
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-jdo.xroles (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-jdo.xroles Fri Feb 25 11:54:12 2005
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<xroles xpath="/role-list" unless="role[@name='org.apache.cocoon.ojb.jdo.components.JdoPMF']">
+<xroles xpath="/role-list" unless="role[@name='org.apache.cocoon.ojb.jdo.components.JDO']">
 
-  <role name="org.apache.cocoon.ojb.jdo.components.JdoPMF" shorthand="ojb-jdo" default-class="org.apache.cocoon.ojb.jdo.components.JdoPMFImpl"/>
+  <role name="org.apache.cocoon.ojb.jdo.components.JDO" shorthand="ojb-jdo" default-class="org.apache.cocoon.ojb.jdo.components.JDOImpl"/>
 </xroles>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-odmg.xroles
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-odmg.xroles?view=diff&r1=155365&r2=155366
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-odmg.xroles (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-odmg.xroles Fri Feb 25 11:54:12 2005
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<xroles xpath="/role-list" unless="role[@name='org.apache.cocoon.ojb.odmg.components.OdmgImplementation']">
+<xroles xpath="/role-list" unless="role[@name='org.apache.cocoon.ojb.odmg.components.ODMG']">
 
-  <role name="org.apache.cocoon.ojb.odmg.components.OdmgImplementation" shorthand="ojb-odmg"
default-class="org.apache.cocoon.ojb.odmg.components.OdmgImplementationImpl"/>
+  <role name="org.apache.cocoon.ojb.odmg.components.ODMG" shorthand="ojb-odmg" default-class="org.apache.cocoon.ojb.odmg.components.ODMGImpl"/>
 </xroles>

Copied: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDO.java
(from r155331, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMF.java)
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDO.java?view=diff&rev=155366&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMF.java&r1=155331&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDO.java&r2=155366
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMF.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDO.java
Fri Feb 25 11:54:12 2005
@@ -26,9 +26,9 @@
  * @author <a href="mailto:antonio@apache.org">Antonio Gallardo</a>
  * @version CVS $Id$
 */
-public interface JdoPMF extends Component {
+public interface JDO extends Component {
 
-    String ROLE = JdoPMF.class.getName();
+    String ROLE = JDO.class.getName();
 
     /**
      * Get a Persitence Manager.

Copied: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDOImpl.java
(from r155331, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMFImpl.java)
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDOImpl.java?view=diff&rev=155366&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMFImpl.java&r1=155331&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDOImpl.java&r2=155366
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMFImpl.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JDOImpl.java
Fri Feb 25 11:54:12 2005
@@ -25,18 +25,19 @@
 import javax.jdo.PersistenceManagerFactory;
 
 /**
- * Implementation of the JdoPMF. Create one PMF and store it for future use
+ * Implementation of the JDO component. Creates one PersistenceManagerFactory
+ * and stores it for the future use.
  *
  * @author <a href="mailto:antonio@apache.org">Antonio Gallardo</a>
  * @version CVS $Id$
 */
-public class JdoPMFImpl extends AbstractLogEnabled
-                        implements JdoPMF, ThreadSafe, Initializable {
+public class JDOImpl extends AbstractLogEnabled
+                     implements JDO, ThreadSafe, Initializable {
 
     protected PersistenceManagerFactory factory;
 
     /* (non-Javadoc)
-     * @see org.apache.cocoon.ojb.jdori.components.JdoPMF#getPersistenceManager()
+     * @see org.apache.cocoon.ojb.jdori.components.JDO#getPersistenceManager()
      */
     public PersistenceManager getPersistenceManager() {
         return this.factory.getPersistenceManager();

Copied: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMG.java
(from r155331, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementation.java)
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMG.java?view=diff&rev=155366&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementation.java&r1=155331&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMG.java&r2=155366
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementation.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMG.java
Fri Feb 25 11:54:12 2005
@@ -21,21 +21,22 @@
 import org.odmg.ODMGException;
 
 /**
- * Interface of the ODMG Implementation. It is used to get the Implementation Object to interact
with ODMG using OJB
+ * Interface component to the ODMG Implementation. It is used to get
+ * the ODMG Implementation object to interact with object database
+ * through ODMG API.
  *
  * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
  * @version CVS $Id$
  */
-public interface OdmgImplementation extends Component {
+public interface ODMG extends Component {
 
     /** The ROLE */
-    String ROLE = OdmgImplementation.class.getName();
+    String ROLE = ODMG.class.getName();
 
     /**
      * Get a ODMG Instance with default settings.
      *
      * @return a ODMG Implementation Object
-     *
      * @throws ODMGException DOCUMENT ME!
      */
     Implementation getInstance()
@@ -45,9 +46,7 @@
      * Get a ODMG Instance with a specific connection definition.
      *
      * @param connection The connection name to be used (OJB specific connection name)
-     *
      * @return a ODMG Implementation Object
-     *
      * @throws ODMGException DOCUMENT ME!
      */
     Implementation getInstance(String connection)
@@ -58,9 +57,7 @@
      *
      * @param connection The connection name to be used (OJB specific connection name)
      * @param mode The Database operation mode
-     *
      * @return a ODMG Implementation Object
-     *
      * @throws ODMGException DOCUMENT ME!
      */
     Implementation getInstance(String connection, int mode)
@@ -70,9 +67,7 @@
      * Get a ODMG Instance with a default connection definition and a Database operation
mode.
      *
      * @param mode The Database operation mode
-     *
      * @return a ODMG Implementation Object
-     *
      * @throws ODMGException DOCUMENT ME!
      */
     Implementation getInstance(int mode)

Copied: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMGImpl.java
(from r155331, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementationImpl.java)
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMGImpl.java?view=diff&rev=155366&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementationImpl.java&r1=155331&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMGImpl.java&r2=155366
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementationImpl.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/ODMGImpl.java
Fri Feb 25 11:54:12 2005
@@ -31,16 +31,17 @@
 import java.util.HashMap;
 
 /**
- * Implementation of the OdmgImplementation. Create a ODMG Implementation and store it for
future use
+ * OJB backed implementation of the ODMG component. Creates a ODMG Implementation
+ * Object and stores it for the future use.
  *
  * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
  * @version CVS $Id$
  */
-public class OdmgImplementationImpl extends AbstractLogEnabled
-                                    implements OdmgImplementation, ThreadSafe, Initializable,
Disposable {
+public class ODMGImpl extends AbstractLogEnabled
+                      implements ODMG, ThreadSafe, Initializable, Disposable {
 
-    private final static String DEFAULT_CONNECTION ="default";
-    private final static int DEFAULT_MODE = Database.OPEN_READ_WRITE;
+    private static final String DEFAULT_CONNECTION ="default";
+    private static final int DEFAULT_MODE = Database.OPEN_READ_WRITE;
 
     private Implementation odmg;
     private HashMap databases = new HashMap();
@@ -70,28 +71,28 @@
     }
 
     /* (non-Javadoc)
-     * @see org.apache.cocoon.ojb.odmg.components.Odmg#getInstance()
+     * @see org.apache.cocoon.ojb.odmg.components.ODMG#getInstance()
      */
     public Implementation getInstance() throws ODMGException {
         return getInstance(DEFAULT_CONNECTION, DEFAULT_MODE);
     }
 
     /* (non-Javadoc)
-     * @see org.apache.cocoon.ojb.odmg.components.Odmg#getInstance(java.lang.String)
+     * @see org.apache.cocoon.ojb.odmg.components.ODMG#getInstance(java.lang.String)
      */
     public Implementation getInstance(String connection) throws ODMGException {
         return getInstance(connection, DEFAULT_MODE);
     }
 
     /* (non-Javadoc)
-     * @see org.apache.cocoon.ojb.odmg.components.OdmgImplementation#getInstance(int)
+     * @see org.apache.cocoon.ojb.odmg.components.ODMG#getInstance(int)
      */
     public Implementation getInstance(int mode) throws ODMGException {
         return getInstance(DEFAULT_CONNECTION, mode);
     }
 
     /* (non-Javadoc)
-     * @see org.apache.cocoon.ojb.odmg.components.Odmg#getInstance(java.lang.String, int)
+     * @see org.apache.cocoon.ojb.odmg.components.ODMG#getInstance(java.lang.String, int)
      */
     public Implementation getInstance(String connection, int mode) throws ODMGException {
         synchronized (this.databases) {
@@ -99,7 +100,7 @@
             if (null == db) {
                 db = this.odmg.newDatabase();
                 db.open(connection, mode);
-                    this.databases.put(connection + ":" + mode, db);
+                this.databases.put(connection + ":" + mode, db);
             }
         }
         return this.odmg;

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/samples/EmployeeDAO.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/samples/EmployeeDAO.java?view=diff&r1=155365&r2=155366
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/samples/EmployeeDAO.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/samples/EmployeeDAO.java
Fri Feb 25 11:54:12 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/branches/BRANCH_2_1_X/src/blocks/ojb/samples/forms/employee.js
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/forms/employee.js?view=diff&r1=155365&r2=155366
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/forms/employee.js (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/forms/employee.js Fri Feb 25 11:54:12
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/branches/BRANCH_2_1_X/src/blocks/ojb/samples/forms/success.xsp
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/forms/success.xsp?view=diff&r1=155365&r2=155366
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/forms/success.xsp (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/forms/success.xsp Fri Feb 25 11:54:12
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/branches/BRANCH_2_1_X/src/blocks/ojb/samples/jdo/xsp/demo1.xsp
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/jdo/xsp/demo1.xsp?view=diff&r1=155365&r2=155366
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/jdo/xsp/demo1.xsp (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/jdo/xsp/demo1.xsp Fri Feb 25 11:54:12
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 (ComponentException 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/branches/BRANCH_2_1_X/src/blocks/ojb/samples/odmg/xsp/demo1.xsp
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/odmg/xsp/demo1.xsp?view=diff&r1=155365&r2=155366
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/odmg/xsp/demo1.xsp (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/odmg/xsp/demo1.xsp Fri Feb 25 11:54:12
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 (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 -->
-				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>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/pb/xsp/demo1.xsp
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/pb/xsp/demo1.xsp?view=diff&r1=155365&r2=155366
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/pb/xsp/demo1.xsp (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/pb/xsp/demo1.xsp Fri Feb 25 11:54:12
2005
@@ -16,7 +16,7 @@
 -->
 
 <!--
- * Simple demo that insert a row into hsqldb using OJB with PB
+ * Simple demo that inserts a row into hsqldb using OJB with PB
  *
  * @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,44 @@
 
 <xsp:page language="java" xmlns:xsp="http://apache.org/xsp">
 
-    <xsp:structure>
-        <xsp:include>org.apache.cocoon.ojb.broker.components.PBFactory</xsp:include>
-        <xsp:include>org.apache.cocoon.ojb.samples.bean.Department</xsp:include>
-        <xsp:include>org.apache.ojb.broker.PersistenceBroker</xsp:include>
-    </xsp:structure>
+  <xsp:structure>
+    <xsp:include>org.apache.cocoon.ojb.samples.bean.Department</xsp:include>
+    <xsp:include>org.apache.ojb.broker.PersistenceBroker</xsp:include>
+    <xsp:include>org.apache.ojb.broker.PersistenceBrokerFactory</xsp:include>
+  </xsp:structure>
 
-    <xsp:init-page>
-        PBFactory pbFactory = null;
-        PersistenceBroker pb = null;
+  <page>
+    <content>
+      <title>Hello OJB</title>
+      <para>This is my first Cocoon page with OJB using Persistence Broker!</para>
+      <xsp:logic>
+        /* Get the PersistenceManager */
+        PersistenceBroker pb = PersistenceBrokerFactory.defaultPersistenceBroker();
         Department bean = new Department();
-        String s;
-    </xsp:init-page>
 
-    <page>
-        <content>
-            <title>Hello OJB</title>
-            <para>This is my first Cocoon page with OJB using Persistence Broker!</para>
-            <xsp:logic>
-			try {
-				/* Get the PersistenceManager */
-				try {
-                    pbFactory = (PBFactory)manager.lookup(PBFactory.ROLE );
-                    pb = pbFactory.defaultPersistenceBroker();
-				} catch (ComponentException cme) {
-					getLogger().error("Could not look up the PB Factory", cme);
-                }
-				<!-- Setting up the Bean -->
-				bean.setId(8);
-				bean.setName("Apache OJB-PB Development");
-				<!-- 2. Start a Transaction -->
-				pb.beginTransaction();
-				<!-- 3. now perform persistence operations. Store the new Department -->
-                pb.store(bean);
-				<!-- 4. Commit the transaction  -->
-                pb.commitTransaction();
-                s = bean.getId() + " : " + bean.getName();
-			</xsp:logic>
-            <p> Inserted data: <xsp:expr>s</xsp:expr>
-            </p>
-            <xsp:logic>
-			} finally {
-                if (pb != null &amp;&amp; !pb.isClosed()) {
-                    if (pb.isInTransaction()) {
-                        pb.abortTransaction();
-                    }
-                    pb.close();
-                }
-				manager.release(pbFactory);
-			}
-		</xsp:logic>
-        </content>
-    </page>
+        try {
+          <!-- Setting up the Bean -->
+          bean.setId(8);
+          bean.setName("Apache OJB-PB Development");
+          <!-- 2. Start a Transaction -->
+          pb.beginTransaction();
+          <!-- 3. now perform persistence operations. Store the new Department -->
+          pb.store(bean);
+          <!-- 4. Commit the transaction  -->
+          pb.commitTransaction();
+
+          <p>
+            Inserted data: <xsp:expr>bean.getId() + " : " + bean.getName()</xsp:expr>
+          </p>
+        } finally {
+          if (!pb.isClosed()) {
+            if (pb.isInTransaction()) {
+              pb.abortTransaction();
+            }
+            pb.close();
+          }
+        }
+      </xsp:logic>
+    </content>
+  </page>
 </xsp:page>



Mime
View raw message