Oh, that's interesting, thank you Thorsten.

I thought that the env dependent variable substitution only worked for 
properties that are defined directly in my own beans - I guess I should have 
read the documentation more carefully!

This makes it quite straightforward.

Thank you again,
B.

From: Thorsten Scherler [mailto:scher...@gmail.com]
Sent: 10 February 2012 11:18
To: users@cocoon.apache.org
Subject: Re: How to use the Cocoon Spring Configurator with "hidden" properties

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:

<bean id="featureLauncherMBean"
            
class="com.iggroup.wb.core.featurelauncher.internal.DefaultFeatureLauncher"
            init-method="init" destroy-method="dismissAllFeatures">
</bean>

<util:map id="exposedMBeans">
      <entry key="bean:type=featureLauncherMBean,name=remoteJMX"
            value-ref="featureLauncherMBean" />
</util:map>

<bean id="mBeanExporter" class="org.springframework.jmx.export.MBeanExporter"
      p:beans-ref="exposedMBeans" p:assembler-ref="assembler" />

<util:list id="manageableInterfaces">
      
<value>com.iggroup.wb.core.featurelauncher.api.FeatureLauncherMBean</value>
</util:list>

<bean id="assembler"
      
class="org.springframework.jmx.export.assembler.InterfaceBasedMBeanInfoAssembler"
      p:managedInterfaces-ref="manageableInterfaces" />

<bean id="registry" 
class="org.springframework.remoting.rmi.RmiRegistryFactoryBean"
      p:port="1099" />

<bean id="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<http://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/

Reply via email to