You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Ephemeris Lappis <ep...@gmail.com> on 2012/07/25 15:17:05 UTC

Endpoints URI and system environment

Hello.

I'm looking for a way to configure some URI in Camel routes taking into
account the server execution context.

For example, HTTP, JETTY or RESTLET endpoints URI must be given with a
complete URL, and forces the designer to be aware of the server's host and
port. If the platform needs to be reconfigured with different port or host
name, any dependent route has to be modified.

At the opposite, for example, I can package a CXF web service as a bundle,
configuring only the specific path part of the URL, and let the runtime bind
it to the current HTTP service with the right host and port.

How can I do this for simple Camel URI ? I've been looking for some way to
inject system properties, but with no concrete result. I suppose I can use a
property placeholder to set somthing like {{my.host}} or {{my.port}} from
each bundle properties file, and set the correct values there. But this
solution forces me to have as many properties file copies as deployed
bundles...

An idea ?

Thanks.



--
View this message in context: http://servicemix.396122.n5.nabble.com/Endpoints-URI-and-system-environment-tp5713987.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Endpoints URI and system environment

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello.

I've found a good solution, I think...

Instead of deploying all my blueprint XML files separately, I build a 
bundle with all my files. One of them set the "cm:property-placeholder" 
using a given persistent ID that will be associated with the bundle. Any 
of the XML files in the OSGI-INF\blueprint folder can access the 
properties that are shared at the bundle scope.

This way, a single blueprint container is created. The properties can be 
managed now from the web console, and changes are propagated...

Nice, no ?

Thanks for your help.

Ephemeris Lappis

Le 31/07/2012 14:41, ajs6f@virginia.edu [via ServiceMix] a écrit :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I've checked the OSGi JavaDocs, and I _think_ you may be able to 
> override the simple behavior programmatically via the method:
>
> http://www.osgi.org/javadoc/r4v42/org/osgi/service/cm/ConfigurationAdmin.html#createFactoryConfiguration%28java.lang.String,%20java.lang.String%29
>
> which allows you to offer not just a PID for the factory to create the 
> Configuration, but a location for the bundle in which the 
> ManagedService that is being configured resides. You could use this 
> several times for each of your bundles.
>
> But I welcome correction from more serious OSGi-heads! {grin} I may be 
> misunderstanding the semantics of the spec, and there certainly may be 
> a more Karaf/SMX-idiomatic way to accomplish this.
>
> - ---
> A. Soroka
> Software & Systems Engineering :: Online Library Environment
> the University of Virginia Library
>
> On Jul 26, 2012, at 10:42 AM, Ephemeris Lappis wrote:
>
> > Hello.
> >
> > If I'm not wrong, the persistent ID of a managed configuration is 
> attached
> > to the OSGi bundle that declares it.
> >
> > Indeed, I can declare my properties like that in one bundle :
> >
> > <cm:property-placeholder
> > id="my.properties"
> > persistent-id="my.system.application"
> > update-strategy="reload" />
> >
> > And ServiceMix actually manages the "etc/my.system.application.cfg" 
> file and
> > lets us modify the properties using the configuration view of the web
> > console, that is exactly the desired goal. In tehbconsole you can 
> see the
> > relationship between the configuration file and the bundle...
> >
> > No more bundle can declare a property placeholder with the same 
> persistent
> > id... Thus, the question about a better way to share global or common
> > configuration values...
> >
> >
> >
> >
> >
> > --
> > View this message in context: 
> http://servicemix.396122.n5.nabble.com/Endpoints-URI-and-system-environment-tp5713987p5714004.html
> > Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
>
> iQEcBAEBAgAGBQJQF9IyAAoJEATpPYSyaoIkWoMH/2zWi7bb9HR20edc3t6fZSu5
> X3hs1C9str+GWGc2v1bdCZY43Fsu3GUXV9zGZ6oFuWkblzOJEEBEyeF3KsBA++B/
> +UNvtG2UbKnSSJXoxRZkyP2vtD9Jo4rZDnmO9AEJQWk0O4oATBHG5ZlYR0eCL2uh
> 6ha/Pem+83zcY/g/ZTqqQb2MavxabvBnCcIjKBlzwOJHax6RRjTJ/P+jE7EqbpFQ
> T7BSTJkgWJ3Z2bC5KNXbkljq677Fm+413NxXPE0zpokac6tXoflsYkXmW8+rZuKh
> msRrTmhvhndrIT+SY9HoMTSgW4b8S8ACU11NhBMnpj7725oJ1PdO1hMVkILhavM=
> =NXNR
> -----END PGP SIGNATURE-----
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://servicemix.396122.n5.nabble.com/Endpoints-URI-and-system-environment-tp5713987p5714031.html 
>
> To unsubscribe from Endpoints URI and system environment, click here 
> <http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5713987&code=ZXBoZW1lcmlzLmxhcHBpc0BnbWFpbC5jb218NTcxMzk4N3w0OTQyMjM2NDI=>.
> NAML 
> <http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> 
>





--
View this message in context: http://servicemix.396122.n5.nabble.com/Endpoints-URI-and-system-environment-tp5713987p5714049.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Endpoints URI and system environment

