Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Lyo » OSLCClient receiving entity issue
OSLCClient receiving entity issue [message #1578645] Thu, 22 January 2015 14:30 Go to next message
D. G. is currently offline D. G.Friend
Messages: 4
Registered: January 2015
Junior Member
Hey there,

I am having an issue with receiving an entity through response.getEntity function.

I am quite sure that the ClientResponse is not null and it's entity attribute is not null either but when I try to get entity out of that response I see that the entity properti changes to null and I do not understand how it is happening.

The code and explanation is:
OslcClient oslcClient = new OslcClient();I create OSLC client

ClientResponse response= null;
Entity entity = null;
response= oslcClient.getResource(resourceURI, OslcMediaType.APPLICATION_RDF_XML); get responce and I see the result from other adapter that entity is not null and it is the right entity. But the response entity is not readable here sinde it is inputstream

entity = response.getEntity(Entity.class);Here I see the result entity as null and it also changes the response entity property to null

It looks like I am doing something wrong but I really do not understand what it is. I appretiate any help or suggestions.

Best regards
Re: OSLCClient receiving entity issue [message #1578830 is a reply to message #1578645] Thu, 22 January 2015 16:44 Go to previous messageGo to next message
Samuel Padgett is currently offline Samuel PadgettFriend
Messages: 30
Registered: July 2009
Member
Hi, D.G. What type of resource are you getting specifically? You probably want to use something like ChangeRequest.class or Requirement.class in your call to get resource. If Entity.class is an OSLC4J annotated class, you'll want to check your annotations. You need at least @OslcNamespace and @OslcResourceShape on the class declaration. OSLC4J will return null if it can't find any resources matching the declared type in the annotations.

If you need, you can debug further by passing String.class when you call getEntity(). Then at least you can see the content as a plain text string.

Good luck,
Sam
Re: OSLCClient receiving entity issue [message #1580356 is a reply to message #1578830] Fri, 23 January 2015 12:46 Go to previous messageGo to next message
D          G             is currently offline D G Friend
Messages: 2
Registered: January 2015
Junior Member
No Message Body

[Updated on: Fri, 23 January 2015 14:33]

Report message to a moderator

Re: OSLCClient receiving entity issue [message #1580497 is a reply to message #1580356] Fri, 23 January 2015 14:31 Go to previous messageGo to next message
D. G. is currently offline D. G.Friend
Messages: 4
Registered: January 2015
Junior Member
Dear Sam,

Thank you very much for the respond. I am using two custom adapters and Entity.class is an OSLC4J annotated class.

I copied class declarations as you said:
@OslcName(ToolBAdaptorConstants.ENTITY)
@OslcResourceShape(title = "Entity Resource Shape", describes = ToolBAdaptorConstants.TYPE_ENTITY)

Unfortunately I am still receiving null for both Entity.class and String.class where response is not null.

When I run code in debug mode I had an message "Source not found." ClientResponseImpl.getEntity(Class<T> line:52) with Edit source Lookup Path.. button.
Does that make any sense for you may be? I am sorry if I am asking something very basic.

best regards
Re: OSLCClient receiving entity issue [message #1585917 is a reply to message #1580497] Mon, 26 January 2015 15:07 Go to previous message
D          G             is currently offline D G Friend
Messages: 2
Registered: January 2015
Junior Member
Hi,

I was wondering if any of you used client for adapters other than BugzillaAdapter and have found a way to receive the resources as an RDF/XML. If I use HTML as a media type it is easy to read resource but this is totally against what OSLC tries to do. However I am just not able to use client to receive resource from other adapter. This should be easy as I understand but couldn't find any solution. I appreciate your experienced suggestions if anyone used the clint for custom adapters.

Best regards
Previous Topic:DOORS/Bugzilla Sample Integration
Next Topic:OSLCClient getEntity function
Goto Forum:
  


Current Time: Tue Sep 25 11:43:09 GMT 2018

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

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

Back to the top