|[lyo-dev] how to best map Service Providers (& their services) into JAX-RS resources?|
Assuming you have a OSLC server/provider that deals with a few different types of ServiceProviders, each dealing with different types of OSLC Resources. For example, one set of ServiceProviders handles Products, while another set handles Projects. (of course, each such type of ServiceProviders can consist of many ServiceProvider instances).
I am trying to find a general pattern on how to best implement ServiceProviders and OSLC-Resources using JAX-RS.
My thoughts are:
1. Define a JAX-RS resource (in OSLC4J terms, means a class with @OSLCService annotation) for each ServiceProvider type.
2. within each such JAX-RS resource, you define the @OslcQueryCapability, @OslcDialog & @OslcCreationFactory capabilities as desired.
3. within each such JAX-RS resource, you also define the CRUD methods for the resources the ServiceProvider is meant to manage.
Would that be a valid and sustainable pattern?
Using the Bugzilla reference example for inspiration, one gets the impression that the following pattern is to be recommended:
1. Define a JAX-RS resource for each OSLC-Resource type. The class name “BugzillaChangeRequestService” implies that the JAX-RS resource is dedicated to that particular OSLC-Resources, and any associated services (dialogs, factories, …) related to that OSLC-Resource.
2. within each such JAX-RS resource, you define the @OslcQueryCapability, @OslcDialog & @OslcCreationFactory capabilities – from across the different ServiceProviders – that are relevant for that particular OSLC-Resource.
Any hints on which is more appropriate?
I have a feeling that the first approach of mapping ServiceProviders to JAX-RS resources makes conceptually more sense.
Jad El-khoury, PhD
KTH Royal Institute of Technology
School of Industrial Engineering and Management, Mechatronics Division
Brinellvägen 83, SE-100 44 Stockholm, Sweden
Phone: +46(0)8 790 6877 Mobile: +46(0)70 773 93 45