= Resource Endpoint = [[PageOutline(2-3,Table of Contents,inline)]] == Role of Resource Endpoints == The Resource Endpoint (REP) provides a standardised access to the sensors inside the test bed which are exposed as SENSEI Resources. The Resource Access Interface (RAI) is the standard RESTful interface provided to SENSEI users. Each sensor of the test bed will have a counterpart on the REP modelled as a Resource. One REP can accommodate more Resources. A router will take care that a REST call will be directed to the Resource the call concerns. Once a method on a Resource is called, the call will be translated into the proprietary call the sensor island gateway is able to handle. This Gateway inside the test bed will forward the call to the desired sensor. == Resource Provider's efforts == The REP is basically the **adapter to the SENSEI system that needs to be implemented**. The Java REP reference implementation provides some helpers to the Resource Providers. The stubs for RPI and RAI methods are given in the example code. === RPI methods: === * public List publishResourceDescription(String descriptionString) * public List publishResourceDescription(ResourceDescription desc) * public String updateResourceDescription(String resourceID, ResourceDescription description) * public String deleteResourceDescription(List resourceIDs) === Resource Access Interface === The RAI methods are provided by the **RAIHandler** which is attached to the REP. The **RAIHandler** presents the Resource the REP exposes to the SENSEI Resource Users. In the example project a **com.sensinode.sensei.rep.rest.test.SensorType.class** is attached to the REP. === RAI handler SensorType class explained === '''GET''' requests are handled by its method: * public Representation represent(Variant variant) This method returns the Observation & Measurement value in XML/RDF format. '''POST''' requests are handled by: * public void acceptRepresentation(Representation entity) The POST request is meant to be used to subscribe to sensor readings. A subscription needs to be sent in the POST body. The subscription handling is not yet standardised. The '''describeXXX''' methods in the SensorType class are used to create a WADL description of the Resource's RAI interface. In the currently used version of the Restlet framework the WADL support is not yet finalised, so that the WADL support cannot be guaranteed.