Refactored the VirtualFirealarm device-type component & feature

Shabirmean 9 years ago
parent 0e47fbc48a
commit a355b19c1e

@ -29,7 +29,7 @@ public class AgentConstants {
public static final String DEVICE_CONTROLLER_API_EP = "/virtual_firealarm/controller"; public static final String DEVICE_CONTROLLER_API_EP = "/virtual_firealarm/controller";
public static final String DEVICE_ENROLLMENT_API_EP = "/scep"; public static final String DEVICE_ENROLLMENT_API_EP = "/scep";
public static final String DEVICE_REGISTER_API_EP = "/register"; public static final String DEVICE_REGISTER_API_EP = "/register";
public static final String DEVICE_PUSH_TEMPERATURE_API_EP = "/push_temperature"; public static final String DEVICE_PUSH_TEMPERATURE_API_EP = "/temperature";
public static final String PUSH_DATA_PAYLOAD = public static final String PUSH_DATA_PAYLOAD =
"{\"owner\":\"%s\",\"deviceId\":\"%s\",\"reply\":\"%s\",\"value\":\"%s\"}"; "{\"owner\":\"%s\",\"deviceId\":\"%s\",\"reply\":\"%s\",\"value\":\"%s\"}";

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service; package org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -36,14 +36,14 @@ import org.wso2.carbon.device.mgt.iot.sensormgt.SensorDataManager;
import org.wso2.carbon.device.mgt.iot.sensormgt.SensorRecord; import org.wso2.carbon.device.mgt.iot.sensormgt.SensorRecord;
import org.wso2.carbon.device.mgt.iot.transport.TransportHandlerException; import org.wso2.carbon.device.mgt.iot.transport.TransportHandlerException;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.constants.VirtualFireAlarmConstants; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.constants.VirtualFireAlarmConstants;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.dto.DeviceJSON; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.dto.DeviceJSON;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.exception.VirtualFireAlarmException; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.exception.VirtualFireAlarmException;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.transport.VirtualFireAlarmMQTTConnector; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.transport.VirtualFireAlarmMQTTConnector;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.transport.VirtualFireAlarmXMPPConnector; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.transport.VirtualFireAlarmXMPPConnector;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.util.SecurityManager; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.util.SecurityManager;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.util.VirtualFireAlarmServiceUtils; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.util.VirtualFireAlarmServiceUtils;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.util.scep.ContentType; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.util.scep.ContentType;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.util.scep.SCEPOperation; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.util.scep.SCEPOperation;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -73,8 +73,8 @@ import java.util.concurrent.ConcurrentHashMap;
@API(name = "virtual_firealarm", version = "1.0.0", context = "/virtual_firealarm") @API(name = "virtual_firealarm", version = "1.0.0", context = "/virtual_firealarm")
@DeviceType(value = "virtual_firealarm") @DeviceType(value = "virtual_firealarm")
@SuppressWarnings("Non-Annoted WebService") @SuppressWarnings("Non-Annoted WebService")
public class VirtualFireAlarmService { public class VirtualFireAlarmControllerService {
private static Log log = LogFactory.getLog(VirtualFireAlarmService.class); private static Log log = LogFactory.getLog(VirtualFireAlarmControllerService.class);
//TODO; replace this tenant domain //TODO; replace this tenant domain
private static final String SUPER_TENANT = "carbon.super"; private static final String SUPER_TENANT = "carbon.super";
@ -238,8 +238,8 @@ public class VirtualFireAlarmService {
* @param response the HTTP servlet response object received by default as part of the HTTP call to this API. * @param response the HTTP servlet response object received by default as part of the HTTP call to this API.
*/ */
@POST @POST
@Path("controller/buzzer") @Path("controller/buzz")
@Feature(code = "buzzer", 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)")
public void switchBulb(@HeaderParam("owner") String owner, public void switchBulb(@HeaderParam("owner") String owner,
@HeaderParam("deviceId") String deviceId, @HeaderParam("deviceId") String deviceId,
@ -326,10 +326,10 @@ public class VirtualFireAlarmService {
* whose humidity reading was requested. * whose humidity reading was requested.
*/ */
@GET @GET
@Path("controller/readhumidity") @Path("controller/humidity")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Feature(code = "readhumidity", name = "Humidity", type = "monitor", @Feature(code = "humidity", name = "Humidity", type = "monitor",
description = "Read Humidity Readings from Virtual Fire Alarm") description = "Read Humidity Readings from Virtual Fire Alarm")
public SensorRecord requestHumidity(@HeaderParam("owner") String owner, public SensorRecord requestHumidity(@HeaderParam("owner") String owner,
@HeaderParam("deviceId") String deviceId, @HeaderParam("deviceId") String deviceId,
@ -407,10 +407,10 @@ public class VirtualFireAlarmService {
* whose temperature reading was requested. * whose temperature reading was requested.
*/ */
@GET @GET
@Path("controller/readtemperature") @Path("controller/temperature")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Feature(code = "readtemperature", name = "Temperature", type = "monitor", @Feature(code = "temperature", name = "Temperature", type = "monitor",
description = "Request Temperature reading from Virtual Fire Alarm") description = "Request Temperature reading from Virtual Fire Alarm")
public SensorRecord requestTemperature(@HeaderParam("owner") String owner, public SensorRecord requestTemperature(@HeaderParam("owner") String owner,
@HeaderParam("deviceId") String deviceId, @HeaderParam("deviceId") String deviceId,
@ -486,7 +486,7 @@ public class VirtualFireAlarmService {
* @param response the HTTP servlet response object received by default as part of the HTTP call to this API. * @param response the HTTP servlet response object received by default as part of the HTTP call to this API.
*/ */
@POST @POST
@Path("controller/push_temperature") @Path("controller/temperature")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public void pushTemperatureData(final DeviceJSON dataMsg, @Context HttpServletResponse response) { public void pushTemperatureData(final DeviceJSON dataMsg, @Context HttpServletResponse response) {
String deviceId = dataMsg.deviceId; String deviceId = dataMsg.deviceId;

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.dto; package org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.dto;
import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonIgnoreProperties;

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.exception; package org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.exception;
public class VirtualFireAlarmException extends Exception { public class VirtualFireAlarmException extends Exception {
private static final long serialVersionUID = 118512086957330189L; private static final long serialVersionUID = 118512086957330189L;

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.transport; package org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.transport;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -28,9 +28,9 @@ import org.wso2.carbon.device.mgt.iot.sensormgt.SensorDataManager;
import org.wso2.carbon.device.mgt.iot.transport.TransportHandlerException; import org.wso2.carbon.device.mgt.iot.transport.TransportHandlerException;
import org.wso2.carbon.device.mgt.iot.transport.mqtt.MQTTTransportHandler; import org.wso2.carbon.device.mgt.iot.transport.mqtt.MQTTTransportHandler;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.constants.VirtualFireAlarmConstants; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.constants.VirtualFireAlarmConstants;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.exception.VirtualFireAlarmException; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.exception.VirtualFireAlarmException;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.util.SecurityManager; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.util.SecurityManager;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.util.VirtualFireAlarmServiceUtils; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.util.VirtualFireAlarmServiceUtils;
import java.io.File; import java.io.File;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.transport; package org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.transport;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -30,9 +30,9 @@ import org.wso2.carbon.device.mgt.iot.sensormgt.SensorDataManager;
import org.wso2.carbon.device.mgt.iot.transport.TransportHandlerException; import org.wso2.carbon.device.mgt.iot.transport.TransportHandlerException;
import org.wso2.carbon.device.mgt.iot.transport.xmpp.XMPPTransportHandler; import org.wso2.carbon.device.mgt.iot.transport.xmpp.XMPPTransportHandler;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.constants.VirtualFireAlarmConstants; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.constants.VirtualFireAlarmConstants;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.exception.VirtualFireAlarmException; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.exception.VirtualFireAlarmException;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.util.SecurityManager; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.util.SecurityManager;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.util.VirtualFireAlarmServiceUtils; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.util.VirtualFireAlarmServiceUtils;
import java.io.File; import java.io.File;
import java.security.PrivateKey; import java.security.PrivateKey;

@ -16,14 +16,14 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.util; package org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.util;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.certificate.mgt.core.exception.KeystoreException; import org.wso2.carbon.certificate.mgt.core.exception.KeystoreException;
import org.wso2.carbon.certificate.mgt.core.util.ConfigurationUtil; import org.wso2.carbon.certificate.mgt.core.util.ConfigurationUtil;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.exception.VirtualFireAlarmException; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.exception.VirtualFireAlarmException;
import javax.crypto.BadPaddingException; import javax.crypto.BadPaddingException;
import javax.crypto.Cipher; import javax.crypto.Cipher;

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.util; package org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.util;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -33,7 +33,7 @@ import org.wso2.carbon.device.mgt.analytics.exception.DataPublisherConfiguration
import org.wso2.carbon.device.mgt.analytics.service.DeviceAnalyticsService; import org.wso2.carbon.device.mgt.analytics.service.DeviceAnalyticsService;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.constants.VirtualFireAlarmConstants; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.constants.VirtualFireAlarmConstants;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.exception.VirtualFireAlarmException; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.exception.VirtualFireAlarmException;
import javax.ws.rs.HttpMethod; import javax.ws.rs.HttpMethod;
import java.io.BufferedReader; import java.io.BufferedReader;

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.util.scep; package org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.util.scep;
public class ContentType { public class ContentType {
public static final String X_PKI_MESSAGE = "application/x-pki-message"; public static final String X_PKI_MESSAGE = "application/x-pki-message";

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.util.scep; package org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.util.scep;
public enum SCEPOperation { public enum SCEPOperation {
GET_CA_CERT("GetCACert"), GET_CA_CERT("GetCACert"),

@ -1,105 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2015, 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
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<!-- This file contains the list of permissions that are associated with URL end points
of the web app. Each permission should contain the name, permission path ,API path
(URL) , HTTP method and OAUTH2 authorization scope (not-required).
When defining dynamic paths for APIs, path variables are denoted by '*' notation.
For ex:
Actual API endpoint: mdm-admin/1.0.0/devices/{device-id}
URL to be represented here: /devices/*
NOTE: All the endpoints of the web app should be available in this file. Otherwise
it will result 403 error at the runtime.
-->
<ResourceConfiguration>
<!-- Device related APIs -->
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>PUT</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/manager/device/register</Uri>
<UriTemplate>/manager/device/register/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>DELETE</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/manager/device/remove</Uri>
<UriTemplate>/manager/device/remove/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>POST</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/manager/device/update</Uri>
<UriTemplate>/manager/device/update/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/manager/device</Uri>
<UriTemplate>/manager/device/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/manager/devices</Uri>
<UriTemplate>/manager/devices/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/manager/device/{sketch_type}/download</Uri>
<UriTemplate>/manager/device/{sketch_type}/download</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/manager/device/{sketch_type}/generate_link</Uri>
<UriTemplate>/manager/device/{sketch_type}/generate_link</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>POST</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/controller/register/{owner}/{deviceId}/{ip}/{port}</Uri>
<UriTemplate>/controller/register/{owner}/{deviceId}/{ip}/{port}</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>POST</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/controller/controller/bulb/{state}</Uri>
<UriTemplate>/controller/bulb/{state}</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/controller/controller/readhumidity</Uri>
<UriTemplate>/controller/readhumidity</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/controller/controller/readtemperature</Uri>
<UriTemplate>/controller/readtemperature</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>POST</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/controller/controller/push_temperature</Uri>
<UriTemplate>/controller/push_temperature</UriTemplate>
</Resource>
</ResourceConfiguration>

@ -24,10 +24,10 @@
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="/">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<bean id="VirtualFireAlarmService" <bean id="VirtualFireAlarmControllerService"
class="org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.VirtualFireAlarmService"> class="org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.VirtualFireAlarmControllerService">
<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"/>
@ -39,13 +39,13 @@
</jaxrs:server> </jaxrs:server>
<bean id="securityManagerBean" <bean id="securityManagerBean"
class="org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.util.SecurityManager"> class="org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.util.SecurityManager">
</bean> </bean>
<bean id="mqttConnectorBean" <bean id="mqttConnectorBean"
class="org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.transport.VirtualFireAlarmMQTTConnector"> class="org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.transport.VirtualFireAlarmMQTTConnector">
</bean> </bean>
<bean id="xmppConnectorBean" <bean id="xmppConnectorBean"
class="org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.transport.VirtualFireAlarmXMPPConnector"> class="org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl.transport.VirtualFireAlarmXMPPConnector">
</bean> </bean>
</beans> </beans>

@ -28,7 +28,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.mgt.service.impl</artifactId> <artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.manager.service.impl</artifactId>
<version>1.9.2-SNAPSHOT</version> <version>1.9.2-SNAPSHOT</version>
<packaging>war</packaging> <packaging>war</packaging>
<name>WSO2 Carbon - IoT Server VirtualFireAlarm API</name> <name>WSO2 Carbon - IoT Server VirtualFireAlarm API</name>

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service; package org.wso2.carbon.device.mgt.iot.virtualfirealarm.manager.service.impl;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -61,11 +61,11 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
@API(name = "virtual_firealarm", version = "1.0.0", context = "/virtual_firealarm") @API(name = "virtual_firealarm", version = "1.0.0", context = "/virtual_firealarm")
public class VirtualFireAlarmService { public class VirtualFireAlarmManagerService {
//TODO; replace this tenant domain //TODO; replace this tenant domain
private static final String SUPER_TENANT = "carbon.super"; private static final String SUPER_TENANT = "carbon.super";
private static Log log = LogFactory.getLog(VirtualFireAlarmService.class); private static Log log = LogFactory.getLog(VirtualFireAlarmManagerService.class);
@Context //injected response proxy supporting multiple thread @Context //injected response proxy supporting multiple thread
private HttpServletResponse response; private HttpServletResponse response;
@ -395,5 +395,4 @@ public class VirtualFireAlarmService {
zipFile.setDeviceId(deviceId); zipFile.setDeviceId(deviceId);
return zipFile; return zipFile;
} }
} }

@ -24,10 +24,10 @@
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="VirtualFireAlarmManager" address="/">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<bean id="VirtualFireAlarmService" <bean id="VirtualFireAlarmManagerService"
class="org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.VirtualFireAlarmService"> class="org.wso2.carbon.device.mgt.iot.virtualfirealarm.manager.service.impl.VirtualFireAlarmManagerService">
</bean> </bean>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
<jaxrs:providers> <jaxrs:providers>

@ -1,105 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2015, 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
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<!-- This file contains the list of permissions that are associated with URL end points
of the web app. Each permission should contain the name, permission path ,API path
(URL) , HTTP method and OAUTH2 authorization scope (not-required).
When defining dynamic paths for APIs, path variables are denoted by '*' notation.
For ex:
Actual API endpoint: mdm-admin/1.0.0/devices/{device-id}
URL to be represented here: /devices/*
NOTE: All the endpoints of the web app should be available in this file. Otherwise
it will result 403 error at the runtime.
-->
<ResourceConfiguration>
<!-- Device related APIs -->
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>PUT</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/manager/device/register</Uri>
<UriTemplate>/manager/device/register/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>DELETE</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/manager/device/remove</Uri>
<UriTemplate>/manager/device/remove/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>POST</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/manager/device/update</Uri>
<UriTemplate>/manager/device/update/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/manager/device</Uri>
<UriTemplate>/manager/device/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/manager/devices</Uri>
<UriTemplate>/manager/devices/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/manager/device/{sketch_type}/download</Uri>
<UriTemplate>/manager/device/{sketch_type}/download</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/manager/device/{sketch_type}/generate_link</Uri>
<UriTemplate>/manager/device/{sketch_type}/generate_link</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>POST</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/controller/register/{owner}/{deviceId}/{ip}/{port}</Uri>
<UriTemplate>/controller/register/{owner}/{deviceId}/{ip}/{port}</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>POST</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/controller/controller/bulb/{state}</Uri>
<UriTemplate>/controller/bulb/{state}</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/controller/controller/readhumidity</Uri>
<UriTemplate>/controller/readhumidity</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/controller/controller/readtemperature</Uri>
<UriTemplate>/controller/readtemperature</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>POST</HttpVerb>
<Uri>http://localhost:9763/virtual_firealarm/controller/controller/push_temperature</Uri>
<UriTemplate>/controller/push_temperature</UriTemplate>
</Resource>
</ResourceConfiguration>

@ -38,7 +38,7 @@
<modules> <modules>
<module>org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.impl</module> <module>org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.impl</module>
<module>org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl</module> <module>org.wso2.carbon.device.mgt.iot.virtualfirealarm.controller.service.impl</module>
<module>org.wso2.carbon.device.mgt.iot.virtualfirealarm.mgt.service.impl</module> <module>org.wso2.carbon.device.mgt.iot.virtualfirealarm.manager.service.impl</module>
<module>org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl</module> <module>org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl</module>
<module>org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl</module> <module>org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl</module>
</modules> </modules>

@ -44,7 +44,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.mgt.service.impl</artifactId> <artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.manager.service.impl</artifactId>
<version>1.9.2-SNAPSHOT</version> <version>1.9.2-SNAPSHOT</version>
<type>war</type> <type>war</type>
</dependency> </dependency>
@ -110,7 +110,7 @@
</artifactItem> </artifactItem>
<artifactItem> <artifactItem>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.mgt.service.impl <artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.manager.service.impl
</artifactId> </artifactId>
<type>war</type> <type>war</type>
<overWrite>true</overWrite> <overWrite>true</overWrite>

@ -492,7 +492,7 @@
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.mgt.service.impl</artifactId> <artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.manager.service.impl</artifactId>
<version>${carbon.iot.device.mgt.version}</version> <version>${carbon.iot.device.mgt.version}</version>
<type>war</type> <type>war</type>
</dependency> </dependency>

Loading…
Cancel
Save