cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lgaw...@apache.org
Subject svn commit: r279075 - in /cocoon/blocks/template/trunk/java/org/apache/cocoon/template: JXTemplateGenerator.java TransformerAdapter.java environment/ParsingContext.java script/DefaultScriptManager.java script/Parser.java
Date Tue, 06 Sep 2005 19:28:52 GMT
Author: lgawron
Date: Tue Sep  6 12:27:56 2005
New Revision: 279075

URL: http://svn.apache.org/viewcvs?rev=279075&view=rev
Log:
introduce ParsingContext

Added:
    cocoon/blocks/template/trunk/java/org/apache/cocoon/template/environment/ParsingContext.java
  (with props)
Modified:
    cocoon/blocks/template/trunk/java/org/apache/cocoon/template/JXTemplateGenerator.java
    cocoon/blocks/template/trunk/java/org/apache/cocoon/template/TransformerAdapter.java
    cocoon/blocks/template/trunk/java/org/apache/cocoon/template/script/DefaultScriptManager.java
    cocoon/blocks/template/trunk/java/org/apache/cocoon/template/script/Parser.java

Modified: cocoon/blocks/template/trunk/java/org/apache/cocoon/template/JXTemplateGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/template/trunk/java/org/apache/cocoon/template/JXTemplateGenerator.java?rev=279075&r1=279074&r2=279075&view=diff
==============================================================================
--- cocoon/blocks/template/trunk/java/org/apache/cocoon/template/JXTemplateGenerator.java
(original)
+++ cocoon/blocks/template/trunk/java/org/apache/cocoon/template/JXTemplateGenerator.java
Tue Sep  6 12:27:56 2005
@@ -26,7 +26,6 @@
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.caching.CacheableProcessingComponent;
 import org.apache.cocoon.components.expression.ExpressionContext;
-import org.apache.cocoon.components.expression.ExpressionFactory;
 import org.apache.cocoon.environment.SourceResolver;
 import org.apache.cocoon.generation.ServiceableGenerator;
 import org.apache.cocoon.template.environment.ExecutionContext;

Modified: cocoon/blocks/template/trunk/java/org/apache/cocoon/template/TransformerAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/template/trunk/java/org/apache/cocoon/template/TransformerAdapter.java?rev=279075&r1=279074&r2=279075&view=diff
==============================================================================
--- cocoon/blocks/template/trunk/java/org/apache/cocoon/template/TransformerAdapter.java (original)
+++ cocoon/blocks/template/trunk/java/org/apache/cocoon/template/TransformerAdapter.java Tue
Sep  6 12:27:56 2005
@@ -26,6 +26,7 @@
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.components.expression.ExpressionFactory;
 import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.template.environment.ParsingContext;
 import org.apache.cocoon.template.script.InstructionFactory;
 import org.apache.cocoon.template.script.Parser;
 import org.apache.cocoon.transformation.ServiceableTransformer;
