Changes between Version 5 and Version 6 of RpRepDeployment


Ignore:
Timestamp:
Oct 20, 2010, 12:11:46 PM (14 years ago)
Author:
s.meissner
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RpRepDeployment

    v5 v6  
    1717
    1818The REP is basically the **adapter to the SENSEI system that needs to be implemented**.
    19 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.
    20 
    21 === RPI methods: ===
    22 *       public List<String> publishResourceDescription(String descriptionString)
    23 *       public List<String> publishResourceDescription(ResourceDescription desc)
    24 *       public String updateResourceDescription(String resourceID, ResourceDescription description)
    25 *       public String deleteResourceDescription(List<String> resourceIDs)
     19The Java REP reference implementation provides some helpers to Resource Providers.
     20The stubs for RPI and RAI methods are given in the example code.
    2621
    2722=== Resource Access Interface ===
    2823
    29 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.
     24The RAI methods are provided by the **RAI handler** which is attached to the REP. The **RAI handler** presents the Resource the REP exposes to the SENSEI Resource Users.
     25In the example project a **com.sensinode.sensei.rep.rest.test.SensorType.class** is uses as an example for a RAI handler attached to the REP.
    3026
    3127=== RAI handler SensorType class explained ===
    3228
    33 '''GET''' requests are handled by its method:
    34 *       public Representation represent(Variant variant)
    35 This method returns the Observation & Measurement value in XML/RDF format.
     29'''GET''' requests are handled by the method toXML(). This method returns the Observation & Measurement value in XML/RDF format.
     30
     31{{{
     32@Get("xml")
     33public Representation toXml() {
     34        try {
     35                DomRepresentation representation = new DomRepresentation(
     36                                MediaType.TEXT_XML);
     37
     38                // read the Observation & Measurement value from the respective file
     39                String fileName = "./xml/sensors/" + sensorName + ".rdf";
     40
     41                File file = new File(fileName);
     42
     43                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
     44                DocumentBuilder db = dbf.newDocumentBuilder();
     45
     46                // Generate a DOM document
     47                Document doc = db.parse(file);
     48                doc.normalize();
     49                representation.setDocument(doc);
     50
     51                // Returns the XML representation of this document.
     52                return representation;
     53
     54        } catch (IOException e) {
     55                e.printStackTrace();
     56        } catch (ParserConfigurationException e) {
     57                e.printStackTrace();
     58        } catch (SAXException e) {
     59                e.printStackTrace();
     60        }
     61        return null;
     62}
     63}}}
     64 
    3665
    3766'''POST''' requests are handled by:
     
    4170
    4271The '''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. 
     72
     73=== RPI methods: ===
     74*       public List<String> publishResourceDescription(String descriptionString)
     75*       public List<String> publishResourceDescription(ResourceDescription desc)
     76*       public String updateResourceDescription(String resourceID, ResourceDescription description)
     77*       public String deleteResourceDescription(List<String> resourceIDs)