Hi All,

It worked like a charm. We used the Non-OSGi approach to access the JNDI
context. This is the way I did, added "org.wso2.carbon.jndi.feature" and
you can get service instance with;

Context context = new InitialContext();
Object serviceInstance =
context.lookup("osgi:service/org.wso2.carbon.uuf.core.create.RenderableCreator");

Regards,
Rasika


On Tue, Apr 26, 2016 at 5:17 PM, Sameera Jayasoma <[email protected]> wrote:

> It should work. We've implemented JNDI OSGi spec just for this
>
> On Tue, Apr 26, 2016 at 5:12 PM, Aruna Karunarathna <[email protected]>
> wrote:
>
>>
>>
>> On Tue, Apr 26, 2016 at 4:57 PM, Nipuni Perera <[email protected]> wrote:
>>
>>> Hi Rasika,
>>>
>>> With Carbon-JNDI approach we provide a way to access osgi services from
>>> the service registry. The OSGi url scheme syntax is different from java URL
>>> scheme.
>>>
>>> The syntax is :  "osgi:service/<service-class>/<filter>"
>>>
>>> Eg : If you have a service registered in the service registry with a
>>> class name "org.wso2.carbon.jndi.osgi.services.FooService", you should be
>>> able to get the object with JNDI lookup :
>>>
>>>             Object service = context.lookup("
>>> osgi:service/org.wso2.carbon.jndi.osgi.services.FooService");
>>>
>>> Please find the samples and documentation from [1].
>>>
>>
>> Hi Nipuni,
>>
>> Shall we test this carbon-jndi feature installing to the UUF server?.. We
>> need to check whether the carbon-jndi works in the traditional way also,
>> apart from accessing the service using,
>>
>> Object service =
>> context.lookup("osgi:service/org.wso2.carbon.jndi.osgi.services.FooService");
>>
>> Regards,
>> Aruna
>>
>>>
>>> [1] https://github.com/wso2/carbon-jndi/
>>>
>>> Thanks,
>>> Nipuni
>>>
>>>
>>> On Tue, Apr 26, 2016 at 4:46 PM, Rasika Perera <[email protected]> wrote:
>>>
>>>> Hi Aruna & All,
>>>>
>>>> The requirement is that we need to provide a simple API to invoke a
>>>> method in an OSGi Service from the JavaScript(Nashorn). As per the offline
>>>> discussion with Aruna, JNDI is the recommended way to invoke OSGi services
>>>> in C5.
>>>>
>>>> @Nipuni
>>>> On the JNDI approach; are all OSGi services getting registered through
>>>> a unique URI(eg. "java:comp/env/osgi-service-a") at the service startup?
>>>>
>>>> Thanks,
>>>> Rasika
>>>>
>>>> On Tue, Apr 26, 2016 at 1:31 PM, Aruna Karunarathna <[email protected]>
>>>> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Tue, Apr 26, 2016 at 12:33 PM, Rasika Perera <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> ​Hi All,
>>>>>>
>>>>>> Before C5, we had a method "getOSGiService(Class clazz,
>>>>>> Hashtable<String, String> props)​ to retrieve an OSGi service[1]. In 
>>>>>> latest
>>>>>> C5, I couldn't find any similar feature in [2].
>>>>>>
>>>>>
>>>>> Can you elaborate more on your requirement here?. AFAIK there is no
>>>>> such way in C5 to retrieve OSGi services as in [1]
>>>>>
>>>>>>
>>>>>> ​What is the correct way to retrieve an OSGi service in C5?
>>>>>>
>>>>>> Or do we need to get it through directly from a "ServiceTracker" ?
>>>>>>
>>>>>> ​[1]
>>>>>> https://github.com/wso2/carbon-kernel/blob/4.4.x/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/CarbonContext.java#L322
>>>>>> [2]
>>>>>> https://github.com/wso2/carbon-kernel/blob/master/core/src/main/java/org/wso2/carbon/kernel/context/PrivilegedCarbonContext.java
>>>>>> ​
>>>>>>
>>>>>> --
>>>>>> With Regards,
>>>>>>
>>>>>> *Rasika Perera*
>>>>>> Software Engineer
>>>>>> M: +94 71 680 9060 E: [email protected]
>>>>>> LinkedIn: http://lk.linkedin.com/in/rasika90
>>>>>>
>>>>>> WSO2 Inc. www.wso2.com
>>>>>> lean.enterprise.middleware
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> *Aruna Sujith Karunarathna *
>>>>> WSO2, Inc | lean. enterprise. middleware.
>>>>> #20, Palm Grove, Colombo 03, Sri Lanka
>>>>> Mobile: +94 71 9040362 | Work: +94 112145345
>>>>> Email: [email protected] | Web: www.wso2.com
>>>>>
>>>>>
>>>>> On Tue, Apr 26, 2016 at 12:33 PM, Rasika Perera <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> ​Hi All,
>>>>>>
>>>>>> Before C5, we had a method "getOSGiService(Class clazz,
>>>>>> Hashtable<String, String> props)​ to retrieve an OSGi service[1]. In 
>>>>>> latest
>>>>>> C5, I couldn't find any similar feature in [2].
>>>>>>
>>>>>> ​What is the correct way to retrieve an OSGi service in C5?
>>>>>>
>>>>>> Or do we need to get it through directly from a "ServiceTracker" ?
>>>>>>
>>>>>> ​[1]
>>>>>> https://github.com/wso2/carbon-kernel/blob/4.4.x/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/CarbonContext.java#L322
>>>>>> [2]
>>>>>> https://github.com/wso2/carbon-kernel/blob/master/core/src/main/java/org/wso2/carbon/kernel/context/PrivilegedCarbonContext.java
>>>>>> ​
>>>>>>
>>>>>> --
>>>>>> With Regards,
>>>>>>
>>>>>> *Rasika Perera*
>>>>>> Software Engineer
>>>>>> M: +94 71 680 9060 E: [email protected]
>>>>>> LinkedIn: http://lk.linkedin.com/in/rasika90
>>>>>>
>>>>>> WSO2 Inc. www.wso2.com
>>>>>> lean.enterprise.middleware
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> *Aruna Sujith Karunarathna *
>>>>> WSO2, Inc | lean. enterprise. middleware.
>>>>> #20, Palm Grove, Colombo 03, Sri Lanka
>>>>> Mobile: +94 71 9040362 | Work: +94 112145345
>>>>> Email: [email protected] | Web: www.wso2.com
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> With Regards,
>>>>
>>>> *Rasika Perera*
>>>> Software Engineer
>>>> M: +94 71 680 9060 E: [email protected]
>>>> LinkedIn: http://lk.linkedin.com/in/rasika90
>>>>
>>>> WSO2 Inc. www.wso2.com
>>>> lean.enterprise.middleware
>>>>
>>>
>>>
>>>
>>> --
>>> 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
>>> <http://wso2.com>
>>>
>>>
>>
>>
>> --
>>
>> *Aruna Sujith Karunarathna *
>> WSO2, Inc | lean. enterprise. middleware.
>> #20, Palm Grove, Colombo 03, Sri Lanka
>> Mobile: +94 71 9040362 | Work: +94 112145345
>> Email: [email protected] | Web: www.wso2.com
>>
>>
>
>
>
> --
> Sameera Jayasoma,
> Software Architect,
>
> WSO2, Inc. (http://wso2.com)
> email: [email protected]
> blog: http://blog.sameera.org
> twitter: https://twitter.com/sameerajayasoma
> flickr: http://www.flickr.com/photos/sameera-jayasoma/collections
> Mobile: 0094776364456
>
> Lean . Enterprise . Middleware
>
>


-- 
With Regards,

*Rasika Perera*
Software Engineer
M: +94 71 680 9060 E: [email protected]
LinkedIn: http://lk.linkedin.com/in/rasika90

WSO2 Inc. www.wso2.com
lean.enterprise.middleware
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to