Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Lyo » Using Lyo with multiple "project" roots
icon3.gif  Using Lyo with multiple "project" roots [message #1016077] Mon, 04 March 2013 21:09 Go to next message
Stephen Rowles is currently offline Stephen RowlesFriend
Messages: 4
Registered: March 2013
Junior Member
Hi,

I've picked up the Lyo project and I'm hoping to use it to provide an OSLC interface to an existing product. The aim is to be an OSLC service provider that other people can consume.

My existing web based system is logically separated internally into differing areas that are compartmentalized and permissioned separately, much like Project Areas in IBM's Jazz product stack.

I would like to expose OSLC services that are specific to just one of these internal areas so that when being accessed I can provide permissioning as appropriate, and so the user doesn't need to specify the area on every REST call.

From looking at Rational Quality Manager's service catalog it has a Service Provider for every Project Area, so a consumer then needs to pick the top level provider they wish to use from that catalog before looking up the specific service URLs. I would like to achieve exactly the same pattern in my code.

I can't find a way to achieve this with Lyo. I've looked at the RIO reference implementation as a starting point. I can see there is one service provider for just one area, e.g. Quality Management and then the "Resource" classes have their base path set using the @Path annotation.

This leads to have fixed URLs, but as the Project Area's are dynamic at runtime, how would I use Lyo to expose a Resource on a dynamic URL? is it possible to drive the service exposure programmatically or is Lyo purely driven from the annotations?

Any pointers would be greatly appreciated,

Thank you.
Re: Using Lyo with multiple "project" roots [message #1016690 is a reply to message #1016077] Thu, 07 March 2013 11:21 Go to previous messageGo to next message
Stephen Rowles is currently offline Stephen RowlesFriend
Messages: 4
Registered: March 2013
Junior Member
Problem solved:

You can use a parameter in the root level @Path annotation and then use a different method call on the ServiceProviderFactory to pass through a parameter map <String, Object> which will then perform a key/value substitution to resolve the parameters from the annotations.

So the top level path can be specified as:

@Path(/{area}/resource)


Then when creating the ServiceProvider using the ServiceProvider factory use the method:

createServiceProvider(String baseURI, String genericBaseURI, String title, String description, Publisher publisher, Class<?>[] resourceClasses, Map<String, Object> pathParameterValues)


With the pathParameterValues map containing a key of "area" mapping to a string that you would want to replace.

The methods within that Resource can then reference the parameter using the standard @PathParam() annotation on the methods.
Re: Using Lyo with multiple "project" roots [message #1016973 is a reply to message #1016077] Fri, 08 March 2013 12:19 Go to previous message
Michael Fiedler is currently offline Michael FiedlerFriend
Messages: 12
Registered: September 2012
Junior Member
Hi, Sorry for the slow response - for some reason I'm not getting notifications on this forum. You can use the lyo-dev mailing list in the future for a quicker response.

In any case, yes, you've worked out the exact solution. See the Bugzilla OSLC adapter in the git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.docs.git repository for code that does exactly this - it maps Bugzilla "products" to individual service providers in the same way IBM Rational Jazz products map project areas to service providers.

Please continue to share your experiences as you move forward with your provider.

Regards,
Mike


Regards,
Mike
Previous Topic:Welcome to eclipse.lyo
Next Topic:How do I translate the values returned from the ServiceCatalog?
Goto Forum:
  


Current Time: Mon Nov 24 15:35:21 GMT 2014

Powered by FUDForum. Page generated in 0.02081 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software