Hello!

Thanks for the link, but I'm trying to avoid writing XML at the moment :)
I'm trying to understand what you're saying with "May be, if the impl class
is proxified, then ther are not visible." as well: it means that if the
annotation are all inside the service implementation class, they are
"hidden" from RSA discovery zookeeper range?

If so can you provide an exmaple on how to solve this issue? Some steps in
order to understand the issue are welcome as well!

Thanks again!


2017-05-13 21:30 GMT+02:00 Sergey Beryozkin <sberyoz...@gmail.com>:

> Hi
> Yes, the annotations can (and very often) are put on the implementation
> class...May be, if the impl class is proxified, then ther are not visible...
> By the way, one other option is
> http://cxf.apache.org/docs/jax-rs-advanced-features.html#JAX
> -RSAdvancedFeatures-RESTfulserviceswithoutannotations
>
> Sergey
>
> On 13/05/17 10:21, Massimo Bono wrote:
>
>> Thanks for the example Christian. Obviously I didn't search the web well
>> enough :)
>>
>> I tried to replicate your example and everything works as expected.
>>
>> I have a question though: Assume rest interface is different than model
>> interface (but somewhat overlapping), or simply assume I don't want my
>> model to be "polluted" with JAXRS annotations.
>>
>> I thought I could remove all the annotation within the service interface
>> and add the same annotations within the rest class. Something like:
>>
>> interface:
>>
>> public interface TaskService {
>> public Task getTask(String id);
>> public void addTask(Task task);
>> public void updateTask(Task task);
>> public void deleteTask(String id);
>> public Task[] getAll();
>> public default Collection<Task> getTasks() {
>> return Arrays.asList(this.getAll());
>> }
>> }
>>
>>
>> rest:
>>
>> @Api
>> @Path("")
>> @Produces(MediaType.APPLICATION_XML) //if you want to generate json
>> instead
>> @Component(
>>     immediate = true,
>>     name = "TaskService",
>>     property = {
>>       "service.exported.interfaces=*",
>>       "service.exported.configs=org.apache.cxf.rs",
>>       "org.apache.cxf.rs.address=/tasks2",
>>     }
>> )
>> public class TaskRest implements TaskService {
>>
>> //reference of another implementation of TaskService, inside osgi
>> framework
>>
>> @Reference
>> private TaskService taskService;
>>
>>     @GET
>>     @Path("/{id}")
>> public Task getTask(@PathParam("id") String id) {
>> return this.taskService.getTask(id);
>> }
>>
>> @PUT
>> public void addTask(Task task) {
>> this.taskService.addTask(task);
>> }
>>
>> @Override
>> public void updateTask(Task task) {
>> this.addTask(task);
>> }
>>
>> @DELETE
>> @Path("/{id}")
>> public void deleteTask(String id) {
>> this.taskService.deleteTask(id);
>> }
>>
>> @GET
>> public Task[] getAll() {
>> return this.taskService.getAll();
>> }
>> }
>>
>> However, rsa:endpoints does not detect the rest service when the rest
>> bundle starts.
>> Is this an expected behaviour (since I removed an interface with JAXRS
>> annotation)? Can I make this work?
>> I know the example I have provided does not make any sense (it's just a
>> semantic-less wrapper of an osgi service).
>>
>> Thanks you very much!
>>
>>
>>
>> 2017-05-10 20:51 GMT+02:00 Christian Schneider <ch...@die-schneider.net>:
>>
>> You can use CXF-DOSGi. The examples use declarative services.
>>>
>>> See
>>> https://github.com/apache/cxf-dosgi/tree/master/samples/rest
>>>
>>> Christian
>>>
>>> 2017-05-10 10:32 GMT+02:00 Massimo Bono <massimobo...@gmail.com>:
>>>
>>> Hello,
>>>>
>>>> I'm playing with Apache Karaf and CXF and I'm trying to setup a REST
>>>>
>>> hello
>>>
>>>> world application with Declarative Service. Several tutorial are
>>>>
>>> available
>>>
>>>> on the internet (like
>>>> http://liquid-reality.de/display/liquid/2011/12/22/Karaf+
>>>> Tutorial+Part+4+-+CXF+Services+in+OSGi
>>>> or https://cwiki.apache.org/confluence/pages/viewpage.action?
>>>> pageId=55153391
>>>> ).
>>>>
>>>> However, there seems to be no example exploiting DS. I'm not accustomed
>>>>
>>> to
>>>
>>>> blueprints, but I thought i could transfer the parameters inside it to
>>>>
>>> DS.
>>>
>>>> Sadly, I can't translate jaxrs:server values from BP to DS.
>>>>
>>>> So my question are:
>>>> 1) Is it possible to start CXF on apache karaf (4.1.1) with DS?
>>>> 2) If yes, can you provide an example or some basic step to achieve it?
>>>>
>>>> Thanks for any kind reply
>>>>
>>>> --
>>>> *Ing. Massimo Bono*
>>>>
>>>>
>>>
>>>
>>> --
>>> --
>>> Christian Schneider
>>> http://www.liquid-reality.de
>>> <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e
>>> 46&URL=http%3a%2f%2fwww.liquid-reality.de>
>>>
>>> Open Source Architect
>>> http://www.talend.com
>>> <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e
>>> 46&URL=http%3a%2f%2fwww.talend.com>
>>>
>>>
>>
>>
>>


-- 
*Ing. Massimo Bono*

Reply via email to