diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml
index 8cdb81317..b747d2f5d 100644
--- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml
+++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml
@@ -156,6 +156,7 @@
org.wso2.carbon.devicemgt
org.wso2.carbon.apimgt.annotations
+ provided
diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml
index 1dbb17457..cfabc64c7 100644
--- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml
+++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml
@@ -144,6 +144,7 @@
org.wso2.carbon.devicemgt
org.wso2.carbon.apimgt.annotations
+ provided
diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml
index afcd89e0f..d4b7524f3 100644
--- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml
+++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml
@@ -21,7 +21,7 @@
virtual-fire-alarm-plugin
org.wso2.carbon.devicemgt-plugins
- 3.0.5-SNAPSHOT
+ 3.0.6-SNAPSHOT
../pom.xml
diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml
index a37fc8ad4..ab9ed68ed 100644
--- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml
+++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml
@@ -238,6 +238,7 @@
org.wso2.carbon.devicemgt
org.wso2.carbon.apimgt.annotations
+ provided
diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapterFactory.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapterFactory.java
index 763ae771c..b46117f65 100644
--- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapterFactory.java
+++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapterFactory.java
@@ -66,7 +66,7 @@ public class HTTPEventAdapterFactory extends InputEventAdapterFactory {
// Transport Exposed
Property exposedTransportsProperty = new Property(HTTPEventAdapterConstants.EXPOSED_TRANSPORTS);
- exposedTransportsProperty.setRequired(true);
+ exposedTransportsProperty.setRequired(false);
exposedTransportsProperty.setDisplayName(
resourceBundle.getString(HTTPEventAdapterConstants.EXPOSED_TRANSPORTS));
exposedTransportsProperty.setOptions(
diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTEventAdapterConstants.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTEventAdapterConstants.java
index c7427a81a..f21abd29b 100644
--- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTEventAdapterConstants.java
+++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTEventAdapterConstants.java
@@ -56,8 +56,8 @@ public class MQTTEventAdapterConstants {
public static final String GRANT_TYPE = "password refresh_token";
public static final String TOKEN_SCOPE = "production";
public static final String APPLICATION_NAME_PREFIX = "InputAdapter_";
- public static final String CLIENT_ID = "client_id";
- public static final String CLIENT_SECRET = "client_secret";
+ public static final String CLIENT_ID = "clientId";
+ public static final String CLIENT_SECRET = "clientSecret";
public static final String CLIENT_NAME = "client_name";
public static final String DEFAULT = "default";
public static final String MQTT_CONTENT_VALIDATION_DEFAULT_PARAMETERS = "";
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTAdapterPublisher.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTAdapterPublisher.java
index 0e5dfed8e..79188e840 100644
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTAdapterPublisher.java
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTAdapterPublisher.java
@@ -175,7 +175,7 @@ public class MQTTAdapterPublisher {
JSONObject jsonPayload = (JSONObject) jsonParser.parse(response);
String clientId = (String) jsonPayload.get(MQTTEventAdapterConstants.CLIENT_ID);
String clientSecret = (String) jsonPayload.get(MQTTEventAdapterConstants.CLIENT_SECRET);
- getToken(clientId, clientSecret);
+ return getToken(clientId, clientSecret);
}
} catch (ParseException e) {
String msg = "error occurred while parsing generating token for the adapter";
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTEventAdapterConstants.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTEventAdapterConstants.java
index 31520c6e5..732af141c 100644
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTEventAdapterConstants.java
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTEventAdapterConstants.java
@@ -30,7 +30,7 @@ public final class MQTTEventAdapterConstants {
public static final String ADAPTER_CONF_PASSWORD = "password";
public static final String ADAPTER_CONF_PASSWORD_HINT = "password.hint";
public static final String ADAPTER_CONF_DCR_URL = "dcrUrl";
- public static final String ADAPTER_CONF_TOKEN_URL = "keymanagerUrl";
+ public static final String ADAPTER_CONF_TOKEN_URL = "tokenUrl";
public static final String ADAPTER_CONF_SCOPES = "scopes";
public static final String ADAPTER_CONF_SCOPES_HINT = "scopes.hint";
public static final String ADAPTER_CONF_URL_HINT = "url.hint";
@@ -58,11 +58,11 @@ public final class MQTTEventAdapterConstants {
public static final String DEFAULT_CALLBACK = "";
public static final String DEFAULT_PASSWORD = "";
- public static final String GRANT_TYPE = "grant_type";
+ public static final String GRANT_TYPE = "password";
public static final String TOKEN_SCOPE = "production";
public static final String APPLICATION_NAME_PREFIX = "OutputAdapter_";
- public static final String CLIENT_ID = "client_id";
- public static final String CLIENT_SECRET = "client_secret";
+ public static final String CLIENT_ID = "clientId";
+ public static final String CLIENT_SECRET = "clientSecret";
public static final String AUTHORIZATION_HEADER_NAME = "Authorization";
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SubscriptionEndpoint.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SubscriptionEndpoint.java
index fc92f9cb1..0afe5ebe2 100644
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SubscriptionEndpoint.java
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SubscriptionEndpoint.java
@@ -52,7 +52,7 @@ public class SubscriptionEndpoint {
() +
", for request URI - " + session.getRequestURI());
}
- ServiceHolder.getInstance().getUiOutputCallbackControllerService().unsubscribeWebsocket(streamName, version,
+ ServiceHolder.getInstance().getWebsocketOutputCallbackControllerService().unsubscribeWebsocket(streamName, version,
session);
}
@@ -68,7 +68,7 @@ public class SubscriptionEndpoint {
log.error(
"Error occurred in session ID: " + session.getId() + ", for request URI - " + session.getRequestURI() +
", " + throwable.getMessage(), throwable);
- ServiceHolder.getInstance().getUiOutputCallbackControllerService().unsubscribeWebsocket(streamName, version,
+ ServiceHolder.getInstance().getWebsocketOutputCallbackControllerService().unsubscribeWebsocket(streamName, version,
session);
}
}
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SuperTenantSubscriptionEndpoint.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SuperTenantSubscriptionEndpoint.java
index 5eac9280e..672e9aedf 100644
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SuperTenantSubscriptionEndpoint.java
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SuperTenantSubscriptionEndpoint.java
@@ -75,7 +75,7 @@ public class SuperTenantSubscriptionEndpoint extends SubscriptionEndpoint {
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(
MultitenantConstants.SUPER_TENANT_ID);
- ServiceHolder.getInstance().getUiOutputCallbackControllerService().subscribeWebsocket(streamName,
+ ServiceHolder.getInstance().getWebsocketOutputCallbackControllerService().subscribeWebsocket(streamName,
version,
session);
} finally {
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/TenantSubscriptionEndpoint.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/TenantSubscriptionEndpoint.java
index 9243498a1..6203f8888 100644
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/TenantSubscriptionEndpoint.java
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/TenantSubscriptionEndpoint.java
@@ -74,7 +74,7 @@ public class TenantSubscriptionEndpoint extends SubscriptionEndpoint {
try {
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tdomain, true);
- ServiceHolder.getInstance().getUiOutputCallbackControllerService().subscribeWebsocket(streamName
+ ServiceHolder.getInstance().getWebsocketOutputCallbackControllerService().subscribeWebsocket(streamName
, version, session);
} finally {
PrivilegedCarbonContext.endTenantFlow();
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/util/ServiceHolder.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/util/ServiceHolder.java
index c6ddc4914..7bd8f06d0 100644
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/util/ServiceHolder.java
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/util/ServiceHolder.java
@@ -21,18 +21,18 @@ package org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.UIOutputCallbackControllerService;
+import org.wso2.carbon.device.mgt.output.adapter.websocket.WebsocketOutputCallbackControllerService;
import org.wso2.carbon.device.mgt.output.adapter.websocket.service.WebsocketValidationService;
public class ServiceHolder {
private static ServiceHolder instance;
- private UIOutputCallbackControllerService uiOutputCallbackControllerService;
+ private WebsocketOutputCallbackControllerService websocketOutputCallbackControllerService;
private static final Log log = LogFactory.getLog(ServiceHolder.class);
private ServiceHolder(){
- uiOutputCallbackControllerService = (UIOutputCallbackControllerService) PrivilegedCarbonContext
- .getThreadLocalCarbonContext().getOSGiService(UIOutputCallbackControllerService.class, null);
+ websocketOutputCallbackControllerService = (WebsocketOutputCallbackControllerService) PrivilegedCarbonContext
+ .getThreadLocalCarbonContext().getOSGiService(WebsocketOutputCallbackControllerService.class, null);
}
public synchronized static ServiceHolder getInstance() {
@@ -42,8 +42,8 @@ public class ServiceHolder {
return instance;
}
- public UIOutputCallbackControllerService getUiOutputCallbackControllerService() {
- return uiOutputCallbackControllerService;
+ public WebsocketOutputCallbackControllerService getWebsocketOutputCallbackControllerService() {
+ return websocketOutputCallbackControllerService;
}
public static WebsocketValidationService getWebsocketValidationService() {
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapter.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketEventAdapter.java
similarity index 87%
rename from components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapter.java
rename to components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketEventAdapter.java
index 4d622d8e7..edf39993a 100644
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapter.java
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketEventAdapter.java
@@ -28,8 +28,8 @@ import org.wso2.carbon.databridge.commons.Attribute;
import org.wso2.carbon.databridge.commons.Event;
import org.wso2.carbon.databridge.commons.StreamDefinition;
import org.wso2.carbon.device.mgt.output.adapter.websocket.constants.WebsocketConstants;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.internal.UIEventAdaptorServiceDataHolder;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.util.UIEventAdapterConstants;
+import org.wso2.carbon.device.mgt.output.adapter.websocket.internal.WebsocketEventAdaptorServiceDataHolder;
+import org.wso2.carbon.device.mgt.output.adapter.websocket.util.WebsocketEventAdapterConstants;
import org.wso2.carbon.device.mgt.output.adapter.websocket.util.WebSocketSessionRequest;
import org.wso2.carbon.event.output.adapter.core.EventAdapterUtil;
import org.wso2.carbon.event.output.adapter.core.OutputEventAdapter;
@@ -56,9 +56,9 @@ import java.util.concurrent.TimeUnit;
* Contains the life cycle of executions regarding the UI Adapter
*/
-public class UIEventAdapter implements OutputEventAdapter {
+public class WebsocketEventAdapter implements OutputEventAdapter {
- private static final Log log = LogFactory.getLog(UIEventAdapter.class);
+ private static final Log log = LogFactory.getLog(WebsocketEventAdapter.class);
private OutputEventAdapterConfiguration eventAdapterConfiguration;
private Map globalProperties;
private int queueSize;
@@ -72,7 +72,7 @@ public class UIEventAdapter implements OutputEventAdapter {
private List streamCorrelationAttributes;
private List streamPayloadAttributes;
- public UIEventAdapter(OutputEventAdapterConfiguration eventAdapterConfiguration, Map globalProperties) {
this.eventAdapterConfiguration = eventAdapterConfiguration;
this.globalProperties = globalProperties;
@@ -91,32 +91,32 @@ public class UIEventAdapter implements OutputEventAdapter {
int jobQueSize;
//If global properties are available those will be assigned else constant values will be assigned
- if (globalProperties.get(UIEventAdapterConstants.ADAPTER_MIN_THREAD_POOL_SIZE_NAME) != null) {
+ if (globalProperties.get(WebsocketEventAdapterConstants.ADAPTER_MIN_THREAD_POOL_SIZE_NAME) != null) {
minThread = Integer.parseInt(globalProperties.get(
- UIEventAdapterConstants.ADAPTER_MIN_THREAD_POOL_SIZE_NAME));
+ WebsocketEventAdapterConstants.ADAPTER_MIN_THREAD_POOL_SIZE_NAME));
} else {
- minThread = UIEventAdapterConstants.ADAPTER_MIN_THREAD_POOL_SIZE;
+ minThread = WebsocketEventAdapterConstants.ADAPTER_MIN_THREAD_POOL_SIZE;
}
- if (globalProperties.get(UIEventAdapterConstants.ADAPTER_MAX_THREAD_POOL_SIZE_NAME) != null) {
+ if (globalProperties.get(WebsocketEventAdapterConstants.ADAPTER_MAX_THREAD_POOL_SIZE_NAME) != null) {
maxThread = Integer.parseInt(globalProperties.get(
- UIEventAdapterConstants.ADAPTER_MAX_THREAD_POOL_SIZE_NAME));
+ WebsocketEventAdapterConstants.ADAPTER_MAX_THREAD_POOL_SIZE_NAME));
} else {
- maxThread = UIEventAdapterConstants.ADAPTER_MAX_THREAD_POOL_SIZE;
+ maxThread = WebsocketEventAdapterConstants.ADAPTER_MAX_THREAD_POOL_SIZE;
}
- if (globalProperties.get(UIEventAdapterConstants.ADAPTER_KEEP_ALIVE_TIME_NAME) != null) {
+ if (globalProperties.get(WebsocketEventAdapterConstants.ADAPTER_KEEP_ALIVE_TIME_NAME) != null) {
defaultKeepAliveTime = Integer.parseInt(globalProperties.get(
- UIEventAdapterConstants.ADAPTER_KEEP_ALIVE_TIME_NAME));
+ WebsocketEventAdapterConstants.ADAPTER_KEEP_ALIVE_TIME_NAME));
} else {
- defaultKeepAliveTime = UIEventAdapterConstants.DEFAULT_KEEP_ALIVE_TIME_IN_MILLIS;
+ defaultKeepAliveTime = WebsocketEventAdapterConstants.DEFAULT_KEEP_ALIVE_TIME_IN_MILLIS;
}
- if (globalProperties.get(UIEventAdapterConstants.ADAPTER_EXECUTOR_JOB_QUEUE_SIZE_NAME) != null) {
+ if (globalProperties.get(WebsocketEventAdapterConstants.ADAPTER_EXECUTOR_JOB_QUEUE_SIZE_NAME) != null) {
jobQueSize = Integer.parseInt(globalProperties.get(
- UIEventAdapterConstants.ADAPTER_EXECUTOR_JOB_QUEUE_SIZE_NAME));
+ WebsocketEventAdapterConstants.ADAPTER_EXECUTOR_JOB_QUEUE_SIZE_NAME));
} else {
- jobQueSize = UIEventAdapterConstants.ADAPTER_EXECUTOR_JOB_QUEUE_SIZE;
+ jobQueSize = WebsocketEventAdapterConstants.ADAPTER_EXECUTOR_JOB_QUEUE_SIZE;
}
executorService = new ThreadPoolExecutor(minThread, maxThread, defaultKeepAliveTime, TimeUnit.MILLISECONDS,
@@ -137,7 +137,7 @@ public class UIEventAdapter implements OutputEventAdapter {
streamPayloadAttributes = streamDefinition.getPayloadData();
ConcurrentHashMap> tenantSpecifcEventOutputAdapterMap =
- UIEventAdaptorServiceDataHolder.getTenantSpecificOutputEventStreamAdapterMap();
+ WebsocketEventAdaptorServiceDataHolder.getTenantSpecificOutputEventStreamAdapterMap();
ConcurrentHashMap streamSpecifAdapterMap = tenantSpecifcEventOutputAdapterMap.get(tenantId);
@@ -157,7 +157,7 @@ public class UIEventAdapter implements OutputEventAdapter {
streamSpecifAdapterMap.put(streamId, eventAdapterConfiguration.getName());
ConcurrentHashMap>> tenantSpecificStreamMap =
- UIEventAdaptorServiceDataHolder.getTenantSpecificStreamEventMap();
+ WebsocketEventAdaptorServiceDataHolder.getTenantSpecificStreamEventMap();
ConcurrentHashMap> streamSpecificEventsMap =
tenantSpecificStreamMap.get(tenantId);
if (streamSpecificEventsMap == null) {
@@ -175,16 +175,16 @@ public class UIEventAdapter implements OutputEventAdapter {
}
}
- if (globalProperties.get(UIEventAdapterConstants.ADAPTER_EVENT_QUEUE_SIZE_NAME) != null) {
+ if (globalProperties.get(WebsocketEventAdapterConstants.ADAPTER_EVENT_QUEUE_SIZE_NAME) != null) {
try {
queueSize = Integer.parseInt(
- globalProperties.get(UIEventAdapterConstants.ADAPTER_EVENT_QUEUE_SIZE_NAME));
+ globalProperties.get(WebsocketEventAdapterConstants.ADAPTER_EVENT_QUEUE_SIZE_NAME));
} catch (NumberFormatException e) {
log.error("String does not have the appropriate format for conversion." + e.getMessage());
- queueSize = UIEventAdapterConstants.EVENTS_QUEUE_SIZE;
+ queueSize = WebsocketEventAdapterConstants.EVENTS_QUEUE_SIZE;
}
} else {
- queueSize = UIEventAdapterConstants.EVENTS_QUEUE_SIZE;
+ queueSize = WebsocketEventAdapterConstants.EVENTS_QUEUE_SIZE;
}
}
@@ -256,9 +256,9 @@ public class UIEventAdapter implements OutputEventAdapter {
eventString = message.toString();
}
- Object[] eventValues = new Object[UIEventAdapterConstants.INDEX_TWO];
- eventValues[UIEventAdapterConstants.INDEX_ZERO] = eventString;
- eventValues[UIEventAdapterConstants.INDEX_ONE] = System.currentTimeMillis();
+ Object[] eventValues = new Object[WebsocketEventAdapterConstants.INDEX_TWO];
+ eventValues[WebsocketEventAdapterConstants.INDEX_ZERO] = eventString;
+ eventValues[WebsocketEventAdapterConstants.INDEX_ONE] = System.currentTimeMillis();
streamSpecificEvents.add(eventValues);
// fetch all valid sessions checked against any queryParameters provided when subscribing.
@@ -282,14 +282,14 @@ public class UIEventAdapter implements OutputEventAdapter {
public void destroy() {
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
- ConcurrentHashMap tenantSpecificAdapterMap = UIEventAdaptorServiceDataHolder
+ ConcurrentHashMap tenantSpecificAdapterMap = WebsocketEventAdaptorServiceDataHolder
.getTenantSpecificOutputEventStreamAdapterMap().get(tenantId);
if (tenantSpecificAdapterMap != null && streamId != null) {
tenantSpecificAdapterMap.remove(streamId); //Removing outputadapter and streamId
}
ConcurrentHashMap> tenantSpecificStreamEventMap =
- UIEventAdaptorServiceDataHolder.getTenantSpecificStreamEventMap().get(tenantId);
+ WebsocketEventAdaptorServiceDataHolder.getTenantSpecificStreamEventMap().get(tenantId);
if (tenantSpecificStreamEventMap != null && streamId != null) {
//Removing the streamId and events registered for the output adapter
tenantSpecificStreamEventMap.remove(streamId);
@@ -310,7 +310,7 @@ public class UIEventAdapter implements OutputEventAdapter {
* the matching Steam-Definition for the given StreamId cannot be retrieved.
*/
private StreamDefinition getStreamDefinition(String streamId) throws OutputEventAdapterException {
- EventStreamService eventStreamService = UIEventAdaptorServiceDataHolder.getEventStreamService();
+ EventStreamService eventStreamService = WebsocketEventAdaptorServiceDataHolder.getEventStreamService();
if (eventStreamService != null) {
try {
return eventStreamService.getStreamDefinition(streamId);
@@ -337,11 +337,11 @@ public class UIEventAdapter implements OutputEventAdapter {
*/
private CopyOnWriteArrayList getValidSessions(Object event) {
CopyOnWriteArrayList validSessions = new CopyOnWriteArrayList<>();
- UIOutputCallbackControllerServiceImpl uiOutputCallbackControllerServiceImpl =
- UIEventAdaptorServiceDataHolder.getUIOutputCallbackRegisterServiceImpl();
+ WebsocketOutputCallbackControllerServiceImpl websocketOutputCallbackControllerServiceImpl =
+ WebsocketEventAdaptorServiceDataHolder.getUIOutputCallbackRegisterServiceImpl();
// get all subscribed web-socket sessions.
CopyOnWriteArrayList webSocketSessionUtils =
- uiOutputCallbackControllerServiceImpl.getSessions(tenantId, streamId);
+ websocketOutputCallbackControllerServiceImpl.getSessions(tenantId, streamId);
if (webSocketSessionUtils != null) {
for (WebSocketSessionRequest webSocketSessionUtil : webSocketSessionUtils) {
boolean isValidSession;
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapterFactory.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketEventAdapterFactory.java
similarity index 85%
rename from components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapterFactory.java
rename to components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketEventAdapterFactory.java
index 6150ec59d..d06baa908 100644
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapterFactory.java
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketEventAdapterFactory.java
@@ -25,7 +25,7 @@ import org.wso2.carbon.device.mgt.output.adapter.websocket.authentication.Authen
import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.Authorizer;
import org.wso2.carbon.device.mgt.output.adapter.websocket.service.WebsocketValidationService;
import org.wso2.carbon.device.mgt.output.adapter.websocket.service.WebsocketValidationServiceImpl;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.util.UIEventAdapterConstants;
+import org.wso2.carbon.device.mgt.output.adapter.websocket.util.WebsocketEventAdapterConstants;
import org.wso2.carbon.event.output.adapter.core.MessageType;
import org.wso2.carbon.event.output.adapter.core.OutputEventAdapter;
import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration;
@@ -41,20 +41,20 @@ import java.util.ResourceBundle;
/**
* The UI event adapter factory class to create a UI output adapter
*/
-public class UIEventAdapterFactory extends OutputEventAdapterFactory {
+public class WebsocketEventAdapterFactory extends OutputEventAdapterFactory {
private ResourceBundle resourceBundle = ResourceBundle.getBundle("org.wso2.carbon.device.mgt.output.adapter.websocket.i18n" +
".Resources", Locale.getDefault());
private BundleContext bundleContext;
private boolean isAuthInitialized = false;
- private static final Log log = LogFactory.getLog(UIEventAdapter.class);
+ private static final Log log = LogFactory.getLog(WebsocketEventAdapter.class);
- public UIEventAdapterFactory() {
+ public WebsocketEventAdapterFactory() {
}
@Override
public String getType() {
- return UIEventAdapterConstants.ADAPTER_TYPE_UI;
+ return WebsocketEventAdapterConstants.ADAPTER_TYPE_UI;
}
@Override
@@ -77,8 +77,8 @@ public class UIEventAdapterFactory extends OutputEventAdapterFactory {
@Override
public String getUsageTips() {
- return resourceBundle.getString(UIEventAdapterConstants.ADAPTER_USAGE_TIPS_PREFIX) + " "
- + resourceBundle.getString(UIEventAdapterConstants.ADAPTER_USAGE_TIPS_POSTFIX);
+ return resourceBundle.getString(WebsocketEventAdapterConstants.ADAPTER_USAGE_TIPS_PREFIX) + " "
+ + resourceBundle.getString(WebsocketEventAdapterConstants.ADAPTER_USAGE_TIPS_POSTFIX);
}
@Override
@@ -87,7 +87,7 @@ public class UIEventAdapterFactory extends OutputEventAdapterFactory {
if (!isAuthInitialized) {
initializeAuthenticatorAndAuthorizor(globalProperties);
}
- return new UIEventAdapter(eventAdapterConfiguration, globalProperties);
+ return new WebsocketEventAdapter(eventAdapterConfiguration, globalProperties);
}
public BundleContext getBundleContext() {
@@ -100,24 +100,26 @@ public class UIEventAdapterFactory extends OutputEventAdapterFactory {
private void initializeAuthenticatorAndAuthorizor (Map globalProperties) {
if (!isAuthInitialized) {
- synchronized (UIEventAdapterFactory.class) {
+ synchronized (WebsocketEventAdapterFactory.class) {
if (!isAuthInitialized) {
try {
WebsocketValidationServiceImpl websocketValidationService =
new WebsocketValidationServiceImpl();
String authenticatorClassName = globalProperties.get(
- UIEventAdapterConstants.AUTHENTICATOR_CLASS);
- String authorizerClassName = globalProperties.get(UIEventAdapterConstants.AUTHORIZER_CLASS);
+ WebsocketEventAdapterConstants.AUTHENTICATOR_CLASS);
+ String authorizerClassName = globalProperties.get(WebsocketEventAdapterConstants.AUTHORIZER_CLASS);
if (authenticatorClassName != null && !authenticatorClassName.isEmpty()) {
Class extends Authenticator> authenticatorClass = Class.forName(authenticatorClassName)
.asSubclass(Authenticator.class);
Authenticator authenticator = authenticatorClass.newInstance();
+ authenticator.init(globalProperties);
websocketValidationService.setAuthenticator(authenticator);
}
if (authorizerClassName != null && !authorizerClassName.isEmpty()) {
Class extends Authorizer> authorizerClass = Class.forName(authorizerClassName)
.asSubclass(Authorizer.class);
Authorizer authorizer = authorizerClass.newInstance();
+ authorizer.init(globalProperties);
websocketValidationService.setAuthorizer(authorizer);
}
bundleContext.registerService(
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIOutputCallbackControllerService.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketOutputCallbackControllerService.java
similarity index 96%
rename from components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIOutputCallbackControllerService.java
rename to components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketOutputCallbackControllerService.java
index ffcfb72a4..8d1858380 100644
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIOutputCallbackControllerService.java
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketOutputCallbackControllerService.java
@@ -24,7 +24,7 @@ import javax.websocket.Session;
/**
* This interface is exposed as an OSGI service, which will be invoked by the local websocket endpoint to inform new subscriptions; and do un-subscriptions..
*/
-public interface UIOutputCallbackControllerService {
+public interface WebsocketOutputCallbackControllerService {
/**
* Used to subscribe the session id and stream id for later web socket connectivity
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIOutputCallbackControllerServiceImpl.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketOutputCallbackControllerServiceImpl.java
similarity index 87%
rename from components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIOutputCallbackControllerServiceImpl.java
rename to components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketOutputCallbackControllerServiceImpl.java
index b71a6fc78..d1566795d 100644
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIOutputCallbackControllerServiceImpl.java
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketOutputCallbackControllerServiceImpl.java
@@ -19,9 +19,9 @@
package org.wso2.carbon.device.mgt.output.adapter.websocket;
import org.wso2.carbon.context.PrivilegedCarbonContext;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.internal.UIEventAdaptorServiceDataHolder;
+import org.wso2.carbon.device.mgt.output.adapter.websocket.internal.WebsocketEventAdaptorServiceDataHolder;
import org.wso2.carbon.device.mgt.output.adapter.websocket.util.WebSocketSessionRequest;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.util.UIEventAdapterConstants;
+import org.wso2.carbon.device.mgt.output.adapter.websocket.util.WebsocketEventAdapterConstants;
import javax.websocket.Session;
import java.util.Iterator;
@@ -32,12 +32,12 @@ import java.util.concurrent.LinkedBlockingDeque;
/**
* Service implementation class which exposes to front end
*/
-public class UIOutputCallbackControllerServiceImpl implements UIOutputCallbackControllerService {
+public class WebsocketOutputCallbackControllerServiceImpl implements WebsocketOutputCallbackControllerService {
private ConcurrentHashMap>>
outputEventAdaptorSessionMap;
- public UIOutputCallbackControllerServiceImpl() {
+ public WebsocketOutputCallbackControllerServiceImpl() {
outputEventAdaptorSessionMap = new ConcurrentHashMap<>();
}
@@ -53,9 +53,9 @@ public class UIOutputCallbackControllerServiceImpl implements UIOutputCallbackCo
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
if (version == null || " ".equals(version)) {
- version = UIEventAdapterConstants.ADAPTER_UI_DEFAULT_OUTPUT_STREAM_VERSION;
+ version = WebsocketEventAdapterConstants.ADAPTER_UI_DEFAULT_OUTPUT_STREAM_VERSION;
}
- String streamId = streamName + UIEventAdapterConstants.ADAPTER_UI_COLON + version;
+ String streamId = streamName + WebsocketEventAdapterConstants.ADAPTER_UI_COLON + version;
ConcurrentHashMap> tenantSpecificAdaptorMap =
outputEventAdaptorSessionMap.get(tenantId);
if (tenantSpecificAdaptorMap == null) {
@@ -102,9 +102,9 @@ public class UIOutputCallbackControllerServiceImpl implements UIOutputCallbackCo
*/
public LinkedBlockingDeque