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" ) @DeviceType( value = "android_sense" )
@API( name="android_sense", version="1.0.0", context="/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 ACCELEROMETER_STREAM_DEFINITION = "org.wso2.iot.devices.accelerometer";
private static final String BATTERY_STREAM_DEFINITION = "org.wso2.iot.devices.battery"; 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_PRESSURE = "pressure";
private static final String SENSOR_PROXIMITY = "proximity"; private static final String SENSOR_PROXIMITY = "proximity";
private static final String SENSOR_ROTATION = "rotation"; 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 //TODO; replace this tenant domain
private final String SUPER_TENANT = "carbon.super"; 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> <jaxrs:features>
<cxf:logging/> <cxf:logging/>
</jaxrs:features> </jaxrs:features>
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<bean id="AndroidSenseService" <bean id="AndroidSenseControllerService"
class="org.wso2.carbon.device.mgt.iot.androidsense.controller.service.impl.AndroidSenseService"/> class="org.wso2.carbon.device.mgt.iot.androidsense.controller.service.impl.AndroidSenseControllerService"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
<jaxrs:providers> <jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" /> <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />

@ -10,11 +10,11 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <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> <version>1.9.2-SNAPSHOT</version>
<packaging>war</packaging> <packaging>war</packaging>
<name>WSO2 Carbon - Android Sense Management API</name> <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> <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"); * WSO2 Inc. licenses this file to you under the Apache License,
* you may not use this file except in compliance with the 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 * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing,
* distributed under the License is distributed on an "AS IS" BASIS, * software distributed under the License is distributed on an
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* See the License for the specific language governing permissions and * KIND, either express or implied. See the License for the
* limitations under the License. * 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.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -44,9 +46,9 @@ import java.io.File;
import java.util.Date; import java.util.Date;
@API( name="android_sense_mgt", version="1.0.0", context="/android_sense_mgt") @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 //TODO; replace this tenant domain
private final String SUPER_TENANT = "carbon.super"; private final String SUPER_TENANT = "carbon.super";

@ -24,13 +24,13 @@
<jaxrs:server id="AndroidSense" address="/"> <jaxrs:server id="AndroidSenseManager" address="/">
<jaxrs:features> <jaxrs:features>
<cxf:logging/> <cxf:logging/>
</jaxrs:features> </jaxrs:features>
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<bean id="AndroidSenseService" <bean id="AndroidSenseManagerService"
class="org.wso2.carbon.device.mgt.iot.androidsense.mgt.service.impl.AndroidSenseService"/> class="org.wso2.carbon.device.mgt.iot.androidsense.manager.service.impl.AndroidSenseManagerService"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
<jaxrs:providers> <jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" /> <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> </parent>
<modelVersion>4.0.0</modelVersion> <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> <version>${carbon.iot.device.mgt.version}</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - Android Sense Management Impl</name> <name>WSO2 Carbon - AndroidSense DeviceType Plugin</name>
<description>WSO2 Carbon - Android Sense Management and Control Implementation</description> <description>WSO2 Carbon - AndroidSense DeviceType Plugin Implementation</description>
<url>http://wso2.org</url> <url>http://wso2.org</url>
<build> <build>

@ -36,9 +36,9 @@
<url>http://wso2.org</url> <url>http://wso2.org</url>
<modules> <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.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> </modules>
<build> <build>

@ -40,11 +40,11 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <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>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <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> <type>war</type>
</dependency> </dependency>
<dependency> <dependency>
@ -99,7 +99,7 @@
<artifactItems> <artifactItems>
<artifactItem> <artifactItem>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <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> <type>war</type>
<overWrite>true</overWrite> <overWrite>true</overWrite>
<outputDirectory>${basedir}/src/main/resources/webapps/</outputDirectory> <outputDirectory>${basedir}/src/main/resources/webapps/</outputDirectory>

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