So filters with the version attribute works with JNDI ! Great !!!

Thanks

Bartosz Kowalewski a écrit :
Hi Erik,

Continuing Lin's guide:

You should be now able to use something similar to:
"aries:services/javax.jms.MessageListener/(" +
Constants.VERSION_ATTRIBUTE + "=1.0)"
when doing JNDI lookup.

I hope I'm not misstating anything.

Best regards,
  Bartek

2010/6/25 Lin Sun <[email protected]>:
Hi

When you publish a service, you could specify the version info in
service property, for example, publishing a service using blueprint
XML:

<service ref="myMessageDrivenBean" interface="javax.jms.MessageListener">
  <service-properties>
       <entry key="version" value="1.0" />
  </service-properties>
</service>

Or you could do similar thing without using blueprint, using
context.registerService

       Dictionary dict = new Hashtable();
       dict.put(Constants.VERSION_ATTRIBUTE, "1.0");
       sr = context.registerService(MessageListener.class.getName(),
new MyMessageDrivenBean(context), dict);

A client can use filter to specify the exact query it wants, for
example something like below -

String fiter = "(" + Constants.VERSION_ATTRIBUTE + "=1.0")";

Then pass the filter into context.getServiceReferences(clazz, filter)
to get the service reference for the service you are interested.

HTH

Lin



On Thu, Jun 24, 2010 at 8:16 AM, Erik Gollot <[email protected]> wrote:
Hello,

first, thanks for your work in the OSGI  world !

This is my first question about Aries.

So, when we publish a service, we can specify a version number, ok ?
So, now, if I've published 2 versions of the "same service", how a client
can specify the version he needs when a "IntialContext.lookup" is performed
? Do we need an OSGIfied JNDI ?

Thanks



Reply via email to