You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Earle Nietzel <ea...@gmail.com> on 2012/03/29 15:46:12 UTC

Re: Where to store site settings?

Quick question on this topic about configuration.

Has anyone tried having separate configs for hibernate.cfg.xml and/or
log4j.properties i.e. production/QA/development?

I was looking at commons-configuration and have it setup with spring
via tapestry-spring. Would like a way to move the configs mentioned
above into it as well?

My next thought is to look at when log4j and hibernate are initialized
to inject them with a configuration from spring that way I can manage
all the config using commons-configuration.

Thoughts or ideas are appreciated?
Earle


On Wed, Sep 28, 2011 at 12:53 PM, Kalle Korhonen
<ka...@gmail.com> wrote:
> I typically have a bunch of application specific symbols since they
> allow so much flexibility. Set the defaults in AppModule, override
> with jvm system properties, in your setup scripts for production
> environment etc.
>
> Kalle
>
>
> On Wed, Sep 28, 2011 at 9:47 AM, Tim <ko...@gmail.com> wrote:
>> Can someone please tell me the best way to store site settings in a Tapestry
>> application?
>>
>> I would like to store the location of a certain directory (where Lucene data
>> is to be kept), and it is different in development and in production, so I
>> don't want it hard coded into the code.  Where should I store this setting?
>>  In a properties file? (and if so, where do I store the location to the
>> properties files?)   In the web.xml file as a context-param?  In
>> app.properties?
>>
>> What do people out there do?
>>
>> I suspect the answer is probably app.properties, so how do I get access to
>> this in a normal Java class?
>>
>> Thanks.
>>
>> --
>> Tim Koop
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

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


Re: Where to store site settings?

Posted by Beat Durrer <bd...@gmail.com>.
We load a different hibernate.cfg.xml for each environment by adding a
HibernateSessionSource Service:

In our DevelopmentModule:

public static void
contributeApplicationDefaults(MappedConfiguration<String, Object>
configuration){
      // to prevent the default file to be loaded
      configuration.add(HibernateSymbols.DEFAULT_CONFIGURATION, "false");
}


public static void
contributeHibernateSessionSource(OrderedConfiguration<HibernateConfigurer>
hibernateConfigurers, Logger logger){
     hibernateConfigurers.add("hibernate.cfg.file", new
FilebasedHibernateSetup(logger, "hibernate.cfg.DEV.xml"));
}


public class FilebasedHibernateSetup implements HibernateConfigurer{
     private final String hibernateFile;
     private final Logger logger;

     public FilebasedHibernateSetup(Logger aLogger, String anHibernateFile)
     {
          hibernateFile = anHibernateFile;
          logger = aLogger;
     }
	
     public void configure(Configuration configuration)
     {
          logger.info("Loading Hibernate config:" + hibernateFile);
          configuration.configure(hibernateFile);
     }
}


Have fun :)


2012/3/29 Jonathan Barker <jo...@gmail.com>:
> I reference a JNDI datasource in my hibernate configuration, so each
> environment (server) just has a different configuration for a
> datasource of the same name.  It took a bit of experimenting to get
> something that worked well across Tomcat, Jetty and JBoss.
>
> I haven't hit upon the magic recipe for log4j yet.
>
> On Thu, Mar 29, 2012 at 9:46 AM, Earle Nietzel <ea...@gmail.com> wrote:
>> Quick question on this topic about configuration.
>>
>> Has anyone tried having separate configs for hibernate.cfg.xml and/or
>> log4j.properties i.e. production/QA/development?
>>
>> I was looking at commons-configuration and have it setup with spring
>> via tapestry-spring. Would like a way to move the configs mentioned
>> above into it as well?
>>
>> My next thought is to look at when log4j and hibernate are initialized
>> to inject them with a configuration from spring that way I can manage
>> all the config using commons-configuration.
>>
>> Thoughts or ideas are appreciated?
>> Earle
>>
>>
>> On Wed, Sep 28, 2011 at 12:53 PM, Kalle Korhonen
>> <ka...@gmail.com> wrote:
>>> I typically have a bunch of application specific symbols since they
>>> allow so much flexibility. Set the defaults in AppModule, override
>>> with jvm system properties, in your setup scripts for production
>>> environment etc.
>>>
>>> Kalle
>>>
>>>
>>> On Wed, Sep 28, 2011 at 9:47 AM, Tim <ko...@gmail.com> wrote:
>>>> Can someone please tell me the best way to store site settings in a Tapestry
>>>> application?
>>>>
>>>> I would like to store the location of a certain directory (where Lucene data
>>>> is to be kept), and it is different in development and in production, so I
>>>> don't want it hard coded into the code.  Where should I store this setting?
>>>>  In a properties file? (and if so, where do I store the location to the
>>>> properties files?)   In the web.xml file as a context-param?  In
>>>> app.properties?
>>>>
>>>> What do people out there do?
>>>>
>>>> I suspect the answer is probably app.properties, so how do I get access to
>>>> this in a normal Java class?
>>>>
>>>> Thanks.
>>>>
>>>> --
>>>> Tim Koop
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
>
> --
> Jonathan Barker
> ITStrategic
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

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


Re: Where to store site settings?

Posted by Jonathan Barker <jo...@gmail.com>.
I reference a JNDI datasource in my hibernate configuration, so each
environment (server) just has a different configuration for a
datasource of the same name.  It took a bit of experimenting to get
something that worked well across Tomcat, Jetty and JBoss.

I haven't hit upon the magic recipe for log4j yet.

On Thu, Mar 29, 2012 at 9:46 AM, Earle Nietzel <ea...@gmail.com> wrote:
> Quick question on this topic about configuration.
>
> Has anyone tried having separate configs for hibernate.cfg.xml and/or
> log4j.properties i.e. production/QA/development?
>
> I was looking at commons-configuration and have it setup with spring
> via tapestry-spring. Would like a way to move the configs mentioned
> above into it as well?
>
> My next thought is to look at when log4j and hibernate are initialized
> to inject them with a configuration from spring that way I can manage
> all the config using commons-configuration.
>
> Thoughts or ideas are appreciated?
> Earle
>
>
> On Wed, Sep 28, 2011 at 12:53 PM, Kalle Korhonen
> <ka...@gmail.com> wrote:
>> I typically have a bunch of application specific symbols since they
>> allow so much flexibility. Set the defaults in AppModule, override
>> with jvm system properties, in your setup scripts for production
>> environment etc.
>>
>> Kalle
>>
>>
>> On Wed, Sep 28, 2011 at 9:47 AM, Tim <ko...@gmail.com> wrote:
>>> Can someone please tell me the best way to store site settings in a Tapestry
>>> application?
>>>
>>> I would like to store the location of a certain directory (where Lucene data
>>> is to be kept), and it is different in development and in production, so I
>>> don't want it hard coded into the code.  Where should I store this setting?
>>>  In a properties file? (and if so, where do I store the location to the
>>> properties files?)   In the web.xml file as a context-param?  In
>>> app.properties?
>>>
>>> What do people out there do?
>>>
>>> I suspect the answer is probably app.properties, so how do I get access to
>>> this in a normal Java class?
>>>
>>> Thanks.
>>>
>>> --
>>> Tim Koop
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>



-- 
Jonathan Barker
ITStrategic

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