Author: vgritsenko
Date: Thu Feb 17 08:58:11 2005
New Revision: 154169
URL: http://svn.apache.org/viewcvs?view=rev&rev=154169
Log:
separate ojb connection factory config out of ojb access components
(pb/jdo/odmg)
cleanup code
integrate ojb logging with cocoon logging.
Added:
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/OJB-logging.properties
(with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-connection.xconf
(with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-jdo.xconf
- copied, changed from r154160,
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb.xconf
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-jdo.xroles
- copied unchanged from r154160,
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb.xroles
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-logger.xconf (with
props)
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java
(with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/LoggerImpl.java
(with props)
Removed:
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb.xconf
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb.xroles
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/AbstractOjbImpl.java
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryAvalonDataSource.java
Modified:
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/build.xml
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/OJB.properties
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-odmg.xconf
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-pb.xconf
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/broker/components/PBFactory.java
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/broker/components/PBFactoryImpl.java
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
cocoon/branches/BRANCH_2_1_X/status.xml
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/build.xml
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/build.xml?view=diff&r1=154168&r2=154169
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/build.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/build.xml Thu Feb 17 08:58:11
2005
@@ -39,6 +39,7 @@
<copy file="${block.dir}/conf/repository.dtd"
tofile="${build.webapp.classes}/repository.dtd"/>
<copy file="${block.dir}/conf/repository.xml"
tofile="${build.webapp.classes}/repository.xml"/>
<copy file="${block.dir}/conf/OJB.properties"
tofile="${build.webapp.classes}/OJB.properties"/>
+ <copy file="${block.dir}/conf/OJB-logging.properties"
tofile="${build.webapp.classes}/OJB-logging.properties"/>
</target>
<!-- unfortunately this build.xml is called before the samples are compiled,
Added: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/OJB-logging.properties
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/OJB-logging.properties?view=auto&rev=154169
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/OJB-logging.properties
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/OJB-logging.properties Thu
Feb 17 08:58:11 2005
@@ -0,0 +1,95 @@
+#<!--
+#/* Copyright 2002-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.
+# * You may obtain a copy of the License at
+# *
+# * http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+#-->
+# OJB-logging.properties -- configuration of the logging within the OJB
runtime environment
+# Version: 1.0
+# (c) 2001, 2002, 2003 Apache Software Foundation
+# Author: Thomas Mahler and many others
+# @version $Id$
+#----------------------------------------------------------------------------------------
+# The LoggerClass entry tells OJB which concrete Logger implementation is to
be used.
+# If it is not specified (or this file is not present/found, then OJB will
check
+# whether there is a log4j.properties or commons-logging.properties file, in
which
+# case it will use Log4J/commons-logging. If neither is present, then OJB will
default
+# to commons-logging.
+#
+# Integrated with Cocoon logging. Ignores settings below, use
+# central configuration place: logkit.xconf or log4j.xconf
+LoggerClass=org.apache.cocoon.ojb.components.LoggerImpl
+# Commons-logging
+#LoggerClass=org.apache.ojb.broker.util.logging.CommonsLoggerImpl
+# log4j based logging
+#LoggerClass=org.apache.ojb.broker.util.logging.Log4jLoggerImpl
+# OJB's own simple looging support
+#LoggerClass=org.apache.ojb.broker.util.logging.PoorMansLoggerImpl
+#LoggerConfigFile=log4j.properties
+#
+# The LogLevel entries tells OJB which LogLevels are active
+# for the different loggers used within OJB
+# Loglevels: DEBUG < INFO < WARN < ERROR < FATAL
+# That is loglevel WARN won't log DEBUG and INFO messages,
+# but will log WARN, ERROR, and FATAL messages
+#
+# Global default log level used for all logging
+# entities if not specified
+ROOT.LogLevel=ERROR
+#
+# The Default Logger instance used within OJB
+DEFAULT.LogLevel=WARN
+# Logger for PersistenceBrokerImpl class
+org.apache.ojb.broker.core.PersistenceBrokerImpl.LogLevel=WARN
+# Logger for PersistenceBrokerFactory class PersistenceBrokerFactoryDefaultImpl
+org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.LogLevel=WARN
+# Logger for RepositoryXmlHandler, useful for debugging parsing of
repository.xml!
+# persistence capable object metadata
+org.apache.ojb.broker.metadata.RepositoryXmlHandler.LogLevel=WARN
+# Logger for ConnectionDescriptorXmlHandler, useful for debugging parsing of
repository.xml!
+# connection specific metadata
+org.apache.ojb.broker.metadata.ConnectionDescriptorXmlHandler.LogLevel=WARN
+# Logger for JdbcAccess, useful for debugging JDBC related problems
+org.apache.ojb.broker.accesslayer.JdbcAccessImpl.LogLevel=WARN
+# Logger for RsIterator, useful for debugging problems with Object
materialization
+org.apache.ojb.broker.accesslayer.RsIterator.LogLevel=WARN
+# Logger for StatementsForClass, useful for debugging JDBC Connection related
problems
+org.apache.ojb.broker.accesslayer.StatementsForClassImpl.LogLevel=WARN
+# Logger for SqlGenerator, useful for debugging generation of SQL
+org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.LogLevel=WARN
+# Logger for RepositoryPersistor
+org.apache.ojb.broker.metadata.RepositoryPersistor.LogLevel=WARN
+# Logger for ConnectionFactory base class
+org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.LogLevel=WARN
+# Logger for ConnectionManager
+org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.LogLevel=WARN
+# Logger for IndirectionHandler class
+org.apache.ojb.broker.core.proxy.IndirectionHandler.LogLevel=WARN
+#
+# Special Logger categories used in test suite and tutorials
+#
+# Logger for the ODMG Implementation
+ODMG.LogLevel=DEBUG
+# Logger for the JDO RI Implementation
+JDO.LogLevel=DEBUG
+# Logger for the performance tests
+performance.LogLevel=INFO
+# Logger for the soda api
+soda.LogLevel=WARN
+# Logger for the factory service
+ConfigurableFactory.LogLevel=WARN
+#
+#
+#----------------------------------------------------------------------------------------
+# End of OJB.properties file
+#----------------------------------------------------------------------------------------
Propchange:
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/OJB-logging.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/OJB-logging.properties
------------------------------------------------------------------------------
svn:keywords = Id
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/OJB.properties
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/OJB.properties?view=diff&r1=154168&r2=154169
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/OJB.properties (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/OJB.properties Thu Feb 17
08:58:11 2005
@@ -109,7 +109,7 @@
# JDBC Connections. Current version ships four implementations:
#
# 1. ConnectionFactoryAvalonDatasource
-# Uses a Cocoon configured DataSource specified with the jcd-alias
attribute value in
+# Uses a Cocoon configured DataSource specified with the jcd-alias
attribute value in
# a jdbc-connection-descriptor element in the repository.xml file.
# 2. ConnectionFactoryNotPooledImpl
# No pooling, no playing around.
@@ -133,7 +133,7 @@
# take a look at the repository.dtd, there was a possibility to override
# this default connection factory entry in each JDBCConnectionDescriptor.
#
-ConnectionFactoryClass=org.apache.cocoon.ojb.components.ConnectionFactoryAvalonDataSource
+ConnectionFactoryClass=org.apache.cocoon.ojb.components.ConnectionFactoryImpl
#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl
#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl
#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl
Added: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-connection.xconf
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-connection.xconf?view=auto&rev=154169
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-connection.xconf
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-connection.xconf Thu
Feb 17 08:58:11 2005
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<xconf xpath="/cocoon"
unless="component[class='org.apache.cocoon.ojb.components.ConnectionFactoryImpl']">
+ <!-- OJB Connection Factory -->
+ <component role="org.apache.cocoon.ojb.components.ConnectionFactory"
+ class="org.apache.cocoon.ojb.components.ConnectionFactoryImpl"
+ logger="core.ojb"/>
+</xconf>
Propchange:
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-connection.xconf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-connection.xconf
------------------------------------------------------------------------------
svn:keywords = Id
Copied: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-jdo.xconf (from
r154160, cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb.xconf)
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-jdo.xconf?view=diff&rev=154169&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb.xconf&r1=154160&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-jdo.xconf&r2=154169
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb.xconf (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-jdo.xconf Thu Feb 17
08:58:11 2005
@@ -15,9 +15,7 @@
limitations under the License.
-->
-<xconf xpath="/cocoon" unless="comment()[contains(., 'Persistent Manager
Factory for JDO')]">
+<xconf xpath="/cocoon" unless="ojb-jdo">
<!-- Persistent Manager Factory for JDO -->
- <!-- uncomment in order to set the logger to a category other than
core.startup
- <ojb-jdo class="org.apache.cocoon.ojb.jdo.components.JdoPMFImpl"
logger="core.ojb-jdo"/>
- -->
+ <ojb-jdo logger="core.ojb.jdo"/>
</xconf>
Added: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-logger.xconf
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-logger.xconf?view=auto&rev=154169
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-logger.xconf (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-logger.xconf Thu Feb
17 08:58:11 2005
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<xconf xpath="/cocoon"
unless="component[class='org.apache.cocoon.ojb.components.LoggerImpl']">
+ <!-- OJB Logger -->
+ <component role="org.apache.cocoon.ojb.components.Logger"
+ class="org.apache.cocoon.ojb.components.LoggerImpl"
+ logger="ojb"/>
+</xconf>
Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-logger.xconf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-logger.xconf
------------------------------------------------------------------------------
svn:keywords = Id
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-odmg.xconf
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-odmg.xconf?view=diff&r1=154168&r2=154169
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-odmg.xconf (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-odmg.xconf Thu Feb 17
08:58:11 2005
@@ -16,6 +16,6 @@
-->
<xconf xpath="/cocoon" unless="ojb-odmg">
- <!-- ODMG Implementation Interface
- <ojb-odmg logger="core.ojb-odmg"/> -->
+ <!-- ODMG Implementation Interface -->
+ <ojb-odmg logger="core.ojb.odmg"/>
</xconf>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-pb.xconf
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-pb.xconf?view=diff&r1=154168&r2=154169
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-pb.xconf (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/ojb-pb.xconf Thu Feb 17
08:58:11 2005
@@ -17,5 +17,5 @@
<xconf xpath="/cocoon" unless="ojb-pb">
<!-- PersistenceBroker Interface -->
- <ojb-pb logger="core.ojb-pb"/>
+ <ojb-pb logger="core.ojb.pb"/>
</xconf>
Modified:
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/broker/components/PBFactory.java
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/broker/components/PBFactory.java?view=diff&r1=154168&r2=154169
==============================================================================
---
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/broker/components/PBFactory.java
(original)
+++
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/broker/components/PBFactory.java
Thu Feb 17 08:58:11 2005
@@ -16,6 +16,7 @@
package org.apache.cocoon.ojb.broker.components;
import org.apache.avalon.framework.component.Component;
+
import org.apache.ojb.broker.PBFactoryException;
import org.apache.ojb.broker.PBKey;
import org.apache.ojb.broker.PersistenceBroker;
Modified:
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/broker/components/PBFactoryImpl.java
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/broker/components/PBFactoryImpl.java?view=diff&r1=154168&r2=154169
==============================================================================
---
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/broker/components/PBFactoryImpl.java
(original)
+++
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/broker/components/PBFactoryImpl.java
Thu Feb 17 08:58:11 2005
@@ -15,8 +15,9 @@
*/
package org.apache.cocoon.ojb.broker.components;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.ojb.components.AbstractOjbImpl;
+
import org.apache.ojb.broker.PBFactoryException;
import org.apache.ojb.broker.PBKey;
import org.apache.ojb.broker.PersistenceBroker;
@@ -28,25 +29,8 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Antonio Gallardo</a>
* @version CVS $Id$
*/
-public class PBFactoryImpl
- extends AbstractOjbImpl
- implements PBFactory, ThreadSafe {
-
- /* (non-Javadoc)
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose() {
- super.dispose();
- getLogger().debug("Disposed");
- }
-
- /* (non-Javadoc)
- * @see org.apache.avalon.framework.activity.Initializable#initialize()
- */
- public void initialize() throws Exception {
- super.initialize();
- getLogger().debug("Started");
- }
+public class PBFactoryImpl extends AbstractLogEnabled
+ implements PBFactory, ThreadSafe {
/* (non-Javadoc)
* @see
org.apache.cocoon.ojb.broker.components.PBFactory#defaultPersistenceBroker()
Added:
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?view=auto&rev=154169
==============================================================================
---
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java
(added)
+++
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java
Thu Feb 17 08:58:11 2005
@@ -0,0 +1,104 @@
+/*
+ * Copyright 1999-2002,2004 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.ojb.components;
+
+import org.apache.avalon.excalibur.datasource.DataSourceComponent;
+import org.apache.avalon.framework.CascadingRuntimeException;
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.component.Component;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.thread.ThreadSafe;
+
+import org.apache.ojb.broker.accesslayer.ConnectionFactory;
+import org.apache.ojb.broker.accesslayer.LookupException;
+import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * OJB ConnectionFactory implemenation to bridge into the Avalon DataSource
+ * connection pooling component defined in the Cocoon configuration.
+ *
+ * @author giacomo at apache.org
+ * @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a>
+ * @version $Id$
+ */
+public class ConnectionFactoryImpl implements Component, ThreadSafe,
Serviceable, Disposable,
+ ConnectionFactory {
+
+ /** The <code>ServiceManager</code> to be used */
+ private static ServiceManager manager;
+
+ /** The <code>ServiceSelector</code> to be used */
+ private static ServiceSelector datasources;
+
+ public void service(ServiceManager manager) throws ServiceException {
+ ConnectionFactoryImpl.manager = manager;
+ ConnectionFactoryImpl.datasources = (ServiceSelector)
manager.lookup(DataSourceComponent.ROLE + "Selector");
+ }
+
+ public void dispose() {
+ if (ConnectionFactoryImpl.manager != null) {
+
ConnectionFactoryImpl.manager.release(ConnectionFactoryImpl.datasources);
+ ConnectionFactoryImpl.datasources = null;
+ ConnectionFactoryImpl.manager = null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see
org.apache.ojb.broker.accesslayer.ConnectionFactory#lookupConnection(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor)
+ */
+ public Connection lookupConnection(final JdbcConnectionDescriptor conDesc)
+ throws LookupException {
+ if (ConnectionFactoryImpl.manager == null) {
+ throw new LookupException("ConnectionFactoryImpl is not
initialized! Please check your cocoon.xconf");
+ }
+
+ try {
+ return ((DataSourceComponent)
ConnectionFactoryImpl.datasources.select(conDesc.getJcdAlias())).getConnection();
+ } catch (final ServiceException e) {
+ throw new LookupException("Cannot lookup DataSource named " +
+ conDesc.getJcdAlias(), e);
+ } catch (final SQLException e) {
+ throw new LookupException("Cannot get connection from DataSource
named " +
+ conDesc.getDbAlias(), e);
+ }
+ }
+
+ /* (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) {
+ try {
+ // The DataSource of this connection will take care of pooling
+ con.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
+ }
+}
Propchange:
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
Added:
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?view=auto&rev=154169
==============================================================================
---
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/LoggerImpl.java
(added)
+++
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/LoggerImpl.java
Thu Feb 17 08:58:11 2005
@@ -0,0 +1,228 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.ojb.components;
+
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.component.Component;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.thread.ThreadSafe;
+
+import org.apache.ojb.broker.util.configuration.Configuration;
+import org.apache.ojb.broker.util.configuration.ConfigurationException;
+import org.apache.ojb.broker.util.logging.Logger;
+
+/**
+ * OJB logger implementation delegating to the Avalon logger
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a>
+ * @version $Id$
+ */
+public class LoggerImpl extends AbstractLogEnabled
+ implements Component, ThreadSafe,
Initializable,
+ Logger {
+
+ /**
+ * Root logger for all OJB loggers
+ */
+ private static org.apache.avalon.framework.logger.Logger LOGGER;
+
+ private final String name;
+ private transient int level;
+ private transient org.apache.avalon.framework.logger.Logger logger;
+
+ /**
+ * Constructor used by Container
+ */
+ public LoggerImpl() {
+ this.name = null;
+ }
+
+ /**
+ * Constructor used by OJB to create a logger instance
+ */
+ public LoggerImpl(String name) {
+ this.name = name.startsWith("org.apache.ojb.")? name.substring(15):
name;
+ }
+
+ /**
+ * Set root logger instance which will be used by OJB
+ */
+ public void initialize() {
+ LOGGER = getLogger();
+ }
+
+ protected int getLevel() {
+ if (logger == null) {
+ this.logger = LOGGER.getChildLogger(this.name);
+ if (this.logger.isDebugEnabled()) this.level = DEBUG;
+ else if (this.logger.isInfoEnabled()) this.level = INFO;
+ else if (this.logger.isWarnEnabled()) this.level = WARN;
+ else if (this.logger.isErrorEnabled()) this.level = ERROR;
+ else this.level = FATAL;
+ }
+ return level;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void debug(Object message) {
+ if (DEBUG >= getLevel()) {
+ logger.debug(toString(message));
+ }
+ }
+
+ public void debug(Object message, Throwable t) {
+ if (DEBUG >= getLevel()) {
+ logger.debug(toString(message), t);
+ }
+ }
+
+ public void safeDebug(String message, Object obj) {
+ if (DEBUG >= getLevel()) {
+ logger.debug(message + " : " + toString(obj));
+ }
+ }
+
+ public void safeDebug(String message, Object obj, Throwable t) {
+ if (DEBUG >= getLevel()) {
+ logger.debug(message + " : " + toString(obj), t);
+ }
+ }
+
+ public void info(Object message) {
+ if (INFO >= getLevel()) {
+ logger.info(toString(message));
+ }
+ }
+
+ public void info(Object message, Throwable t) {
+ if (INFO >= getLevel()) {
+ logger.info(toString(message), t);
+ }
+ }
+
+ public void safeInfo(String message, Object obj) {
+ if (INFO >= getLevel()) {
+ logger.info(message + " : " + toString(obj));
+ }
+ }
+
+ public void safeInfo(String message, Object obj, Throwable t) {
+ if (INFO >= getLevel()) {
+ logger.info(message + " : " + toString(obj), t);
+ }
+ }
+
+ public void warn(Object message) {
+ if (WARN >= getLevel()) {
+ logger.warn(toString(message));
+ }
+ }
+
+ public void warn(Object message, Throwable t) {
+ if (WARN >= getLevel()) {
+ logger.warn(toString(message), t);
+ }
+ }
+
+ public void safeWarn(String message, Object obj) {
+ if (WARN >= getLevel()) {
+ logger.warn(message + " : " + toString(obj));
+ }
+ }
+
+ public void safeWarn(String message, Object obj, Throwable t) {
+ if (WARN >= getLevel()) {
+ logger.warn(message + " : " + toString(obj), t);
+ }
+ }
+
+ public void error(Object message) {
+ if (ERROR >= getLevel()) {
+ logger.fatalError(toString(message));
+ }
+ }
+
+ public void error(Object message, Throwable t) {
+ if (ERROR >= getLevel()) {
+ logger.fatalError(toString(message), t);
+ }
+ }
+
+ public void safeError(String message, Object obj) {
+ if (ERROR >= getLevel()) {
+ logger.error(message + " : " + toString(obj));
+ }
+ }
+
+ public void safeError(String message, Object obj, Throwable t) {
+ if (ERROR >= getLevel()) {
+ logger.error(message + " : " + toString(obj), t);
+ }
+ }
+
+ public void fatal(Object message) {
+ if (FATAL >= getLevel()) {
+ logger.fatalError(toString(message));
+ }
+ }
+
+ public void fatal(Object message, Throwable t) {
+ if (FATAL >= getLevel()) {
+ logger.fatalError(toString(message), t);
+ }
+ }
+
+ public void safeFatal(String message, Object obj) {
+ if (FATAL >= getLevel()) {
+ logger.fatalError(message + " : " + toString(obj));
+ }
+ }
+
+ public void safeFatal(String message, Object obj, Throwable t) {
+ if (FATAL >= getLevel()) {
+ logger.fatalError(message + " : " + toString(obj), t);
+ }
+ }
+
+ public boolean isDebugEnabled() {
+ return isEnabledFor(DEBUG);
+ }
+
+ public boolean isEnabledFor(int priority) {
+ return priority >= getLevel();
+ }
+
+ /*
+ * @see
org.apache.ojb.broker.util.configuration.Configurable#configure(Configuration)
+ */
+ public void configure(Configuration config) throws ConfigurationException {
+ }
+
+ private String toString(Object obj) {
+ if (obj != null) {
+ try {
+ return obj.toString();
+ } catch (Throwable throwable) {
+ return "BAD toString() impl for " + obj.getClass().getName();
+ }
+ }
+
+ return "null";
+ }
+}
Propchange:
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/LoggerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/LoggerImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified:
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/JdoPMF.java?view=diff&r1=154168&r2=154169
==============================================================================
---
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/JdoPMF.java
Thu Feb 17 08:58:11 2005
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,23 +15,23 @@
*/
package org.apache.cocoon.ojb.jdo.components;
-import javax.jdo.PersistenceManager;
-
import org.apache.avalon.framework.component.Component;
+import javax.jdo.PersistenceManager;
+
/**
- * Interface of the JDO Persistent Manager Factory.
+ * Interface of the JDO Persistent Manager Factory.
* It is used to get the Persistence Manager to interact with JDO using OJB
*
* @author <a href="mailto:[EMAIL PROTECTED]">Antonio Gallardo</a>
* @version CVS $Id$
*/
public interface JdoPMF extends Component {
-
+
String ROLE = JdoPMF.class.getName();
-
+
/**
- * get a Persitence Manager.
- */
+ * Get a Persitence Manager.
+ */
PersistenceManager getPersistenceManager();
}
Modified:
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/JdoPMFImpl.java?view=diff&r1=154168&r2=154169
==============================================================================
---
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/JdoPMFImpl.java
Thu Feb 17 08:58:11 2005
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,57 +15,37 @@
*/
package org.apache.cocoon.ojb.jdo.components;
-import javax.jdo.PersistenceManager;
-import javax.jdo.PersistenceManagerFactory;
-
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.ojb.components.AbstractOjbImpl;
+
import org.apache.ojb.jdori.sql.OjbStorePMF;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
/**
* Implementation of the JdoPMF. Create one PMF and store it for future use
*
* @author <a href="mailto:[EMAIL PROTECTED]">Antonio Gallardo</a>
* @version CVS $Id$
*/
-public class JdoPMFImpl
- extends AbstractOjbImpl
- implements JdoPMF, ThreadSafe {
-
- protected PersistenceManagerFactory factory;
+public class JdoPMFImpl extends AbstractLogEnabled
+ implements JdoPMF, ThreadSafe, Initializable {
- /* (non-Javadoc)
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose() {
- super.dispose();
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("OJB-JDO: Disposed OK!");
- }
- }
+ protected PersistenceManagerFactory factory;
/* (non-Javadoc)
* @see
org.apache.cocoon.ojb.jdori.components.JdoPMF#getPersistenceManager()
*/
public PersistenceManager getPersistenceManager() {
- return factory.getPersistenceManager();
+ return this.factory.getPersistenceManager();
}
-
+
/* (non-Javadoc)
* @see org.apache.avalon.framework.activity.Initializable#initialize()
*/
public void initialize() throws Exception {
- super.initialize();
- try {
- // Create the factory
- factory = new OjbStorePMF();
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("OJB-JDO: Started OK!");
- }
- } catch (Throwable t) {
- if (this.getLogger().isFatalErrorEnabled()) {
- this.getLogger().fatalError("OJB-JDO: Started failed: Cannot
create a Persistence Manager Factory.",t);
- }
- }
+ this.factory = new OjbStorePMF();
}
}
Modified:
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/OdmgImplementation.java?view=diff&r1=154168&r2=154169
==============================================================================
---
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/OdmgImplementation.java
Thu Feb 17 08:58:11 2005
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2002,2004 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,10 +16,10 @@
package org.apache.cocoon.ojb.odmg.components;
import org.apache.avalon.framework.component.Component;
+
import org.odmg.Implementation;
import org.odmg.ODMGException;
-
/**
* Interface of the ODMG Implementation. It is used to get the Implementation
Object to interact with ODMG using OJB
*
@@ -39,7 +39,7 @@
* @throws ODMGException DOCUMENT ME!
*/
Implementation getInstance()
- throws ODMGException;
+ throws ODMGException;
/**
* Get a ODMG Instance with a specific connection definition.
@@ -51,7 +51,7 @@
* @throws ODMGException DOCUMENT ME!
*/
Implementation getInstance(String connection)
- throws ODMGException;
+ throws ODMGException;
/**
* Get a ODMG Instance with a specific connection definition and a
Database operation mode.
@@ -64,7 +64,7 @@
* @throws ODMGException DOCUMENT ME!
*/
Implementation getInstance(String connection, int mode)
- throws ODMGException;
+ throws ODMGException;
/**
* Get a ODMG Instance with a default connection definition and a Database
operation mode.
@@ -76,5 +76,5 @@
* @throws ODMGException DOCUMENT ME!
*/
Implementation getInstance(int mode)
- throws ODMGException;
+ throws ODMGException;
}
Modified:
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/OdmgImplementationImpl.java?view=diff&r1=154168&r2=154169
==============================================================================
---
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/OdmgImplementationImpl.java
Thu Feb 17 08:58:11 2005
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2002,2004 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,17 +15,19 @@
*/
package org.apache.cocoon.ojb.odmg.components;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Set;
-
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.ojb.components.AbstractOjbImpl;
+
import org.apache.ojb.odmg.OJB;
import org.odmg.Database;
import org.odmg.Implementation;
import org.odmg.ODMGException;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Set;
/**
* Implementation of the OdmgImplementation. Create a ODMG Implementation and
store it for future use
@@ -33,71 +35,49 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @version CVS $Id$
*/
-public class OdmgImplementationImpl
- extends AbstractOjbImpl
- implements OdmgImplementation, ThreadSafe {
+public class OdmgImplementationImpl extends AbstractLogEnabled
+ implements OdmgImplementation, ThreadSafe,
Initializable, Disposable {
private final static String DEFAULT_CONNECTION ="default";
private final static int DEFAULT_MODE = Database.OPEN_READ_WRITE;
private Implementation odmg;
-
+
private Hashtable databases = new Hashtable();
-
- /* (non-Javadoc)
+
+ /* (non-Javadoc)
* @see org.apache.avalon.framework.activity.Disposable#dispose()
*/
public void dispose() {
- super.dispose();
- synchronized(this.databases) {
- final Set keys = this.databases.keySet();
- for( Iterator i = keys.iterator(); i.hasNext(); )
- {
- final Database db = (Database)i.next();
- try
- {
- db.close();
- }
- catch( final ODMGException e) {
- getLogger().error( "OJB-ODMG: Cannot close Database", e);
- }
- i.remove();
+ final Set keys = this.databases.keySet();
+ for (Iterator i = keys.iterator(); i.hasNext();) {
+ final Database db = (Database) i.next();
+ try {
+ db.close();
+ } catch (ODMGException e) {
+ getLogger().error("OJB-ODMG: Cannot close Database", e);
}
- }
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("OJB-ODMG: Disposed OK!");
+ i.remove();
}
}
/* (non-Javadoc)
* @see org.apache.avalon.framework.activity.Initializable#initialize()
*/
- public void initialize()
- throws Exception {
- super.initialize();
- try {
- // Get the Implementation
- this.odmg = OJB.getInstance();
-
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("OJB-ODMG: Started OK!");
- }
- } catch (Throwable t) {
- if (this.getLogger().isFatalErrorEnabled()) {
- this.getLogger().fatalError("OJB-ODMG: Started failed: Cannot
get an ODMG Implementation.", t);
- }
- }
+ public void initialize() throws Exception {
+ // Get the Implementation
+ this.odmg = OJB.getInstance();
}
/* (non-Javadoc)
* @see org.apache.cocoon.ojb.odmg.components.Odmg#getInstance()
*/
public Implementation getInstance() throws ODMGException {
- Database db = (Database)this.databases.get( DEFAULT_CONNECTION );
- if(null == db ) {
+ Database db = (Database) this.databases.get(DEFAULT_CONNECTION);
+ if (null == db) {
db = this.odmg.newDatabase();
db.open(DEFAULT_CONNECTION, DEFAULT_MODE);
synchronized (this.databases) {
- this.databases.put( DEFAULT_CONNECTION + DEFAULT_MODE, db );
+ this.databases.put(DEFAULT_CONNECTION + DEFAULT_MODE, db);
}
}
return this.odmg;
@@ -107,12 +87,12 @@
* @see
org.apache.cocoon.ojb.odmg.components.Odmg#getInstance(java.lang.String, int)
*/
public Implementation getInstance(String connection, int mode) throws
ODMGException {
- Database db = (Database)this.databases.get( connection + mode);
- if(null == db ) {
+ Database db = (Database) this.databases.get(connection + mode);
+ if (null == db) {
db = this.odmg.newDatabase();
db.open(connection, mode);
synchronized (this.databases) {
- this.databases.put( connection + mode, db );
+ this.databases.put(connection + mode, db);
}
}
return this.odmg;
@@ -122,26 +102,27 @@
* @see
org.apache.cocoon.ojb.odmg.components.Odmg#getInstance(java.lang.String)
*/
public Implementation getInstance(String connection) throws ODMGException {
- Database db = (Database)this.databases.get( connection + DEFAULT_MODE);
- if(null == db ) {
+ Database db = (Database) this.databases.get(connection + DEFAULT_MODE);
+ if (null == db) {
db = this.odmg.newDatabase();
db.open(connection, DEFAULT_MODE);
synchronized (this.databases) {
- this.databases.put( connection + DEFAULT_MODE, db );
+ this.databases.put(connection + DEFAULT_MODE, db);
}
}
return this.odmg;
}
+
/* (non-Javadoc)
* @see
org.apache.cocoon.ojb.odmg.components.OdmgImplementation#getInstance(int)
*/
- public Implementation getInstance( int mode ) throws ODMGException {
- Database db = (Database)this.databases.get( DEFAULT_CONNECTION+ mode);
- if(null == db ) {
+ public Implementation getInstance(int mode) throws ODMGException {
+ Database db = (Database) this.databases.get(DEFAULT_CONNECTION + mode);
+ if (null == db) {
db = this.odmg.newDatabase();
db.open(DEFAULT_CONNECTION, mode);
synchronized (this.databases) {
- this.databases.put( DEFAULT_CONNECTION+ mode, db );
+ this.databases.put(DEFAULT_CONNECTION + mode, db);
}
}
return this.odmg;
Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?view=diff&r1=154168&r2=154169
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Thu Feb 17 08:58:11 2005
@@ -202,6 +202,9 @@
<changes>
<release version="@version@" date="@date@">
+ <action dev="VG" type="update">
+ OJB Block: Integrated OJB logging with Cocoon logging.
+ </action>
<action dev="CZ" type="update">
Add a deprecation logger that gives hint about used deprecated stuff.
</action>