Refactored the AndroidSense device-type component & feature

Shabirmean 9 years ago
parent 9f770a44c8
commit 8caa048afe

@ -39,7 +39,7 @@ import javax.ws.rs.core.Response;
@DeviceType( value = "android_sense" )
@API( name="android_sense", version="1.0.0", context="/android_sense")
public class AndroidSenseService {
public class AndroidSenseControllerService {
private static final String ACCELEROMETER_STREAM_DEFINITION = "org.wso2.iot.devices.accelerometer";
private static final String BATTERY_STREAM_DEFINITION = "org.wso2.iot.devices.battery";
@ -62,7 +62,7 @@ public class AndroidSenseService {
private static final String SENSOR_PRESSURE = "pressure";
private static final String SENSOR_PROXIMITY = "proximity";
private static final String SENSOR_ROTATION = "rotation";
private static Log log = LogFactory.getLog(AndroidSenseService.class);
private static Log log = LogFactory.getLog(AndroidSenseControllerService.class);
//TODO; replace this tenant domain
private final String SUPER_TENANT = "carbon.super";

@ -1,123 +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/android_sense/manager/device/register</Uri>
<UriTemplate>/manager/device/register/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>DELETE</HttpVerb>
<Uri>http://localhost:9763/android_sense/manager/device/remove</Uri>
<UriTemplate>/manager/device/remove/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>POST</HttpVerb>
<Uri>http://localhost:9763/android_sense/manager/device/update</Uri>
<UriTemplate>/manager/device/update/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/manager/device/{device_id}</Uri>
<UriTemplate>/manager/device/{device_id}</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/sensordata</Uri>
<UriTemplate>/controller/sensordata</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readbattery</Uri>
<UriTemplate>/controller/readbattery</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readlight</Uri>
<UriTemplate>/controller/readlight</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readgps</Uri>
<UriTemplate>/controller/readgps</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readmagnetic</Uri>
<UriTemplate>/controller/readmagnetic</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readgravity</Uri>
<UriTemplate>/controller/readgravity</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readpressure</Uri>
<UriTemplate>/controller/readpressure</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readproximity</Uri>
<UriTemplate>/controller/readproximity</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readgyroscope</Uri>
<UriTemplate>/controller/readgyroscope</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readrotation</Uri>
<UriTemplate>/controller/readrotation</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readaccelerometer</Uri>
<UriTemplate>/controller/readaccelerometer</UriTemplate>
</Resource>
</ResourceConfiguration>

@ -24,13 +24,13 @@
<jaxrs:server id="AndroidSense" address="/">
<jaxrs:server id="AndroidSenseController" address="/">
<jaxrs:features>
<cxf:logging/>
</jaxrs:features>
<jaxrs:serviceBeans>
<bean id="AndroidSenseService"
class="org.wso2.carbon.device.mgt.iot.androidsense.controller.service.impl.AndroidSenseService"/>
<bean id="AndroidSenseControllerService"
class="org.wso2.carbon.device.mgt.iot.androidsense.controller.service.impl.AndroidSenseControllerService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />

@ -10,11 +10,11 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.mgt.api</artifactId>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.manager.api</artifactId>
<version>1.9.2-SNAPSHOT</version>
<packaging>war</packaging>
<name>WSO2 Carbon - Android Sense Management API</name>
<description>WSO2 Carbon - Android Sense Service Management API Implementation</description>
<description>WSO2 Carbon - Android Sense Management Service-API Implementation</description>
<url>http://wso2.org</url>

@ -1,20 +1,22 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.
* 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.
*/
package org.wso2.carbon.device.mgt.iot.androidsense.mgt.service.impl;
package org.wso2.carbon.device.mgt.iot.androidsense.manager.service.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -44,9 +46,9 @@ import java.io.File;
import java.util.Date;
@API( name="android_sense_mgt", version="1.0.0", context="/android_sense_mgt")
public class AndroidSenseService {
public class AndroidSenseManagerService {
private static Log log = LogFactory.getLog(AndroidSenseService.class);
private static Log log = LogFactory.getLog(AndroidSenseManagerService.class);
//TODO; replace this tenant domain
private final String SUPER_TENANT = "carbon.super";

@ -24,13 +24,13 @@
<jaxrs:server id="AndroidSense" address="/">
<jaxrs:server id="AndroidSenseManager" address="/">
<jaxrs:features>
<cxf:logging/>
</jaxrs:features>
<jaxrs:serviceBeans>
<bean id="AndroidSenseService"
class="org.wso2.carbon.device.mgt.iot.androidsense.mgt.service.impl.AndroidSenseService"/>
<bean id="AndroidSenseManagerService"
class="org.wso2.carbon.device.mgt.iot.androidsense.manager.service.impl.AndroidSenseManagerService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />

@ -1,123 +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/android_sense/manager/device/register</Uri>
<UriTemplate>/manager/device/register/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>DELETE</HttpVerb>
<Uri>http://localhost:9763/android_sense/manager/device/remove</Uri>
<UriTemplate>/manager/device/remove/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>POST</HttpVerb>
<Uri>http://localhost:9763/android_sense/manager/device/update</Uri>
<UriTemplate>/manager/device/update/*</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/manager/device/{device_id}</Uri>
<UriTemplate>/manager/device/{device_id}</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/sensordata</Uri>
<UriTemplate>/controller/sensordata</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readbattery</Uri>
<UriTemplate>/controller/readbattery</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readlight</Uri>
<UriTemplate>/controller/readlight</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readgps</Uri>
<UriTemplate>/controller/readgps</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readmagnetic</Uri>
<UriTemplate>/controller/readmagnetic</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readgravity</Uri>
<UriTemplate>/controller/readgravity</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readpressure</Uri>
<UriTemplate>/controller/readpressure</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readproximity</Uri>
<UriTemplate>/controller/readproximity</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readgyroscope</Uri>
<UriTemplate>/controller/readgyroscope</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readrotation</Uri>
<UriTemplate>/controller/readrotation</UriTemplate>
</Resource>
<Resource>
<AuthType>Any</AuthType>
<HttpVerb>GET</HttpVerb>
<Uri>http://localhost:9763/android_sense/controller/readaccelerometer</Uri>
<UriTemplate>/controller/readaccelerometer</UriTemplate>
</Resource>
</ResourceConfiguration>

@ -20,11 +20,11 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense</artifactId>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.plugin</artifactId>
<version>${carbon.iot.device.mgt.version}</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Android Sense Management Impl</name>
<description>WSO2 Carbon - Android Sense Management and Control Implementation</description>
<name>WSO2 Carbon - AndroidSense DeviceType Plugin</name>
<description>WSO2 Carbon - AndroidSense DeviceType Plugin Implementation</description>
<url>http://wso2.org</url>
<build>

@ -36,9 +36,9 @@
<url>http://wso2.org</url>
<modules>
<module>org.wso2.carbon.device.mgt.iot.androidsense</module>
<module>org.wso2.carbon.device.mgt.iot.androidsense.plugin</module>
<module>org.wso2.carbon.device.mgt.iot.androidsense.controller.api</module>
<module>org.wso2.carbon.device.mgt.iot.androidsense.mgt.api</module>
<module>org.wso2.carbon.device.mgt.iot.androidsense.manager.api</module>
</modules>
<build>

@ -40,11 +40,11 @@
<dependencies>
<dependency>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense</artifactId>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.plugin</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.mgt.api</artifactId>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.manager.api</artifactId>
<type>war</type>
</dependency>
<dependency>
@ -99,7 +99,7 @@
<artifactItems>
<artifactItem>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.mgt.api</artifactId>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.manager.api</artifactId>
<type>war</type>
<overWrite>true</overWrite>
<outputDirectory>${basedir}/src/main/resources/webapps/</outputDirectory>

@ -374,7 +374,7 @@
<!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<dependency>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense</artifactId>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.plugin</artifactId>
<version>${carbon.iot.device.mgt.version}</version>
</dependency>
<dependency>
@ -385,7 +385,7 @@
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.mgt.api</artifactId>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.manager.api</artifactId>
<version>${carbon.iot.device.mgt.version}</version>
<type>war</type>
</dependency>

Loading…
Cancel
Save