Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[lyo-dev] How to use @OslcRange or @ OslcValueType appropriately?

Hi,

 

I am wondering if there are any documentation on how to annotate java class/resource attributes properly.

 

when launching my application, I get the following exception. It seems that I am not setting the  @OslcRange or @ OslcValueType appropriately.

 

javax.servlet.UnavailableException: org.eclipse.lyo.oslc4j.core.exception.OslcCoreInvalidValueTypeException: OSLC007: Invalid value type http://open-services.net/ns/core#Resource defined for method getChildren of class se.kth.md.it.ms.resources.Block

                at org.apache.wink.server.internal.servlet.RestServlet.init(RestServlet.java:111)

                at javax.servlet.GenericServlet.init(GenericServlet.java:244)

                ...

 

The guilty method seems to be the following:

                @OslcName("children")

                @OslcPropertyDefinition(SimulinkAdaptorConstants.SIMULINK_NAMSPACE + "children")

                @OslcDescription("the child blocks")

                @OslcOccurs(Occurs.ZeroOrMany)

                @OslcValueType(ValueType.Resource)

                @OslcRange("http://ti.md.kth.se/sim#Block")

                @OslcReadOnly(false)

                @OslcTitle("Children")

    public HashSet<Block> getChildren() {

        return children;

    }

 

After a few trials, I can only get it to work, if I do the following:

1. remove the @OslcRange annotation

2. redefine  the "children" property to be HashSet<Link>. (that is the function signature becomes "public HashSet<Link> getChildren()")

 

I also tried to only remove the @OslcRange, but that did not help. One does not seem to be able to define properties other than String, Date, Link, etc.

Is it not possible maybe to define own java classes?

 

Any hints are appreciated

----

Jad El-khoury, PhD

Mechatronics Lab, Department of Machine Design

Royal Institute of Technology (KTH)

S-100 44 Stockholm, Sweden

e-mail: jad@xxxxxx

Phone: +46(0)8 790 6877

Mobile: +46(0)70 773 93 45

 


Back to the top