Version 3 (modified by 14 years ago) (diff) | ,
---|
REP deployment Quick Start
Software requirements
To build and run the REP example code you need to meet following requirements:
- Java 6.0 SDK http://java.sun.com/javase/downloads/index.jsp
- eclipse http://eclipse.org/downloads/
- REP example code: eclipse project 'REP'
The project makes use of the Java REST framework 'restlet' by http://www.restlet.org/. The required libraries are part of the eclipse project.
run the Example REP Project
In order to run the code samples please follow the steps below:
- Import the eclipse project into your eclipse workspace
- fix missing class path errors if required (e.g. if eclipse could not find a Java Sdk)
- the project structure should look like this:
[Image(projectStructure.png)]
- run uk.ac.surrey.sensei.rep.test.REPTest.java
The REPTest class provides a couple of test cases. Please uncomment the sections you want to have tested. By default REPTest.java creates a REP listening on HTTP port 8185. It attaches a RAIHandler of type SensorType? for a dummy light sensor. The hard coded light value is read from the file xml/sensors/light.rdf. It can be requested by a REST GET method call on http://localhost:8185/rep/s/light.
The response is the Observation and Measurement value in XML-RDF syntax.
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE rdf:RDF [ <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY sensor 'http://www.ict-sensei.org/Sensor#'> <!ENTITY mo 'http://www.ict-sensei.org/MeasurementAndObservation#'> <!ENTITY provider456 'http://www.resource-provider-456.com/resources#'> ]> <rdf:RDF xmlns:rdf="&rdf;" xmlns:rdfs="&rdfs;" xmlns:provider456="&provider456;" xmlns:mo="&mo;" xmlns:sensor="&sensor;"> <sensor:Light rdf:about="&provider456;LightSensor15" mo:hasTimeStamp="Thu Jan 14 09:15:36 2009" mo:hasDecimalValue="0.23" mo:hasUnit="percent"> </sensor:Light> </rdf:RDF>
REST client tools
GET and POST requests can be easily tested by using a web browser. For testing other REST methods like PUT, DELETE, and OPTIONS dedicated REST client tools are available, like:
- RESTClient: plug-in for Firefox: https://addons.mozilla.org/en-US/firefox/addon/9780
- Java GUI tool: http://code.google.com/p/rest-client/
- soapUI: http://www.soapui.org/userguide/rest/index.html
Attachments (7)
- projectStructure.png (28.7 KB) - added by 14 years ago.
- runningTestServer.png (62.3 KB) - added by 14 years ago.
- runTest.png (50.6 KB) - added by 14 years ago.
- GETtemp.png (21.6 KB) - added by 14 years ago.
- GETtemp.2.png (21.6 KB) - added by 14 years ago.
- GETlight.png (21.4 KB) - added by 14 years ago.
- JavaREP.zip (80.6 KB) - added by 14 years ago.
Download all attachments as: .zip