cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor TreeProcessor.java
Date Wed, 28 Jan 2004 10:17:18 GMT
cziegeler    2004/01/28 02:17:18

  Modified:    src/java/org/apache/cocoon/components/cprocessor/sitemap
                        MountNode.java ActNode.java
               src/java/org/apache/cocoon/environment/internal
                        EnvironmentHelper.java
               src/java/org/apache/cocoon/components/cprocessor
                        TreeProcessor.java
  Log:
  Use SourceResolver from processor
  
  Revision  Changes    Path
  1.6       +5 -2      cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/sitemap/MountNode.java
  
  Index: MountNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/sitemap/MountNode.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MountNode.java	5 Jan 2004 11:28:24 -0000	1.5
  +++ MountNode.java	28 Jan 2004 10:17:12 -0000	1.6
  @@ -117,8 +117,11 @@
           }
       }
       
  +    /* (non-Javadoc)
  +     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
  +     */
       public void contextualize(Context context) throws ContextException {
  -        m_parentProcessor = (TreeProcessor) context.get("treeprocessor");
  +        m_parentProcessor = (TreeProcessor) context.get(TreeProcessor.CONTEXT_TREE_PROCESSOR);
       }
   
       public final boolean invoke(Environment env, InvokeContext context)
  
  
  
  1.4       +17 -3     cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/sitemap/ActNode.java
  
  Index: ActNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/sitemap/ActNode.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ActNode.java	27 Jan 2004 13:41:42 -0000	1.3
  +++ ActNode.java	28 Jan 2004 10:17:12 -0000	1.4
  @@ -57,6 +57,9 @@
   import org.apache.avalon.framework.activity.Initializable;
   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.parameters.Parameters;
   import org.apache.avalon.framework.service.ServiceException;
   import org.apache.avalon.framework.thread.ThreadSafe;
  @@ -64,6 +67,7 @@
   import org.apache.cocoon.components.cprocessor.InvokeContext;
   import org.apache.cocoon.components.cprocessor.ProcessingNode;
   import org.apache.cocoon.components.cprocessor.SimpleParentProcessingNode;
  +import org.apache.cocoon.components.cprocessor.TreeProcessor;
   import org.apache.cocoon.components.cprocessor.variables.VariableResolver;
   import org.apache.cocoon.components.cprocessor.variables.VariableResolverFactory;
   import org.apache.cocoon.environment.Environment;
  @@ -85,7 +89,7 @@
    * @x-avalon.info name=act-node
    */
   public class ActNode extends SimpleParentProcessingNode
  -implements ProcessingNode, Initializable, Disposable {
  +implements ProcessingNode, Initializable, Disposable, Contextualizable {
       
       /** The 'name' for the variable anchor */
       private String m_name;
  @@ -104,6 +108,9 @@
   
       protected boolean m_inActionSet;
   
  +    /** The source resolver for this sitemap */
  +    protected SourceResolver resolver;
  +    
       public ActNode() {
       }
   
  @@ -114,6 +121,14 @@
           return true;
       }
   
  +    /* (non-Javadoc)
  +     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
  +     */
  +    public void contextualize(Context context) throws ContextException {
  +        TreeProcessor processor = (TreeProcessor) context.get(TreeProcessor.CONTEXT_TREE_PROCESSOR);
  +        this.resolver = processor.getEnvironmentHelper();
  +    }
  +    
       public void configure(Configuration config) throws ConfigurationException {
           super.configure(config);
           m_name = config.getAttribute("name", null);
  @@ -195,7 +210,6 @@
           // Prepare data needed by the action
           Map            objectModel    = env.getObjectModel();
           Redirector     redirector     = EnvironmentHelper.getRedirector(env);
  -        SourceResolver resolver       = EnvironmentHelper.getSourceResolver(env);
           String         resolvedSource = m_source.resolve(context, objectModel);
           Parameters     resolvedParams = VariableResolver.buildParameters(super.m_parameters,
context, objectModel);
   
  
  
  
  1.5       +1 -17     cocoon-2.2/src/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java
  
  Index: EnvironmentHelper.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EnvironmentHelper.java	27 Jan 2004 13:41:51 -0000	1.4
  +++ EnvironmentHelper.java	28 Jan 2004 10:17:14 -0000	1.5
  @@ -88,10 +88,6 @@
   extends AbstractLogEnabled
   implements SourceResolver, Serviceable, Disposable {
   
  -    /** The key used to store the current SourceResolver 
  -     * in the environment context */
  -    private static final String SOURCE_RESOLVER_KEY = "global:" + SourceResolver.class.getName();
  -
       /** The key used to store the current redirector 
        * in the environment context */
       private static final String REDIRECTOR_KEY = "global:" + Redirector.class.getName();
  @@ -416,7 +412,6 @@
           
           EnvironmentContext ctx = (EnvironmentContext)env.getObjectModel().get(PROCESS_KEY);
           ctx.addAttribute(LAST_PROCESSOR_KEY, processor);
  -        ctx.addAttribute(SOURCE_RESOLVER_KEY, processor.getEnvironmentHelper());
           
           ForwardRedirector redirector = new ForwardRedirector(env);
           redirector.enableLogging(processor.getEnvironmentHelper().getLogger());
  @@ -475,17 +470,6 @@
               final EnvironmentInfo info = stack.getCurrentInfo();
               final Map objectModel = info.environment.getObjectModel();
               return (EnvironmentContext)objectModel.get(PROCESS_KEY);
  -        }
  -        return null;
  -    }
  -    
  -    /**
  -     * Return the SourceResolver
  -     */
  -    public static SourceResolver getSourceResolver(Environment env) {
  -        final EnvironmentContext ctx = getEnvironmentContext(env);
  -        if (ctx != null) {
  -            return (SourceResolver) ctx.getAttribute(SOURCE_RESOLVER_KEY);
           }
           return null;
       }
  
  
  
  1.16      +4 -1      cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/TreeProcessor.java
  
  Index: TreeProcessor.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/TreeProcessor.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TreeProcessor.java	26 Jan 2004 15:53:25 -0000	1.15
  +++ TreeProcessor.java	28 Jan 2004 10:17:16 -0000	1.16
  @@ -121,6 +121,9 @@
       /** The key for the pipeline component */
       public static final String PIPELINE_KEY = ProcessingPipeline.class.getName();
       
  +    /** The key for the processor inside the component context */
  +    public static final String CONTEXT_TREE_PROCESSOR = TreeProcessor.class.getName();
  +    
       /* The xsl transformation location for turning a 
        * sitemap into a Fortress container configuration 
        */
  @@ -348,7 +351,7 @@
       private void createContainer() throws Exception {
           // create the sitemap container
           DefaultContext context = new DefaultContext(m_context);
  -        context.put("treeprocessor",this);
  +        context.put(TreeProcessor.CONTEXT_TREE_PROCESSOR, this);
           context.makeReadOnly();
           FortressConfig config = new FortressConfig(context);
           config.setContainerClass(SitemapContainer.class);
  
  
  

Mime
View raw message