cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r164911 - /cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java /cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/LoggerImpl.java /cocoon/branches/BRANCH_2_1_X/status.xml
Date Tue, 26 Apr 2005 23:31:44 GMT
Author: vgritsenko
Date: Tue Apr 26 16:31:43 2005
New Revision: 164911

URL: http://svn.apache.org/viewcvs?rev=164911&view=rev
Log:
add support for ojb 1.1 (interfaces changed)

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/LoggerImpl.java
    cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java?rev=164911&r1=164910&r2=164911&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java
Tue Apr 26 16:31:43 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2002,2004 The Apache Software Foundation.
+ * Copyright 1999-2002,2004-2005 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -49,6 +49,22 @@
     /** The <code>ServiceSelector</code> to be used */
     private static ServiceSelector datasources;
 
+    /** The <code>JdbcConnectionDescriptor</code> */
+    private JdbcConnectionDescriptor conDesc;
+
+    /**
+     * Default constructor
+     */
+    public ConnectionFactoryImpl() {
+    }
+
+    /**
+     * OJB 1.1 constructor
+     */
+    public ConnectionFactoryImpl(JdbcConnectionDescriptor conDesc) {
+        this.conDesc = conDesc;
+    }
+
     public void service(ServiceManager manager) throws ServiceException {
         ConnectionFactoryImpl.manager = manager;
         ConnectionFactoryImpl.datasources = (ServiceSelector) manager.lookup(DataSourceComponent.ROLE
+ "Selector");
@@ -62,9 +78,31 @@
         }
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.ojb.broker.accesslayer.ConnectionFactory#lookupConnection(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor)
-     */
+    //
+    // OJB 1.1 ConnectionFactory Implementation
+    //
+
+    public Connection lookupConnection()
+    throws LookupException {
+        return lookupConnection(this.conDesc);
+    }
+
+    public void releaseConnection(Connection connection) {
+        releaseConnection(this.conDesc, connection);
+    }
+
+    public int getActiveConnections() {
+        return 0;
+    }
+
+    public int getIdleConnections() {
+        return 0;
+    }
+
+    //
+    // OJB 1.0 ConnectionFactory Implementation
+    //
+
     public Connection lookupConnection(final JdbcConnectionDescriptor conDesc)
     throws LookupException {
         if (ConnectionFactoryImpl.manager == null) {
@@ -82,22 +120,16 @@
         }
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.ojb.broker.accesslayer.ConnectionFactory#releaseConnection(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor,
java.sql.Connection)
-     */
-    public void releaseConnection(JdbcConnectionDescriptor conDesc, Connection con) {
+    public void releaseConnection(JdbcConnectionDescriptor conDesc, Connection connection)
{
         try {
             // The DataSource of this connection will take care of pooling
-            con.close();
+            connection.close();
         } catch (final SQLException e) {
             // This should not happen, but in case
             throw new CascadingRuntimeException("Cannot release SQL Connection to DataSource",
e);
         }
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.ojb.broker.accesslayer.ConnectionFactory#releaseAllResources()
-     */
     public void releaseAllResources() {
         // Nothing to do here
     }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/LoggerImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/LoggerImpl.java?rev=164911&r1=164910&r2=164911&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/LoggerImpl.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/LoggerImpl.java
Tue Apr 26 16:31:43 2005
@@ -32,8 +32,8 @@
  * @version $Id$
  */
 public class LoggerImpl extends AbstractLogEnabled
-                                 implements Component, ThreadSafe, Initializable,
-                                            Logger {
+                        implements Component, ThreadSafe, Initializable,
+                                   Logger {
 
     /**
      * Root logger for all OJB loggers
@@ -162,13 +162,13 @@
 
     public void error(Object message) {
         if (ERROR >= getLevel()) {
-            logger.fatalError(toString(message));
+            logger.error(toString(message));
         }
     }
 
     public void error(Object message, Throwable t) {
         if (ERROR >= getLevel()) {
-            logger.fatalError(toString(message), t);
+            logger.error(toString(message), t);
         }
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?rev=164911&r1=164910&r2=164911&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Tue Apr 26 16:31:43 2005
@@ -197,6 +197,9 @@
   <changes>
   <release version="@version@" date="@date@">
     <action dev="VG" type="update">
+      OJB Block: Added support for OJB 1.1.
+    </action>
+    <action dev="VG" type="update">
       AbstractSAXTransformer gets <code>transformer-factory</code> configuration
       parameter.
     </action>



Mime
View raw message