cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <scher...@gmail.com>
Subject Re: How to use the Cocoon Spring Configurator with "hidden" properties
Date Fri, 10 Feb 2012 11:18:29 GMT
On 02/10/2012 10:13 AM, Barbara Rosi-Schwartz wrote:
>
> Hello everyone.
>
> I want to use the Spring Configurator to configure access ports for my 
> JMX MBeans, with ports changing for the different development 
> environments.
>
> The spring configuration file contains the following:
>
> <beanid=/"featureLauncherMBean"/
>
> class=/"com.iggroup.wb.core.featurelauncher.internal.DefaultFeatureLauncher"/
>
> init-method=/"init"/ destroy-method=/"dismissAllFeatures"/>
>
> </bean>
>
> <util:mapid=/"exposedMBeans"/>
>
> <entrykey=/"bean:type=featureLauncherMBean,name=remoteJMX"/
>
> value-ref=/"featureLauncherMBean"/ />
>
> </util:map>
>
> <beanid=/"mBeanExporter"/class=/"org.springframework.jmx.export.MBeanExporter"/
>
> p:beans-ref=/"exposedMBeans"/ p:assembler-ref=/"assembler"/ />
>
> <util:listid=/"manageableInterfaces"/>
>
> <value>com.iggroup.wb.core.featurelauncher.api.FeatureLauncherMBean</value>
>
> </util:list>
>
> <beanid=/"assembler"/
>
> class=/"org.springframework.jmx.export.assembler.InterfaceBasedMBeanInfoAssembler"/
>
> p:managedInterfaces-ref=/"manageableInterfaces"/ />
>
> <beanid=/"registry"/ 
> class=/"org.springframework.remoting.rmi.RmiRegistryFactoryBean"/
>
> p:port=/"1099"/ />
>
> <beanid=/"serverConnector"/
>
> class=/"org.springframework.jmx.support.ConnectorServerFactoryBean"/
>
> depends-on=/"registry"/ p:objectName=/"connector:name=rmi"/
>
> p:serviceUrl=/"service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jmxrmi"/ 
> />
>
> The first bean, featureLauncherMBean,  is the one I work with directly 
> but the ones that contain the environment dependent properties are 
> registry (port property) and serverConnector (serviceUrl 
> property).These beans are just part of the wiring and  I cannot access 
> them directly.
>
> How would I go about using the Configurator to get port and serviceUrl 
> to point to the right port values depending upon the environment?
>

Use running modes to store the properties
http://cocoon.apache.org/subprojects/configuration/1.0/spring-configurator/2.0/1309_1_1.html
http://cocoon.apache.org/subprojects/configuration/1.0/spring-configurator/2.0/1310_1_1.html

so you have something like
src/main/resources/META-INF/cocoon/properties/
and in there a prod.properties (1) file and in a dev (RUNNING_MODE) 
folder the same file (2) with another url.

put in (1) 
serviceUrl=///service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jmxrmi/
and in (2) e.g. 
serviceUrl=///service:jmx:rmi://myhost/jndi/rmi://localhost:666/jmxrmi/

and then simply p:serviceUrl=/"${/serviceUrl/}"/ in your spring file.

HTH

salu2

> TIA,
>
> B.
>
> BARBARA ROSI-SCHWARTZ
>
> *Senior Developer*
>
> **
>
> IG Group|Cannon Bridge House**
>
> 25 Dowgate Hill|London|EC4R ZYA
>
> t: +44(0)20 7573 0208 (Direct)
>
> t: +44(0)20 7896 0011 (Switchboard)
>
> w: www.iggroup.com
>
>
> ------------------------------------------------------------------------
> The information contained in this email is strictly confidential and 
> for the use of the addressee only, unless otherwise indicated. If you 
> are not the intended recipient, please do not read, copy, use or 
> disclose to others this message or any attachment. Please also notify 
> the sender by replying to this email or by telephone (+44 (0)20 7896 
> 0011) and then delete the email and any copies of it. Opinions, 
> conclusions (etc) that do not relate to the official business of this 
> company shall be understood as neither given nor endorsed by it. IG 
> Group Holdings plc is a company registered in England and Wales under 
> number 04677092. VAT registration number 761 2978 07. Registered 
> Office: Cannon Bridge House, 25 Dowgate Hill, London EC4R 2YA. Listed 
> on the London Stock Exchange. Its subsidiaries IG Markets Limited and 
> IG Index Limited are authorised and regulated by the Financial 
> Services Authority (IG Markets Limited FSA registration number 195355 
> and IG Index Limited FSA registration number 114059).


-- 
Thorsten Scherler<scherler.at.gmail.com>
codeBusters S.L. - web based systems
<consulting, training and solutions>

http://www.codebusters.es/


Mime
View raw message