cziegeler 02/03/15 05:39:51 Modified: src/java/org/apache/cocoon/components CocoonComponentManager.java Log: Commented out new source resolving for new release Revision Changes Path 1.11 +76 -11 xml-cocoon2/src/java/org/apache/cocoon/components/CocoonComponentManager.java Index: CocoonComponentManager.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/CocoonComponentManager.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- CocoonComponentManager.java 13 Mar 2002 14:50:57 -0000 1.10 +++ CocoonComponentManager.java 15 Mar 2002 13:39:51 -0000 1.11 @@ -56,14 +56,17 @@ import java.util.Map; import java.util.Stack; import org.apache.avalon.excalibur.component.ExcaliburComponentManager; -import org.apache.avalon.excalibur.source.SourceResolver; import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.component.Recomposable; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.environment.Environment; -import org.apache.cocoon.environment.Source; +/* The new source resolving (will go online after 2.0.2) +import java.net.MalformedURLException; +import org.apache.avalon.excalibur.source.Source; +import org.apache.avalon.excalibur.source.SourceResolver; +*/ import org.xml.sax.SAXException; @@ -74,14 +77,22 @@ * and by handling the lookup of the <code>SourceResolver</code> (in development) * * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: CocoonComponentManager.java,v 1.10 2002/03/13 14:50:57 cziegeler Exp $ + * @version CVS $Id: CocoonComponentManager.java,v 1.11 2002/03/15 13:39:51 cziegeler Exp $ */ public final class CocoonComponentManager extends ExcaliburComponentManager +/* The new source resolving (will go online after 2.0.2) +implements SourceResolver +*/ { /** The environment information */ private static InheritableThreadLocal environmentStack = new InheritableThreadLocal(); + /** The configured <code>SourceResolver</code> */ + /* The new source resolving (will go online after 2.0.2) + private SourceResolver sourceResolver; + */ + /** Create the ComponentManager */ public CocoonComponentManager() { @@ -153,6 +164,14 @@ */ public Component lookup( final String role ) throws ComponentException { + /* The new source resolving (will go online after 2.0.2) + if ( role.equals(SourceResolver.ROLE) ) { + if ( null == this.sourceResolver ) { + this.sourceResolver = (SourceResolver) super.lookup( role ); + } + return this; + } + */ final Stack stack = (Stack)environmentStack.get(); if ( null != stack && !stack.empty()) { final Object[] objects = (Object[])stack.peek(); @@ -164,12 +183,6 @@ return component; } } - - if ( role.equals(SourceResolver.ROLE) ) { - SourceResolver resolver = (SourceResolver) super.lookup( role ); - // wrap resolver here: - return new CocoonSourceResolver((Environment)objects[0], resolver); - } } final Component component = super.lookup( role ); @@ -205,17 +218,69 @@ if ( component instanceof RequestLifecycleComponent) { return; } - if ( component instanceof CocoonSourceResolver ) { - super.release(((CocoonSourceResolver)component).getSourceResolver()); + /* The new source resolving (will go online after 2.0.2) + if ( component == this ) { return; } + */ super.release( component); } /** + * Dispose + */ + /* The new source resolving (will go online after 2.0.2) + public void dispose() { + if ( null != this.sourceResolver ) { + super.release( this.sourceResolver ); + this.sourceResolver = null; + } + super.dispose(); + } + */ + + /** * Release a RequestLifecycleComponent */ protected void releaseRLComponent( final Component component ) { super.release( component ); } + + /** + * Get a <code>Source</code> object. + */ + /* The new source resolving (will go online after 2.0.2) + public Source resolve(final String location) + throws MalformedURLException, IOException, ComponentException { + return this.resolve(location, null, null); + } + */ + + /** + * Get a <code>Source</code> object. + */ + /* The new source resolving (will go online after 2.0.2) + public Source resolve(final String location, + String baseURI, + final Map parameters) + throws MalformedURLException, IOException, ComponentException { + if (baseURI == null) { + final Stack stack = (Stack)environmentStack.get(); + if ( null != stack && !stack.empty()) { + final Object[] objects = (Object[])stack.peek(); + baseURI = ((Environment)objects[0]).getContext().toExternalForm(); + } + } + return this.sourceResolver.resolve(location, baseURI, parameters); + } + */ + + /** + * Releases a resolved resource + */ + /* The new source resolving (will go online after 2.0.2) + public void release( final Source source ) { + this.sourceResolver.release( source ); + } + */ }
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]