diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/RegisterActivity.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/RegisterActivity.java index fceeeeede..a7e069757 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/RegisterActivity.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/RegisterActivity.java @@ -20,12 +20,14 @@ import android.app.Activity; import android.content.Intent; import android.os.Build; import android.os.Bundle; +import android.os.Handler; import android.text.TextUtils; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; +import android.widget.Toast; import org.wso2.carbon.iot.android.sense.data.publisher.DataPublisherReceiver; import org.wso2.carbon.iot.android.sense.data.publisher.mqtt.AndroidSenseMQTTHandler; @@ -37,6 +39,8 @@ import org.wso2.carbon.iot.android.sense.realtimeviewer.sensorlisting.SupportedS import org.wso2.carbon.iot.android.sense.util.LocalRegistry; import org.wso2.carbon.iot.android.sense.util.SenseClient; import org.wso2.carbon.iot.android.sense.util.SenseUtils; +import org.wso2.carbon.iot.android.sense.util.dto.RegisterInfo; + import agent.sense.android.iot.carbon.wso2.org.wso2_senseagent.R; @@ -51,6 +55,7 @@ public class RegisterActivity extends Activity { private EditText mMqttPortView; private View mProgressView; private View mLoginFormView; + private Handler mUiHandler = new Handler(); @Override protected void onCreate(Bundle savedInstanceState) { @@ -91,9 +96,9 @@ public class RegisterActivity extends Activity { mPasswordView.setError(null); // Store values at the time of the login attempt. - String username = mUsernameView.getText().toString(); - String password = mPasswordView.getText().toString(); - String hostname = mHostView.getText().toString(); + final String username = mUsernameView.getText().toString(); + final String password = mPasswordView.getText().toString(); + final String hostname = mHostView.getText().toString(); String mqttPort = mMqttPortView.getText().toString(); boolean cancel = false; View focusView = null; @@ -119,30 +124,57 @@ public class RegisterActivity extends Activity { if (cancel) { focusView.requestFocus(); } else { - SenseClient client = new SenseClient(getApplicationContext()); - LocalRegistry.addServerURL(getBaseContext(), hostname); - String deviceId = SenseUtils.generateDeviceId(getBaseContext(), getContentResolver()); - boolean registerStatus = client.register(username, password, deviceId); - if (registerStatus) { - LocalRegistry.addUsername(getApplicationContext(), username); - LocalRegistry.addDeviceId(getApplicationContext(), deviceId); - LocalRegistry.addMqttPort(getApplicationContext(), Integer.parseInt(mqttPort)); - MQTTTransportHandler mqttTransportHandler = AndroidSenseMQTTHandler.getInstance(this); - if (!mqttTransportHandler.isConnected()) { - mqttTransportHandler.connect(); - } - SenseScheduleReceiver senseScheduleReceiver = new SenseScheduleReceiver(); - senseScheduleReceiver.clearAbortBroadcast(); - senseScheduleReceiver.onReceive(this, null); + final int mqttPortNo= Integer.parseInt(mqttPort); + Thread myThread = new Thread(new Runnable() { + @Override + public void run() { + SenseClient client = new SenseClient(getApplicationContext()); + LocalRegistry.addServerURL(getBaseContext(), hostname); + String deviceId = SenseUtils.generateDeviceId(getBaseContext(), getContentResolver()); + final RegisterInfo registerStatus = client.register(username, password, deviceId, mUiHandler); + mUiHandler.post(new Runnable() { + @Override + public void run() { + Toast.makeText(getApplicationContext(), registerStatus.getMsg(), Toast.LENGTH_LONG).show(); + } + }); + + if (registerStatus.isRegistered()) { + LocalRegistry.addUsername(getApplicationContext(), username); + LocalRegistry.addDeviceId(getApplicationContext(), deviceId); + LocalRegistry.addMqttPort(getApplicationContext(), mqttPortNo); + MQTTTransportHandler mqttTransportHandler = AndroidSenseMQTTHandler.getInstance(getApplicationContext()); + if (!mqttTransportHandler.isConnected()) { + mqttTransportHandler.connect(); + } + SenseScheduleReceiver senseScheduleReceiver = new SenseScheduleReceiver(); + senseScheduleReceiver.clearAbortBroadcast(); + senseScheduleReceiver.onReceive(getApplicationContext(), null); + + DataPublisherReceiver dataUploaderReceiver = new DataPublisherReceiver(); + dataUploaderReceiver.clearAbortBroadcast(); + dataUploaderReceiver.onReceive(getApplicationContext(), null); + + mUiHandler.post(new Runnable() { + @Override + public void run() { + Intent intent = new Intent(getApplicationContext(), ActivitySelectSensor.class); + startActivity(intent); + } + }); + + } + mUiHandler.post(new Runnable() { + @Override + public void run() { + showProgress(false); + } + }); - DataPublisherReceiver dataUploaderReceiver = new DataPublisherReceiver(); - dataUploaderReceiver.clearAbortBroadcast(); - dataUploaderReceiver.onReceive(this, null); + } + }); + myThread.start(); - Intent intent = new Intent(getApplicationContext(), ActivitySelectSensor.class); - startActivity(intent); - } - showProgress(false); } } diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/constants/SenseConstants.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/constants/SenseConstants.java index 70d847802..0661144ad 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/constants/SenseConstants.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/constants/SenseConstants.java @@ -13,9 +13,12 @@ */ package org.wso2.carbon.iot.android.sense.constants; +/** + * This hold constants related to android_sense. + */ public class SenseConstants { public final static String DEVICE_TYPE = "android_sense"; - public final static String REGISTER_CONTEXT = "/android_sense_mgt"; + public final static String REGISTER_CONTEXT = "/android_sense"; public final static String DCR_CONTEXT = "/dynamic-client-web"; public final static String TOKEN_ISSUER_CONTEXT = "/oauth2"; public final static String API_APPLICATION_REGISTRATION_CONTEXT = "/api-application-registration"; diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherService.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherService.java index 41853f8cd..51c7cb807 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherService.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherService.java @@ -43,7 +43,7 @@ import java.util.List; * This is an android service which publishes the data to the server. */ public class DataPublisherService extends Service { - private static final String TAG = "Data Publisher"; + private static final String TAG = DataPublisherService.class.getName(); private static String KEY_TAG = "key"; private static String TIME_TAG = "time"; private static String VALUE_TAG = "value"; diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/Event.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/Event.java index e7ceea063..554c38b12 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/Event.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/Event.java @@ -3,6 +3,9 @@ package org.wso2.carbon.iot.android.sense.data.publisher; import org.json.JSONException; import org.json.JSONObject; +/** + * This hold the definition of the stream that android sense is publishing to. + */ public class Event { private String owner; diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/mqtt/transport/TransportHandlerException.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/mqtt/transport/TransportHandlerException.java index c52ca2ed0..fe297b828 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/mqtt/transport/TransportHandlerException.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/mqtt/transport/TransportHandlerException.java @@ -18,6 +18,9 @@ package org.wso2.carbon.iot.android.sense.data.publisher.mqtt.transport; +/** + * This exception will be thrown when the mqtt transport fails. + */ public class TransportHandlerException extends Exception { private static final long serialVersionUID = 2736466230451105440L; diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/Location/LocationDataReader.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/Location/LocationDataReader.java index b8d3a4e58..3504a1245 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/Location/LocationDataReader.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/Location/LocationDataReader.java @@ -30,7 +30,7 @@ public class LocationDataReader extends DataReader implements LocationListener { protected LocationManager locationManager; private Context mContext; private boolean canGetLocation = false; - private static final String TAG = "Location Data"; + private static final String TAG = LocationDataReader.class.getName(); Location location; // location double latitude; // latitude diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/Sensor/SensorDataReader.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/Sensor/SensorDataReader.java index 4f4697e50..0c872eaa6 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/Sensor/SensorDataReader.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/Sensor/SensorDataReader.java @@ -43,6 +43,7 @@ public class SensorDataReader extends DataReader implements SensorEventListener Context ctx; private List sensorList = new ArrayList<>(); private SupportedSensors supportedSensors = SupportedSensors.getInstance(); + private static final String TAG = SensorDataReader.class.getName(); public SensorDataReader(Context context) { ctx = context; @@ -63,11 +64,11 @@ public class SensorDataReader extends DataReader implements SensorEventListener if (senseDataStruct.containsKey(sensor.getName())) { SensorData sensorInfo = senseDataStruct.get(sensor.getName()); sensorVector.add(sensorInfo); - Log.d(this.getClass().getName(), "Sensor Name " + sensor.getName() + ", Type " + sensor.getType() + " " + + Log.d(TAG, "Sensor Name " + sensor.getName() + ", Type " + sensor.getType() + " " + ", sensorValue :" + sensorInfo.getSensorValues()); } } catch (Throwable e) { - Log.d(this.getClass().getName(), "error on sensors"); + Log.d(TAG, "error on sensors"); } } @@ -79,7 +80,7 @@ public class SensorDataReader extends DataReader implements SensorEventListener TimeUnit.MILLISECONDS.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); - Log.e(SensorDataReader.class.getName(), e.getMessage()); + Log.e(TAG, e.getMessage()); } collectSensorData(); return sensorVector; @@ -96,7 +97,7 @@ public class SensorDataReader extends DataReader implements SensorEventListener @Override public void run() { - Log.d(this.getClass().getName(), "running -sensorDataMap"); + Log.d(TAG, "running -sensorDataMap"); Vector sensorDatas = getSensorData(); for (SensorData data : sensorDatas) { SenseDataHolder.getSensorDataHolder().add(data); diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/realtimeviewer/view/adaptor/SensorViewAdaptor.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/realtimeviewer/view/adaptor/SensorViewAdaptor.java index d2d852226..77f3f710c 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/realtimeviewer/view/adaptor/SensorViewAdaptor.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/realtimeviewer/view/adaptor/SensorViewAdaptor.java @@ -30,8 +30,6 @@ import agent.sense.android.iot.carbon.wso2.org.wso2_senseagent.R; * Adaptor for populate the ListView. * Takes list of Sensor readings */ - -//TODO : Add the location and battery data sections. public class SensorViewAdaptor extends BaseAdapter { private Context context; diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/WordRecognitionActivity.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/WordRecognitionActivity.java index 903b6c3a8..a3521f9ca 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/WordRecognitionActivity.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/WordRecognitionActivity.java @@ -1,3 +1,16 @@ +/* + * 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. + * 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. + * + */ package org.wso2.carbon.iot.android.sense.speech.detector; import android.content.Intent; @@ -21,6 +34,9 @@ import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; import agent.sense.android.iot.carbon.wso2.org.wso2_senseagent.R; +/** + * This is main activity for word recognition. + */ public class WordRecognitionActivity extends ListeningActivity { Button setThreasholdButton; Button addWordButton; diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/util/WordData.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/util/WordData.java index fb76eab24..a112cbd81 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/util/WordData.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/util/WordData.java @@ -1,3 +1,16 @@ +/* + * 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. + * 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. + * + */ package org.wso2.carbon.iot.android.sense.speech.detector.util; /** diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClient.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClient.java index 173525b82..057268285 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClient.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClient.java @@ -20,9 +20,11 @@ import android.util.Log; import android.widget.Toast; import org.wso2.carbon.iot.android.sense.constants.SenseConstants; +import org.wso2.carbon.iot.android.sense.util.dto.RegisterInfo; import java.util.Map; import java.util.concurrent.ExecutionException; +import java.util.logging.Handler; /** * This Client is used for http communication with the server. @@ -44,40 +46,39 @@ public class SenseClient { * @param deviceId * @return */ - public boolean register(String username, String password, String deviceId) { + public RegisterInfo register(String username, String password, String deviceId, android.os.Handler mUiHandler) { Map response = registerWithTimeWait(username, password, deviceId); String responseStatus = response.get("status"); + RegisterInfo registerInfo = new RegisterInfo(); if (responseStatus.trim().contains(SenseConstants.Request.REQUEST_SUCCESSFUL)) { - Toast.makeText(context, "Device Registered", Toast.LENGTH_LONG).show(); - return true; + registerInfo.setMsg("Device Registered"); + registerInfo.setIsRegistered(true); + return registerInfo; } else if (responseStatus.trim().contains(SenseConstants.Request.REQUEST_CONFLICT)) { - Toast.makeText(context, "Login Successful", Toast.LENGTH_LONG).show(); - return true; + registerInfo.setMsg("Login Successful"); + registerInfo.setIsRegistered(true); + return registerInfo; } else { - Toast.makeText(context, "Authentication failed, please check your credentials and try again.", Toast - .LENGTH_LONG).show(); - - return false; + registerInfo.setMsg("Authentication failed, please check your credentials and try again."); + registerInfo.setIsRegistered(false); + return registerInfo; } } public Map registerWithTimeWait(String username, String password, String deviceId) { - for (int i = 1; i <= SenseConstants.Request.MAX_ATTEMPTS; i++) { - Log.d(TAG, "Attempt #" + i + " to register"); - try { - SenseClientAsyncExecutor senseClientAsyncExecutor = new SenseClientAsyncExecutor(context); - String endpoint = LocalRegistry.getServerURL(context); - senseClientAsyncExecutor.execute(username, password, deviceId, endpoint); - Map response = senseClientAsyncExecutor.get(); - if (response != null) { - return response; - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - Log.e("Send Sensor Data", "Thread Interruption for endpoint " + LocalRegistry.getServerURL(context)); - } catch (ExecutionException e) { - Log.e("Send Sensor Data", "Failed to push data to the endpoint " + LocalRegistry.getServerURL(context)); + try { + SenseClientAsyncExecutor senseClientAsyncExecutor = new SenseClientAsyncExecutor(context); + String endpoint = LocalRegistry.getServerURL(context); + senseClientAsyncExecutor.execute(username, password, deviceId, endpoint); + Map response = senseClientAsyncExecutor.get(); + if (response != null) { + return response; } + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + Log.e("Send Sensor Data", "Thread Interruption for endpoint " + LocalRegistry.getServerURL(context)); + } catch (ExecutionException e) { + Log.e("Send Sensor Data", "Failed to push data to the endpoint " + LocalRegistry.getServerURL(context)); } return null; } diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java index 56842f6b2..79b3d740b 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java @@ -136,7 +136,7 @@ public class SenseClientAsyncExecutor extends AsyncTask Set words - /device-mgt/android_sense/word/add + /device-mgt/android_sense/user /device/*/words POST android_sense_user set word threshold information - /device-mgt/android_sense/threshold + /device-mgt/android_sense/user /device/*/words/threshold POST android_sense_user delete words - /device-mgt/android_sense/word/delete + /device-mgt/android_sense/user /device/*/words DELETE android_sense_user get device stats - /device-mgt/android_sense/device/stats + /device-mgt/android_sense/user /stats/*/sensors/* GET android_sense_device Get device - /device-mgt/android_sense/user/devices/list - /devices/* + /device-mgt/android_sense/user + /enrollment/devices/* GET android_sense_user Add device - /device-mgt/android_sense/user/devices/add - /devices/* + /login + /enrollment/devices/* POST android_sense_user Remove device - /device-mgt/android_sense/user/devices/remove - /devices/* + /device-mgt/android_sense/user + /enrollment/devices/* DELETE android_sense_user Download device - /device-mgt/android_sense/user/devices/add - /devices/download + /device-mgt/android_sense/user + /enrollment/devices/download GET android_sense_user Update device - /device-mgt/android_sense/user/devices/update - /devices/* + /device-mgt/android_sense/user + /enrollment/devices/* PUT android_sense_user diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 9ddba99b0..31dfb6aee 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -36,6 +36,16 @@ + + + + + + + + + + diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml index f3c570f1e..3908d86c6 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml @@ -42,8 +42,4 @@ managed-api-owner admin - - managed-api-endpoint-context - /android_sense - diff --git a/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoManagerServiceImpl.java b/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoManagerServiceImpl.java index fa7566b22..0f5e9ed6e 100644 --- a/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoManagerServiceImpl.java +++ b/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoManagerServiceImpl.java @@ -45,8 +45,6 @@ import java.util.Date; import java.util.List; import java.util.UUID; -@API(name = "arduino_mgt", version = "1.0.0", context = "/arduino_mgt", tags = {"arduino"}) -@DeviceType(value = "arduino") public class ArduinoManagerServiceImpl implements ArduinoManagerService { private static final String KEY_TYPE = "PRODUCTION"; diff --git a/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/http/HTTPMessageServlet.java b/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/http/HTTPMessageServlet.java index 4220ec773..804c19130 100644 --- a/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/http/HTTPMessageServlet.java +++ b/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/http/HTTPMessageServlet.java @@ -51,6 +51,9 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +/** + * This will act as the event reciver. + */ public class HTTPMessageServlet extends HttpServlet { private static final String AUTHORIZATION_HEADER = "Authorization"; diff --git a/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/http/util/AuthenticationInfo.java b/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/http/util/AuthenticationInfo.java index 7e64cd36e..f1498a707 100644 --- a/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/http/util/AuthenticationInfo.java +++ b/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/http/util/AuthenticationInfo.java @@ -1,5 +1,22 @@ +/* + * 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. + * 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. + * + */ + package org.wso2.carbon.event.input.adapter.extensions.http.util; +/** + * This will be return after authentication and this will consist of the authenticated user info. + */ public class AuthenticationInfo { /** diff --git a/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/http/util/HTTPEventAdapterConstants.java b/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/http/util/HTTPEventAdapterConstants.java index a03112c77..68af844e0 100644 --- a/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/http/util/HTTPEventAdapterConstants.java +++ b/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/http/util/HTTPEventAdapterConstants.java @@ -1,5 +1,5 @@ /* - * 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. You may obtain a copy @@ -14,7 +14,9 @@ */ package org.wso2.carbon.event.input.adapter.extensions.http.util; - +/** + * This holds the constants related to HTTP event adapter. + */ public final class HTTPEventAdapterConstants { private HTTPEventAdapterConstants() { diff --git a/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/mqtt/exception/MQTTContentValidatorInitializationException.java b/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/mqtt/exception/MQTTContentValidatorInitializationException.java index a03cde2f9..cca3e0dfb 100644 --- a/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/mqtt/exception/MQTTContentValidatorInitializationException.java +++ b/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/mqtt/exception/MQTTContentValidatorInitializationException.java @@ -17,6 +17,9 @@ */ package org.wso2.carbon.event.input.adapter.extensions.mqtt.exception; +/** + * This exception will thrown when content validator is failed to intialiaze. + */ public class MQTTContentValidatorInitializationException extends RuntimeException { private String errMessage; diff --git a/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/mqtt/util/MQTTBrokerConnectionConfiguration.java b/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/mqtt/util/MQTTBrokerConnectionConfiguration.java index 504d46ff6..3845531c2 100644 --- a/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/mqtt/util/MQTTBrokerConnectionConfiguration.java +++ b/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/mqtt/util/MQTTBrokerConnectionConfiguration.java @@ -21,6 +21,9 @@ import org.wso2.carbon.event.input.adapter.extensions.mqtt.Constants; import java.util.Map; +/** + * This holds the configurations related to MQTT Broker. + */ public class MQTTBrokerConnectionConfiguration { private String brokerUsername = null; diff --git a/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/mqtt/util/MQTTEventAdapterConstants.java b/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/mqtt/util/MQTTEventAdapterConstants.java index d9a564d96..7fbca18f9 100644 --- a/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/mqtt/util/MQTTEventAdapterConstants.java +++ b/components/iot-plugins/das-extensions/org.wso2.carbon.event.input.adapter.extensions/src/main/java/org/wso2/carbon/event/input/adapter/extensions/mqtt/util/MQTTEventAdapterConstants.java @@ -17,6 +17,10 @@ */ package org.wso2.carbon.event.input.adapter.extensions.mqtt.util; + +/** + * This holds the constants related to mqtt event adapter. + */ public class MQTTEventAdapterConstants { public static final String ADAPTER_TYPE_MQTT = "oauth-mqtt"; diff --git a/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui.endpoint/src/main/java/oauth/OAuthTokenValdiator.java b/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui.endpoint/src/main/java/oauth/OAuthTokenValdiator.java index 0c2a4c144..9ab47d39a 100644 --- a/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui.endpoint/src/main/java/oauth/OAuthTokenValdiator.java +++ b/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui.endpoint/src/main/java/oauth/OAuthTokenValdiator.java @@ -1,3 +1,17 @@ +/* + * 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. + * 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. + * + */ + package oauth; import org.apache.axis2.context.ServiceContext; @@ -22,6 +36,9 @@ import java.io.InputStream; import java.rmi.RemoteException; import java.util.Properties; +/** + * This acts as a contract point for OAuth token validation. + */ public class OAuthTokenValdiator { private static String cookie; diff --git a/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui.endpoint/src/main/java/util/AuthenticationInfo.java b/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui.endpoint/src/main/java/util/AuthenticationInfo.java index 2bac34e68..4e2115cf0 100644 --- a/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui.endpoint/src/main/java/util/AuthenticationInfo.java +++ b/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui.endpoint/src/main/java/util/AuthenticationInfo.java @@ -1,5 +1,22 @@ +/* + * 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. + * 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. + * + */ + package util; +/** + * This is returned after authentication. + */ public class AuthenticationInfo { /** diff --git a/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui/src/main/java/org/wso2/carbon/event/output/adapter/extensions/ui/internal/ds/OutputAdaptorEventStreamServiceValueHolder.java b/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui/src/main/java/org/wso2/carbon/event/output/adapter/extensions/ui/internal/ds/OutputAdaptorEventStreamServiceValueHolder.java index 99515467a..5b0ff1d3f 100644 --- a/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui/src/main/java/org/wso2/carbon/event/output/adapter/extensions/ui/internal/ds/OutputAdaptorEventStreamServiceValueHolder.java +++ b/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui/src/main/java/org/wso2/carbon/event/output/adapter/extensions/ui/internal/ds/OutputAdaptorEventStreamServiceValueHolder.java @@ -1,3 +1,17 @@ +/* + * 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. + * 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. + * + */ + package org.wso2.carbon.event.output.adapter.extensions.ui.internal.ds; import org.wso2.carbon.event.stream.core.EventStreamService; diff --git a/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui/src/main/java/org/wso2/carbon/event/output/adapter/extensions/ui/internal/ds/UIEventAdaptorServiceInternalValueHolder.java b/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui/src/main/java/org/wso2/carbon/event/output/adapter/extensions/ui/internal/ds/UIEventAdaptorServiceInternalValueHolder.java index 145b320d6..465dac54d 100644 --- a/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui/src/main/java/org/wso2/carbon/event/output/adapter/extensions/ui/internal/ds/UIEventAdaptorServiceInternalValueHolder.java +++ b/components/iot-plugins/das-extensions/org.wso2.carbon.event.output.adapter.extensions.ui/src/main/java/org/wso2/carbon/event/output/adapter/extensions/ui/internal/ds/UIEventAdaptorServiceInternalValueHolder.java @@ -1,6 +1,6 @@ /* * - * 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