Hi Christian,
Thanks for the replies. (I received replies through the osgi-digest mail).
Yes. I went through the Apache Aries implementation and I found some
confusions and I wanted to clarify them with osgi-dev. Some of the examples
are as follows:
1. Using osgi: scheme and servicelist path. "If this osgi:servicelist
scheme is used from a lookup method then a Context object is returned
instead of a service object" - specification page 508. Say we got a Context
object from a URL (eg:
context.lookup("osgi:servicelist/<interface-name>")). We again can call a
lookup using the received context as below:
*Context listContext = context.lookup("osgi:servicelist/<interface-name>");*
*Object service = listContext.lookup(<some-parameter>)
//what should be the parameters passed here?*
As per the Apache Aries implementation, the parameters of the second
lookup() method is a service id. So the OSGi service query will be perform
reading the interface from the first URL (i.e
*"osgi:servicelist/<interface-name>"*) and the service id from the second
URL (i.e "*<some-parameter>*"). I could not find such description from the
specification. (Correct me if I am wrong).
2. As per the Apache Aries implementation you can call list() and
listbindings() methods for both "service" and "servicelist" paths. Both
method calls directs to a same method which passes an empty string as the
parameter to list() method [1]. Is this the expected behavior? (Or
specification
may not provide each and every implementation detail and developers might
have to taken decisions while implementing.)
[1]
https://github.com/apache/aries/blob/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryContext.java#L63
Thanks,
Nipuni
On Thu, Mar 31, 2016 at 9:40 AM, Nipuni Piyabasi Perera <
[email protected]> wrote:
> Hi all,
>
> Thanks for the replies. (I received replies through the osgi-digest mail).
>
> Seems my second question is not much clear. Hence adding the same question
> with more details below:
>
> 2. As per the specification, listBindings() and list() methods will return
> NamingEnumeration objects. Do both "service" and "servicelist" paths need
> to support aforementioned methods?
> a. eg: context.list("osgi:service/<query>") is this a valid statement ?
> b. eg: context.list("osgi:servicelist/<query>") is this a valid
> statement ?
> c. If this(above (b)) is a valid scenario, does the Context object
> need to obtain first, before doing list() and listbinding() queries?
> (Please find a sample code below)
>
> Context context = jndiContextManager.newInitialContext();
> Context listContext =
> context.lookup("osgi:servicelist/org.my.jndi.osgi.services.FooService")
>
> - In a scenario as above, is it valid to pass two different names to
> list() and lookup() methods (i.e
> context.lookup("osgi:servicelist/SERVICE-A") and do a
> context.list(osgi:servicelist/SERVICE-B)) ?
> NamingEnumeration<NameClassPair> namingEnumeration =
> listContext.list("osgi:service/org.my.jndi.osgi.services.FooService");
>
> - In a scenario as above say we received a context object with lookup
> method.
> Context listContext =
> context.lookup("osgi:servicelist/<service-name>");
>
> We should be able to do lookup() calls with this received context
> object. In such cases what should pass as the URL.
> eg: is it "listContext.lookup("osgi:servicelist/<service-name>") or
> listContext.lookup("<service-name>|<service-id>")"
>
> (I also have raised the queries in OSGi public Bugzilla)
>
> Thanks,
> Nipuni
>
> On Wed, Mar 30, 2016 at 9:37 AM, Nipuni Piyabasi Perera <
> [email protected]> wrote:
>
>> Hi all,
>>
>> Appreciate any response on the above questions.
>>
>> Thanks,
>> Nipuni
>>
>> On Thu, Mar 24, 2016 at 8:05 PM, Nipuni Piyabasi Perera <
>> [email protected]> wrote:
>>
>>> Hi all,
>>>
>>> I am trying to implement OSGI URL scheme support for JNDI following the
>>> OSGI service specification[1]. While implementing the OSGI URL scheme I
>>> encountered following issues.
>>> As per the specification, Following are the confusions I have:
>>>
>>> 1. A lookup with osgi:service path will return a service while a
>>> servicelist path returns an context object. Does a query
>>> "osgi:servicelist/" is valid? Or is it mandatory to have a query followed
>>> by the osgi:servicelist/ ?
>>> 2. As per the specification, listBindings() and list() methods will
>>> return NamingEnumeration objects. Do both "service" and "servicelist"
>>> paths
>>> need to support aforementioned methods?
>>> 1. context.list("osgi:service/<qname>") is this a valid URL ?
>>> 2. context.list(osgi:servicelist/<qname>) is this a valid URL ?
>>> 1. If this is a valid scenario, does the Context object need
>>> to obtain first before doing list() and listbinding() queries?
>>> (Please find
>>> a sample code below)
>>> 2.
>>>
>>> Context context = jndiContextManager.newInitialContext();
>>>
>>> Context listContext =
>>> context.lookup("osgi:servicelist/org.my.jndi.osgi.services.FooService")
>>>
>>> NamingEnumeration<NameClassPair> namingEnumeration =
>>>
>>>
>>> listContext.list("osgi:service/org.wso2.carbon.jndi.osgi.services.FooService");
>>>
>>> 3.
>>>
>>> In a scenario as above, is it valid to pass two different names to
>>> list() and lookup() methods (i.e
>>> context.lookup("osgi:servicelist/SERVICE-A") and do a
>>> context.list(osgi:servicelist/SERVICE-B)) ?
>>>
>>> 3. As per the specification we mainly support list(),
>>> listbindings(), and lookup() methods. Can we consider the other methods
>>> such as bind(), rebind() , unbind() , rename() as operations that are
>>> not
>>> supported with the provider?
>>>
>>> Appreciate any input on above queries.
>>>
>>> [1] https://osgi.org/download/r6/osgi.enterprise-6.0.0.pdf
>>> <https://www.osgi.org/developer/downloads/release-6/release-6-download/>
>>>
>>> Thanks,
>>> Nipuni
>>>
>>> --
>>> Nipuni Perera
>>> Software Engineer; WSO2 Inc.; http://wso2.com
>>> Email: [email protected]
>>> Git hub profile: https://github.com/nipuni
>>> Blog : http://nipunipererablog.blogspot.com/
>>> Mobile: +94 (71) 5626680
>>>
>>
>>
>>
>> --
>> Nipuni Perera
>> Software Engineer; WSO2 Inc.; http://wso2.com
>> Email: [email protected]
>> Git hub profile: https://github.com/nipuni
>> Blog : http://nipunipererablog.blogspot.com/
>> Mobile: +94 (71) 5626680
>>
>
>
>
> --
> Nipuni Perera
> Software Engineer; WSO2 Inc.; http://wso2.com
> Email: [email protected]
> Git hub profile: https://github.com/nipuni
> Blog : http://nipunipererablog.blogspot.com/
> Mobile: +94 (71) 5626680
>
--
Nipuni Perera
Software Engineer; WSO2 Inc.; http://wso2.com
Email: [email protected]
Git hub profile: https://github.com/nipuni
Blog : http://nipunipererablog.blogspot.com/
Mobile: +94 (71) 5626680
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev