Andreas,
On Wed, Sep 28, 2005 at 07:37:31PM -0000, [EMAIL PROTECTED] 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");
Advertising
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