Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [lyo-dev] Where to implement the resource's GET/POST/PUT methods?

I added some of this to our wiki. The page could use more detail, but it's a start.

https://wiki.eclipse.org/Lyo/OSLC4JAnnotations

--
Samuel Padgett | IBM Rational | spadgett@xxxxxxxxxx
Eclipse Lyo: Enabling tool integration with OSLC


Inactive hide details for Samuel Padgett---03/07/2014 05:29:33 PM---Unfortunately, our documentation is a bit lacking. We actuaSamuel Padgett---03/07/2014 05:29:33 PM---Unfortunately, our documentation is a bit lacking. We actually have a bug specifically to document @


    From:

Samuel Padgett/Durham/IBM@IBMUS

    To:


    Cc:

Lyo project developer discussions <lyo-dev@xxxxxxxxxxx>, lyo-dev-bounces@xxxxxxxxxxx

    Date:

03/07/2014 05:29 PM

    Subject:

Re: [lyo-dev] Where to implement the resource's GET/POST/PUT methods?

    Sent by:

lyo-dev-bounces@xxxxxxxxxxx




Unfortunately, our documentation is a bit lacking. We actually have a bug specifically to document @OslcDialog.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=405495

Right now the best way to learn is to look at the reference implementations or the Bugzilla workshop.


org.eclipse.lyo.docs/Lab1/Lyo_OSLC_Workshop.pdf


You should have an @OslcService annotation on every JAX-RS resource, even if you only have one service description document.


To use @OslcQueryCapability and @OslcCreationFactory, you simply add those annotations to the @GET and @POST methods for each resource that handles those requests. The URIs are added to the service description document calculated from the JAX-RS @Path annotation.


For selection dialogs, the @OslcDialogs or @OslcDialog annotation has to be on a @GET method, usually the query capability. For creation dialogs, the annotation has to be on an @POST method, usually the creation factory. The @OslcDialog "uri" determines the URI for the dialog, and you can use path parameters. For instance, the Bugzilla adapter has this selection dialog:


@OslcDialog

       (
            title =
"Change Request Selection Dialog",
            label =
"Change Request Selection Dialog",
            uri =
"/{productId}/changeRequests/selector",
            hintWidth =
"525px",
            hintHeight =
"325px",
            resourceTypes = {Constants.
TYPE_CHANGE_REQUEST},
            usages = {OslcConstants.
OSLC_USAGE_DEFAULT}
       )


If you want to see the code that looks for these annotations, this is the method:


org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory.handleResourceClass(String, String, Class<?>, Service, Map<String, Object>)


Hope this helps. Let me know if you spot anything wrong in my description. I might drop this into a wiki page for later reference.


--
Samuel Padgett | IBM Rational | spadgett@xxxxxxxxxx
Eclipse Lyo: Enabling tool integration with OSLC



Inactive hide details for Jad El-Khoury ---03/07/2014 04:59:05 PM---Thanks Samuel for the clarification. Now more things fall iJad El-Khoury ---03/07/2014 04:59:05 PM---Thanks Samuel for the clarification. Now more things fall into place. My assumption that "class (ann
    From:

Jad El-Khoury <jad@xxxxxx>
    To:

Lyo project developer discussions <lyo-dev@xxxxxxxxxxx>
    Date:

03/07/2014 04:59 PM
    Subject:

Re: [lyo-dev] Where to implement the resource's GET/POST/PUT methods?
    Sent by:

lyo-dev-bounces@xxxxxxxxxxx




Thanks Samuel for the clarification.

Now more things fall into place. My assumption that “class (annotated @OslcService) is the implementation of an OSLC Service” was simply wrong.

My follow-up question was going to be on tips to try to sort out how a single JAX-RS resource (the class with the @OslcService which I thought ought to correspond to a single “OSLC Service”) could handle creation factories, queries and dialogs that can essentially specify different URIs in their properties.

But I have yet another follow-up question: Any documentation on how to declare the “OSLC Service” annotations @OslcDialogs, @OslcQueryCapability & @OslcCreationFactory. For example, does it matter in which class they are declared?

Regards.
----
Jad El-khoury, PhD
Mechatronics Lab, Department of Machine Design
Royal Institute of Technology (KTH)
S-100 44 Stockholm, Sweden
e-mail:
jad@xxxxxx
Phone: +46(0)8 790 6877
Mobile: +46(0)70 773 93 45

From:
 lyo-dev-bounces@xxxxxxxxxxx [mailto:lyo-dev-bounces@xxxxxxxxxxx] On Behalf Of Samuel Padgett
Sent:
 den 7 mars 2014 19:57
To:
 Lyo project developer discussions
Cc:
 lyo-dev-bounces@xxxxxxxxxxx
Subject:
 Re: [lyo-dev] Where to implement the resource's GET/POST/PUT methods?
 

Hey, Jad. To me, it's a best practice to have one class than the GET/PUT/POST for one resource type, at least that's how I've usually done it. Of course, there's no limitation that forces you to do it that way. Bugzilla has only one "service" because it really only handles one type, change request.

I sometimes get confused talking about it because of overloaded terms. What we've called a service in the Lyo reference implementations I believe is called a resource in JAX-RS terminology.
--
Samuel Padgett | IBM Rational |
spadgett@xxxxxxxxxx
Eclipse Lyo: Enabling tool integration with OSLC



Inactive hide details for Jad El-Khoury ---03/04/2014 04:56:20 PM---Hi, I am wondering where to best implement a given resourceJad El-Khoury ---03/04/2014 04:56:20 PM---Hi, I am wondering where to best implement a given resource's GET/POST/PUT methods. 

    From:

Jad El-Khoury <
jad@xxxxxx>
    To:

"
lyo-dev@eclipse. org (lyo-dev@xxxxxxxxxxx)" <lyo-dev@xxxxxxxxxxx>
    Date:

03/04/2014 04:56 PM
    Subject:

[lyo-dev] Where to implement the resource's GET/POST/PUT methods?
    Sent by:

lyo-dev-bounces@xxxxxxxxxxx





Hi,

I am wondering where to best implement a given resource's GET/POST/PUT methods.

Using the OSLCWorkshop as a reference (Bugzilla adaptor implementation), the GET/POST/PUT methods for the BugzillaChangeRequest resource were implemented in the class BugzillaChangeRequestService. My understanding here is that this class (annotated @OslcService) is the implementation of an OSLC Service as illustrated in
http://open-services.net/bin/view/Main/OslcCoreSpecification?sortcol=table;up=#Overview.

Now, this made sense since this service is the only service dealing with  BugzillaChangeRequest resources. And, this services does not handle any other resource type.

In a general case where a resource type is managed by more than one service, I wonder where to best place that resource's methods.  Or is it safe to assume that a resource type should be handled within a single service?

Regards,
----
Jad El-khoury, PhD
Mechatronics Lab, Department of Machine Design
Royal Institute of Technology (KTH)
S-100 44 Stockholm, Sweden
e-mail:
jad@xxxxxx
Phone: +46(0)8 790 6877
Mobile: +46(0)70 773 93 45

_______________________________________________
lyo-dev mailing list

lyo-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/lyo-dev
_______________________________________________
lyo-dev mailing list
lyo-dev@xxxxxxxxxxx

https://dev.eclipse.org/mailman/listinfo/lyo-dev

_______________________________________________
lyo-dev mailing list
lyo-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/lyo-dev


GIF image

GIF image

JPEG image

JPEG image


Back to the top