You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Simon Pepping <sp...@leverkruid.nl> on 2005/09/28 22:09:59 UTC

Re: svn commit: r292280 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOUserAgent.java

Andreas,

On Wed, Sep 28, 2005 at 07:37:31PM -0000, adelmelle@apache.org wrote:
> URL: http://svn.apache.org/viewcvs?rev=292280&view=rev
> Log:
> Added UA initialization from user-config
> 
> Modified:
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOUserAgent.java
> 
> +    public void initUserConfig() throws ConfigurationException {
> +        log.info("Initializing User Agent Configuration");
> +        Configuration cfgUserAgent = userConfig.getChild("userAgent");

Why do you wrap these configuration elements in a userAgent element?
The fact that we let the user agent object handle the configuration,
does not need to be reflected in the configuration file. I would
prefer to see these configuration elements as direct children of the
top level element, or perhaps some of them wrapped in an element like
pagesettings.

> +        if (cfgUserAgent.getChild("base", false) != null) {
> +            try {
> +                String cfgBaseDir = cfgUserAgent.getChild("base")
> +                                    .getAttribute("url");
> +                File dir = new File(cfgBaseDir);
> +                if (dir.isDirectory()) {
> +                    cfgBaseDir = "file://" + dir.getCanonicalPath() 
> +                        + System.getProperty("file.separator");
> +                }
> +                URL cfgBaseURL = new URL(cfgBaseDir);
> +                setBaseURL(cfgBaseDir);
> +            } catch (MalformedURLException mue) {
> +                log.error("Base URL in user config is malformed!");
> +            } catch (IOException ioe) {
> +                log.error("Error converting relative base directory to absolute URL.");
> +            }
> +            log.info("Base URL set to: " + baseURL);
> +        }
> +        if (cfgUserAgent.getChild("pixelToMillimeter", false) != null) {
> +            this.px2mm = cfgUserAgent.getChild("pixelToMillimeter")
> +                            .getAttributeAsFloat("value", DEFAULT_PX2MM);
> +            log.info("pixelToMillimeter set to: " + px2mm);
> +        }
> +        if (cfgUserAgent.getChild("pageHeight", false) != null) {
> +            setPageHeight(cfgUserAgent.getChild("pageHeight")
> +                            .getAttribute("value"));
> +            log.info("Default page-height set to: " + pageHeight);
> +        }
> +        if (cfgUserAgent.getChild("pageWidth", false) != null) {
> +            setPageWidth(cfgUserAgent.getChild("pageWidth")
> +                            .getAttribute("value"));
> +            log.info("Default page-width set to: " + pageWidth);
> +        }
>      }

Regards, Simon

-- 
Simon Pepping
home page: http://www.leverkruid.nl


Re: svn commit: r292280 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOUserAgent.java

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 28, 2005, at 22:29, Jeremias Maerki wrote:

>
> On 28.09.2005 22:14:29 Andreas L Delmelle wrote:
> <snip/>
>>> The fact that we let the user agent object handle the configuration,
>>> does not need to be reflected in the configuration file. I would
>>> prefer to see these configuration elements as direct children of the
>>> top level element, or perhaps some of them wrapped in an element like
>>> pagesettings.
>>
>> No objection from me.
>> Anyone with other opinions before I make this alteration?
>
> No, Simon's suggestion is fine.

Since you were the original author of the fop.xconf file, that's enough 
for me :-)

IOW: Done!

Cheers,

Andreas


Re: svn commit: r292280 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOUserAgent.java

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 28.09.2005 22:14:29 Andreas L Delmelle wrote:
<snip/>
> > The fact that we let the user agent object handle the configuration,
> > does not need to be reflected in the configuration file. I would
> > prefer to see these configuration elements as direct children of the
> > top level element, or perhaps some of them wrapped in an element like
> > pagesettings.
> 
> No objection from me.
> Anyone with other opinions before I make this alteration?

No, Simon's suggestion is fine.

Jeremias Maerki


Re: svn commit: r292280 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOUserAgent.java

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 28, 2005, at 22:09, Simon Pepping wrote:

Hi Simon,

> On Wed, Sep 28, 2005 at 07:37:31PM -0000, adelmelle@apache.org wrote:
>>
>> +    public void initUserConfig() throws ConfigurationException {
>> +        log.info("Initializing User Agent Configuration");
>> +        Configuration cfgUserAgent = 
>> userConfig.getChild("userAgent");
>
> Why do you wrap these configuration elements in a userAgent element?

Well, I didn't modify the fop.xconf file myself. The general UA config 
entries were already there, and I just added the page-settings in 
there...

> The fact that we let the user agent object handle the configuration,
> does not need to be reflected in the configuration file. I would
> prefer to see these configuration elements as direct children of the
> top level element, or perhaps some of them wrapped in an element like
> pagesettings.

No objection from me.
Anyone with other opinions before I make this alteration?

Cheers,

Andreas