Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to add custom resource to Eclipse Lyo to read Appache Wink Response, in RDNG 6.0

Hi, when I try in my lyo project which integrates with RDNG 6.0.1M1, null is always returned
ClientResponse response = client.getResource(resourceShape.toString(), OslcMediaType.APPLICATION_RDF_XML); 
CustomResourceShape currentShape = response.getEntity(CustomResourceShape.class);
Why do that? Problem described in:
https://jazz.net/forum/questions/205858/how-ot-get-allowedvalues-for-attribute-data-type-in-rdng-60-using-eclipse-lyo-21

My CustomResourceShape is ResourceShape Lyo's class but with extensions for reading allowedVlaues and Ranges. Now the problem is how to register the resource to Apache wink, so when I read the response to get my CustomResourceShape ,not null as now?

0 votes



One answer

Permanent link
Every one can write it's own implementation there is no need to register the resource class, but when the name of the class is different from the tag you want to describe in the resource, you have to add on you class
@OslcName("Tag Name")

But this do not solve the allowedVlaues problem.

0 votes

Comments

The @OslcName annotation is far from resolving the issue. If I understand correctly, the full set of annotations (for a getter) help OSLC4j read the XML content and cast it into a proper resource shape. For example

    requirement = getResponse.getEntity(Requirement.class);
If it cannot match the XML content to a property correctly, that property will be null. Note that the below annotation for function org.eclipse.lyo.oslc4j.core.model.Property.getAllowedValuesRef(). I don't think you can use the same annotation for another function in the same class.
    @OslcPropertyDefinition(OslcConstants.OSLC_CORE_NAMESPACE + "allowedValues")
Also note that in the current release of Lyo, org.eclipse.lyo.oslc4j.core.annotation.OslcAllowedValues defines the property as a string. I don't know how to define it for the particular value shape in RDNG.



Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Sep 08 '15, 8:15 a.m.

Question was seen: 3,067 times

Last updated: Sep 11 '15, 5:08 a.m.

Confirmation Cancel Confirm