cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mansour Al Akeel <mansour.alak...@gmail.com>
Subject Re: XInclude in sitemap.xmap
Date Tue, 13 Nov 2012 14:50:30 GMT
Robby,
thank you a lot for helping in this, in a timely manner.
My recommendation is to use an instance of unmodifiable collections to
hold configurations and prevent over writing them.
We can either use a method that ensures configurations is not over
written, and put this method in the top level class (ie,
AbstractTransformer .. etc.).
Or just use the read only collections. Here's an example
http://javarevisited.blogspot.ca/2012/07/create-read-only-list-map-set-example-java.html

This may solve potential problems with other invocations.


On Tue, Nov 13, 2012 at 8:54 AM, Robby Pelssers <Robby.Pelssers@nxp.com> wrote:
> I made a little change to that class and will check if that resolves the issue:
>
>         // set the baseUrl
>         if (!invocationParams.containsKey("baseUrl")) {
>             invocationParams.put("baseUrl", invocation.resolve(""));
>         }
> Will let you know once tested.
>
> Robby
>
> -----Original Message-----
> From: Robby Pelssers [mailto:Robby.Pelssers@nxp.com]
> Sent: Tuesday, November 13, 2012 2:49 PM
> To: users@cocoon.apache.org
> Subject: RE: XInclude in sitemap.xmap
>
> Ok... I found the problem.
>
> Inside org.apache.cocoon.sitemap.node.AbstractSitemapNode the baseUrl is overridden,
although it correctly receives the baseUrl.
>
> invocationParams = {
> baseUrl=file:///c:/tmp/
> cacheKey={map:0}
> test=hello world
> }
>
>
> protected InvocationResult invoke(final String src, final String type,  final Invocation
invocation) {
>
>         ....
>         // set the baseUrl  PROBLEMATIC PART
>         invocationParams.put("baseUrl", invocation.resolve(""));
>
> }
>
>
> But before starting making changes... this might need careful attention.
>
> Robby
>
>
> -----Original Message-----
> From: Robby Pelssers [mailto:Robby.Pelssers@nxp.com]
> Sent: Tuesday, November 13, 2012 2:32 PM
> To: users@cocoon.apache.org
> Subject: RE: XInclude in sitemap.xmap
>
> I'm debugging your issue and so far I'm pretty bedazzled about what the hell is going
on:
>
>       <map:match equals="aggregation/xinclude-transformer">
>         <map:generate src="aggregation/xinclude.xml" />
>         <map:transform type="xinclude">
>             <map:parameter name="cacheKey" value="{map:0}"/>
>             <map:parameter name="baseUrl" value="file:///c:/tmp/"/>
>             <map:parameter name="test" value="hello world"/>
>         </map:transform>
>         <map:serialize type="xml" />
>       </map:match
>
> While debugging I see following Configuration -> Map<String, Object>
>
> baseUrl=file:/C:/workspaces/apache/cocoon/cocoon3/trunk/cocoon-sample/./src/main/resources/COB-INF/
> cacheKey=aggregation/xinclude-transformer
> test=hello world
>
> Will keep you posted.. Maybe the baseUrl is somewhere overridden while setting up the
pipeline? Anyone who can tell this?
>
> Robby
>
> -----Original Message-----
> From: Mansour Al Akeel [mailto:mansour.alakeel@gmail.com]
> Sent: Tuesday, November 13, 2012 1:19 PM
> To: users@cocoon.apache.org
> Subject: Re: XInclude in sitemap.xmap
>
> I can not include all my files, but here's the relevant parts:
>
>
>             <map:match pattern="article/{id}.xml">
>                 <map:generate src="{global:base.repo.path}/articles/{map:id}/index.xml"
/>
>                 <map:transform type="xinclude" >
>                     <map:parameter name="cacheKey" value="false"/>
>                     <map:parameter name="baseUrl"
> value="file://{global:base.repo.path}/articles/{map:id}/" />
>                 </map:transform>
>                 <!-- <map:transform src="sheets/html/xslthl.xsl " /> -->
>                 <map:serialize type="xml"  />
>             </map:match>
>
> In my xml file:
>
>         <programlisting language="c">
>             <xi:include  href="hello.c"  parse="text"
> xmlns:xi="http://www.w3.org/2001/XInclude"/>
>         </programlisting>
>
>
> In the log I am getting this:
>
> 12:11:57.039 [btpool0-1] DEBUG o.a.cocoon.pipeline.AbstractPipeline - Going to link the
component XMLGenerator(hashCode=1295514377 internalGenerator=URLGenerator(hashCode=1212516680
> source=file:/home/mansour/workspace/pipeline
> s/repo/articles/example/index.xml)) with
> XIncludeTransformer(hashCode=373437306
> baseUrl=file:/home/mansour/workspace/pipelines/contents/./src/main/resources/COB-INF/).
> 12:11:57.039 [btpool0-1] DEBUG o.a.cocoon.pipeline.AbstractPipeline - Going to link the
component XIncludeTransformer(hashCode=373437306
> baseUrl=file:/home/mansour/workspace/pipelines/contents/./src/main/resources/COB-INF/)
> wi
> th XMLSerializer(hashCode=1413585408).
> 12:11:57.039 [btpool0-1] DEBUG o.a.cocoon.pipeline.CachingPipeline - Creating CompoundCacheKey(hashCode=518365495
key=[]):
> 12:11:57.039 [btpool0-1] DEBUG o.a.cocoon.pipeline.CachingPipeline - ~ adding TimestampCacheKey(hashCode=1975202233
> url=file:/home/mansour/workspace/pipelines/repo/articles/example/index.xml
> timestamp=1352808707000 (2012-11-
> 13 12:11:47.0)) for component XMLGenerator(hashCode=1295514377 internalGenerator=URLGenerator(hashCode=1212516680
> source=file:/home/mansour/workspace/pipelines/repo/articles/example/index.xml))
> 12:11:57.039 [btpool0-1] DEBUG o.a.cocoon.pipeline.CachingPipeline - ~ adding CachedCacheKey(hashCode=1855990413
> internalCacheKey=ObjectCacheKey(hashCode=1421714705 obj=false) cachedCacheKey=URLListCacheKey(hashCode=13584830
> 78 urls=[TimestampCacheKey(hashCode=334463211
> url=file:/home/mansour/workspace/pipelines/contents/src/main/resources/COB-INF/hello.c
> timestamp=0 (1970-01-01 00:00:00.0))])) for component
> XIncludeTransformer(hashCode=373437306
> baseUrl=file:/home/mansour/workspace/pipelines/contents/./src/main/resources/COB-INF/)
> 12:11:57.039 [btpool0-1] DEBUG o.a.cocoon.pipeline.CachingPipeline - ~ adding ParameterCacheKey(hashCode=1430898616
> parameters={encoding=UTF-8, method=xml}) for component
> XMLSerializer(hashCode=1413585408)
> 12:11:57.040 [btpool0-1] DEBUG o.a.cocoon.pipeline.CachingPipeline - Creating  CompoundCacheKey(hashCode=518365495
> key=[TimestampCacheKey(hashCode=1975202233
> url=file:/home/mansour/workspace/pipelines/repo/articles/example/ind
> ex.xml timestamp=1352808707000 (2012-11-13 12:11:47.0)),
> CachedCacheKey(hashCode=1855990413
> internalCacheKey=ObjectCacheKey(hashCode=1421714705 obj=false)
> cachedCacheKey=URLListCacheKey(hashCode=1358483078
> urls=[TimestampCache
> Key(hashCode=334463211
> url=file:/home/mansour/workspace/pipelines/contents/src/main/resources/COB-INF/hello.c
> timestamp=0 (1970-01-01 00:00:00.0))])),
> ParameterCacheKey(hashCode=1430898616 parameters={encoding=UTF-8, method=xm
> l})]) for pipeline CachingPipeline(hashCode=839414089
> components=[XMLGenerator(hashCode=1295514377
> internalGenerator=URLGenerator(hashCode=1212516680
> source=file:/home/mansour/workspace/pipelines/repo/articles/example/index.xm
> l)), XIncludeTransformer(hashCode=373437306
> baseUrl=file:/home/mansour/workspace/pipelines/contents/./src/main/resources/COB-INF/),
> XMLSerializer(hashCode=1413585408)])
> 12:11:57.040 [btpool0-1] DEBUG o.a.cocoon.pipeline.CachingPipeline - Used cache: SimpleCache(hashCode=1672230800)
12:11:57.040 [btpool0-1] DEBUG o.a.cocoon.pipeline.CachingPipeline - No cache value available
for CompoundCacheKey(hashCode=518365495
> key=[TimestampCacheKey(hashCode=1975202233
> url=file:/home/mansour/workspace/pipelines/repo/a
> rticles/example/index.xml timestamp=1352808707000 (2012-11-13 12:11:47.0)), CachedCacheKey(hashCode=1855990413
> internalCacheKey=ObjectCacheKey(hashCode=1421714705 obj=false)
> cachedCacheKey=URLListCacheKey(hashCode=1358483078 u
> rls=[TimestampCacheKey(hashCode=334463211
> url=file:/home/mansour/workspace/pipelines/contents/src/main/resources/COB-INF/hello.c
> timestamp=0 (1970-01-01 00:00:00.0))])),
> ParameterCacheKey(hashCode=1430898616 parameters={encodi ng=UTF-8, method=xml})]) 12:11:57.040
[btpool0-1] DEBUG o.a.cocoon.pipeline.AbstractPipeline - Invoking first component of CachingPipeline(hashCode=839414089
> components=[XMLGenerator(hashCode=1295514377
> internalGenerator=URLGenerator(hashCode=12125166
> 80 source=file:/home/mansour/workspace/pipelines/repo/articles/example/index.xml)),
> XIncludeTransformer(hashCode=373437306
> baseUrl=file:/home/mansour/workspace/pipelines/contents/./src/main/resources/COB-INF/),
> XMLSerializer(hashCode=1413585408)])
> 12:11:57.040 [btpool0-1] DEBUG o.a.c.sax.component.XMLGenerator - Using the URL file:/home/mansour/workspace/pipelines/repo/articles/example/index.xml
> to produce SAX events.
> 12:11:57.040 [btpool0-1] DEBUG o.a.c.jci.stores.MemoryResourceStore - reading resource
com/sun/org/apache/xerces/internal/parsers/SAXParser.class
> 12:11:57.041 [btpool0-1] DEBUG o.a.c.jci.stores.MemoryResourceStore - reading resource
com/sun/org/apache/xerces/internal/parsers/XIncludeAwareParserConfiguration.class
> 12:11:57.041 [btpool0-1] DEBUG o.a.c.jci.stores.MemoryResourceStore - reading resource
com/sun/org/apache/xerces/internal/impl/dv/dtd/DTDDVFactoryImpl.class
> 12:11:57.041 [btpool0-1] DEBUG o.a.c.s.c.XIncludeTransformer - setDocumentLocator called
null
> 12:11:57.042 [btpool0-1] DEBUG o.a.c.jci.stores.MemoryResourceStore - reading resource
org/apache/xml/serializer/ToXMLStream.class
> 12:11:57.043 [btpool0-1] DEBUG o.a.c.s.c.XIncludeTransformer - Processing XInclude element:
href=hello.c, parse=text, xpointer=null, encoding=null, accept=null, acceptLanguage=null
> 12:11:57.043 [btpool0-1] DEBUG o.a.c.s.c.XIncludeTransformer - Including source:
> file:/home/mansour/workspace/pipelines/contents/src/main/resources/COB-INF/hello.c
> 12:11:57.043 [btpool0-1] DEBUG o.a.c.s.c.XIncludeTransformer - Parse type=text
> 12:11:57.045 [btpool0-1] ERROR o.a.c.s.c.XIncludeTransformer - Error including text:
> java.io.FileNotFoundException:
> /home/mansour/workspace/pipelines/contents/src/main/resources/COB-INF/hello.c
> (No such file or directory)
>         at java.io.FileInputStream.open(Native Method) ~[na:1.7.0]
>         at java.io.FileInputStream.<init>(FileInputStream.java:138)
> ~[na:1.7.0]
>
>
>
>
> Please note the logs where the baseUrl is in the COB-INF directory.
> The base url is set to the same the same directory of the article, but the logs shows
it didn't change.
>
> Thank you
>
>
>
> On Tue, Nov 13, 2012 at 2:43 AM, Francesco Chicchiriccò <ilgrosso@apache.org>
wrote:
>> On 13/11/2012 05:49, Mansour Al Akeel wrote:
>>> I am doing two project.
>>> A personal one with C3.0, and one for a product, and using C2.2.
>>> This issue is happening with C3.0.
>>>
>>> I didn't get a chance to test the files you sent me.
>>
>> Ok, take a look there, then: using the XInclude transformer should be
>> pretty straightforward.
>>
>>> However, from the logs (which are really hard to read), it looks like I am having
issues with the baseUrl.
>>> I looked into the source, and tried to set baseUrl="full-path-to-my-repo", but
that didn't work either.
>>
>> Again, please take a look at [1] and [2].
>>
>>> Would be nice to see a document describing the attributes to be set on each transformer.
>>
>> XInclude transformer hasn't changed much since C2.1 [3] / C2.2 [4].
>>
>>> A clear error message can be a lot of help as well.
>>
>> Definitely: in your case, though, I suspect that something really
>> "basic" is getting wrong.
>>
>> Please share your files if you'd like to get more in-depth help.
>>
>> Regards.
>>
>>> On Mon, Nov 12, 2012 at 2:23 AM, Francesco Chicchiriccň
>>> <ilgrosso@apache.org> wrote:
>>>> On 12/11/2012 07:59, Mansour Al Akeel wrote:
>>>>> Here's what I am doing:
>>>>>
>>>>>      <map:match pattern="article/{id}">
>>>>>               <map:generate src="{global:base.repo.path}/articles/{map:id}/index.xml"
/>
>>>>>               <map:transform type="xinclude" />
>>>>>               <map:serialize type="xhtml"  />
>>>>>
>>>>> and this is error:
>>>>> [...]
>>>> Hi,
>>>> did you take a look at sample sitemap.xmap [1] (around line 387) and
>>>> specifically xinclude.xml [2]?
>>>>
>>>> BTW: which version are you running? From the reported stacktrace I
>>>> understand C3, but some of your earlier questions were referring to C2.2....
>>>>
>>>> Regards.
>>>>
>>>> [1]
>>>> https://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-sample/
>>>> src/main/resources/COB-INF/sitemap.xmap
>>>> [2]
>>>> https://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-sample/
>>>> src/main/resources/COB-INF/aggregation/xinclude.xml
>> [3] http://cocoon.apache.org/2.1/userdocs/xinclude-transformer.html
>> [4] http://cocoon.apache.org/2.2/core-modules/core/2.2/985_1_1.html
>>
>> --
>> Francesco Chicchiriccň
>>
>> ASF Member, Apache Cocoon PMC and Apache Syncope PPMC Member
>> http://people.apache.org/~ilgrosso/
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>  B KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB    [  X  ܚX
K  K[XZ[
>   \ \  ][  X  ܚX P     ۋ \ X  K ܙ B  ܈ Y  ] [ۘ[    [X[     K[XZ[
>   \ \  Z [       ۋ \ X  K ܙ B
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message