userconfig for FOP in Cocoon3

2012-05-08 Thread Jos Snellings
Dear cocooners,

We use FOP to generate a PDF publication of a thesaurus. Needing cyrillic 
greek we have to setup
a user configuration. This is not yet foreseen in the current FOPSerializer.
Yesterday Robby and Ivan were so kind to send me a working Cocoon 2.2
configuration.
This morning, there was room to adapt it to C3.

I suggest that we extend FOPSerializer.java a bit, to include an internal
configuration file  resources.:

 public FlopSerializer(String outputFormat, String userConfigurationPath) {
if (outputFormat == null) {
throw new IllegalArgumentException(The parameter
'outputFormat' mustn't be null.);
}

URL configurationURL = this.getClass().getResource(/COB-INF/ +
userConfigurationPath);

try {
DefaultConfigurationBuilder cfgBuilder = new
DefaultConfigurationBuilder();
Configuration cfg =
cfgBuilder.build(configurationURL.openStream());
FOP_FACTORY.setUserConfig(cfg);

this.outputFormat = outputFormat;
}

This way, we can package our custom configuration and the font in the block
jar.

Kind regards,
Jos Snellings



-- 
The doctrine of human equality reposes on this: that there is no man
really clever who has not found that he is stupid.
-- Gilbert K. Chesterson


Re: userconfig for FOP in Cocoon3

2012-05-08 Thread Francesco Chicchiriccò

On 08/05/2012 09:48, Jos Snellings wrote:

Dear cocooners,

We use FOP to generate a PDF publication of a thesaurus. Needing 
cyrillic  greek we have to setup
a user configuration. This is not yet foreseen in the current 
FOPSerializer.
Yesterday Robby and Ivan were so kind to send me a working Cocoon 2.2 
configuration.

This morning, there was room to adapt it to C3.

I suggest that we extend FOPSerializer.java a bit, to include an 
internal configuration file  resources.:


 public FlopSerializer(String outputFormat, String 
userConfigurationPath) {

if (outputFormat == null) {
throw new IllegalArgumentException(The parameter 
'outputFormat' mustn't be null.);

}

URL configurationURL = this.getClass().getResource(/COB-INF/ 
+ userConfigurationPath);


try {
DefaultConfigurationBuilder cfgBuilder = new 
DefaultConfigurationBuilder();
Configuration cfg = 
cfgBuilder.build(configurationURL.openStream());

FOP_FACTORY.setUserConfig(cfg);

this.outputFormat = outputFormat;
}

This way, we can package our custom configuration and the font in the 
block jar.


Hi Jos,
this looks very nice: could you open an issue on JIRA and provide a 
proper patch for this? I would be glad to take it, then. Thanks!


Regards.

--
Francesco Chicchiriccò

Apache Cocoon PMC and Apache Syncope PPMC Member
http://people.apache.org/~ilgrosso/



Re: userconfig for FOP in Cocoon3

2012-05-08 Thread Jos Snellings
I will do that, Francesco!
However, this patch alters the constructor. This could cause other updates.
Better override setup?
I think that every pipeline's component setup method is called. I will try
that and log it in the ticket.

Ciao,
Jos

On Tue, May 8, 2012 at 9:51 AM, Francesco Chicchiriccò
ilgro...@apache.orgwrote:

 On 08/05/2012 09:48, Jos Snellings wrote:

 Dear cocooners,

 We use FOP to generate a PDF publication of a thesaurus. Needing cyrillic
  greek we have to setup
 a user configuration. This is not yet foreseen in the current
 FOPSerializer.
 Yesterday Robby and Ivan were so kind to send me a working Cocoon 2.2
 configuration.
 This morning, there was room to adapt it to C3.

 I suggest that we extend FOPSerializer.java a bit, to include an internal
 configuration file  resources.:

  public FlopSerializer(String outputFormat, String userConfigurationPath)
 {
if (outputFormat == null) {
throw new IllegalArgumentException(The parameter
 'outputFormat' mustn't be null.);
}

URL configurationURL = this.getClass().getResource(/**COB-INF/
 + userConfigurationPath);

try {
DefaultConfigurationBuilder cfgBuilder = new
 DefaultConfigurationBuilder();
Configuration cfg = cfgBuilder.build(**
 configurationURL.openStream())**;
FOP_FACTORY.setUserConfig(cfg)**;

this.outputFormat = outputFormat;
}

 This way, we can package our custom configuration and the font in the
 block jar.


 Hi Jos,
 this looks very nice: could you open an issue on JIRA and provide a proper
 patch for this? I would be glad to take it, then. Thanks!

 Regards.

 --
 Francesco Chicchiriccò

 Apache Cocoon PMC and Apache Syncope PPMC Member
 http://people.apache.org/~**ilgrosso/http://people.apache.org/%7Eilgrosso/




-- 
The doctrine of human equality reposes on this: that there is no man
really clever who has not found that he is stupid.
-- Gilbert K. Chesterson


Re: userconfig for FOP in Cocoon3

2012-05-08 Thread Francesco Chicchiriccò

On 08/05/2012 10:43, Jos Snellings wrote:

I will do that, Francesco!
However, this patch alters the constructor. This could cause other 
updates.

Better override setup?
I think that every pipeline's component setup method is called. I will 
try that and log it in the ticket.


Good: looking forward for this.

Regards.

On Tue, May 8, 2012 at 9:51 AM, Francesco Chicchiriccò 
ilgro...@apache.org mailto:ilgro...@apache.org wrote:


On 08/05/2012 09:48, Jos Snellings wrote:

Dear cocooners,

We use FOP to generate a PDF publication of a thesaurus.
Needing cyrillic  greek we have to setup
a user configuration. This is not yet foreseen in the current
FOPSerializer.
Yesterday Robby and Ivan were so kind to send me a working
Cocoon 2.2 configuration.
This morning, there was room to adapt it to C3.

I suggest that we extend FOPSerializer.java a bit, to include
an internal configuration file  resources.:

 public FlopSerializer(String outputFormat, String
userConfigurationPath) {
   if (outputFormat == null) {
   throw new IllegalArgumentException(The parameter
'outputFormat' mustn't be null.);
   }

   URL configurationURL =
this.getClass().getResource(/COB-INF/ + userConfigurationPath);

   try {
   DefaultConfigurationBuilder cfgBuilder = new
DefaultConfigurationBuilder();
   Configuration cfg =
cfgBuilder.build(configurationURL.openStream());
   FOP_FACTORY.setUserConfig(cfg);

   this.outputFormat = outputFormat;
   }

This way, we can package our custom configuration and the font
in the block jar.


Hi Jos,
this looks very nice: could you open an issue on JIRA and provide
a proper patch for this? I would be glad to take it, then. Thanks!

Regards.


--
Francesco Chicchiriccò

Apache Cocoon PMC and Apache Syncope PPMC Member
http://people.apache.org/~ilgrosso/



Re: avalon:bridge causes exception in eclipse

2012-05-08 Thread Leszek Gawron

On 2012-04-21 19:53, Andy Stevens wrote:

When do you get the exception? Running the app from within eclipse,
opening a file or the project, running a cocoon archetype to generate
the app, ...?


whoops I missed that mail.

The problem is just there in eclise for each opened cocoon based project:

http://i.imgur.com/LIwkB.png

The logs state:



!MESSAGE Error occured processing 
'/my-webapp/src/main/webapp/WEB-INF/applicationContext.xml'
!STACK 0
java.lang.NullPointerException
at 
org.apache.cocoon.core.container.spring.avalon.ConfigurationReader.getInputSource(ConfigurationReader.java:225)
at 
org.apache.cocoon.core.container.spring.avalon.ConfigurationReader.convert(ConfigurationReader.java:238)
at 
org.apache.cocoon.core.container.spring.avalon.ConfigurationReader.readConfiguration(ConfigurationReader.java:82)
at 
org.apache.cocoon.core.container.spring.avalon.BridgeElementParser.readConfiguration(BridgeElementParser.java:154)
at 
org.apache.cocoon.core.container.spring.avalon.BridgeElementParser.parse(BridgeElementParser.java:78)
at 
org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)


I suspect the reason is in eclipse environment when spring configuration 
is being parsed the source resolver is not initialized properly which 
leads to strange NPEs. Am I right?


  Leszek



[jira] [Created] (COCOON3-99) Provide FopSerializer with an embedded user configuration present in the cocoon block

2012-05-08 Thread Jos Snellings (JIRA)
Jos Snellings created COCOON3-99:


 Summary: Provide FopSerializer with an embedded user configuration 
present in the cocoon block
 Key: COCOON3-99
 URL: https://issues.apache.org/jira/browse/COCOON3-99
 Project: Cocoon 3
  Issue Type: Improvement
  Components: cocoon-optional
Affects Versions: 3.0.0-beta-1
Reporter: Jos Snellings
Priority: Minor
 Fix For: 3.0.0-beta-1


The current FopSerializer creates an instance of FopFactory. Only the defaults 
are used. This is a problem if you want to generate PDFs 
from Unicode data. The Cyrillic and Greek characters have no glyphs in these 
fonts, causing those strings to be displayed as # sequences.

This patch adds an override for the method setConfiguration to add a user 
configuration location via a sitemap parameter.
In sitemap.xmap of the block, add the parameter userConfigurationPath 
indicating the location of the user configuration file.
Example:
 map:match pattern=editor/publish/thesaurus.pdf
  map:generate type=publish/
  map:transform src=presentation/xslt/thesaurusfo.xslt/
   map:serialize type=flo2pdf
map:parameter name=userConfigurationPath 
value=fopconf/fop.xconf/
   /map:serialize
  /map:match

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Updated] (COCOON3-99) Provide FopSerializer with an embedded user configuration present in the cocoon block

2012-05-08 Thread Jos Snellings (JIRA)

 [ 
https://issues.apache.org/jira/browse/COCOON3-99?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jos Snellings updated COCOON3-99:
-

Attachment: patch-fopserializer.txt

A patch for adding the user configuration to
the fop serializer via a sitemap construct.

 Provide FopSerializer with an embedded user configuration present in the 
 cocoon block
 -

 Key: COCOON3-99
 URL: https://issues.apache.org/jira/browse/COCOON3-99
 Project: Cocoon 3
  Issue Type: Improvement
  Components: cocoon-optional
Affects Versions: 3.0.0-beta-1
Reporter: Jos Snellings
Priority: Minor
 Fix For: 3.0.0-beta-1

 Attachments: patch-fopserializer.txt


 The current FopSerializer creates an instance of FopFactory. Only the 
 defaults are used. This is a problem if you want to generate PDFs 
 from Unicode data. The Cyrillic and Greek characters have no glyphs in these 
 fonts, causing those strings to be displayed as # sequences.
 This patch adds an override for the method setConfiguration to add a user 
 configuration location via a sitemap parameter.
 In sitemap.xmap of the block, add the parameter userConfigurationPath 
 indicating the location of the user configuration file.
 Example:
  map:match pattern=editor/publish/thesaurus.pdf
   map:generate type=publish/
   map:transform src=presentation/xslt/thesaurusfo.xslt/
map:serialize type=flo2pdf
 map:parameter name=userConfigurationPath 
 value=fopconf/fop.xconf/
/map:serialize
   /map:match

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




patch

2012-05-08 Thread Jos Snellings
Hi Francesco,

I opened issue COCOON3-99 and added a patch.
(I hope I did it right).

Ciao,
Jos

-- 
The doctrine of human equality reposes on this: that there is no man
really clever who has not found that he is stupid.
-- Gilbert K. Chesterson


Re: patch

2012-05-08 Thread Francesco Chicchiriccò

On 08/05/2012 16:28, Jos Snellings wrote:

Hi Francesco,

I opened issue COCOON3-99 and added a patch.
(I hope I did it right).


Yep, just seen.
Thanks.

Regards.

--
Francesco Chicchiriccò

Apache Cocoon PMC and Apache Syncope PPMC Member
http://people.apache.org/~ilgrosso/