FYI

Tapestry5 supports more than two execution modes. If you only need to
determine if current mode is production, then no need to inject value of
EXECUTION_MODE, you can simply inject value of PRODUCTION_MODE into boolean
field/variable, and build conditions on that boolean instead of using
String.contains():

@Symbol(SymbolConstants.PRODUCTION_MODE) boolean productionMode


Also, in some cases it is better (more object oriented way) to override
entire service for production/development/qa execution modes than put
if/else conditions to single implementation.
See here for details:
http://tapestry.apache.org/configuration.html#Configuration-SettingExecutionModes


On Tue, Jan 15, 2013 at 7:30 PM, John <j...@quivinco.com> wrote:

> Thanks.
>
> my solution
>
>     @Inject
>     @Symbol(SymbolConstants.EXECUTION_MODE)
>     private String exeMode;
>
>
>     ...
>     if (exeMode.contains(SymbolConstants.PRODUCTION_MODE)) {
>   ----- Original Message -----
>   From: Lutz Hühnken
>   To: Tapestry users
>   Sent: Tuesday, January 15, 2013 10:15 AM
>   Subject: Re: detecting execution mode
>
>
>   Hi John,
>
>   you should be able to inject its value into your class with
>   @Symbol("tapestry.production-mode")
>
>   See org.apache.tapestry5.ioc.annotations.Symbol for documentation and
>   org.apache.tapestry5.SymbolConstants for names.
>
>   Hth,
>   Lutz
>
>
>   On Tue, Jan 15, 2013 at 11:07 AM, John <j...@quivinco.com> wrote:
>   > Hi,
>   >
>   > What is a neat way to detect the execution mode? I want to know if my
> service class is running with development mode so I can switch a feature
> off.
>   >
>   > John
>
>   ---------------------------------------------------------------------
>   To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>   For additional commands, e-mail: users-h...@tapestry.apache.org
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Reply via email to