Posted by "ajs6f@virginia.edu" <aj...@virginia.edu>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've checked the OSGi JavaDocs, and I _think_ you may be able to override the simple behavior programmatically via the method:

http://www.osgi.org/javadoc/r4v42/org/osgi/service/cm/ConfigurationAdmin.html#createFactoryConfiguration%28java.lang.String,%20java.lang.String%29

which allows you to offer not just a PID for the factory to create the Configuration, but a location for the bundle in which the ManagedService that is being configured resides. You could use this several times for each of your bundles.

But I welcome correction from more serious OSGi-heads! {grin} I may be misunderstanding the semantics of the spec, and there certainly may be a more Karaf/SMX-idiomatic way to accomplish this.

- ---
A. Soroka
Software & Systems Engineering :: Online Library Environment
the University of Virginia Library

On Jul 26, 2012, at 10:42 AM, Ephemeris Lappis wrote:

> Hello.
> 
> If I'm not wrong, the persistent ID of a managed configuration is attached
> to the OSGi bundle that declares it.
> 
> Indeed, I can declare my properties like that in one bundle :
> 
> 	<cm:property-placeholder
> 		id="my.properties"
> 		persistent-id="my.system.application"
> 		update-strategy="reload" />
> 
> And ServiceMix actually manages the "etc/my.system.application.cfg" file and
> lets us modify the properties using the configuration view of the web
> console, that is exactly the desired goal. In tehbconsole you can see the
> relationship between the configuration file and the bundle...
> 
> No more bundle can declare a property placeholder with the same persistent
> id... Thus, the question about a better way to share global or common
> configuration values...
> 
> 
> 
> 
> 
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Endpoints-URI-and-system-environment-tp5713987p5714004.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org

iQEcBAEBAgAGBQJQF9IyAAoJEATpPYSyaoIkWoMH/2zWi7bb9HR20edc3t6fZSu5
X3hs1C9str+GWGc2v1bdCZY43Fsu3GUXV9zGZ6oFuWkblzOJEEBEyeF3KsBA++B/
+UNvtG2UbKnSSJXoxRZkyP2vtD9Jo4rZDnmO9AEJQWk0O4oATBHG5ZlYR0eCL2uh
6ha/Pem+83zcY/g/ZTqqQb2MavxabvBnCcIjKBlzwOJHax6RRjTJ/P+jE7EqbpFQ
T7BSTJkgWJ3Z2bC5KNXbkljq677Fm+413NxXPE0zpokac6tXoflsYkXmW8+rZuKh
msRrTmhvhndrIT+SY9HoMTSgW4b8S8ACU11NhBMnpj7725oJ1PdO1hMVkILhavM=
=NXNR
-----END PGP SIGNATURE-----

Re: Endpoints URI and system environment

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello.

If I'm not wrong, the persistent ID of a managed configuration is attached
to the OSGi bundle that declares it.

Indeed, I can declare my properties like that in one bundle :

	<cm:property-placeholder
		id="my.properties"
		persistent-id="my.system.application"
		update-strategy="reload" />

And ServiceMix actually manages the "etc/my.system.application.cfg" file and
lets us modify the properties using the configuration view of the web
console, that is exactly the desired goal. In tehbconsole you can see the
relationship between the configuration file and the bundle...

No more bundle can declare a property placeholder with the same persistent
id... Thus, the question about a better way to share global or common
configuration values...





--
View this message in context: http://servicemix.396122.n5.nabble.com/Endpoints-URI-and-system-environment-tp5713987p5714004.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Endpoints URI and system environment

Posted by "ajs6f@virginia.edu" <aj...@virginia.edu>.
I may be missing something here, but why couldn't you use the same Config
Admin PID for each bundle? (That is: one config, many bundles.) In Camel I
believe that you can choose to inject placeholder properties from a
particular Config Admin PID.

---
A. Soroka
Online Library Environment
the University of Virginia Library

On Wed, Jul 25, 2012 at 9:17 AM, Ephemeris Lappis <
ephemeris.lappis@gmail.com> wrote:

> Hello.
>
> I'm looking for a way to configure some URI in Camel routes taking into
> account the server execution context.
>
> For example, HTTP, JETTY or RESTLET endpoints URI must be given with a
> complete URL, and forces the designer to be aware of the server's host and
> port. If the platform needs to be reconfigured with different port or host
> name, any dependent route has to be modified.
>
> At the opposite, for example, I can package a CXF web service as a bundle,
> configuring only the specific path part of the URL, and let the runtime
> bind
> it to the current HTTP service with the right host and port.
>
> How can I do this for simple Camel URI ? I've been looking for some way to
> inject system properties, but with no concrete result. I suppose I can use
> a
> property placeholder to set somthing like {{my.host}} or {{my.port}} from
> each bundle properties file, and set the correct values there. But this
> solution forces me to have as many properties file copies as deployed
> bundles...
>
> An idea ?
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://servicemix.396122.n5.nabble.com/Endpoints-URI-and-system-environment-tp5713987.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>