Author: cziegeler Date: Tue Oct 5 02:35:53 2004 New Revision: 53785 Modified: 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/components/AbstractOjbImpl.java cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryAvalonDataSource.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/src/blocks/ojb/samples/sitemap.xmap cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/acting/modular/TestAction.java cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/parentcm/Generator.java Log: Sync ojb and java samples
Modified: 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/PBFactory.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/broker/components/PBFactory.java Tue Oct 5 02:35:53 2004 @@ -26,10 +26,10 @@ * The PersistenceBroker API provides the lowest level access to OJB's persistence engine. * * @author <a href="mailto:[EMAIL PROTECTED]">Antonio Gallardo</a> - * @version CVS $Id: PBFactory.java,v 1.2 2004/03/05 13:02:01 bdelacretaz Exp $ + * @version CVS $Id$ */ -public interface PBFactory extends Component -{ +public interface PBFactory extends Component { + /** * The <code>ROLE</code> */ @@ -40,7 +40,7 @@ * @return a PersistenceBroker Object * @throws PBFactoryException - If the operation failed. */ - public PersistenceBroker defaultPersistenceBroker() + PersistenceBroker defaultPersistenceBroker() throws PBFactoryException; /** @@ -53,7 +53,7 @@ * @return a PersistenceBroker Object * @throws PBFactoryException - If the operation failed. */ - public PersistenceBroker createPersistenceBroker(String jcdAlias, + PersistenceBroker createPersistenceBroker(String jcdAlias, String user, String password) throws PBFactoryException; /** @@ -62,6 +62,6 @@ * @return a PersistenceBroker Object * @throws PBFactoryException - If the operation failed. */ - public PersistenceBroker createPersistenceBroker(PBKey key) + PersistenceBroker createPersistenceBroker(PBKey key) throws PBFactoryException; } Modified: 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/broker/components/PBFactoryImpl.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/broker/components/PBFactoryImpl.java Tue Oct 5 02:35:53 2004 @@ -15,11 +15,6 @@ */ package org.apache.cocoon.ojb.broker.components; -import org.apache.avalon.framework.activity.Disposable; -import org.apache.avalon.framework.activity.Initializable; -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.thread.ThreadSafe; import org.apache.cocoon.ojb.components.AbstractOjbImpl; import org.apache.ojb.broker.PBFactoryException; @@ -31,25 +26,20 @@ * 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: PBFactoryImpl.java,v 1.3 2004/03/23 19:21:33 stephan Exp $ + * @version CVS $Id$ */ -public class PBFactoryImpl extends AbstractOjbImpl implements PBFactory, Configurable, Initializable, Disposable, ThreadSafe { +public class PBFactoryImpl +extends AbstractOjbImpl +implements PBFactory, ThreadSafe { /* (non-Javadoc) - * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) - */ - public void configure(Configuration myconf) throws ConfigurationException { - if (this.getLogger().isDebugEnabled()) - this.getLogger().debug("OJB-JDO: configuration"); - } - - /* (non-Javadoc) * @see org.apache.avalon.framework.activity.Disposable#dispose() */ public void dispose() { super.dispose(); - if (this.getLogger().isDebugEnabled()) + if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("OJB-PB: Disposed OK!"); + } } /* (non-Javadoc) Modified: 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/AbstractOjbImpl.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/AbstractOjbImpl.java Tue Oct 5 02:35:53 2004 @@ -29,11 +29,12 @@ * the OJB Configuration * * @author giacomo - * @version $Id: AbstractOjbImpl.java,v 1.2 2004/03/05 13:02:01 bdelacretaz Exp $ + * @version $Id$ */ public class AbstractOjbImpl extends AbstractLogEnabled implements Initializable, Disposable, Serviceable { + /** The <code>ServiceManager</code> instance */ protected ServiceManager manager; Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryAvalonDataSource.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryAvalonDataSource.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/components/ConnectionFactoryAvalonDataSource.java Tue Oct 5 02:35:53 2004 @@ -34,10 +34,11 @@ * Component defined in the Cocoon configuration. * * @author giacomo at apache.org - * @version $Id: ConnectionFactoryAvalonDataSource.java,v 1.3 2004/03/05 13:02:02 bdelacretaz Exp $ + * @version $Id$ */ public class ConnectionFactoryAvalonDataSource implements ConnectionFactory { + /** The <code>ServiceManager</code> to be used */ private static ServiceManager manager; Modified: 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/JdoPMF.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMF.java Tue Oct 5 02:35:53 2004 @@ -15,22 +15,23 @@ */ package org.apache.cocoon.ojb.jdo.components; -import org.apache.avalon.framework.component.Component; import javax.jdo.PersistenceManager; +import org.apache.avalon.framework.component.Component; + /** * 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: JdoPMF.java,v 1.2 2004/03/05 13:02:02 bdelacretaz Exp $ + * @version CVS $Id$ */ -public interface JdoPMF extends Component -{ +public interface JdoPMF extends Component { + String ROLE = JdoPMF.class.getName(); /** * get a Persitence Manager. */ - public PersistenceManager getPersistenceManager(); + PersistenceManager getPersistenceManager(); } Modified: 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/jdo/components/JdoPMFImpl.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/jdo/components/JdoPMFImpl.java Tue Oct 5 02:35:53 2004 @@ -18,11 +18,6 @@ import javax.jdo.PersistenceManager; import javax.jdo.PersistenceManagerFactory; -import org.apache.avalon.framework.activity.Disposable; -import org.apache.avalon.framework.activity.Initializable; -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.thread.ThreadSafe; import org.apache.cocoon.ojb.components.AbstractOjbImpl; import org.apache.ojb.jdori.sql.OjbStorePMF; @@ -31,57 +26,46 @@ * 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: JdoPMFImpl.java,v 1.5 2004/03/05 13:02:02 bdelacretaz Exp $ + * @version CVS $Id$ */ -public class JdoPMFImpl extends AbstractOjbImpl implements JdoPMF, Configurable, Initializable, -Disposable, ThreadSafe -{ - protected PersistenceManagerFactory factory = null; +public class JdoPMFImpl + extends AbstractOjbImpl + implements JdoPMF, ThreadSafe { - /* (non-Javadoc) - * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) - */ - public void configure(Configuration myconf) throws ConfigurationException - { - if (this.getLogger().isDebugEnabled()) - this.getLogger().debug("OJB-JDO: configuration"); - } + protected PersistenceManagerFactory factory; /* (non-Javadoc) * @see org.apache.avalon.framework.activity.Disposable#dispose() */ - public void dispose() - { + public void dispose() { super.dispose(); - if (this.getLogger().isDebugEnabled()) - this.getLogger().debug("OJB-JDO: Disposed OK!"); + if (this.getLogger().isDebugEnabled()) { + this.getLogger().debug("OJB-JDO: Disposed OK!"); + } } - /* (non-Javadoc) - * @see org.apache.cocoon.ojb.jdori.components.JdoPMF#getPersistenceManager() - */ - public PersistenceManager getPersistenceManager() - { - return factory.getPersistenceManager(); - } - /* (non-Javadoc) - * @see org.apache.avalon.framework.activity.Initializable#initialize() - */ - public void initialize() throws Exception - { + /* (non-Javadoc) + * @see org.apache.cocoon.ojb.jdori.components.JdoPMF#getPersistenceManager() + */ + public PersistenceManager getPersistenceManager() { + return 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); - } - } - } + 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); + } + } + } } Modified: 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/OdmgImplementation.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementation.java Tue Oct 5 02:35:53 2004 @@ -24,10 +24,10 @@ * Interface of the ODMG Implementation. It is used to get the Implementation Object to interact with ODMG using OJB * * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> - * @version CVS $Id: OdmgImplementation.java,v 1.2 2004/03/05 13:02:02 bdelacretaz Exp $ + * @version CVS $Id$ */ -public interface OdmgImplementation - extends Component { +public interface OdmgImplementation extends Component { + /** The ROLE */ String ROLE = OdmgImplementation.class.getName(); Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/odmg/components/OdmgImplementationImpl.java ============================================================================== --- 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 Tue Oct 5 02:35:53 2004 @@ -19,11 +19,6 @@ 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.configuration.Configurable; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.ojb.components.AbstractOjbImpl; import org.apache.ojb.odmg.OJB; @@ -36,11 +31,11 @@ * Implementation of the OdmgImplementation. Create a ODMG Implementation and store it for future use * * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> - * @version CVS $Id: OdmgImplementationImpl.java,v 1.3 2004/03/05 13:02:02 bdelacretaz Exp $ + * @version CVS $Id$ */ public class OdmgImplementationImpl extends AbstractOjbImpl - implements OdmgImplementation, Configurable, Initializable, Disposable, ThreadSafe { + implements OdmgImplementation, ThreadSafe { private final static String DEFAULT_CONNECTION ="default"; private final static int DEFAULT_MODE = Database.OPEN_READ_WRITE; @@ -49,16 +44,6 @@ private Hashtable databases = new Hashtable(); /* (non-Javadoc) - * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) - */ - public void configure(Configuration myconf) - throws ConfigurationException { - if (this.getLogger().isDebugEnabled()) { - this.getLogger().debug("OJB-ODMG: configuration"); - } - } - - /* (non-Javadoc) * @see org.apache.avalon.framework.activity.Disposable#dispose() */ public void dispose() { @@ -150,8 +135,7 @@ /* (non-Javadoc) * @see org.apache.cocoon.ojb.odmg.components.OdmgImplementation#getInstance(int) */ - public Implementation getInstance( int mode ) throws ODMGException - { + public Implementation getInstance( int mode ) throws ODMGException { Database db = (Database)this.databases.get( DEFAULT_CONNECTION+ mode); if(null == db ) { db = this.odmg.newDatabase(); Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/sitemap.xmap ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/sitemap.xmap (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/samples/sitemap.xmap Tue Oct 5 02:35:53 2004 @@ -22,8 +22,8 @@ <map:transformers default="xalan"> <map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer"> <catalogues default="other"> - <catalogue id="other" name="OtherMessages" location="context://samples/forms/messages"/> - <catalogue id="forms" name="FormsMessages" location="context://samples/forms/messages"/> + <catalogue id="other" name="OtherMessages" location="context://samples/blocks/forms/messages"/> + <catalogue id="forms" name="FormsMessages" location="context://samples/blocks/forms/messages"/> </catalogues> <cache-at-startup>true</cache-at-startup> </map:transformer> @@ -92,7 +92,7 @@ <map:transform type="i18n"> <map:parameter name="locale" value="en-US"/> </map:transform> - <map:transform src="context://samples/forms/resources/forms-samples-styling.xsl"/> + <map:transform src="context://samples/blocks/forms/resources/forms-samples-styling.xsl"/> <map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl"> <map:parameter name="contextPath" value="{request:contextPath}"/> <map:parameter name="servletPath" value="{request:servletPath}"/> Modified: cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/acting/modular/TestAction.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/acting/modular/TestAction.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/acting/modular/TestAction.java Tue Oct 5 02:35:53 2004 @@ -22,7 +22,7 @@ import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.parameters.Parameters; import org.apache.avalon.framework.thread.ThreadSafe; -import org.apache.cocoon.acting.ComposerAction; +import org.apache.cocoon.acting.ServiceableAction; import org.apache.cocoon.components.modules.input.InputModule; import org.apache.cocoon.components.modules.output.OutputModule; import org.apache.cocoon.environment.Redirector; @@ -43,9 +43,9 @@ * from the input component to the output component or, if a specific * parameter is specified through parameter-name, just one parameter. * - * @version CVS $Id: TestAction.java,v 1.3 2004/03/05 13:03:02 bdelacretaz Exp $ + * @version CVS $Id$ */ -public class TestAction extends ComposerAction +public class TestAction extends ServiceableAction implements Configurable, ThreadSafe { String INPUT_MODULE_ROLE = InputModule.ROLE; @@ -64,6 +64,9 @@ String outputHint = "request-attr"; // default to request attributes + /* (non-Javadoc) + * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) + */ public void configure(Configuration config) throws ConfigurationException { this.inputConf = config.getChild("input-module"); @@ -76,6 +79,9 @@ + /* (non-Javadoc) + * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters) + */ public Map act( Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters param ) throws Exception { Modified: cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/parentcm/Generator.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/parentcm/Generator.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/parentcm/Generator.java Tue Oct 5 02:35:53 2004 @@ -16,11 +16,11 @@ package org.apache.cocoon.samples.parentcm; import org.apache.avalon.excalibur.pool.Poolable; -import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.parameters.Parameters; +import org.apache.avalon.framework.service.ServiceException; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.environment.SourceResolver; -import org.apache.cocoon.generation.ComposerGenerator; +import org.apache.cocoon.generation.ServiceableGenerator; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; @@ -35,9 +35,9 @@ * <code>Time</code> component. * * @author <a href="mailto:[EMAIL PROTECTED]">Leo Sutic</a> - * @version CVS $Id: Generator.java,v 1.2 2004/03/05 13:03:02 bdelacretaz Exp $ + * @version CVS $Id$ */ -public class Generator extends ComposerGenerator implements Poolable { +public class Generator extends ServiceableGenerator implements Poolable { /** * Current time. @@ -52,9 +52,9 @@ Time timeGiver = null; try { - timeGiver = (Time) manager.lookup(Time.ROLE); + timeGiver = (Time) this.manager.lookup(Time.ROLE); this.time = timeGiver.getTime (); - } catch (ComponentException ce) { + } catch (ServiceException ce) { throw new ProcessingException ("Could not obtain current time.", ce); } finally { manager.release(timeGiver);