hasuniea 9 years ago
commit 34cf1abf80

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

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

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

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

Loading…
Cancel
Save