You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Stewart, Gary" <Ga...@luht.scot.nhs.uk> on 2006/05/24 17:57:42 UTC

Accessing Global Variables As External File

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.

Thanks,

Gary

*****************************************************************
The information contained in this message may be confidential or 
legally privileged and is intended for the addressee only. If you 
have received this message in error or there are any problems 
please notify the originator immediately. The unauthorised use, 
disclosure, copying or alteration of this message is 
strictly forbidden.
*****************************************************************


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


Re: Accessing Global Variables As External File

Posted by Ralph Goers <Ra...@dslextreme.com>.
The latest version of Cocoon lets you use property files. You can define 
your global variables but make their values be ${varname}.  Then define 
the variable in your property file and Cocoon will substitute it.

Ralph

Stewart, Gary wrote:

>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.
>
>Thanks,
>
>Gary
>
>*****************************************************************
>The information contained in this message may be confidential or 
>legally privileged and is intended for the addressee only. If you 
>have received this message in error or there are any problems 
>please notify the originator immediately. The unauthorised use, 
>disclosure, copying or alteration of this message is 
>strictly forbidden.
>*****************************************************************
>
>
>---------------------------------------------------------------------
>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


RE: Accessing Global Variables As External File

Posted by Andrew Stevens <at...@hotmail.com>.
>From: "Stewart, Gary" <Ga...@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