[OT] Deli transformer and xsltc
Hi all, Does anybody have a feedback on using Deli transformer with xsltc transformer? I'm stucked with the following exception whenever i try to use xsltc instead of xalan java.lang.RuntimeException: Invalid conversion from 'reference' to 'org.apache.xerces.dom.DocumentImpl' I know it's somehow a problem related to xalan, but i can't figure out why i can't (?) swap processors with this particular transformer. Many thanks Charles Borges _ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com
[FYI] store bug
Hi, Fixing the following excalibur store bug should increasing performance: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25122 currently picking cached items from the persistent store is of any help because it's always returning null value. Charles Borges Do You Yahoo!? -- Avec Yahoo! soyez au coeur de la récolte de dons pour le Téléthon. http://fr.promotions.yahoo.com/caritatif/
Re: SVGSerializer patch
> >I think that in cocoon 2.1.3 the sitemap parameters > are not available for serializers. They're always > set to empty parameters when the > SitemapModelComponent is a Serializer. > >Is that correct? > > > > > > It is correct that... you found a bug :-/ > > The sitemap engine wasn't updated to take into > account the ability for > serializers to implement SitemapModelComponent. > > I just fixed it in the CVS. > > Sylvain > Given this bug fix, i propose a SVGSerializer patch which support sitemap parameters (see attached files). Thus, 1. in the serializer configuration you define the transcoding hints which can be overriden by the sitemap parameters, say: 2. Override in a serialize node: Charles ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.comIndex: SVGSerializer.java === RCS file: /home/cvspublic/cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/serialization/SVGSerializer.java,v retrieving revision 1.9 diff -u -r1.9 SVGSerializer.java --- SVGSerializer.java 9 Oct 2003 15:26:54 - 1.9 +++ SVGSerializer.java 24 Nov 2003 10:17:39 - @@ -51,7 +51,13 @@ package org.apache.cocoon.serialization; import java.awt.Color; +import java.io.IOException; import java.io.OutputStream; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; import org.apache.avalon.excalibur.pool.Poolable; import org.apache.avalon.framework.component.ComponentManager; @@ -62,18 +68,22 @@ 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.batik.transcoder.Transcoder; +import org.apache.batik.transcoder.TranscoderException; import org.apache.batik.transcoder.TranscoderInput; import org.apache.batik.transcoder.TranscoderOutput; import org.apache.batik.transcoder.TranscodingHints; -import org.apache.batik.transcoder.TranscoderException; import org.apache.batik.util.ParsedURL; import org.apache.cocoon.Constants; +import org.apache.cocoon.ProcessingException; import org.apache.cocoon.caching.CacheableProcessingComponent; import org.apache.cocoon.components.transcoder.ExtendableTranscoderFactory; import org.apache.cocoon.components.transcoder.TranscoderFactory; import org.apache.cocoon.components.url.ParsedContextURLProtocolHandler; import org.apache.cocoon.components.url.ParsedResourceURLProtocolHandler; +import org.apache.cocoon.environment.SourceResolver; +import org.apache.cocoon.sitemap.SitemapModelComponent; import org.apache.cocoon.util.ClassUtils; import org.apache.cocoon.xml.dom.SVGBuilder; import org.apache.excalibur.source.SourceValidity; @@ -89,7 +99,7 @@ * @version CVS $Id: SVGSerializer.java,v 1.9 2003/10/09 15:26:54 sylvain Exp $ */ public class SVGSerializer extends SVGBuilder -implements Composable, Serializer, Configurable, Poolable, CacheableProcessingComponent, Contextualizable { +implements Composable, Serializer, Configurable, Poolable, CacheableProcessingComponent, Contextualizable, SitemapModelComponent { /** * Get the context @@ -112,7 +122,22 @@ /** The Transcoder Factory to use */ TranscoderFactory factory = ExtendableTranscoderFactory.getTranscoderFactoryImplementation(); - + +/** The current caching key */ +private Serializable cachingKey; + +/** The default Batik TranscodingHints set up in configuration step */ +private TranscodingHints defaultTranscodingHints; + +/** The current Batik TranscodingHints can overrides the default one */ +private TranscodingHints currentTranscodingHints; + +/** The map holding information for the Batik TranscodingHints.Keys */ +private Map transcodingHintKeysInfo; + +/** Override default TranscodingHints with sitemap parameters? */ +private boolean overrideTranscodingHints = false; +private boolean _overrideTranscodingHints = false; /** * Set the OutputStream where the XML should be serialized. */ @@ -157,8 +182,10 @@ ); } -// Now run through the other parameters, using them as hints -// to the transcoder +// Now run through the other parameters, adding them to the +// default transcoding hints +defaultTranscodingHints = new TranscodingHints(); +transcodingHintKeysInfo = new HashMap(); for (int i = 0; i < parameters.length; i++ ) { String name = parameters[i].getAttribute("name"); // Skip over the parameters we've dealt with. Ensure this @@ -169,48 +196,93 @@ // Now try and get the hints out try { -// Turn it
Re: SVGSerializer patch
--- Vadim Gritsenko <[EMAIL PROTECTED]> a écrit : > Borges Charles wrote: > > >Do you have an idea of how to do if you want to > >override parameters used to render an image like > the > >indexed or quality parameters? > > > > > > Pass via sitemap parameters; passing it via request > parameters does not > look like a safe approach to me. > > Vadim > I think that in cocoon 2.1.3 the sitemap parameters are not available for serializers. They're always set to empty parameters when the SitemapModelComponent is a Serializer. Is that correct? Thanks. ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com
Re: SVGSerializer patch
--- Tony Collen <[EMAIL PROTECTED]> a écrit : > Vadim Gritsenko wrote: > > Borges Charles wrote: > > > >> Hi, > >> > >> Here's proposed SVGSerializer patch to support > request > >> parameters. > >> > >> > > ... > > > >> or > >> > samples/batik/batikLogo.png?width=200&height=100&indexed=2 > >> ... ugly! > >> > >> > > > > Or > > samples/batik/batikLogo.png?width=1000&height=1000 > > samples/batik/batikLogo.png?width=1000&height=1001 > > samples/batik/batikLogo.png?width=1000&height=1002 > > ... > > in the loop and your server is down. > > > > No, thank you, I'll pass on this particular > parameter! > > Shouldn't this be a concern of a transformer or the > generator, anyway, and not the serializer?? > > Just pass the request parameters to an XSLT to > change the svg height or width, then output the > image. > > Tony > I think this example with height and width wasn't a good choice. I agree with you, when it comes to change such parameters which are specified in the svg (height, width, background color...) it's wiser to go for an XSLT. Do you have an idea of how to do if you want to override parameters used to render an image like the indexed or quality parameters? Thanks ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com
SVGSerializer patch
Hi, Here's proposed SVGSerializer patch to support request parameters. The following changes have been made: Configuration = 1. The tag is recognized to allow the serializer to use request parameters. if true ==> All the declared batik keys can be overriden by request parameters. 3. The value attribute of the key now means it's a default value and is not mandatory anymore. 4. A default TranscodingHints is configured with all the keys entries which have a default value 5. A Map is used to keep information on batik transcoding keys and their "types" (INTEGER, ...) Processing == 1. The SVGSerializer implements the SitemapModelComponent 2. A current TranscodingHints is built overriding the default one and adding new key values if their "types" can be resolved. EXEMPLE === 1. in the batik block sitemap add this instead of the current the svg2png serializer: true 2. Try this: samples/batik/batikLogo.png ... the normal logo or samples/batik/batikLogo.png?width=200&height=100 ... small logo or samples/batik/batikLogo.png?width=200&height=100&indexed=2 ... ugly! = BORGES C. ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.comIndex: SVGSerializer.java === RCS file: /home/cvspublic/cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/serialization/SVGSerializer.java,v retrieving revision 1.9 diff -u -r1.9 SVGSerializer.java --- SVGSerializer.java 9 Oct 2003 15:26:54 - 1.9 +++ SVGSerializer.java 19 Nov 2003 17:44:26 - @@ -51,7 +51,12 @@ package org.apache.cocoon.serialization; import java.awt.Color; +import java.io.IOException; import java.io.OutputStream; +import java.io.Serializable; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; import org.apache.avalon.excalibur.pool.Poolable; import org.apache.avalon.framework.component.ComponentManager; @@ -62,6 +67,7 @@ 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.batik.transcoder.Transcoder; import org.apache.batik.transcoder.TranscoderInput; import org.apache.batik.transcoder.TranscoderOutput; @@ -69,11 +75,16 @@ import org.apache.batik.transcoder.TranscoderException; import org.apache.batik.util.ParsedURL; import org.apache.cocoon.Constants; +import org.apache.cocoon.ProcessingException; import org.apache.cocoon.caching.CacheableProcessingComponent; import org.apache.cocoon.components.transcoder.ExtendableTranscoderFactory; import org.apache.cocoon.components.transcoder.TranscoderFactory; import org.apache.cocoon.components.url.ParsedContextURLProtocolHandler; import org.apache.cocoon.components.url.ParsedResourceURLProtocolHandler; +import org.apache.cocoon.environment.ObjectModelHelper; +import org.apache.cocoon.environment.Request; +import org.apache.cocoon.environment.SourceResolver; +import org.apache.cocoon.sitemap.SitemapModelComponent; import org.apache.cocoon.util.ClassUtils; import org.apache.cocoon.xml.dom.SVGBuilder; import org.apache.excalibur.source.SourceValidity; @@ -89,7 +100,7 @@ * @version CVS $Id: SVGSerializer.java,v 1.9 2003/10/09 15:26:54 sylvain Exp $ */ public class SVGSerializer extends SVGBuilder -implements Composable, Serializer, Configurable, Poolable, CacheableProcessingComponent, Contextualizable { +implements Composable, Serializer, Configurable, Poolable, CacheableProcessingComponent, Contextualizable, SitemapModelComponent { /** * Get the context @@ -112,7 +123,22 @@ /** The Transcoder Factory to use */ TranscoderFactory factory = ExtendableTranscoderFactory.getTranscoderFactoryImplementation(); - + +/** The current caching key */ +private Serializable cachingKey; + +/** The default Batik TranscodingHints set up in configuration step */ +private TranscodingHints defaultTranscodingHints; + +/** The current Batik TranscodingHints can overrides the default one */ +private TranscodingHints currentTranscodingHints; + +/** The map holding information for the Batik TranscodingHints.Keys */ +private Map transcodingHintKeysInfo; + +/** Override default TranscodingHints with request parameters? */ +private boolean overrideTranscodingHints = false; +//private boolean _overrideTranscodingHints = false; /** * Set the OutputStream where the XML should be serialized. */ @@ -157,8 +183,10 @@ ); } -// Now run through the other parameters, using them as hints -// to the transcoder +// Now run through the other parameters, adding them to the +// default transcoding hints +
Serializers and SitemapModelComponent
Hi, Quoting the SitemapModelComponent interface javadoc: "This interface marks a component as a sitemap component that is used in the processing phase, like a generator, a transformer, a SERIALIZER or a reader" But the Serializer interface doesn't extends the SiteMapModelComponent interface... Is there a reason to avoid serializers from being a sitemap component? Let's say one would like to parametrize a SVGSerializer (background color, ...) on a request basis, how could it be achieved? Thanks. ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com
RE : Problem using SVG serialializer after a transformation
> > BORGES Charles wrote: > > >Hi, > > > >I run into the following problem when serializing to svg after a xsl > >transformation: > > > >Start with a sitemap including something like this > > > > > > > > > > > > > > > >Turn the debug on and check for the SVGSerializer logging. > >You see that serialization of the xsl transformation output produces > >the > >massage: > >"setDocumentLocator was not called, will use > http://localhost/ as base URI". > > > >This means that if i have > a href in my svg to a css for instance, it > >won't be located and the serialization will fail! > > > >I fixed it (somehow) by: > >1.introducing a base-url attribute in the SVGSerializer > configuration: > > > name="svg2png" > > > src="fr.cegetel.dsco.gi.svg.serialization.SVGSerializer" > > mime-type="image/png" > > base-url="context://sample/batik"/> > > > > Be careful: the convention in configurations is that attributes are > container-related data. Component-related data should be > better located > as child elements. So the following should be better: > > > context://sample/batik > > ok > >3.using the sourceresolver to find out the uri to set in the > document locator. > > > > So do you really need the base-url? Isn't the uri of > SourceResolver.resolveURI("") just what you need? Or at least > it can be > a fallback if base-url is not present. > You're right again > >2.making the SVGBuilder no more Recyclable. > > > > Why can it no more be Recyclable? > Well, i use the given uri to set the locator for the SVGBuilder in the SGVSerializer configure(), But he current recycle() method of SVGBuilder sets locator to null... And the component can only be used once. So either make SVGBuilder not Recyclable or do not set locator=null > Sylvain > > -- > Sylvain Wallez Anyware Technologies > http://www.apache.org/~sylvain http://www.anyware-tech.com > { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects } > Orixo, the opensource XML business alliance - http://www.orixo.com >
Problem using SVG serialializer after a transformation
Hi, I run into the following problem when serializing to svg after a xsl transformation: Start with a sitemap including something like this Turn the debug on and check for the SVGSerializer logging. You see that serialization of the xsl transformation output produces the massage: "setDocumentLocator was not called, will use http://localhost/ as base URI". This means that if i have a href in my svg to a css for instance, it won't be located and the serialization will fail! I fixed it (somehow) by: 1.introducing a base-url attribute in the SVGSerializer configuration: 3.using the sourceresolver to find out the uri to set in the document locator. 2.making the SVGBuilder no more Recyclable. Charles
TR : Problem in SVGSerializer
Hi, In the configure method of org.apache.cocoon.serialization.SVGSerializer there is a problem when mapping config parameters to transcoder hints: When the parameter type is string, nothing is set. For example if you're using in the configuration of a SVGSerializer, the corresponding batik KEY_USER_STYLESHEET_URI is set to "" In configure(): String keyType = parameters[i].getAttribute("type", "STRING").toUpperCase(); if ("FLOAT".equals(keyType)) { // Can throw an exception. value = new Float(parameters[i].getAttributeAsFloat("value")); } else if { ... } else { // Assume String, and get the value. Allow an empty string. value = parameters[i].getValue(""); } I think it should be value = parameters[i].getAttribute("value") instead.