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
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?
ClientResponse response = client.getResource(resourceShape.toString(), OslcMediaType.APPLICATION_RDF_XML);Why do that? Problem described in:
CustomResourceShape currentShape = response.getEntity(CustomResourceShape.class);
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
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
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.