cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jheym...@apache.org
Subject svn commit: r330548 [55/132] - in /cocoon/whiteboard/maven2/cocoon-flat-layout: ./ cocoon-ajax-block/ cocoon-ajax-block/api/ cocoon-ajax-block/api/src/ cocoon-ajax-block/api/src/main/ cocoon-ajax-block/api/src/main/java/ cocoon-ajax-block/api/src/main/...
Date Thu, 03 Nov 2005 14:00:48 GMT
Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapParameters.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapParameters.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapParameters.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapParameters.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,89 @@
+/*
+ * Copyright 1999-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.sitemap;
+
+import java.util.HashMap;
+
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.cocoon.util.location.Locatable;
+import org.apache.cocoon.util.location.Location;
+
+/**
+ * Extension to the Avalon Parameters to give location information
+ *
+ * @version CVS $Id: SitemapParameters.java 233343 2005-08-18 18:06:44Z sylvain $
+ */
+public class SitemapParameters extends Parameters implements Locatable {
+    
+    private Location location = Location.UNKNOWN;
+    
+    public SitemapParameters(Location location) {
+        this.location = location;
+    }
+    
+    /*
+     * Get the location of the statement defining these parameters.
+     * 
+     * @since 2.1.8
+     * @see org.apache.cocoon.util.location.Locatable#getLocation()
+     */
+    public Location getLocation() {
+        return this.location;
+    }
+    
+    /**
+     * Get the location of a <code>Parameters</code> object, returning
+     * {@link Location#UNKNOWN} if no location could be found.
+     * 
+     * @param param
+     * @return the location
+     * @since 2.1.8
+     */
+    public static Location getLocation(Parameters param) {
+        Location loc = null;
+        if (param instanceof Locatable) {
+            loc = ((Locatable)param).getLocation();
+        }
+        return loc == null ? Location.UNKNOWN : loc;
+    }
+
+    /**
+     * @deprecated use {@link #getLocation(Parameters)}
+     */
+    public static String getStatementLocation(Parameters param) {
+        return getLocation(param).toString();
+    }    
+
+    /**
+     * For internal use only.
+     */
+    public static class LocatedHashMap extends HashMap implements Locatable {
+        private Location loc;
+
+        public Location getLocation() {
+            return this.loc;
+        }
+        
+        public LocatedHashMap(Location loc) {
+            this.loc = loc;
+        }
+
+        public LocatedHashMap(Location loc, int size) {
+            super(size);
+            this.loc = loc;
+        }
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapParameters.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/AbstractVirtualSitemapComponent.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/AbstractVirtualSitemapComponent.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/AbstractVirtualSitemapComponent.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/AbstractVirtualSitemapComponent.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,258 @@
+/*
+ * 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.
+ */
+package org.apache.cocoon.sitemap.impl;
+
+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.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.context.DefaultContext;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+
+import org.apache.cocoon.Constants;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.components.source.SourceUtil;
+import org.apache.cocoon.components.source.impl.SitemapSourceInfo;
+import org.apache.cocoon.components.pipeline.VirtualProcessingPipeline;
+import org.apache.cocoon.components.treeprocessor.InvokeContext;
+import org.apache.cocoon.components.treeprocessor.ProcessingNode;
+import org.apache.cocoon.components.treeprocessor.sitemap.VPCNode;
+import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.environment.internal.EnvironmentHelper;
+import org.apache.cocoon.environment.wrapper.EnvironmentWrapper;
+import org.apache.cocoon.sitemap.SitemapModelComponent;
+import org.apache.cocoon.xml.AbstractXMLPipe;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceException;
+import org.apache.excalibur.xml.sax.XMLizable;
+
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * TODO List:
+ * <ul>
+ * <li>Refactor ProcessingPipelines implementations
+ * <li>Implement caching
+ * </ul>
+ */
+public abstract class AbstractVirtualSitemapComponent extends AbstractXMLPipe
+    implements SitemapModelComponent, Serviceable, Contextualizable, Configurable {
+
+    private ProcessingNode node;
+    private String sourceMapName;
+    private Map sourceMap = new HashMap();
+    private Set sources;
+    private VirtualProcessingPipeline pipeline;
+    // An environment containing a map with the souces from the calling environment
+    private EnvironmentWrapper mappedSourceEnvironment;
+    // An environment with the URI and URI prefix of the sitemap where the VPC is defined
+    private EnvironmentWrapper vpcEnvironment;
+
+    protected DefaultContext context;
+    protected SourceResolver resolver;
+    protected ServiceManager manager;
+
+    private class MyInvokeContext extends InvokeContext {
+        public MyInvokeContext(Logger logger) throws Exception {
+            super(true);
+            super.processingPipeline = new VirtualProcessingPipeline(AbstractVirtualSitemapComponent.this.context);
+            ((VirtualProcessingPipeline)super.processingPipeline).enableLogging(logger);
+        }
+    }
+
+    abstract protected String getTypeName();
+
+    /**
+     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+     */
+    public void contextualize(Context context) throws ContextException {
+        this.context = (DefaultContext)context;
+    }
+
+    /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+     */
+    public void service(ServiceManager manager) throws ServiceException {
+        this.manager = manager;
+    }
+
+    /**
+     * Release all resources.
+     */
+    public void recycle() {
+        Iterator sources = this.sourceMap.values().iterator();
+        while (sources.hasNext()) {
+            Source source = (Source)sources.next();
+            // FIXME
+            // These are allready disposed, why?
+            //this.resolver.release(source);
+        }
+        this.sourceMap.clear();
+        super.recycle();
+    }
+
+    /**
+     * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
+     */
+    public void configure(Configuration configuration) throws ConfigurationException {
+        String name = configuration.getAttribute("name");
+        this.sourceMapName =
+            Constants.CONTEXT_ENV_PREFIX + "-" + getTypeName() + "-source-map-" + name;
+        try {
+            this.node = (ProcessingNode)this.context.get(Constants.CONTEXT_VPC_PREFIX +
+                                                         getTypeName() + "-" + name);
+            this.sources = ((VPCNode)node).getSources();
+        } catch (Exception e) {
+            throw new ConfigurationException("Can not find VirtualPipelineComponent '" +
+                                             name + "' configuration");
+        }
+    }
+
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapModelComponent#setup(org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
+     */
+    public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
+    throws ProcessingException, SAXException, IOException {
+        this.resolver = resolver;
+
+        Environment env = EnvironmentHelper.getCurrentEnvironment();
+
+        // Hack to get an info object with the right uri for the
+        // current sitemap, there is no vpc protocol.
+        SitemapSourceInfo mappedSourceEnvironmentInfo =
+            SitemapSourceInfo.parseURI(env, "vpc:/");
+
+        this.mappedSourceEnvironment =
+            new EnvironmentWrapper(env, mappedSourceEnvironmentInfo, getLogger());
+        // place for resolved sources
+        this.mappedSourceEnvironment.setAttribute(this.sourceMapName, this.sourceMap);
+
+        MyInvokeContext invoker = null;
+
+        try {
+            // resolve the sources in the parameter map before switching context
+            Map resolvedParams = resolveParams(par, src);
+
+            // set up info object for VPC environment wrapper, would
+            // better be done in a constructor for the info.
+            SitemapSourceInfo vpcEnvironmentInfo = new SitemapSourceInfo();
+            vpcEnvironmentInfo.prefix = (String) this.context.get(Constants.CONTEXT_ENV_PREFIX);
+            vpcEnvironmentInfo.uri = (String) this.context.get(Constants.CONTEXT_ENV_URI);
+            vpcEnvironmentInfo.requestURI = vpcEnvironmentInfo.prefix + vpcEnvironmentInfo.uri;
+            vpcEnvironmentInfo.rawMode = false;
+
+            // set up the vpc environment
+            this.vpcEnvironment =
+                new EnvironmentWrapper(this.mappedSourceEnvironment,
+                                       vpcEnvironmentInfo, getLogger());
+
+            EnvironmentHelper.enterEnvironment(this.vpcEnvironment);
+
+            // set up invoker with sitemap params
+            invoker = new MyInvokeContext(getLogger());
+            invoker.enableLogging(getLogger());
+            invoker.service(this.manager);
+            invoker.pushMap(null, resolvedParams);
+
+            this.node.invoke(this.vpcEnvironment, invoker);
+            this.pipeline = (VirtualProcessingPipeline)invoker.getProcessingPipeline();
+        } catch (Exception e) {
+            throw new ProcessingException("Oops", e);
+        } finally {
+            if (invoker != null) {
+                invoker.popMap();
+                invoker.dispose();
+            }
+            // Restore context
+            EnvironmentHelper.leaveEnvironment();
+        }
+    }
+
+    protected VirtualProcessingPipeline getPipeline() {
+        return this.pipeline;
+    }
+
+    // An environment containing a map with the souces from the calling environment
+    protected EnvironmentWrapper getMappedSourceEnvironment() {
+        return this.mappedSourceEnvironment;
+    }
+
+    // An environment with the URI and URI prefix of the sitemap where the VPC is defined
+    protected EnvironmentWrapper getVPCEnvironment() {
+        return this.vpcEnvironment;
+    }
+
+    private Map resolveParams(Parameters par, String src)
+        throws ProcessingException, IOException {
+        HashMap map = new HashMap();
+
+        // resolve and map params
+        String[] names = par.getNames();
+        for(int i=0; i<names.length; i++) {
+            String name = names[i];
+            String value = par.getParameter(name, null);
+            if (this.sources.contains(name)) {
+                value = resolveAndMapSourceURI(name, value);
+            }
+            map.put(name, value);
+        }
+
+        // resolve and map src
+        if (src != null) {
+            map.put("src", resolveAndMapSourceURI("src", src));
+        }
+
+        return map;
+    }
+
+    private String resolveAndMapSourceURI(String name, String uri)
+        throws ProcessingException, IOException {
+
+        // Resolve the URI
+        Source src = null;
+        try {
+            src = this.resolver.resolveURI(uri);
+        } catch (SourceException se) {
+            throw SourceUtil.handle("Error during resolving of " + uri, se);
+        }
+
+        // Save the source
+        this.sourceMap.put(name, src);
+
+        // Create a new URI that refers to the source in the context
+        String mappedURI;
+        if (src instanceof XMLizable) {
+            mappedURI = "xmodule:environment-attr:" + this.sourceMapName + "#" + name;
+        } else {
+            mappedURI = "module:environment-attr:" + this.sourceMapName + "#" + name;
+        }
+
+        return mappedURI;
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/AbstractVirtualSitemapComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/ComponentManager.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/ComponentManager.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/ComponentManager.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/ComponentManager.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,125 @@
+/*
+ * Copyright 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.sitemap.impl;
+
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.sitemap.ComponentLocator;
+
+
+/**
+ * This is the connection between the Cocoon core components
+ * and an optional application/sitemap container.
+ *
+ * It acts as a service manager and as a component locator at the same time.
+ * A component manager is initialized with both, a service manager for a sitemap
+ * and an optional component locator for the sitemap. Each operation (lookup etc.)
+ * is first performed on the component locator. If the locator does not have
+ * the component in question, the service manager is asked.
+ *
+ * @since 2.2
+ * @version $Id: ComponentManager.java 171341 2005-05-22 16:35:41Z cziegeler $
+ */
+public class ComponentManager implements ServiceManager, ComponentLocator {
+
+    final protected ServiceManager serviceManager;
+    final protected ComponentLocator componentLocator;
+
+    public ComponentManager(final ServiceManager sm, final ComponentLocator cl) {
+        this.serviceManager = sm;
+        this.componentLocator = cl;
+    }
+
+    /**
+     * @see org.apache.avalon.framework.service.ServiceManager#hasService(java.lang.String)
+     */
+    public boolean hasService(String key) {
+        boolean result = false;
+        if ( this.componentLocator != null ) {
+            result = this.componentLocator.hasComponent(key);
+        }
+        if ( !result ) {
+            result = this.serviceManager.hasService(key);
+        }
+        return result;
+    }
+
+    /**
+     * @see org.apache.cocoon.sitemap.ComponentLocator#release(java.lang.Object)
+     * @see org.apache.avalon.framework.service.ServiceManager#release(java.lang.Object)
+     */
+    public void release(Object component) {
+        // FIXME - we should optimize this
+        if ( this.componentLocator != null ) {
+            this.componentLocator.release(component);
+        }
+        this.serviceManager.release(component);
+    }
+
+    /**
+     * @see org.apache.cocoon.sitemap.ComponentLocator#hasComponent(java.lang.String)
+     */
+    public boolean hasComponent(String key) {
+        return this.hasService(key);
+    }
+
+    /**
+     * @see org.apache.avalon.framework.service.ServiceManager#lookup(java.lang.String)
+     */
+    public Object lookup(String key) 
+    throws ServiceException {
+        try {
+            return this.doLookup(key);
+        } catch (ProcessingException se) {
+            throw new ServiceException("ComponentLocator", 
+                                       "Unable to lookup component for key: " + key, se);
+        }
+    }
+
+    /**
+     * @see org.apache.cocoon.sitemap.ComponentLocator#getComponent(java.lang.String)
+     */
+    public Object getComponent(String key) throws ProcessingException {
+        try {
+            return this.doLookup(key);
+        } catch (ServiceException se) {
+            throw new ProcessingException("Unable to lookup component for key: " + key, se);
+        }
+    }
+
+    protected Object doLookup(String key)
+    throws ProcessingException, ServiceException {
+        Object component = null;
+        if ( this.componentLocator != null ) {
+            if ( this.componentLocator.hasComponent(key) ) {
+                component = this.componentLocator.getComponent(key);
+            }
+        }
+        if ( component == null && this.serviceManager.hasService(key) ) {
+            component = this.serviceManager.lookup(key);
+        }
+        return component;
+    }
+    
+    public ServiceManager getServiceManager() {
+        if ( this.serviceManager instanceof ComponentManager ) {
+            return ((ComponentManager)this.serviceManager).getServiceManager();
+        }
+        return this.serviceManager;
+    }
+
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/ComponentManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/DefaultExecutor.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/DefaultExecutor.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/DefaultExecutor.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/DefaultExecutor.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,178 @@
+/*
+ * Copyright 1999-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.sitemap.impl;
+
+import java.util.Map;
+
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.cocoon.acting.Action;
+import org.apache.cocoon.environment.Redirector;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.matching.Matcher;
+import org.apache.cocoon.matching.PreparableMatcher;
+import org.apache.cocoon.selection.Selector;
+import org.apache.cocoon.selection.SwitchSelector;
+import org.apache.cocoon.sitemap.ExecutionContext;
+import org.apache.cocoon.sitemap.PatternException;
+import org.apache.cocoon.sitemap.SitemapExecutor;
+
+/**
+ * This is the default executor that does nothing but just executing the
+ * statements.
+ * TODO - This is not finished yet!
+ * 
+ * @since 2.2
+ * @version $Id: DefaultExecutor.java 240034 2005-08-25 10:04:05Z cziegeler $
+ */
+public class DefaultExecutor 
+    implements SitemapExecutor {
+    
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#invokeAction(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.acting.Action, org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
+     */
+    public Map invokeAction(final ExecutionContext context,
+                            final Map              objectModel, 
+                            final Action           action, 
+                            final Redirector       redirector, 
+                            final SourceResolver   resolver, 
+                            final String           resolvedSource, 
+                            final Parameters       resolvedParams )
+    throws Exception {
+        return action.act(redirector, resolver, objectModel, 
+                resolvedSource, resolvedParams);        
+    }
+    
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#invokeMatcher(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.matching.Matcher, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
+     */
+    public Map invokeMatcher(ExecutionContext context, 
+                             Map objectModel,
+                             Matcher matcher, 
+                             String pattern, 
+                             Parameters resolvedParams)
+    throws PatternException {
+        return matcher.match(pattern, objectModel, resolvedParams);
+    }
+    
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#invokePreparableMatcher(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.matching.PreparableMatcher, java.lang.String, java.lang.Object, org.apache.avalon.framework.parameters.Parameters)
+     */
+    public Map invokePreparableMatcher(ExecutionContext  context,
+                                       Map               objectModel,
+                                       PreparableMatcher matcher,
+                                       String            pattern,
+                                       Object            preparedPattern,
+                                       Parameters        resolvedParams )
+    throws PatternException {
+        return matcher.preparedMatch(preparedPattern, objectModel, resolvedParams);
+    }
+    
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#invokeSelector(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.selection.Selector, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
+     */
+    public boolean invokeSelector(ExecutionContext context, Map objectModel,
+            Selector selector, String expression, Parameters parameters) {
+        return selector.select(expression, objectModel, parameters);
+    }
+    
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#invokeSwitchSelector(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.selection.SwitchSelector, java.lang.String, org.apache.avalon.framework.parameters.Parameters, Object)
+     */
+    public boolean invokeSwitchSelector(ExecutionContext context,
+            Map objectModel, SwitchSelector selector, String expression,
+            Parameters parameters, Object selectorContext) {
+        return selector.select(expression, selectorContext);
+    }
+    
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#popVariables(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map)
+     */
+    public void popVariables(ExecutionContext context,
+                             Map              objectModel) {
+        // nothing to do
+    }
+    
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#pushVariables(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, java.lang.String, java.util.Map)
+     */
+    public Map pushVariables(ExecutionContext context, 
+                             Map              objectModel,
+                             String key, Map variables) {
+        return variables;
+    }
+    
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#enterSitemap(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, java.lang.String)
+     */
+    public void enterSitemap(ExecutionContext context, Map objectModel, String source) {
+        // nothing to do
+    }
+    
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#addGenerator(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.sitemap.SitemapExecutor.PipelineComponentDescription)
+     */
+    public PipelineComponentDescription addGenerator(ExecutionContext context,
+            Map objectModel, PipelineComponentDescription desc) {
+        return desc;
+    }
+    
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#addReader(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.sitemap.SitemapExecutor.PipelineComponentDescription)
+     */
+    public PipelineComponentDescription addReader(ExecutionContext context,
+            Map objectModel, PipelineComponentDescription desc) {
+        return desc;
+    }
+    
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#addSerializer(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.sitemap.SitemapExecutor.PipelineComponentDescription)
+     */
+    public PipelineComponentDescription addSerializer(ExecutionContext context,
+            Map objectModel, PipelineComponentDescription desc) {
+        return desc;
+    }
+    
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#addTransformer(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.sitemap.SitemapExecutor.PipelineComponentDescription)
+     */
+    public PipelineComponentDescription addTransformer(
+            ExecutionContext context, Map objectModel,
+            PipelineComponentDescription desc) {
+        return desc;
+    }
+
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#leaveSitemap(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map)
+     */
+    public void leaveSitemap(ExecutionContext context, Map objectModel) {
+        // nothing to do
+    }
+
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#redirectTo(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, java.lang.String, boolean, boolean, boolean)
+     */
+    public String redirectTo(ExecutionContext context, Map objectModel, String uri, boolean createSession, boolean global, boolean permanent) {
+        return uri;
+    }
+
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#enteringPipeline(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.sitemap.SitemapExecutor.PipelineComponentDescription)
+     */
+    public PipelineComponentDescription enteringPipeline(ExecutionContext context, Map objectModel, PipelineComponentDescription desc) {
+        return desc;
+    }
+
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/sitemap/impl/DefaultExecutor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/transformation/AbstractDOMTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/transformation/AbstractDOMTransformer.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/transformation/AbstractDOMTransformer.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/transformation/AbstractDOMTransformer.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,242 @@
+/*
+ * 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.
+ */
+package org.apache.cocoon.transformation;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.xml.dom.DOMBuilder;
+import org.apache.cocoon.xml.dom.DOMStreamer;
+
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * An Abstract DOM Transformer, for use when a transformer needs a DOM-based
+ * view of the document.
+ * Subclass this interface and implement <code>transform(Document doc)</code>.
+ * If you need a ServiceManager there is an instance variable
+ * <code>manager</code> for use.
+ *
+ * @author <a href="mailto:rossb@apache.org">Ross Burton</a>
+ * @author <a href="mailto:brobertson@mta.ca">Bruce G. Robertson</a>
+ * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
+ * @version CVS $Id: AbstractDOMTransformer.java 55391 2004-10-23 18:15:02Z cziegeler $
+ */
+public abstract class AbstractDOMTransformer extends AbstractTransformer
+        implements DOMBuilder.Listener, Serviceable, Disposable {
+
+    /**
+     *  The SAX entity resolver
+     */
+    protected SourceResolver resolver;
+
+    /**
+     *  The request object model
+     */
+    protected Map objectModel;
+
+    /**
+     *  The URI requested
+     */
+    protected String source;
+
+    /**
+     *  Parameters in the sitemap
+     */
+    protected Parameters parameters;
+
+    /**
+     * A <code>ServiceManager</code> which is available for use.
+     */
+    protected ServiceManager manager;
+
+    /**
+     * The <code>DOMBuilder</code> used to build DOM tree out of
+     *incoming SAX events.
+     */
+    protected DOMBuilder builder;
+
+
+    public AbstractDOMTransformer() {
+        super();
+        this.builder = new DOMBuilder(this);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+     */
+    public void service(ServiceManager manager) throws ServiceException {
+        this.manager = manager;
+    }
+
+    /**
+     * Set the <code>SourceResolver</code>, objectModel <code>Map</code>,
+     * the source and sitemap <code>Parameters</code> used to process the request.
+     *
+     * If you wish to process the parameters, override this method, call
+     * <code>super()</code> and then add your code.
+     */
+    public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
+            throws ProcessingException, SAXException, IOException {
+
+        this.resolver = resolver;
+        this.objectModel = objectModel;
+        this.source = src;
+        this.parameters = par;
+    }
+
+    /**
+     * Recycle the component.
+     */
+    public void recycle() {
+        this.resolver = null;
+        this.source = null;
+        this.objectModel = null;
+        this.parameters = null;
+        this.builder.recycle();
+        super.recycle();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public void dispose() {
+        this.builder = null;
+        this.manager = null;
+    }
+
+    /**
+     * This method is called when the Document is finished.
+     * @param doc The DOM Document object representing this SAX stream
+     * @see org.apache.cocoon.xml.dom.DOMBuilder.Listener
+     */
+    public void notify(Document doc) throws SAXException {
+        // Call the user's transform method
+        Document newdoc = transform(doc);
+
+        // Now we stream the resulting DOM tree down the pipe
+        DOMStreamer s = new DOMStreamer(contentHandler, lexicalHandler);
+        s.stream(newdoc);
+    }
+
+    /**
+     * Transform the specified DOM, returning a new DOM to stream down the pipeline.
+     * @param doc The DOM Document representing the SAX stream
+     * @return A DOM Document to stream down the pipeline
+     */
+    protected abstract Document transform(Document doc);
+
+
+    //
+    // SAX Methods. Send incoming SAX events to the DOMBuilder.
+    //
+
+    public void setDocumentLocator(Locator locator) {
+        builder.setDocumentLocator(locator);
+    }
+
+    public void startDocument() throws SAXException {
+        builder.startDocument();
+    }
+
+    public void endDocument() throws SAXException {
+        builder.endDocument();
+    }
+
+    public void startPrefixMapping(String prefix, String uri) throws SAXException {
+        builder.startPrefixMapping(prefix, uri);
+    }
+
+    public void endPrefixMapping(String prefix) throws SAXException {
+        builder.endPrefixMapping(prefix);
+    }
+
+    public void startElement(String uri, String loc, String raw, Attributes a)
+            throws SAXException {
+        builder.startElement(uri, loc, raw, a);
+    }
+
+    public void endElement(String uri, String loc, String raw)
+            throws SAXException {
+        builder.endElement(uri, loc, raw);
+    }
+
+    public void characters(char c[], int start, int len)
+            throws SAXException {
+        builder.characters(c, start, len);
+    }
+
+    public void ignorableWhitespace(char c[], int start, int len)
+            throws SAXException {
+        builder.ignorableWhitespace(c, start, len);
+    }
+
+    public void processingInstruction(String target, String data)
+            throws SAXException {
+        builder.processingInstruction(target, data);
+    }
+
+    public void skippedEntity(String name)
+            throws SAXException {
+        builder.skippedEntity(name);
+    }
+
+    public void startDTD(String name, String publicId, String systemId)
+            throws SAXException {
+        builder.startDTD(name, publicId, systemId);
+    }
+
+    public void endDTD()
+            throws SAXException {
+        builder.endDTD();
+    }
+
+    public void startEntity(String name)
+            throws SAXException {
+        builder.startEntity(name);
+    }
+
+    public void endEntity(String name)
+            throws SAXException {
+        builder.endEntity(name);
+    }
+
+    public void startCDATA()
+            throws SAXException {
+        builder.startCDATA();
+    }
+
+    public void endCDATA()
+            throws SAXException {
+        builder.endCDATA();
+    }
+
+    public void comment(char ch[], int start, int len)
+            throws SAXException {
+        builder.comment(ch, start, len);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/transformation/AbstractDOMTransformer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/transformation/AbstractExtractionTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/transformation/AbstractExtractionTransformer.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/transformation/AbstractExtractionTransformer.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/transformation/AbstractExtractionTransformer.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,452 @@
+/*
+ * 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.
+ */
+package org.apache.cocoon.transformation;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.avalon.framework.parameters.Parameters;
+
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.xml.dom.DOMBuilder;
+
+import org.w3c.dom.Document;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * This transformer sieves an incoming stream of xml
+ * and feeds a DOMBuilder with it.
+ *
+ * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
+ * @author <a href="mailto:haul@apache.org">Christian Haul</a>
+ * @version CVS $Id: AbstractExtractionTransformer.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+abstract public class AbstractExtractionTransformer extends AbstractTransformer {
+
+    protected DOMBuilder currentBuilder;
+
+    private Map prefixMap;
+
+    protected int extractLevel;
+
+
+    /** Setup the transformer. */
+    public void setup(SourceResolver resolver, Map objectModel, String src, Parameters parameters)
+            throws ProcessingException, SAXException, IOException {
+        extractLevel = 0;
+        prefixMap = new HashMap();
+    }
+
+    public void recycle() {
+        this.extractLevel = 0;
+        this.currentBuilder = null;
+        this.prefixMap = null;
+        super.recycle();
+    }
+
+
+    /**
+     * Begin the scope of a prefix-URI Namespace mapping.
+     *
+     * @param prefix The Namespace prefix being declared.
+     * @param uri The Namespace URI the prefix is mapped to.
+     */
+    public void startPrefixMapping(String prefix, String uri)
+    throws SAXException {
+        if (extractLevel == 0) {
+            super.startPrefixMapping(prefix,uri);
+            prefixMap.put(prefix,uri);
+        } else {
+            this.currentBuilder.startPrefixMapping(prefix,uri);
+        }
+    }
+
+    /**
+     * End the scope of a prefix-URI mapping.
+     *
+     * @param prefix The prefix that was being mapping.
+     */
+    public void endPrefixMapping(String prefix)
+    throws SAXException {
+        if (extractLevel == 0) {
+            super.endPrefixMapping(prefix);
+            prefixMap.remove(prefix);
+        } else {
+            this.currentBuilder.endPrefixMapping(prefix);
+        }
+    }
+
+
+    /**
+     * Receive notification of the beginning of an element. Uses
+     * startExtraction to determine whether to start
+     * extracting. Nested triggering tags result in only one document.
+     * * startExtractedDocument with the first node of the extracted
+     * Document.
+     *
+     * @param uri The Namespace URI, or the empty string if the element has no
+     *            Namespace URI or if Namespace
+     *            processing is not being performed.
+     * @param loc The local name (without prefix), or the empty string if
+     *            Namespace processing is not being performed.
+     * @param raw The raw XML 1.0 name (with prefix), or the empty string if
+     *            raw names are not available.
+     * @param a The attributes attached to the element. If there are no
+     *          attributes, it shall be an empty Attributes object.
+     */
+    public void startElement(String uri, String loc, String raw, Attributes a) throws SAXException {
+        if (!startExtracting(uri, loc, raw, a)) {
+
+            if (extractLevel == 0) {
+                super.startElement(uri,loc,raw,a);
+            } else {
+                this.currentBuilder.startElement(uri,loc,raw,a);
+            }
+
+        } else {
+
+            extractLevel++;
+            if (this.getLogger().isDebugEnabled()) {
+                getLogger().debug("extractLevel now " + extractLevel + ".");
+            }
+
+            if (extractLevel != 1) {
+                this.currentBuilder.startElement(uri,loc,raw,a);
+            } else {
+
+                // setup new document
+                this.currentBuilder = new DOMBuilder();
+                this.currentBuilder.startDocument();
+                // setup namespaces
+                Iterator itt = prefixMap.entrySet().iterator();
+                while (itt.hasNext()) {
+                    Map.Entry entry = (Map.Entry)itt.next();
+                    this.currentBuilder.startPrefixMapping(
+                        (String)entry.getKey(),
+                        (String)entry.getValue()
+                    );
+                }
+                // start root node
+                startExtractingDocument(uri, loc, raw, a);
+
+            }
+
+        }
+    }
+
+
+    /**
+     * Receive notification of the end of an element. Uses
+     * endExtraction to determine whether to stop extracting or
+     * not. Calls endExtractedDocument with the extracted document.
+     *
+     * @param uri The Namespace URI, or the empty string if the element has no
+     *            Namespace URI or if Namespace
+     *            processing is not being performed.
+     * @param loc The local name (without prefix), or the empty string if
+     *            Namespace processing is not being performed.
+     * @param raw The raw XML 1.0 name (with prefix), or the empty string if
+     *            raw names are not available.
+     */
+    public void endElement(String uri, String loc, String raw)
+    throws SAXException {
+        if (extractLevel == 0) {
+            super.endElement(uri,loc,raw);
+        } else {
+            if (endExtracting(uri, loc, raw)) {
+                extractLevel--;
+                if (this.getLogger().isDebugEnabled()) {
+                    getLogger().debug("extractLevel now " + extractLevel + ".");
+                }
+
+                if (extractLevel != 0) {
+                    this.currentBuilder.endElement(uri,loc,raw);
+                } else {
+
+                    // end root element
+                    endExtractingDocument(uri, loc, raw);
+                    // finish building the document. remove existing prefix mappings.
+                    Iterator itt = prefixMap.entrySet().iterator();
+                    while (itt.hasNext()) {
+                        Map.Entry entry = (Map.Entry) itt.next();
+                        this.currentBuilder.endPrefixMapping(
+                            (String)entry.getKey()
+                        );
+                    }
+                    this.currentBuilder.endDocument();
+
+                    handleExtractedDocument(this.currentBuilder.getDocument());
+
+                    if (this.getLogger().isDebugEnabled()) {
+                        getLogger().debug("Stored document.");
+                    }
+
+                }
+            } else {
+                this.currentBuilder.endElement(uri, loc, raw);
+            }
+        }
+    }
+
+    /**
+     * Receive notification of character data.
+     *
+     * @param c The characters from the XML document.
+     * @param start The start position in the array.
+     * @param len The number of characters to read from the array.
+     */
+    public void characters(char c[], int start, int len)
+    throws SAXException {
+        if (extractLevel == 0) {
+            super.characters(c,start,len);
+        } else {
+            this.currentBuilder.characters(c,start,len);
+        }
+    }
+
+    /**
+     * Receive notification of ignorable whitespace in element content.
+     *
+     * @param c The characters from the XML document.
+     * @param start The start position in the array.
+     * @param len The number of characters to read from the array.
+     */
+    public void ignorableWhitespace(char c[], int start, int len)
+    throws SAXException {
+        if (extractLevel == 0) {
+            super.ignorableWhitespace(c,start,len);
+        } else {
+            this.currentBuilder.ignorableWhitespace(c,start,len);
+        }
+    }
+
+    /**
+     * Receive notification of a processing instruction.
+     *
+     * @param target The processing instruction target.
+     * @param data The processing instruction data, or null if none was
+     *             supplied.
+     */
+    public void processingInstruction(String target, String data)
+    throws SAXException {
+        if (extractLevel == 0) {
+            super.processingInstruction(target,data);
+        } else {
+            this.currentBuilder.processingInstruction(target,data);
+        }
+    }
+
+    /**
+     * Receive notification of a skipped entity.
+     *
+     * @param name The name of the skipped entity.  If it is a  parameter
+     *             entity, the name will begin with '%'.
+     */
+    public void skippedEntity(String name)
+    throws SAXException {
+        if (extractLevel == 0) {
+            super.skippedEntity(name);
+        } else {
+            this.currentBuilder.skippedEntity(name);
+        }
+    }
+
+    /**
+     * Report the start of DTD declarations, if any.
+     *
+     * @param name The document type name.
+     * @param publicId The declared public identifier for the external DTD
+     *                 subset, or null if none was declared.
+     * @param systemId The declared system identifier for the external DTD
+     *                 subset, or null if none was declared.
+     */
+    public void startDTD(String name, String publicId, String systemId)
+    throws SAXException {
+        if (extractLevel == 0) {
+            super.startDTD(name,publicId,systemId);
+        } else {
+            throw new SAXException(
+                "Recieved startDTD after beginning fragment extraction process."
+            );
+        }
+    }
+
+    /**
+     * Report the end of DTD declarations.
+     */
+    public void endDTD()
+    throws SAXException {
+        if (extractLevel == 0) {
+            super.endDTD();
+        } else {
+            throw new SAXException(
+                "Recieved endDTD after beginning fragment extraction process."
+            );
+        }
+    }
+
+    /**
+     * Report the beginning of an entity.
+     *
+     * @param name The name of the entity. If it is a parameter entity, the
+     *             name will begin with '%'.
+     */
+    public void startEntity(String name)
+    throws SAXException {
+        if (extractLevel == 0) {
+            super.startEntity(name);
+        } else {
+            this.currentBuilder.startEntity(name);
+        }
+    }
+
+    /**
+     * Report the end of an entity.
+     *
+     * @param name The name of the entity that is ending.
+     */
+    public void endEntity(String name)
+    throws SAXException {
+        if (extractLevel == 0) {
+            super.endEntity(name);
+        } else {
+            this.currentBuilder.endEntity(name);
+        }
+    }
+
+    /**
+     * Report the start of a CDATA section.
+     */
+    public void startCDATA()
+    throws SAXException {
+        if (extractLevel == 0) {
+            super.startCDATA();
+        } else {
+            this.currentBuilder.startCDATA();
+        }
+    }
+
+    /**
+     * Report the end of a CDATA section.
+     */
+    public void endCDATA()
+    throws SAXException {
+        if (extractLevel == 0) {
+            super.endCDATA();
+        } else {
+            this.currentBuilder.endCDATA();
+        }
+    }
+
+    /**
+     * Report an XML comment anywhere in the document.
+     *
+     * @param ch An array holding the characters in the comment.
+     * @param start The starting position in the array.
+     * @param len The number of characters to use from the array.
+     */
+    public void comment(char ch[], int start, int len)
+    throws SAXException {
+        if (extractLevel == 0) {
+            super.comment(ch,start,len);
+        } else {
+            this.currentBuilder.comment(ch,start,len);
+        }
+    }
+
+
+
+    /**
+     * Receive notification of the beginning of an element and signal extraction start.
+     * 
+     * @param uri The Namespace URI, or the empty string if the element has no
+     *            Namespace URI or if Namespace
+     *            processing is not being performed.
+     * @param loc The local name (without prefix), or the empty string if
+     *            Namespace processing is not being performed.
+     * @param raw The raw XML 1.0 name (with prefix), or the empty string if
+     *            raw names are not available.
+     * @param a The attributes attached to the element. If there are no
+     *          attributes, it shall be an empty Attributes object.
+     * @return a <code>boolean</code> value to signal to start extracting
+     */
+    abstract boolean startExtracting(String uri, String loc, String raw, Attributes a);
+
+    /**
+     * Receive notification of the beginning of the extracted Document. Per default send
+     * startElement message to document builder. Override if necessary. Must override 
+     * {@link #endExtractingDocument(String, String, String)} as well. 
+     *
+     * @param uri The Namespace URI, or the empty string if the element has no
+     *            Namespace URI or if Namespace
+     *            processing is not being performed.
+     * @param loc The local name (without prefix), or the empty string if
+     *            Namespace processing is not being performed.
+     * @param raw The raw XML 1.0 name (with prefix), or the empty string if
+     *            raw names are not available.
+     * @param a The attributes attached to the element. If there are no
+     *          attributes, it shall be an empty Attributes object.
+     */
+    public void startExtractingDocument(String uri, String loc, String raw, Attributes a) throws SAXException{
+        this.currentBuilder.startElement(uri,loc,raw,a);
+    }
+
+    /**
+     * Receive notification of the end of an element and signal extraction end.
+     *
+     * @param uri The Namespace URI, or the empty string if the element has no
+     *            Namespace URI or if Namespace
+     *            processing is not being performed.
+     * @param loc The local name (without prefix), or the empty string if
+     *            Namespace processing is not being performed.
+     * @param raw The raw XML 1.0 name (with prefix), or the empty string if
+     * @return a <code>boolean</code> value to signal to stop extracting
+     */
+    abstract boolean endExtracting(String uri, String loc, String raw);
+
+    /**
+     * Receive notification of the end of the extracted Document. Per default, 
+     * send endElement message to document builder. Override if necessary.
+     * Must override
+     * {@link #startExtractingDocument(String, String, String, Attributes)}
+     * as well.
+     *
+     * @param uri The Namespace URI, or the empty string if the element has no
+     *            Namespace URI or if Namespace
+     *            processing is not being performed.
+     * @param loc The local name (without prefix), or the empty string if
+     *            Namespace processing is not being performed.
+     * @param raw The raw XML 1.0 name (with prefix), or the empty string if
+     *            raw names are not available.
+     */
+    public void endExtractingDocument(String uri, String loc, String raw) throws SAXException{
+        this.currentBuilder.endElement(uri,loc,raw);
+    }
+
+    /**
+     * Receive notification of the end of the extracted Document.
+     *
+     * @param doc a <code>Document</code> value
+     */
+    abstract void handleExtractedDocument(Document doc);
+    
+
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/transformation/AbstractExtractionTransformer.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message