@@ -55,13 +56,13 @@
         public void service(ServiceManager manager) throws ServiceException {
             this.manager = manager;
             this.gen.service(manager);
-            this.instructionFactory = (InstructionFactory) this.manager.lookup(InstructionFactory.ROLE);
-            this.expressionFactory = (ExpressionFactory) this.manager.lookup(ExpressionFactory.ROLE);
+            setParsingContext(new ParsingContext((ExpressionFactory) this.manager.lookup(ExpressionFactory.ROLE),
+                    (InstructionFactory) this.manager.lookup(InstructionFactory.ROLE)));
         }
 
         public void dispose() {
-            this.manager.release(this.instructionFactory);
-            this.manager.release(this.expressionFactory);
+            this.manager.release(this.parsingContext.getInstructionFactory());
+            this.manager.release(this.parsingContext.getExpressionFactory());
         }
 
         public void endDocument() throws SAXException {

Added: cocoon/blocks/template/trunk/java/org/apache/cocoon/template/environment/ParsingContext.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/template/trunk/java/org/apache/cocoon/template/environment/ParsingContext.java?rev=279075&view=auto
==============================================================================
--- cocoon/blocks/template/trunk/java/org/apache/cocoon/template/environment/ParsingContext.java
(added)
+++ cocoon/blocks/template/trunk/java/org/apache/cocoon/template/environment/ParsingContext.java
Tue Sep  6 12:27:56 2005
@@ -0,0 +1,49 @@
+/*
+ * 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.template.environment;
+
+import org.apache.cocoon.components.expression.ExpressionFactory;
+import org.apache.cocoon.template.script.InstructionFactory;
+
+/**
+ * @version SVN $Id$
+ */
+public class ParsingContext {
+    private ExpressionFactory expressionFactory;
+    private InstructionFactory instructionFactory;
+
+    public ParsingContext(ExpressionFactory expressionFactory, InstructionFactory instructionFactory)
{
+        this.expressionFactory = expressionFactory;
+        this.instructionFactory = instructionFactory;
+    }
+
+    public ExpressionFactory getExpressionFactory() {
+        return expressionFactory;
+    }
+
+    public void setExpressionFactory(ExpressionFactory expressionFactory) {
+        this.expressionFactory = expressionFactory;
+    }
+
+    public InstructionFactory getInstructionFactory() {
+        return instructionFactory;
+    }
+
+    public void setInstructionFactory(InstructionFactory instructionFactory) {
+        this.instructionFactory = instructionFactory;
+    }
+
+}

Propchange: cocoon/blocks/template/trunk/java/org/apache/cocoon/template/environment/ParsingContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/blocks/template/trunk/java/org/apache/cocoon/template/environment/ParsingContext.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/blocks/template/trunk/java/org/apache/cocoon/template/script/DefaultScriptManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/template/trunk/java/org/apache/cocoon/template/script/DefaultScriptManager.java?rev=279075&r1=279074&r2=279075&view=diff
==============================================================================
--- cocoon/blocks/template/trunk/java/org/apache/cocoon/template/script/DefaultScriptManager.java
(original)
+++ cocoon/blocks/template/trunk/java/org/apache/cocoon/template/script/DefaultScriptManager.java
Tue Sep  6 12:27:56 2005
@@ -23,6 +23,7 @@
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.components.expression.ExpressionFactory;
 import org.apache.cocoon.components.source.SourceUtil;
+import org.apache.cocoon.template.environment.ParsingContext;
 import org.apache.cocoon.template.script.event.StartDocument;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceException;
@@ -100,7 +101,7 @@
             }
 
             if (doc == null) {
-                Parser parser = new Parser(this.expressionFactory, this.instructionFactory);
+                Parser parser = new Parser(new ParsingContext(this.expressionFactory, this.instructionFactory));
                 // call getValidity before using the stream is faster if
                 // the source is a SitemapSource
                 if (validity == null) {

Modified: cocoon/blocks/template/trunk/java/org/apache/cocoon/template/script/Parser.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/template/trunk/java/org/apache/cocoon/template/script/Parser.java?rev=279075&r1=279074&r2=279075&view=diff
==============================================================================
--- cocoon/blocks/template/trunk/java/org/apache/cocoon/template/script/Parser.java (original)
+++ cocoon/blocks/template/trunk/java/org/apache/cocoon/template/script/Parser.java Tue Sep
 6 12:27:56 2005
@@ -19,6 +19,7 @@
 
 import org.apache.cocoon.components.expression.ExpressionFactory;
 import org.apache.cocoon.template.JXTemplateGenerator;
+import org.apache.cocoon.template.environment.ParsingContext;
 import org.apache.cocoon.template.expression.JXTExpressionCompiler;
 import org.apache.cocoon.template.instruction.Instruction;
 import org.apache.cocoon.template.script.event.*;
@@ -43,25 +44,19 @@
     StringBuffer charBuf;
 
     public static final Locator NULL_LOCATOR = new LocatorImpl();
-    protected InstructionFactory instructionFactory;
-    protected ExpressionFactory expressionFactory;
+    protected ParsingContext parsingContext;
     
     public Parser() {
     }
 
-    public Parser(ExpressionFactory expressionFactory, InstructionFactory instructionFactory)
{
-        this.expressionFactory = expressionFactory;
-        this.instructionFactory = instructionFactory;
+    public Parser(ParsingContext parsingContext) {
+        this.parsingContext = parsingContext;
     }
 
-    public void setInstructionFactory(InstructionFactory factory) {
-        this.instructionFactory = factory;
+    public void setParsingContext(ParsingContext parsingContext) {
+        this.parsingContext = parsingContext;
     }
     
-    public void setExpressionFactory(ExpressionFactory factory) {
-        this.expressionFactory = factory;
-    }
-
     public StartDocument getStartEvent() {
         return this.startEvent;
     }
@@ -188,6 +183,7 @@
         }
         StartElement startElement = new StartElement(locator, namespaceURI,
                 localName, qname, elementAttributes);
+        InstructionFactory instructionFactory = this.parsingContext.getInstructionFactory();
         if (instructionFactory.isInstruction(startElement))
             newEvent = instructionFactory.createInstruction(startElement,
                     attrs, stack);



Mime
View raw message