analyticsClients = new ArrayList<>();
- for (String publisherURLGroup : publisherGroups) {
- try {
- String[] endpoints = DataPublisherUtil.getEndpoints(publisherURLGroup);
- for (String endpoint : endpoints) {
- try {
- endpoint = endpoint.trim();
- if (!endpoint.endsWith("/")) {
- endpoint += "/";
- }
- endpoint += session.getRequestURI().getSchemeSpecificPart().replace("secured-websocket-proxy","");
- AnalyticsClient analyticsClient = new AnalyticsClient(session, new URI(endpoint));
- analyticsClients.add(analyticsClient);
- } catch (URISyntaxException e) {
- log.error("Unable to create URL from: " + endpoint, e);
- } catch (WSProxyException e) {
- log.error("Unable to create WS client for: " + endpoint, e);
- }
- }
- } catch (DataEndpointConfigurationException e) {
- log.error("Unable to obtain endpoints from receiverURLGroup: " + publisherURLGroup, e);
- }
- }
- if (log.isDebugEnabled()) {
- log.debug("Configured " + analyticsClients.size() + " analytics clients for Session id: " +
- session.getId());
- }
- analyticsClientsMap.put(session.getId(), analyticsClients);
- }
-
- /**
- * Web socket onClose - Remove the registered sessions
- *
- * @param session - Users registered session.
- * @param reason - Status code for web-socket close.
- * @param streamName - StreamName extracted from the ws url.
- * @param version - Version extracted from the ws url.
- * @param tenantDomain - Domain of the tenant.
- */
- public void onClose(Session session, CloseReason reason, String streamName, String version, String tenantDomain) {
- if (log.isDebugEnabled()) {
- log.debug("Closing a WebSocket due to " + reason.getReasonPhrase() + ", for session ID:" +
- session.getId() + ", for request URI - " + session.getRequestURI());
- }
- for (AnalyticsClient analyticsClient : analyticsClientsMap.get(session.getId())) {
- if (analyticsClient != null) {
- try {
- analyticsClient.closeConnection(reason);
- } catch (WSProxyException e) {
- log.error("Error occurred while closing ws connection due to " + reason.getReasonPhrase() +
- ", for session ID:" + session.getId() + ", for request URI - " + session.getRequestURI(), e);
- }
- }
- }
- analyticsClientsMap.remove(session.getId());
- }
-
- /**
- * Web socket onMessage - When client sens a message
- *
- * @param session - Users registered session.
- * @param message - Status code for web-socket close.
- */
- void onMessage(Session session, String message) {
- for (AnalyticsClient analyticsClient : analyticsClientsMap.get(session.getId())) {
- if (analyticsClient != null) {
- analyticsClient.sendMessage(message);
- }
- }
- }
-
- /**
- * Web socket onError
- *
- * @param session - Users registered session.
- * @param throwable - Status code for web-socket close.
- * @param streamName - StreamName extracted from the ws url.
- * @param version - Version extracted from the ws url.
- * @param tenantDomain - Domain of the tenant.
- */
- public void onError(Session session, Throwable throwable, String streamName, String version, String tenantDomain) {
- log.error("Error occurred in session ID: " + session.getId() + ", for request URI - " +
- session.getRequestURI() + ", " + throwable.getMessage(), throwable);
- }
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/java/org/wso2/carbon/device/mgt/analytics/wsproxy/inbound/SuperTenantSubscriptionEndpoint.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/java/org/wso2/carbon/device/mgt/analytics/wsproxy/inbound/SuperTenantSubscriptionEndpoint.java
deleted file mode 100644
index 0e4bc3684d..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/java/org/wso2/carbon/device/mgt/analytics/wsproxy/inbound/SuperTenantSubscriptionEndpoint.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2018, 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.
- */
-
-package org.wso2.carbon.device.mgt.analytics.wsproxy.inbound;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.base.MultitenantConstants;
-
-import javax.websocket.CloseReason;
-import javax.websocket.EndpointConfig;
-import javax.websocket.OnClose;
-import javax.websocket.OnError;
-import javax.websocket.OnMessage;
-import javax.websocket.OnOpen;
-import javax.websocket.Session;
-import javax.websocket.server.PathParam;
-import javax.websocket.server.ServerEndpoint;
-
-/**
- * Connect to web socket with Super tenant
- */
-
-@ServerEndpoint(value = "/{destination}/{streamname}/{version}")
-public class SuperTenantSubscriptionEndpoint extends SubscriptionEndpoint {
-
- private static final Log log = LogFactory.getLog(SuperTenantSubscriptionEndpoint.class);
-
- /**
- * Web socket onOpen - When client sends a message
- *
- * @param session - Users registered session.
- * @param streamName - StreamName extracted from the ws url.
- * @param version - Version extracted from the ws url.
- */
- @OnOpen
- public void onOpen(Session session, EndpointConfig config, @PathParam("streamname") String streamName,
- @PathParam("version") String version) {
- if (log.isDebugEnabled()) {
- log.debug("WebSocket opened, for Session id: " + session.getId() + ", for the Stream:" + streamName);
- }
- super.onOpen(session);
- }
-
- /**
- * Web socket onMessage - When client sens a message
- *
- * @param session - Users registered session.
- * @param message - Status code for web-socket close.
- * @param streamName - StreamName extracted from the ws url.
- */
- @OnMessage
- public void onMessage(Session session, String message, @PathParam("streamname") String streamName) {
- if (log.isDebugEnabled()) {
- log.debug("Received message from client. Message: " + message + ", " +
- "for Session id: " + session.getId() + ", for the Stream:" + streamName);
- }
- super.onMessage(session, message);
- }
-
- /**
- * Web socket onClose - Remove the registered sessions
- *
- * @param session - Users registered session.
- * @param reason - Status code for web-socket close.
- * @param streamName - StreamName extracted from the ws url.
- * @param version - Version extracted from the ws url.
- */
- @OnClose
- public void onClose(Session session, CloseReason reason, @PathParam("streamname") String streamName,
- @PathParam("version") String version) {
- super.onClose(session, reason, streamName, version, MultitenantConstants.SUPER_TENANT_NAME);
- }
-
- /**
- * Web socket onError - Remove the registered sessions
- *
- * @param session - Users registered session.
- * @param throwable - Status code for web-socket close.
- * @param streamName - StreamName extracted from the ws url.
- * @param version - Version extracted from the ws url.
- */
- @OnError
- public void onError(Session session, Throwable throwable, @PathParam("streamname") String streamName,
- @PathParam("version") String version) {
- super.onError(session, throwable, streamName, version, MultitenantConstants.SUPER_TENANT_NAME);
- }
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/java/org/wso2/carbon/device/mgt/analytics/wsproxy/inbound/TenantSubscriptionEndpoint.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/java/org/wso2/carbon/device/mgt/analytics/wsproxy/inbound/TenantSubscriptionEndpoint.java
deleted file mode 100644
index 02e55cfed6..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/java/org/wso2/carbon/device/mgt/analytics/wsproxy/inbound/TenantSubscriptionEndpoint.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2018, 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.
- */
-
-package org.wso2.carbon.device.mgt.analytics.wsproxy.inbound;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.websocket.CloseReason;
-import javax.websocket.EndpointConfig;
-import javax.websocket.OnClose;
-import javax.websocket.OnError;
-import javax.websocket.OnMessage;
-import javax.websocket.OnOpen;
-import javax.websocket.Session;
-import javax.websocket.server.PathParam;
-import javax.websocket.server.ServerEndpoint;
-
-/**
- * Connect to web socket with a tenant
- */
-
-@ServerEndpoint(value = "/{destination}/t/{tdomain}/{streamname}/{version}")
-public class TenantSubscriptionEndpoint extends SubscriptionEndpoint {
-
- private static final Log log = LogFactory.getLog(TenantSubscriptionEndpoint.class);
-
- /**
- * Web socket onOpen - When client sends a message
- *
- * @param session - Users registered session.
- * @param streamName - StreamName extracted from the ws url.
- * @param version - Version extracted from the ws url.
- * @param tdomain - Tenant domain extracted from ws url.
- */
- @OnOpen
- public void onOpen(Session session, EndpointConfig config, @PathParam("streamname") String streamName,
- @PathParam("version") String version, @PathParam("tdomain") String tdomain) {
- if (log.isDebugEnabled()) {
- log.debug("WebSocket opened, for Session id: " + session.getId() + ", for the Stream:" + streamName);
- }
- super.onOpen(session);
- }
-
- /**
- * Web socket onMessage - When client sens a message
- *
- * @param session - Users registered session.
- * @param message - Status code for web-socket close.
- * @param streamName - StreamName extracted from the ws url.
- */
- @OnMessage
- public void onMessage(Session session, String message, @PathParam("streamname") String streamName, @PathParam("tdomain") String tdomain) {
- if (log.isDebugEnabled()) {
- log.debug("Received message from client. Message: " + message + ", for Session id: " +
- session.getId() + ", for tenant domain" + tdomain + ", for the Adaptor:" + streamName);
- }
- super.onMessage(session, message);
- }
-
- /**
- * Web socket onClose - Remove the registered sessions
- *
- * @param session - Users registered session.
- * @param reason - Status code for web-socket close.
- * @param streamName - StreamName extracted from the ws url.
- * @param version - Version extracted from the ws url.
- */
- @OnClose
- public void onClose(Session session, CloseReason reason, @PathParam("streamname") String streamName,
- @PathParam("version") String version, @PathParam("tdomain") String tdomain) {
- super.onClose(session, reason, streamName, version, tdomain);
- }
-
- /**
- * Web socket onError - Remove the registered sessions
- *
- * @param session - Users registered session.
- * @param throwable - Status code for web-socket close.
- * @param streamName - StreamName extracted from the ws url.
- * @param version - Version extracted from the ws url.
- */
- @OnError
- public void onError(Session session, Throwable throwable, @PathParam("streamname") String streamName,
- @PathParam("version") String version, @PathParam("tdomain") String tdomain) {
- super.onError(session, throwable, streamName, version, tdomain);
- }
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/java/org/wso2/carbon/device/mgt/analytics/wsproxy/outbound/AnalyticsClient.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/java/org/wso2/carbon/device/mgt/analytics/wsproxy/outbound/AnalyticsClient.java
deleted file mode 100644
index 96e6d6974a..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/java/org/wso2/carbon/device/mgt/analytics/wsproxy/outbound/AnalyticsClient.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2018, 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.
- */
-
-package org.wso2.carbon.device.mgt.analytics.wsproxy.outbound;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.device.mgt.analytics.wsproxy.exception.WSProxyException;
-
-import javax.websocket.CloseReason;
-import javax.websocket.ContainerProvider;
-import javax.websocket.DeploymentException;
-import javax.websocket.OnClose;
-import javax.websocket.OnMessage;
-import javax.websocket.Session;
-import javax.websocket.WebSocketContainer;
-import java.io.IOException;
-import java.net.URI;
-
-/**
- * This class holds web socket client implementation
- *
- * @since 1.0.0
- */
-@javax.websocket.ClientEndpoint
-public class AnalyticsClient {
-
- private static final Log log = LogFactory.getLog(AnalyticsClient.class);
-
- private final Session analyticsSession;
- private final Session clientSession;
-
- /**
- * Create {@link AnalyticsClient} instance.
- */
- public AnalyticsClient(Session clientSession, URI endpointURI) throws WSProxyException {
- WebSocketContainer container = ContainerProvider.getWebSocketContainer();
- this.clientSession = clientSession;
-
- try {
- this.analyticsSession = container.connectToServer(this, endpointURI);
- } catch (DeploymentException | IOException e) {
- String msg = "Error occurred while connecting to remote endpoint " + endpointURI.toString();
- log.error(msg, e);
- throw new WSProxyException(msg, e);
- }
- }
-
- /**
- * Callback hook for Connection close events.
- *
- * @param userSession the analyticsSession which is getting closed.
- * @param reason the reason for connection close
- */
- @OnClose
- public void onClose(Session userSession, CloseReason reason) {
- if (log.isDebugEnabled()) {
- log.debug("Closing web socket session: '" + userSession.getId() + "'. Code: " +
- reason.getCloseCode().toString() + " Reason: " + reason.getReasonPhrase());
- }
- }
-
- /**
- * Callback hook for Message Events.
- *
- * This method will be invoked when a client send a message.
- *
- * @param message The text message.
- */
- @OnMessage
- public void onMessage(String message) {
- synchronized (this.clientSession) {
- try {
- this.clientSession.getBasicRemote().sendText(message);
- } catch (IOException e) {
- log.warn("Sending message to client failed due to " + e.getMessage());
- if (log.isDebugEnabled()) {
- log.debug("Full stack trace:", e);
- }
- }
- }
- }
-
- /**
- * Send a message.
- *
- * @param message the message which is going to send.
- */
- public void sendMessage(String message) {
- synchronized (this.analyticsSession) {
- try {
- this.analyticsSession.getBasicRemote().sendText(message);
- } catch (IOException e) {
- log.warn("Sending message to analytics failed due to " + e.getMessage());
- if (log.isDebugEnabled()) {
- log.debug("Full stack trace:", e);
- }
- }
- }
- }
-
- /**
- * Close current connection.
- */
- public void closeConnection(CloseReason closeReason) throws WSProxyException {
- if (this.analyticsSession.isOpen()) {
- try {
- this.analyticsSession.close(closeReason);
- } catch (IOException e) {
- String msg = "Error on closing WS connection.";
- log.error(msg, e);
- throw new WSProxyException(msg, e);
- }
- } else {
- log.warn("Analytics session '" + this.analyticsSession.getId() + "' is already closed");
- }
- }
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/webapp/WEB-INF/web.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 933cf86531..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
- Output WebSocket Proxy
-
-
- ContentTypeBasedCachePreventionFilter
- org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter
-
- patterns
- text/html" ,application/json" ,text/plain
-
-
- filterAction
- enforce
-
-
- httpHeaders
- Cache-Control: no-store, no-cache, must-revalidate, private
-
-
-
-
- ContentTypeBasedCachePreventionFilter
- /*
-
-
diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml
index baca16bf79..1881c7f0ad 100644
--- a/components/device-mgt/pom.xml
+++ b/components/device-mgt/pom.xml
@@ -30,7 +30,7 @@
device-mgt
pom
WSO2 Carbon - Device Management Component
- http://wso2.org
+ https://entgra.io
io.entgra.device.mgt.core.device.mgt.core
diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml
index 6316fff69a..1a44ac0544 100644
--- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml
+++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml
@@ -36,8 +36,12 @@
- org.apache.felix
- maven-scr-plugin
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 1.8
+
org.apache.felix
@@ -51,20 +55,28 @@
Server Startup Heart Beat Beacon Bundle
io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.internal
- org.apache.axis2.*;version="${axis2.osgi.version.range}",
- org.apache.axiom.*; version="${axiom.osgi.version.range}",
+ io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)",
+ io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)",
+ io.entgra.device.mgt.core.server.bootup.heartbeat.beacon,
+ io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config,
+ io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config.datasource,
+ io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dao,
+ io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dao.exception,
+ io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dao.impl,
+ io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dao.util,
+ io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dto,
+ io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception,
+ javax.naming,
+ javax.sql,
+ javax.xml.bind;version="[0.0,1)",
+ javax.xml.bind.annotation;version="[0.0,1)",
+ javax.xml.parsers,
+ org.apache.commons.logging;version="[1.2,2)",
org.osgi.framework.*;version="${imp.package.version.osgi.framework}",
org.osgi.service.*;version="${imp.package.version.osgi.service}",
- org.apache.commons.logging,
- javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional,
- org.wso2.carbon.context,
- org.wso2.carbon.utils.*,
- org.wso2.carbon.ndatasource.core,
org.w3c.dom,
- org.apache.commons.io,
- org.apache.axis2.transport.mail,
- org.apache.commons.collections,
- io.entgra.device.mgt.core.device.mgt.common.*
+ org.wso2.carbon.ndatasource.core;version="[4.8,5)",
+ org.wso2.carbon.utils;version="[4.8,5)"
!io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.internal,
@@ -74,59 +86,18 @@