Merge pull request #224 from charithag/master

Fix issues in virtual fire alarm jax-rs api
merge-requests/1/head
Ruwan 9 years ago
commit 4953a2b225

@ -22,6 +22,7 @@ import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.dto.DeviceData;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
@ -55,7 +56,7 @@ public interface VirtualFireAlarmControllerService {
* @return a custom message indicating whether the DeviceID to IP mapping was successful.
*/
@POST
@Path("device/register/{deviceId}/{ip}/{port}")
@Path("register/{deviceId}/{ip}/{port}")
Response registerDeviceIP(@PathParam("deviceId") String deviceId, @PathParam("ip") String deviceIP,
@PathParam("port") String devicePort, @Context HttpServletRequest request);
@ -71,7 +72,7 @@ public interface VirtualFireAlarmControllerService {
* (Case-Insensitive String)
*/
@POST
@Path("device/{deviceId}/buzz")
@Path("{deviceId}/buzz")
@Feature(code = "buzz", name = "Buzzer On / Off", type = "operation",
description = "Switch on/off Virtual Fire Alarm Buzzer. (On / Off)")
Response switchBuzzer(@PathParam("deviceId") String deviceId, @QueryParam("protocol") String protocol,
@ -88,7 +89,7 @@ public interface VirtualFireAlarmControllerService {
* whose temperature reading was requested.
*/
@GET
@Path("device/{deviceId}/temperature")
@Path("{deviceId}/temperature")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Feature(code = "temperature", name = "Temperature", type = "monitor",
@ -104,7 +105,7 @@ public interface VirtualFireAlarmControllerService {
* @param dataMsg the temperature data received from the device in JSON format complying to type 'DeviceData'.
*/
@POST
@Path("device/temperature")
@Path("temperature")
@Consumes(MediaType.APPLICATION_JSON)
Response pushTemperatureData(final DeviceData dataMsg);
@ -122,7 +123,7 @@ public interface VirtualFireAlarmControllerService {
* @return an HTTP Response object with either the CA-Cert or the CA-Capabilities according to the operation.
*/
@GET
@Path("device/scep")
@Path("scep")
Response scepRequest(@QueryParam("operation") String operation, @QueryParam("message") String message);
@ -139,13 +140,13 @@ public interface VirtualFireAlarmControllerService {
* @return an HTTP Response object with the signed certificate for the device by the CA of the SCEP Server.
*/
@POST
@Path("device/scep")
@Path("scep")
Response scepRequestPost(@QueryParam("operation") String operation, InputStream inputStream);
/**
* Retreive Sensor data for the device type
* Retrieve Sensor data for the device type
*/
@Path("device/stats/{deviceId}/sensors/{sensorName}")
@Path("stats/{deviceId}/sensors/{sensorName}")
@GET
@Consumes("application/json")
@Produces("application/json")

@ -36,36 +36,36 @@ import javax.ws.rs.core.Response;
@DeviceType(value = "virtual_firealarm")
public interface VirtualFireAlarmManagerService {
@Path("manager/device/{device_id}")
@Path("{device_id}")
@DELETE
Response removeDevice(@PathParam("device_id") String deviceId);
@Path("manager/device/{device_id}")
@Path("{device_id}")
@PUT
Response updateDevice(@PathParam("device_id") String deviceId, @QueryParam("name") String name);
@Path("manager/device/{device_id}")
@Path("{device_id}")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
Response getDevice(@PathParam("device_id") String deviceId);
@Path("manager/devices")
@Path("devices")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
Response getFirealarmDevices();
@Path("manager/device/{sketch_type}/download")
@Path("download")
@GET
@Produces(MediaType.APPLICATION_JSON)
Response downloadSketch(@QueryParam("deviceName") String deviceName, @PathParam("sketch_type") String sketchType);
Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType);
@Path("manager/device/{sketch_type}/generate_link")
@Path("generate_link")
@GET
Response generateSketchLink(@QueryParam("deviceName") String deviceName,
@PathParam("sketch_type") String sketchType);
@QueryParam("sketchType") String sketchType);
}

@ -45,7 +45,7 @@
<Permission>
<name>Download device</name>
<path>/device-mgt/user/devices/add</path>
<url>/devices/*/download</url>
<url>/devices/download</url>
<method>GET</method>
<scope>virtual_firealarm_user</scope>
</Permission>
@ -66,7 +66,7 @@
<Permission>
<name>Generate Link</name>
<path>/device-mgt/user/devices/generate_link</path>
<url>/devices/*/generate_link</url>
<url>/devices/generate_link</url>
<method>GET</method>
<scope>virtual_firealarm_user</scope>
</Permission>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
@ -17,28 +17,36 @@
~ under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<jaxrs:server id="VirtualFireAlarm" address="/">
<jaxrs:serviceBeans>
<bean id="VirtualFireAlarmControllerService"
class="org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.VirtualFireAlarmControllerServiceImpl">
<property name="securityManager" ref="securityManagerBean"/>
<property name="virtualFireAlarmMQTTConnector" ref="mqttConnectorBean"/>
<property name="virtualFireAlarmXMPPConnector" ref="xmppConnectorBean"/>
</bean>
<jaxrs:server id="VirtualFireAlarmController" address="/device">
<jaxrs:serviceBeans>
<bean id="VirtualFireAlarmControllerService"
class="org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.VirtualFireAlarmControllerServiceImpl">
<property name="securityManager" ref="securityManagerBean"/>
<property name="virtualFireAlarmMQTTConnector" ref="mqttConnectorBean"/>
<property name="virtualFireAlarmXMPPConnector" ref="xmppConnectorBean"/>
</bean>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
</jaxrs:providers>
</jaxrs:server>
<jaxrs:server id="VirtualFireAlarmManager" address="/devices">
<jaxrs:serviceBeans>
<bean id="VirtualFireAlarmManagerService"
class="org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.VirtualFireAlarmManagerServiceImpl">
</bean>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
</jaxrs:providers>
</jaxrs:server>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
</jaxrs:providers>
</jaxrs:server>
<bean id="securityManagerBean"
class="org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.util.SecurityManager">

Loading…
Cancel
Save