It's all about the answers!

Ask a question

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


Dinyo Dinev (311134) | asked Sep 08 '15, 8:15 a.m.
edited Sep 08 '15, 8:17 a.m.
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?

One answer



permanent link
Dinyo Dinev (311134) | answered Sep 10 '15, 10:42 a.m.
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.


Comments
Donald Nong commented Sep 11 '15, 5:08 a.m.

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 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.