giacomo 2004/02/01 13:37:30
Modified: . blocks.properties gump.xml status.xml
src/blocks/ojb/WEB-INF/classes OJB.properties repository.xml
src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components
JdoPMFImpl.java
src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components
OdmgImplementationImpl.java
src/blocks/ojb/samples sitemap.xmap welcome.xml
Added: src/blocks/ojb/java/org/apache/cocoon/ojb/components
AbstractOjbImpl.java
ConnectionFactoryAvalonDataSource.java
src/blocks/ojb/samples/odmg/xsp demo1.xsp
Log:
OJB-Block: Added our own OJB ConnectionFactory which uses the DataSources
configured in cocoon.xconf
Revision Changes Path
1.1
cocoon-2.1/src/blocks/ojb/java/org/apache/cocoon/ojb/components/AbstractOjbImpl.java
Index: AbstractOjbImpl.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights
reserved.
Redistribution and use in source and binary forms, with or without
modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice,
this list of conditions and the following disclaimer in the
documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any,
must
include the following acknowledgment: "This product includes
software
developed by the Apache Software Foundation
(http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself,
if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not
be
used to endorse or promote products derived from this software
without
prior written permission. For written permission, please contact
[EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor
may
"Apache" appear in their name, without prior written permission of
the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY
DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many
individuals
on behalf of the Apache Software Foundation and was originally created
by
Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.cocoon.ojb.components;
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.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
/**
* Base class for different DB-OBJ wrapper implementations. This base class
is responsible to initialize and dispose of
* the helper class <code>ConnectionFactoryAvalonDataSource</code> which can
be used as a ConnectionFactory class in
* the OJB Configuration
*
* @author giacomo
* @version $Id: AbstractOjbImpl.java,v 1.1 2004/02/01 21:37:29 giacomo Exp $
*/
public class AbstractOjbImpl
extends AbstractLogEnabled
implements Initializable, Disposable, Serviceable {
/** The <code>ServiceManager</code> instance */
protected ServiceManager manager;
/* (non-Javadoc)
* @see org.apache.avalon.framework.activity.Initializable#initialize()
*/
public void initialize()
throws Exception {
ConnectionFactoryAvalonDataSource.initialize(this.manager);
}
/* (non-Javadoc)
* @see org.apache.avalon.framework.activity.Disposable#dispose()
*/
public void dispose() {
ConnectionFactoryAvalonDataSource.dispose();
}
/* (non-Javadoc)
* @see
org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
*/
public void service(final ServiceManager manager)
throws ServiceException {
this.manager = manager;
}
}
1.1
cocoon-2.1/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryAvalonDataSource.java
Index: ConnectionFactoryAvalonDataSource.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights
reserved.
Redistribution and use in source and binary forms, with or without
modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice,
this list of conditions and the following disclaimer in the
documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any,
must
include the following acknowledgment: "This product includes
software
developed by the Apache Software Foundation
(http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself,
if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not
be
used to endorse or promote products derived from this software
without
prior written permission. For written permission, please contact
[EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor
may
"Apache" appear in their name, without prior written permission of
the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY
DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many
individuals
on behalf of the Apache Software Foundation and was originally created
by
Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.cocoon.ojb.components;
import java.sql.Connection;
import java.sql.SQLException;
import org.apache.avalon.framework.CascadingRuntimeException;
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.excalibur.datasource.DataSourceComponent;
import org.apache.ojb.broker.accesslayer.ConnectionFactory;
import org.apache.ojb.broker.accesslayer.LookupException;
import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
/**
* OJBConnectionFactory implemenation to bridge into the Avalon DataSource
Connection Pooling
* Component defined in the Cocoon configuration.
*
* @author giacomo at apache.org
* @version $Id: ConnectionFactoryAvalonDataSource.java,v 1.1 2004/02/01
21:37:29 giacomo Exp $
*/
public class ConnectionFactoryAvalonDataSource
implements ConnectionFactory {
/** The <code>ServiceManager</code> to be used */
private static ServiceManager manager;
/** The <code>ServiceSelector</code> to be used */
private static ServiceSelector dbselector;
/**
* Initializes this helper class with the <code>ServiceManager</code> to
be used. This method
* should be called from a Avalon Component configured into Cocoon at
startup to supply the
* needed <code>ServiceManager</code>.
*
* @param serviceManager The ServiceManager
*
* @throws ServiceException In case we cannot obtain a DataSource
*/
public static void initialize(final ServiceManager serviceManager)
throws ServiceException {
ConnectionFactoryAvalonDataSource.manager = serviceManager;
ConnectionFactoryAvalonDataSource.dbselector =
(ServiceSelector)ConnectionFactoryAvalonDataSource.manager.lookup(DataSourceComponent.ROLE
+
"Selector");
}
/**
* Signal disposal to this helper class.
*/
public static void dispose() {
ConnectionFactoryAvalonDataSource.manager.release(ConnectionFactoryAvalonDataSource.dbselector);
}
/* (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 (null == ConnectionFactoryAvalonDataSource.manager) {
throw new LookupException("ServiceManager was not set!");
}
try {
return
((DataSourceComponent)ConnectionFactoryAvalonDataSource.dbselector.select(conDesc.getJcdAlias())).getConnection();
} catch (final ServiceException se) {
throw new LookupException("Cannot lookup DataSources named " +
conDesc.getJcdAlias(), se);
} catch (final SQLException sqle) {
throw new LookupException("Cannot get Connection from DataSource
named " +
conDesc.getDbAlias(), sqle);
}
}
/* (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 {
con.close(); // The DataSource itself from where this connection
comes from will take care of pooling
} catch (final SQLException sqle) {
// This should not happend, but in case
throw new CascadingRuntimeException("Cannot eelase SQL Connection
to DataSource", sqle);
}
}
/* (non-Javadoc)
* @see
org.apache.ojb.broker.accesslayer.ConnectionFactory#releaseAllResources()
*/
public void releaseAllResources() {
//Nothing to do here
}
}
1.1 cocoon-2.1/src/blocks/ojb/samples/odmg/xsp/demo1.xsp
Index: demo1.xsp
===================================================================
<?xml version="1.0"?>
<!-- $Id: demo1.xsp,v 1.1 2004/02/01 21:37:29 giacomo Exp $-->
<!--
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Cocoon" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
[EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-->
<!--
* Simple demo that insert a row into hsqldb using OJB with JDO
*
* @author <a href="mailto:[EMAIL PROTECTED]>Antonio Gallardo</a>
* @version CVS $Revision: 1.1 $ $Date: 2004/02/01 21:37:29 $
-->
<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.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:page>
1.55 +1 -0 cocoon-2.1/blocks.properties
Index: blocks.properties
===================================================================
RCS file: /home/cvs/cocoon-2.1/blocks.properties,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -b -u -r1.54 -r1.55
--- blocks.properties 13 Jan 2004 11:29:49 -0000 1.54
+++ blocks.properties 1 Feb 2004 21:37:29 -0000 1.55
@@ -87,6 +87,7 @@
#-----[dependency]: "mail" depends on "asciiart".
#exclude.block.mail=true
#exclude.block.midi=true
+#-----[dependency]: "ojb" depends on "databases".
#exclude.block.ojb=true
#exclude.block.paranoid=true
#-----[dependency]: "petstore" depends on "databases", "hsqldb", "velocity",
"woody".
1.107 +2 -1 cocoon-2.1/gump.xml
Index: gump.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/gump.xml,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -b -u -r1.106 -r1.107
--- gump.xml 30 Jan 2004 17:00:09 -0000 1.106
+++ gump.xml 1 Feb 2004 21:37:30 -0000 1.107
@@ -1034,6 +1034,7 @@
</ant>
<depend project="cocoon" inherit="all"/>
+ <depend project="cocoon-block-databases"/>
<work nested="tools/anttasks"/>
<home nested="build/cocoon-@@DATE@@"/>
1.234 +6 -2 cocoon-2.1/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/status.xml,v
retrieving revision 1.233
retrieving revision 1.234
diff -u -d -b -u -r1.233 -r1.234
--- status.xml 31 Jan 2004 00:07:01 -0000 1.233
+++ status.xml 1 Feb 2004 21:37:30 -0000 1.234
@@ -196,6 +196,10 @@
<changes>
<release version="@version@" date="@date@">
+ <action dev="GP" type="add" >
+ OJB-Block: Added our own OJB ConnectionFactory which uses the
+ DataSources configured in cocoon.xconf
+ </action>
<action dev="AG" type="update">
Updated POI to 2.0-final
</action>
1.3 +10 -6 cocoon-2.1/src/blocks/ojb/WEB-INF/classes/OJB.properties
Index: OJB.properties
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/ojb/WEB-INF/classes/OJB.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -b -u -r1.2 -r1.3
--- OJB.properties 10 Oct 2003 06:10:00 -0000 1.2
+++ OJB.properties 1 Feb 2004 21:37:30 -0000 1.3
@@ -88,16 +88,19 @@
# A ConnectionFactory is responsible for creating
# JDBC Connections. Current version ships four implementations:
#
-# 1. ConnectionFactoryNotPooledImpl
+# 1. ConnectionFactoryAvalonDatasource
+# 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.
# Every connection request returns a new connection,
# every connection release close the connection.
-# 2. ConnectionFactoryPooledImpl
+# 3. ConnectionFactoryPooledImpl
# This implementation supports connection pooling.
-# 3. ConnectionFactoryDBCPImpl
+# 4. ConnectionFactoryDBCPImpl
# Using the jakarta-DBCP api for connection management, support
# connection- and prepared statement-pooling, abandoned connection
handling.
-# 4. ConnectionFactoryManagedImpl
+# 5. ConnectionFactoryManagedImpl
# Connection factory for use within managed environments - e.g. JBoss.
# Every obtained DataSource was wrapped within OJB (and ignore
# e.g. con.commit() calls within OJB).
@@ -110,7 +113,8 @@
# take a look at the repository.dtd, there was a possibility to override
# this default connection factory entry in each JDBCConnectionDescriptor.
#
-ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl
+ConnectionFactoryClass=org.apache.cocoon.ojb.components.ConnectionFactoryAvalonDataSource
+#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl
#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl
#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl
#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryDBCPImpl
1.5 +8 -2 cocoon-2.1/src/blocks/ojb/WEB-INF/classes/repository.xml
Index: repository.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/ojb/WEB-INF/classes/repository.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -b -u -r1.4 -r1.5
--- repository.xml 10 Oct 2003 06:10:00 -0000 1.4
+++ repository.xml 1 Feb 2004 21:37:30 -0000 1.5
@@ -16,7 +16,7 @@
Ditto it is possible to add jdbc-connection-descriptor at runtime
using the MetadataManager.
-->
-<jdbc-connection-descriptor
+ <jdbc-connection-descriptor
jcd-alias="default"
default-connection="true"
platform="Hsqldb"
@@ -41,6 +41,12 @@
<attribute attribute-name="grabSize" attribute-value="5"/>
</sequence-manager>
</jdbc-connection-descriptor>
+
+ <jdbc-connection-descriptor jcd-alias="personnel">
+ <sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
+ <attribute attribute-name="grabSize" attribute-value="5"/>
+ </sequence-manager>
+ </jdbc-connection-descriptor>
<class-descriptor class="org.apache.cocoon.ojb.samples.Department"
table="DEPARTMENT">
<field-descriptor name="id" column="ID" jdbc-type="INTEGER"
primarykey="true"/>
1.2 +5 -2
cocoon-2.1/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMFImpl.java
Index: JdoPMFImpl.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMFImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -b -u -r1.1 -r1.2
--- JdoPMFImpl.java 28 Sep 2003 04:31:11 -0000 1.1
+++ JdoPMFImpl.java 1 Feb 2004 21:37:30 -0000 1.2
@@ -60,6 +60,7 @@
import org.apache.avalon.framework.configuration.ConfigurationException;
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;
/**
@@ -68,7 +69,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Antonio Gallardo</a>
* @version CVS $Id$
*/
-public class JdoPMFImpl extends AbstractLogEnabled implements JdoPMF,
Configurable, Initializable,
+public class JdoPMFImpl extends AbstractOjbImpl implements JdoPMF,
Configurable, Initializable,
Disposable, ThreadSafe
{
protected PersistenceManagerFactory factory = null;
@@ -87,6 +88,7 @@
*/
public void dispose()
{
+ super.dispose();
if (this.getLogger().isDebugEnabled())
this.getLogger().debug("OJB-JDO: Disposed OK!");
}
@@ -103,6 +105,7 @@
*/
public void initialize() throws Exception
{
+ super.initialize();
try
{
// Create the factory
1.2 +5 -3
cocoon-2.1/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementationImpl.java
Index: OdmgImplementationImpl.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementationImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -b -u -r1.1 -r1.2
--- OdmgImplementationImpl.java 27 Jan 2004 06:15:14 -0000 1.1
+++ OdmgImplementationImpl.java 1 Feb 2004 21:37:30 -0000 1.2
@@ -58,8 +58,8 @@
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
-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;
@@ -73,7 +73,7 @@
* @version CVS $Id$
*/
public class OdmgImplementationImpl
- extends AbstractLogEnabled
+ extends AbstractOjbImpl
implements OdmgImplementation, Configurable, Initializable, Disposable,
ThreadSafe {
private final static String DEFAULT_CONNECTION ="default";
@@ -96,6 +96,7 @@
* @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(); )
@@ -121,6 +122,7 @@
*/
public void initialize()
throws Exception {
+ super.initialize();
try {
// Get the Implementation
this.odmg = OJB.getInstance();
1.4 +16 -3 cocoon-2.1/src/blocks/ojb/samples/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/ojb/samples/sitemap.xmap,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -b -u -r1.3 -r1.4
--- sitemap.xmap 29 Oct 2003 21:27:12 -0000 1.3
+++ sitemap.xmap 1 Feb 2004 21:37:30 -0000 1.4
@@ -107,6 +107,19 @@
<!-- Manages continuations -->
<map:match pattern="jdo/woody/*.continue">
<map:call continuation="{1}"/>
+ </map:match>
+
+ <!-- odmg samples -->
+ <map:match pattern="odmg/xspdemo">
+ <map:generate src="odmg/xsp/demo1.xsp" type="serverpages"/>
+ <map:transform
src="context://samples/stylesheets/dynamic-page2html.xsl">
+ <map:parameter name="servletPath" value="{request:servletPath}"/>
+ <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
+ <map:parameter name="contextPath" value="{request:contextPath}"/>
+ <map:parameter name="file" value="odmg/xsp/xspdemo.xsp"/>
+ <map:parameter name="remove" value="{0}"/>
+ </map:transform>
+ <map:serialize/>
</map:match>
</map:pipeline>
1.2 +1 -1 cocoon-2.1/src/blocks/ojb/samples/welcome.xml
Index: welcome.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/ojb/samples/welcome.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -b -u -r1.1 -r1.2
--- welcome.xml 28 Sep 2003 04:31:10 -0000 1.1
+++ welcome.xml 1 Feb 2004 21:37:30 -0000 1.2
@@ -19,7 +19,7 @@
Object Data Management Group (ODMG) 3 standard for binding databases.
Uses Object Query Language (OQL).
ODMG has been superceded by JDO.
</note>
- <sample name="XSP" href="">Sample using in a XSP page. To be done.</sample>
+ <sample name="XSP" href="odmg/xspdemo">Sample using in a XSP page.</sample>
<sample name="Woody" href="">Sample using Woody binding. To be
done.</sample>
<sample name="JXForm" href="">Sample using JXForms. To be done.</sample>
</group>