cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Stevens" <at...@hotmail.com>
Subject RE: Accessing Global Variables As External File
Date Thu, 25 May 2006 00:25:53 GMT
>From: "Stewart, Gary" <Gary.Stewart@luht.scot.nhs.uk>
>Date: Wed, 24 May 2006 16:57:42 +0100
>
>Hi there,
>
>I was wondering if it was possible to access the global-variables component 
>configuration as an external file? Basically there are some values in there 
>that change depending on which server I was using so I figured I could 
>separate that into a static XML file and not include that file in version 
>control so I could customise it depending on the server.
>
>Is there a way to do this or should I use something other than 
>global-variables to access these values in the sitemaps.

The way we do it is by defining an external entity in the internal DTD i.e.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map:sitemap [
  <!ENTITY environment SYSTEM "environment.ent">
]>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
...
  <map:pipelines>
    <map:component-configurations>
      <global-variables>
        &environment;
      </global-variables>
    </map:component-configurations>
...

where environment.ent is of the form

<foo>myfoo</foo>
<bar>dev_bar_database</bar>

Possibly I should have included the global-variables tags in there too, but 
I figured I might want to specify some other variables directly in the 
sitemap.

The only drawback we've found with this approach is that, unlike when the 
sitemap changes, we have to restart the application for it to see any 
changes in the environment.ent file.

In the same way, I externalised the database configuration from 
cocoon.xconf, since that was the only part which differed between our 
development/testing/production environments.


Andrew.

>
>Thanks,
>
>Gary



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


Mime
View raw message