|
Gobal properties (configuration) in Nuxeo5: msg#00346cms.nuxeo.general
Hi all, A few weeks ago a global configuration mechanism was added to Nuxeo5. I will explain here how this is working and what's this good for. So, what's it good for? As you know most of Nuxeo5 modules (functionalities) are configured through XML component descriptors that supports defining properties, extension points and contributing extensions to other components. So the configuration is defined at component level. But there are cases when you want to define global properties accessible to all components in the system. Examples: - you need a name and a version for your product so that it may be displayed in the web interface or exposed by some components to clients through web services (ex: getProductName() getproductVersion()) This should be defined at a global level in the application - you need to setup some ports to listen to in your component. But want to put this configuration in a centralized place so that when you need to change the ports used by nuxeo5 you modify only one file. For example the streaming service is listening to the port 3233, and the remoting service to 62474 If you want to modify the ports used by nuxeo5 you need to modify the StreamingService.xml and RemotingService.xml filers from nuxeo-runtime.jar Using a global configuration file you will need to modify only one file. How it works? To define global properties you simply copy a java property file in nuxeo.ear/config directory. The file should have one of the following extensions: *.ini, *.config, *.properties All properties declared in these files will be loaded at start time and made accessible through NXRuntime API. Example: NXRuntime.getRuntime().getProperty("org.nuxeo.ecm.product.name"); Also you can use property keys inside component XML descriptors as part of property values. Example: <component name="org.nuxeo.runtime.streaming" version="1.0.0"> <implementation class="org.nuxeo.runtime.services.streaming.StreamingService"/> <property name="isServer" type="Boolean" value="${org.nuxeo.runtime.streaming.isServer}"/> ... </component> The property "isServer" of the org.nuxeo.runtime.streaming component will be expanded to the value of the global property "org.nuxeo.runtime.streaming.isServer" You can also use expansion when defining global components: Example: org.nuxeo.runtime.host=localhost org.nuxeo.runtime.streaming.serverLocator=socket://${org.nuxeo.runtime.host}:3233 The property org.nuxeo.runtime.streaming.serverLocator will be expanded to socket://localhost:3233 By default Nuxeo5 comes with a configuration file named nuxeo.config and that for now contains the following properties: -------------------------------------------------------------------------------- # application instance config org.nuxeo.ecm.instance.name = Nuxeo5 org.nuxeo.ecm.instance.description = Nuxeo ECM server on JBoss # product config org.nuxeo.ecm.product.name = Nuxeo5 org.nuxeo.ecm.product.version = 5.1M2 # runtime remoting config org.nuxeo.runtime.server.enabled=true org.nuxeo.runtime.server.port=62474 org.nuxeo.runtime.server.host=127.0.0.1 # streaming config org.nuxeo.runtime.streaming.isServer=true org.nuxeo.runtime.streaming.serverLocator=socket://127.0.0.1:3233 ------------------------------------------------------------------------------------------- Bogdan |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Tables 'USERS' and 'USERS2GROUP' dropped every time: 00346, Florent Guillaume |
|---|---|
| Next by Date: | Re: Tables 'USERS' and 'USERS2GROUP' dropped every time: 00346, George Lefter |
| Previous by Thread: | small error in deployment-fragment.xml of nuxeo-platform-forumi: 00346, Vincent Dutat |
| Next by Thread: | Re: Gobal properties (configuration) in Nuxeo5: 00346, Vincent Dutat |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |