You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@locus.apache.org on 2000/09/05 19:26:53 UTC
cvs commit: xml-cocoon/src/org/apache/cocoon/transformation XTTransformer.java XalanTransformer.java
stefano 00/09/05 10:26:53
Modified: src/org/apache/cocoon/transformation Tag: xml-cocoon2
XalanTransformer.java
Added: src/org/apache/cocoon/transformation Tag: xml-cocoon2
XTTransformer.java
Log:
added XT transformer and started to add stylesheet caching in Xalan
Revision Changes Path
No revision
No revision
1.1.2.8 +34 -34 xml-cocoon/src/org/apache/cocoon/transformation/Attic/XalanTransformer.java
Index: XalanTransformer.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XalanTransformer.java,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -r1.1.2.7 -r1.1.2.8
--- XalanTransformer.java 2000/09/02 21:12:40 1.1.2.7
+++ XalanTransformer.java 2000/09/05 17:26:52 1.1.2.8
@@ -21,10 +21,10 @@
import org.apache.cocoon.Cocoon;
import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.components.parser.Parser;
+import org.apache.cocoon.components.store.Store;
import org.apache.cocoon.xml.XMLConsumer;
-import org.apache.cocoon.xml.util.DocumentHandlerAdapter;
-import org.apache.cocoon.xml.util.DocumentHandlerWrapper;
+import org.apache.cocoon.xml.dom.DocumentHandlerAdapter;
+import org.apache.cocoon.xml.dom.DocumentHandlerWrapper;
import org.apache.xalan.xslt.StylesheetRoot;
import org.apache.xalan.xslt.XSLTInputSource;
@@ -41,15 +41,24 @@
*
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/09/02 21:12:40 $
+ * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/09/05 17:26:52 $
*/
public class XalanTransformer extends DocumentHandlerWrapper
implements Transformer, Composer {
- /** The component manager instance */
- private ComponentManager manager=null;
+ /** The store service instance */
+ private Store store = null;
+
/** The XALAN XSLTProcessor */
- private XSLTProcessor processor=null;
+ private XSLTProcessor processor = null;
+
+ /**
+ * Set the current <code>ComponentManager</code> instance used by this
+ * <code>Composer</code>.
+ */
+ public void setComponentManager(ComponentManager manager) {
+ this.store = (Store) manager.getComponent("store");
+ }
/**
* Set the <code>EntityResolver</code>, the <code>Map</code> with
@@ -60,46 +69,36 @@
throws SAXException, ProcessingException, IOException {
/** The Request object */
- HttpServletRequest request=(HttpServletRequest)objectModel.get("request");
+ HttpServletRequest request = (HttpServletRequest)objectModel.get("request");
if (request == null) {
throw new ProcessingException ("Missing request object in obejctModel");
}
+
// Check the stylesheet uri
- // String xsluri=par.getParameter("stylesheet",null);
- String xsluri=src;
- if (xsluri==null) throw new ProcessingException("No stylesheet");
-
- // Load the stylesheet (we should cache it in the STORE!)
- //Cocoon cocoon=(Cocoon)this.manager.getComponent("cocoon");
- StylesheetRoot stylesheet=null;
- if (true) {
- XSLTProcessor loaderprocessor=XSLTProcessorFactory.getProcessor();
- InputSource xslsrc=resolver.resolveEntity(null,xsluri);
- XSLTInputSource style=new XSLTInputSource(xslsrc);
- stylesheet=loaderprocessor.processStylesheet(style);
+ String xsluri = src;
+ if (xsluri == null) {
+ throw new ProcessingException("Stylesheet URI can't be null");
}
+ // Load the stylesheet
+ XSLTProcessor loaderprocessor = XSLTProcessorFactory.getProcessor();
+ InputSource xslsrc = resolver.resolveEntity(null,xsluri);
+ XSLTInputSource style = new XSLTInputSource(xslsrc);
+ StylesheetRoot stylesheet = loaderprocessor.processStylesheet(style);
+
// Create the processor and set it as this documenthandler
- this.processor=XSLTProcessorFactory.getProcessor();
+ this.processor = XSLTProcessorFactory.getProcessor();
this.processor.setStylesheet(stylesheet);
Enumeration enum = request.getParameterNames();
while (enum.hasMoreElements()) {
- String name = (String)enum.nextElement();
+ String name = (String) enum.nextElement();
if (isValidXSLTParameterName(name)) {
String value = request.getParameter(name);
- processor.setStylesheetParam(name,this.processor.createXString(value));
+ processor.setStylesheetParam(name, this.processor.createXString(value));
}
}
- this.setDocumentHandler(this.processor);
- }
-
- /**
- * Set the current <code>ComponentManager</code> instance used by this
- * <code>Composer</code>.
- */
- public void setComponentManager(ComponentManager manager) {
- this.manager=manager;
+ this.setDocumentHandler(this.processor);
}
/**
@@ -135,7 +134,9 @@
public void setLexicalHandler(LexicalHandler lexical) {
}
- public static boolean isValidXSLTParameterName(String name) {
+ // FIXME (SM): this method may be a hotspot for requests with many
+ // parameters we should try to optimize it further
+ static boolean isValidXSLTParameterName(String name) {
StringCharacterIterator iter = new StringCharacterIterator(name);
char c = iter.first();
if (!(Character.isLetter(c) || c == '_')) {
@@ -155,5 +156,4 @@
}
return true;
}
-
}
No revision
No revision
1.1.2.1 +411 -0 xml-cocoon/src/org/apache/cocoon/transformation/Attic/XTTransformer.java
no problems with cocoon1.7.4 and xsp's anymore !
Posted by Gabi Brysch <br...@inxnet.de>.
hi,
i don't have the problem anymore with xsp's - with the faq's i got the
solution. i changed
the order of the jar-files in the classpath and i deleted the DOMxxx.classes
in the xml.jar, now it's working - great.
gabi
UML-Diagramm of the cocoon-project ???? where can i find these ...
Posted by Gabi Brysch <br...@inxnet.de>.
hi,
because i'm new to cocoon and i'd like to understand more about i'd like to
know where i can find a uml-diagramm of the architecture ???
thanks, GABI
AW: cvs commit: xml-cocoon/src/org/apache/cocoon/transformation XTTransformer.java XalanTransformer.java
Posted by Gabi Brysch <br...@inxnet.de>.
hi,
I'm new to Cocooon and I don't know how to ask questions if there are
problems during
the use of Cocoon 1.7.4. What informations do I have to post that maybe
somebody can
give me some help ???
I installed the binary distribution together with
Apache WebServer 1.3.12,
Tomcat3.1,
Sun JSDK1.3
Windows2000
IE5.00.2920.0000
Netscape6.02
I got easy samples to work, but if I start using xsp-functions, there are
troubles
like this:
java.lang.NoSuchMethodError
at org.apache.xerces.dom.ElementImpl.normalize(ElementImpl.java:290)
at
org.apache.cocoon.processor.xsp.language.java.XSPJavaPreprocessor.process
(XSPJavaPreprocessor.java:116)
at
org.apache.cocoon.processor.xsp.language.java.XSPJavaPreprocessor.process
(XSPJavaPreprocessor.java:123)
at
org.apache.cocoon.processor.xsp.language.java.XSPJavaPreprocessor.preprocess
(XSPJavaPreprocessor.java:81)
at
org.apache.cocoon.processor.xsp.XSPLogicsheet.apply(XSPLogicsheet.java:99)
at
org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java:385)
at org.apache.cocoon.Engine.handle(Engine.java:305)
at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection
(HttpConnectionHandler.java:160)
at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
)
at java.lang.Thread.run(Thread.java:484)
maybe somebody might give me a tip where is the problem - or where can I
find some example
files which uses xsp-features !!
thanks GABI
Re: cvs commit: xml-cocoon/src/org/apache/cocoon/transformation
XTTransformer.java XalanTransformer.java
Posted by Stefano Mazzocchi <st...@apache.org>.
Giacomo Pati wrote:
>
> stefano@locus.apache.org wrote:
> >
> > stefano 00/09/05 10:26:53
> >
> > Modified: src/org/apache/cocoon/transformation Tag: xml-cocoon2
> > XalanTransformer.java
> > Added: src/org/apache/cocoon/transformation Tag: xml-cocoon2
> > XTTransformer.java
> > Log:
> > added XT transformer and started to add stylesheet caching in Xalan
>
> The caching with the store component cannot be done (at the moment)
> because of the algorithm implemented in the ComponentManager part of the
> Cocoon class. Today every request to the ComponentManager results a new
> instance of the requested component. As soon as the new Avalon release
> is ready (which should contain Interfaces to mark classes as ThreadSafe
> and alike) the Cocoon class (which acts as the ComponentManager for the
> system) can be rewritten to take that into account.
Ouch, that hurts :/ didn't think of it... ok, moving my target to
something else then... better finish up the command line interface and
play around with it... there will be tons of people that won't
understand how it works for the first two weeks... damn, it's as
powerful as heaven, but XLinks are kind of mindtwisting...
Better write some docs as I go along...
--
Stefano Mazzocchi One must still have chaos in oneself to be
able to give birth to a dancing star.
<st...@apache.org> Friedrich Nietzsche
--------------------------------------------------------------------
Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------
Re: cvs commit: xml-cocoon/src/org/apache/cocoon/transformation
XTTransformer.java XalanTransformer.java
Posted by Giacomo Pati <Gi...@pwr.ch>.
stefano@locus.apache.org wrote:
>
> stefano 00/09/05 10:26:53
>
> Modified: src/org/apache/cocoon/transformation Tag: xml-cocoon2
> XalanTransformer.java
> Added: src/org/apache/cocoon/transformation Tag: xml-cocoon2
> XTTransformer.java
> Log:
> added XT transformer and started to add stylesheet caching in Xalan
The caching with the store component cannot be done (at the moment)
because of the algorithm implemented in the ComponentManager part of the
Cocoon class. Today every request to the ComponentManager results a new
instance of the requested component. As soon as the new Avalon release
is ready (which should contain Interfaces to mark classes as ThreadSafe
and alike) the Cocoon class (which acts as the ComponentManager for the
system) can be rewritten to take that into account.
Giacomo
--
PWR GmbH, Organisation & Entwicklung Tel: +41 (0)1 856 2202
Giacomo Pati, CTO/CEO Fax: +41 (0)1 856 2201
Hintereichenstrasse 7 Mobil: +41 (0)78 759 7703
CH-8166 Niederweningen Mailto:Giacomo.Pati@pwr.ch
Web: http://www.pwr.ch