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);
+ analyticsClient.connectClient(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.
+ */
+ public 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
new file mode 100644
index 00000000000..0e4bc3684d9
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/java/org/wso2/carbon/device/mgt/analytics/wsproxy/inbound/SuperTenantSubscriptionEndpoint.java
@@ -0,0 +1,104 @@
+/*
+ * 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
new file mode 100644
index 00000000000..02e55cfed6c
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/java/org/wso2/carbon/device/mgt/analytics/wsproxy/inbound/TenantSubscriptionEndpoint.java
@@ -0,0 +1,103 @@
+/*
+ * 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
new file mode 100644
index 00000000000..7bfd480288e
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/java/org/wso2/carbon/device/mgt/analytics/wsproxy/outbound/AnalyticsClient.java
@@ -0,0 +1,120 @@
+/*
+ * 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 WebSocketContainer container;
+ private Session analyticsSession = null;
+ private Session clientSession;
+
+ /**
+ * Create {@link AnalyticsClient} instance.
+ */
+ public AnalyticsClient(Session clientSession) {
+ container = ContainerProvider.getWebSocketContainer();
+ this.clientSession = clientSession;
+ }
+
+ /**
+ * Create web socket client connection using {@link WebSocketContainer}.
+ */
+ public void connectClient(URI endpointURI) throws WSProxyException {
+ try {
+ 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());
+ }
+ this.analyticsSession = null;
+ }
+
+ /**
+ * 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) {
+ this.clientSession.getAsyncRemote().sendText(message);
+ }
+
+ /**
+ * Send a message.
+ *
+ * @param message the message which is going to send.
+ */
+ public void sendMessage(String message) {
+ this.analyticsSession.getAsyncRemote().sendText(message);
+ }
+
+ /**
+ * Close current connection.
+ */
+ public void closeConnection(CloseReason closeReason) throws WSProxyException {
+ if (this.analyticsSession != null) {
+ try {
+ this.analyticsSession.close(closeReason);
+ } catch (IOException e) {
+ String msg = "Error on closing WS connection.";
+ log.error(msg, e);
+ throw new WSProxyException(msg, e);
+ }
+ }
+ }
+}
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
new file mode 100644
index 00000000000..bf625c9256d
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,46 @@
+
+
+
+
+ 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/org.wso2.carbon.device.mgt.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml
index d58eef3345c..33e23468525 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml
@@ -22,7 +22,7 @@
device-mgt
org.wso2.carbon.devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java
index b1c84d48423..ec72dc6d16f 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java
@@ -429,6 +429,12 @@ public interface ActivityInfoProviderService {
"Example: Mon, 05 Jan 2014 15:10:00 +0200",
required = false)
@QueryParam("since") String since,
+ @ApiParam(
+ name = "initiatedBy",
+ value = "The user, who initiated the operation. If is done by the task, the SYSTEM will be returned." +
+ " And if a user adds the operation, username is returned",
+ required = false)
+ @QueryParam("initiatedBy") String initiatedBy,
@ApiParam(
name = "offset",
value = "The starting pagination index for the complete list of qualified items.",
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java
index 45ad77ee78e..d115659e188 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java
@@ -216,8 +216,8 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
@GET
@Override
- public Response getActivities(@QueryParam("since") String since, @QueryParam("offset") int offset,
- @QueryParam("limit") int limit,
+ public Response getActivities(@QueryParam("since") String since, @QueryParam("initiatedBy")String initiatedBy,
+ @QueryParam("offset") int offset, @QueryParam("limit") int limit,
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
long ifModifiedSinceTimestamp;
@@ -267,6 +267,7 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
Response response = validateAdminUser();
if (response == null) {
List activities;
+ int count = 0;
ActivityList activityList = new ActivityList();
DeviceManagementProviderService dmService;
try {
@@ -274,15 +275,28 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
log.debug("Calling database to get activities.");
}
dmService = DeviceMgtAPIUtils.getDeviceManagementService();
- activities = dmService.getActivitiesUpdatedAfter(timestamp, limit, offset);
- activityList.setList(activities);
- if (log.isDebugEnabled()) {
- log.debug("Calling database to get activity count.");
- }
- int count = dmService.getActivityCountUpdatedAfter(timestamp);
- if (log.isDebugEnabled()) {
- log.debug("Activity count: " + count);
+ if (initiatedBy == null || initiatedBy.isEmpty()) {
+ activities = dmService.getActivitiesUpdatedAfter(timestamp, limit, offset);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Calling database to get activity count with timestamp.");
+ }
+ count = dmService.getActivityCountUpdatedAfter(timestamp);
+ if (log.isDebugEnabled()) {
+ log.debug("Activity count: " + count);
+ }
+ } else {
+ activities = dmService.getActivitiesUpdatedAfterByUser(timestamp, initiatedBy, limit, offset);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Calling database to get activity count with timestamp and user.");
+ }
+ count = dmService.getActivityCountUpdatedAfterByUser(timestamp, initiatedBy);
+ if (log.isDebugEnabled()) {
+ log.debug("Activity count: " + count);
+ }
}
+ activityList.setList(activities);
activityList.setCount(count);
if (activities == null || activities.size() == 0) {
if (isIfModifiedSinceSet) {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml
index ac98ec15b7e..81442311420 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml
@@ -21,7 +21,7 @@
device-mgt
org.wso2.carbon.devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java
index 6dc9d55305a..567cc1a1d68 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java
@@ -22,6 +22,8 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationResult;
+import org.wso2.carbon.device.mgt.common.policy.mgt.Policy;
+
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
import java.util.List;
@@ -44,6 +46,10 @@ public interface OperationManager {
Activity addOperation(Operation operation, List devices) throws OperationManagementException,
InvalidDeviceException;
+
+ void addOperationsForPolicyRevoke(Policy policy, List devices) throws OperationManagementException,
+ InvalidDeviceException;
+
/**
* Method to retrieve the list of all operations to a device.
*
@@ -102,12 +108,16 @@ public interface OperationManager {
int getTotalCountOfFilteredActivities(String operationCode) throws OperationManagementException;
+ List getActivitiesUpdatedAfterByUser(long timestamp, String user, int limit, int offset) throws OperationManagementException;
+
int getActivityCountUpdatedAfter(long timestamp) throws OperationManagementException;
+ int getActivityCountUpdatedAfterByUser(long timestamp, String user) throws OperationManagementException;
+
/**
* retrive the push notification strategy.
* @return NotificationStrategy
*/
NotificationStrategy getNotificationStrategy();
-}
\ No newline at end of file
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml
index 2ac107ef43b..5b7ce8b77c1 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
device-mgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java
index 78d393b0487..88d5e291f3d 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java
@@ -38,6 +38,8 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.ActivityStatus;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
+import org.wso2.carbon.device.mgt.common.policy.mgt.Policy;
+import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationContext;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
@@ -64,13 +66,7 @@ import org.wso2.carbon.device.mgt.core.task.impl.DeviceTaskManagerImpl;
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/**
* This class implements all the functionality exposed as part of the OperationManager. Any transaction initiated
@@ -161,8 +157,8 @@ public class OperationManagerImpl implements OperationManager {
List validDeviceIds = deviceValidationResult.getValidDeviceIDList();
if (validDeviceIds.size() > 0) {
DeviceIDHolder deviceAuthorizationResult = this.authorizeDevices(operation, validDeviceIds);
- List authorizedDeviceList = deviceAuthorizationResult.getValidDeviceIDList();
- if (authorizedDeviceList.size() <= 0) {
+ List authorizedDeviceIds = deviceAuthorizationResult.getValidDeviceIDList();
+ if (authorizedDeviceIds.size() <= 0) {
log.warn("User : " + getUser() + " is not authorized to perform operations on given device-list.");
Activity activity = new Activity();
//Send the operation statuses only for admin triggered operations
@@ -189,86 +185,71 @@ public class OperationManagerImpl implements OperationManager {
OperationManagementDAOFactory.beginTransaction();
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation operationDto =
OperationDAOUtil.convertOperation(operation);
+ int enrolmentId;
+ String operationCode = operationDto.getCode();
+
+ List authorizedDevices = new ArrayList<>();
+ List ignoredDevices = new ArrayList<>();
+ for (DeviceIdentifier deviceId : authorizedDeviceIds) {
+ Device device = getDevice(deviceId);
+ authorizedDevices.add(device);
+ }
+
+ if (operationDto.getControl() ==
+ org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Control.NO_REPEAT) {
+ int existingOperationID;
+ for (Device device : authorizedDevices) {
+ enrolmentId = device.getEnrolmentInfo().getId();
+ existingOperationID = operationDAO.getExistingOperationID(enrolmentId, operationCode);
+ if (existingOperationID > 0) {
+ ignoredDevices.add(device);
+ operation.setId(existingOperationID);
+ this.sendNotification(operation, device);
+ }
+ }
+ }
+
+ if (ignoredDevices.size() > 0) {
+ if (authorizedDevices.size() == ignoredDevices.size()) {
+ if (log.isDebugEnabled()) {
+ log.debug("All the devices contain a pending operation for the Operation Code: "
+ + operationCode);
+ }
+ Activity activity = new Activity();
+ //Send the operation statuses only for admin triggered operations
+ String deviceType = validDeviceIds.get(0).getType();
+ activity.setActivityStatus(this.getActivityStatus(deviceValidationResult, deviceAuthorizationResult,
+ deviceType));
+ return activity;
+ } else {
+ authorizedDevices.removeAll(ignoredDevices);
+ }
+ }
+
int operationId = this.lookupOperationDAO(operation).addOperation(operationDto);
- boolean isNotRepeated = false;
+
boolean isScheduled = false;
NotificationStrategy notificationStrategy = getNotificationStrategy();
// check whether device list is greater than batch size notification strategy has enable to send push
// notification using scheduler task
if (DeviceConfigurationManager.getInstance().getDeviceManagementConfig().
- getPushNotificationConfiguration().getSchedulerBatchSize() <= authorizedDeviceList.size() &&
+ getPushNotificationConfiguration().getSchedulerBatchSize() <= authorizedDeviceIds.size() &&
notificationStrategy != null) {
isScheduled = notificationStrategy.getConfig().isScheduled();
}
- boolean hasExistingTaskOperation;
- int enrolmentId;
- List devices = new ArrayList<>();
- if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Control.NO_REPEAT == operationDto.
- getControl()) {
- isNotRepeated = true;
- }
-
//TODO have to create a sql to load device details from deviceDAO using single query.
- String operationCode = operationDto.getCode();
- for (DeviceIdentifier deviceId : authorizedDeviceList) {
- Device device = getDevice(deviceId);
- devices.add(device);
+ for (Device device : authorizedDevices) {
enrolmentId = device.getEnrolmentInfo().getId();
//Do not repeat the task operations
- if (isScheduledOperation) {
- hasExistingTaskOperation = operationDAO.updateTaskOperation(enrolmentId, operationCode);
- if (!hasExistingTaskOperation) {
- operationMappingDAO.addOperationMapping(operationId, enrolmentId, isScheduled);
- }
- } else if (isNotRepeated) {
- operationDAO.updateEnrollmentOperationsStatus(enrolmentId, operationCode,
- org.wso2.carbon.device.mgt.core.dto.operation.mgt.
- Operation.Status.PENDING,
- org.wso2.carbon.device.mgt.core.dto.operation.mgt.
- Operation.Status.REPEATED);
- operationMappingDAO.addOperationMapping(operationId, enrolmentId, isScheduled);
- } else {
- operationMappingDAO.addOperationMapping(operationId, enrolmentId, isScheduled);
- }
+ operationMappingDAO.addOperationMapping(operationId, enrolmentId, isScheduled);
}
OperationManagementDAOFactory.commitTransaction();
- /*
- If notification strategy has not enable to send push notification using scheduler task we will send
- notification immediately. This is done in separate loop inorder to prevent overlap with DB insert
- operations with the possible db update operations trigger followed by pending operation call.
- Otherwise device may call pending operation while DB is locked for write and deadlock can occur.
- */
- if (notificationStrategy != null && !isScheduled) {
- for (Device device : devices) {
- DeviceIdentifier deviceId = new DeviceIdentifier(device.getDeviceIdentifier(), device.getType());
- if (log.isDebugEnabled()) {
- log.debug("Sending push notification to " + deviceId + " from add operation method.");
- }
- operation.setId(operationId);
- operation.setActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + operationId);
- try {
- notificationStrategy.execute(new NotificationContext(deviceId, operation));
- } catch (PushNotificationExecutionFailedException e) {
- log.error("Error occurred while sending push notifications to " + deviceId.getType() +
- " device carrying id '" + deviceId + "'", e);
- /*
- Reschedule if push notification failed. Doing db transactions in atomic way to prevent
- deadlocks.
- */
- enrolmentId = device.getEnrolmentInfo().getId();
- try {
- operationMappingDAO.updateOperationMapping(operationId, enrolmentId, org.wso2.carbon
- .device.mgt.core.dto.operation.mgt.Operation.PushNotificationStatus.SCHEDULED);
- OperationManagementDAOFactory.commitTransaction();
- } catch (OperationManagementDAOException ex) {
- // Not throwing this exception in order to keep sending remaining notifications if any.
- log.error("Error occurred while setting push notification status to SCHEDULED.", ex);
- OperationManagementDAOFactory.rollbackTransaction();
- }
- }
+ if (isScheduled) {
+ for (Device device : authorizedDevices) {
+ this.sendNotification(operation, device);
}
}
@@ -298,6 +279,195 @@ public class OperationManagerImpl implements OperationManager {
}
}
+ private Operation getPolicyRevokeOperation() {
+ CommandOperation policyRevokeOperation = new CommandOperation();
+ policyRevokeOperation.setEnabled(true);
+ policyRevokeOperation.setCode(OperationMgtConstants.OperationCodes.POLICY_REVOKE);
+ policyRevokeOperation.setType(Operation.Type.COMMAND);
+ return policyRevokeOperation;
+ }
+ private Operation transformPolicy(Policy policy) {
+ List effectiveFeatures = policy.getProfile().getProfileFeaturesList();
+ List profileOperationList = new ArrayList();
+ PolicyOperation policyOperation = new PolicyOperation();
+ policyOperation.setEnabled(true);
+ policyOperation.setType(org.wso2.carbon.device.mgt.common.operation.mgt.Operation.Type.POLICY);
+ policyOperation.setCode(PolicyOperation.POLICY_OPERATION_CODE);
+ for (ProfileFeature feature : effectiveFeatures) {
+ ProfileOperation profileOperation = new ProfileOperation();
+ profileOperation.setCode(feature.getFeatureCode());
+ profileOperation.setEnabled(true);
+ profileOperation.setStatus(org.wso2.carbon.device.mgt.common.operation.mgt.Operation.Status.PENDING);
+ profileOperation.setType(org.wso2.carbon.device.mgt.common.operation.mgt.Operation.Type.PROFILE);
+ profileOperation.setPayLoad(feature.getContent());
+ profileOperationList.add(profileOperation);
+ }
+ policyOperation.setProfileOperations(profileOperationList);
+ policyOperation.setPayLoad(policyOperation.getProfileOperations());
+ return policyOperation;
+ }
+ @Override
+ public void addOperationsForPolicyRevoke(Policy policy, List deviceIds)
+ throws OperationManagementException, InvalidDeviceException {
+ Operation revokeOperation = getPolicyRevokeOperation();
+ Operation operation = transformPolicy(policy);
+ if (log.isDebugEnabled()) {
+ log.debug("operation:[" + operation.toString() + "]");
+ for (DeviceIdentifier deviceIdentifier : deviceIds) {
+ log.debug("device identifier id:[" + deviceIdentifier.getId() + "] type:[" +
+ deviceIdentifier.getType() + "]");
+ }
+ }
+ try {
+ DeviceIDHolder deviceValidationResult = DeviceManagerUtil.validateDeviceIdentifiers(deviceIds);
+ List validDeviceIds = deviceValidationResult.getValidDeviceIDList();
+ if (validDeviceIds.size() > 0) {
+ DeviceIDHolder deviceAuthorizationResult = this.authorizeDevices(operation, validDeviceIds);
+ List authorizedDeviceList = deviceAuthorizationResult.getValidDeviceIDList();
+ OperationManagementDAOFactory.beginTransaction();
+ org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation policyOperationDto =
+ OperationDAOUtil.convertOperation(operation);
+ org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation revokeOperationDto =
+ OperationDAOUtil.convertOperation(revokeOperation);
+ boolean isScheduledOperation = this.isTaskScheduledOperation(operation);
+ boolean isNotRepeated = false;
+ boolean isScheduled = false;
+ NotificationStrategy notificationStrategy = getNotificationStrategy();
+ // check whether device list is greater than batch size notification strategy has enable to send push
+ // notification using scheduler task
+ if (DeviceConfigurationManager.getInstance().getDeviceManagementConfig().
+ getPushNotificationConfiguration().getSchedulerBatchSize() <= authorizedDeviceList.size() &&
+ notificationStrategy != null) {
+ isScheduled = notificationStrategy.getConfig().isScheduled();
+ }
+ List operationList = new LinkedList();
+ operationList.add(revokeOperationDto);
+ operationList.add(policyOperationDto);
+ List operationIds = this.lookupOperationDAO(operation).addOperations(operationList);
+ List devices = new ArrayList<>();
+ if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Control.NO_REPEAT == policyOperationDto.
+ getControl()) {
+ isNotRepeated = true;
+ }
+ //Need to happen for both revoke and new policy operation
+ addOperationMappings(authorizedDeviceList, revokeOperationDto, operationIds.get(0), isScheduledOperation,
+ isNotRepeated, isScheduled, devices);
+ sendPushNotifications(revokeOperation, operationIds.get(0), isScheduled, notificationStrategy, devices);
+ //Need to happen for both revoke and new policy operation
+ addOperationMappings(authorizedDeviceList, policyOperationDto, operationIds.get(1), isScheduledOperation,
+ isNotRepeated, isScheduled, devices);
+ sendPushNotifications(operation, operationIds.get(1), isScheduled, notificationStrategy, devices);
+ OperationManagementDAOFactory.commitTransaction();
+ } else {
+ throw new InvalidDeviceException("Invalid device Identifiers found.");
+ }
+ } catch (OperationManagementDAOException e) {
+ OperationManagementDAOFactory.rollbackTransaction();
+ throw new OperationManagementException("Error occurred while adding operation", e);
+ } catch (TransactionManagementException e) {
+ throw new OperationManagementException("Error occurred while initiating the transaction", e);
+ } finally {
+ OperationManagementDAOFactory.closeConnection();
+ }
+ }
+ private String addOperationMappings(List authorizedDeviceList, org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation operationDto, int operationId, boolean isScheduledOperation, boolean isNotRepeated, boolean isScheduled, List devices) throws OperationManagementException, OperationManagementDAOException {
+ int enrolmentId;
+ int existingTaskOperationId;//TODO have to create a sql to load device details from deviceDAO using single query.
+ String operationCode = operationDto.getCode();
+ for (DeviceIdentifier deviceId : authorizedDeviceList) {
+ Device device = getDevice(deviceId);
+ devices.add(device);
+ enrolmentId = device.getEnrolmentInfo().getId();
+ //Do not repeat the task operations
+ if (isScheduledOperation) {
+ existingTaskOperationId = operationDAO.getExistingOperationID(enrolmentId, operationCode);
+ if (existingTaskOperationId != -1) {
+ operationMappingDAO.addOperationMapping(operationId, enrolmentId, isScheduled);
+ }
+ } else if (isNotRepeated) {
+ operationDAO.updateEnrollmentOperationsStatus(enrolmentId, operationCode,
+ org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status.PENDING,
+ org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status.REPEATED);
+ operationMappingDAO.addOperationMapping(operationId, enrolmentId, isScheduled);
+ } else {
+ operationMappingDAO.addOperationMapping(operationId, enrolmentId, isScheduled);
+ }
+ }
+ return operationCode;
+ }
+ /*
+ * If notification strategy has not enable to send push notification using scheduler task we will send
+ * notification immediately. This is done in separate loop inorder to prevent overlap with DB insert
+ * operations with the possible db update operations trigger followed by pending operation call.
+ * Otherwise device may call pending operation while DB is locked for write and deadlock can occur.
+ */
+ private void sendPushNotifications(Operation operation, int operationId, boolean isScheduled, NotificationStrategy notificationStrategy, List devices) {
+ int enrolmentId;
+ if (notificationStrategy != null && !isScheduled) {
+ for (Device device : devices) {
+ DeviceIdentifier deviceId = new DeviceIdentifier(device.getDeviceIdentifier(), device.getType());
+ if (log.isDebugEnabled()) {
+ log.debug("Sending push notification to " + deviceId + " from add operation method.");
+ }
+ operation.setId(operationId);
+ operation.setActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + operationId);
+ try {
+ notificationStrategy.execute(new NotificationContext(deviceId, operation));
+ } catch (PushNotificationExecutionFailedException e) {
+ log.error("Error occurred while sending push notifications to " + deviceId.getType() +
+ " device carrying id '" + deviceId + "'", e);
+ /*
+ Reschedule if push notification failed. Doing db transactions in atomic way to prevent
+ deadlocks.
+ */
+ enrolmentId = device.getEnrolmentInfo().getId();
+ try {
+ operationMappingDAO.updateOperationMapping(operationId, enrolmentId, org.wso2.carbon
+ .device.mgt.core.dto.operation.mgt.Operation.PushNotificationStatus.SCHEDULED);
+ } catch (OperationManagementDAOException ex) {
+ // Not throwing this exception in order to keep sending remaining notifications if any.
+ log.error("Error occurred while setting push notification status to SCHEDULED.", ex);
+ }
+ }
+ }
+ }
+ }
+
+ private void sendNotification(Operation operation, Device device) {
+ NotificationStrategy notificationStrategy = getNotificationStrategy();
+ /*
+ * If notification strategy has not enable to send push notification using scheduler task we will send
+ * notification immediately. This is done in separate loop inorder to prevent overlap with DB insert
+ * operations with the possible db update operations trigger followed by pending operation call.
+ * Otherwise device may call pending operation while DB is locked for write and deadlock can occur.
+ */
+ if (notificationStrategy != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Sending push notification to " + device.getDeviceIdentifier() + " from add operation method.");
+ }
+ DeviceIdentifier deviceIdentifier = new DeviceIdentifier(device.getDeviceIdentifier(), device.getType());
+ try {
+ notificationStrategy.execute(new NotificationContext(deviceIdentifier, operation));
+ } catch (PushNotificationExecutionFailedException e) {
+ log.error("Error occurred while sending push notifications to " + device.getType() +
+ " device carrying id '" + device.getDeviceIdentifier() + "'", e);
+ /*
+ * Reschedule if push notification failed. Doing db transactions in atomic way to prevent
+ * deadlocks.
+ */
+ try {
+ operationMappingDAO.updateOperationMapping(operation.getId(), device.getEnrolmentInfo().getId(), org.wso2.carbon
+ .device.mgt.core.dto.operation.mgt.Operation.PushNotificationStatus.SCHEDULED);
+ OperationManagementDAOFactory.commitTransaction();
+ } catch (OperationManagementDAOException ex) {
+ // Not throwing this exception in order to keep sending remaining notifications if any.
+ log.error("Error occurred while setting push notification status to SCHEDULED.", ex);
+ OperationManagementDAOFactory.rollbackTransaction();
+ }
+ }
+ }
+ }
+
private List getActivityStatus(DeviceIDHolder deviceIdValidationResult, DeviceIDHolder deviceAuthResult,
String deviceType) {
List activityStatuses = new ArrayList<>();
@@ -906,6 +1076,22 @@ public class OperationManagerImpl implements OperationManager {
}
}
+ @Override
+ public List getActivitiesUpdatedAfterByUser(long timestamp, String user, int limit, int offset)
+ throws OperationManagementException {
+ try {
+ OperationManagementDAOFactory.openConnection();
+ return operationDAO.getActivitiesUpdatedAfterByUser(timestamp, user, limit, offset);
+ } catch (SQLException e) {
+ throw new OperationManagementException("Error occurred while opening a connection to the data source.", e);
+ } catch (OperationManagementDAOException e) {
+ throw new OperationManagementException("Error occurred while getting the activity list changed after a " +
+ "given time which are added by user : " + user, e);
+ } finally {
+ OperationManagementDAOFactory.closeConnection();
+ }
+ }
+
@Override
public int getActivityCountUpdatedAfter(long timestamp) throws OperationManagementException {
try {
@@ -921,6 +1107,21 @@ public class OperationManagerImpl implements OperationManager {
}
}
+ @Override
+ public int getActivityCountUpdatedAfterByUser(long timestamp, String user) throws OperationManagementException {
+ try {
+ OperationManagementDAOFactory.openConnection();
+ return operationDAO.getActivityCountUpdatedAfterByUser(timestamp, user);
+ } catch (SQLException e) {
+ throw new OperationManagementException("Error occurred while opening a connection to the data source.", e);
+ } catch (OperationManagementDAOException e) {
+ throw new OperationManagementException("Error occurred while getting the activity count changed after a " +
+ "given time which are added by user :" + user, e);
+ } finally {
+ OperationManagementDAOFactory.closeConnection();
+ }
+ }
+
private OperationDAO lookupOperationDAO(Operation operation) {
if (operation instanceof CommandOperation) {
@@ -1065,4 +1266,4 @@ public class OperationManagerImpl implements OperationManager {
private boolean isSameUser(String user, String owner) {
return user.equalsIgnoreCase(owner);
}
-}
\ No newline at end of file
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationDAO.java
index 908068b394c..a40c0c5e8f4 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationDAO.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationDAO.java
@@ -30,6 +30,8 @@ public interface OperationDAO {
int addOperation(Operation operation) throws OperationManagementDAOException;
+ List addOperations(List operations) throws OperationManagementDAOException;
+
Operation getOperation(int operationId) throws OperationManagementDAOException;
Operation getOperationByDeviceAndId(int enrolmentId, int operationId) throws OperationManagementDAOException;
@@ -54,7 +56,7 @@ public interface OperationDAO {
void updateEnrollmentOperationsStatus(int enrolmentId, String operationCode, Operation.Status existingStatus,
Operation.Status newStatus) throws OperationManagementDAOException;
- boolean updateTaskOperation(int enrolmentId, String operationCode) throws OperationManagementDAOException;
+ int getExistingOperationID(int enrolmentId, String operationCode) throws OperationManagementDAOException;
void addOperationResponse(int enrolmentId, int operationId, Object operationResponse)
throws OperationManagementDAOException;
@@ -71,8 +73,12 @@ public interface OperationDAO {
int getTotalCountOfFilteredActivities(String operationCode) throws OperationManagementDAOException;
+ List getActivitiesUpdatedAfterByUser(long timestamp, String user, int limit, int offset) throws OperationManagementDAOException;
+
int getActivityCountUpdatedAfter(long timestamp) throws OperationManagementDAOException;
+ int getActivityCountUpdatedAfterByUser(long timestamp, String user) throws OperationManagementDAOException;
+
/**
* This method provides operation mappings for given status
* @param opStatus Operation status
@@ -84,4 +90,4 @@ public interface OperationDAO {
Map> getOperationMappingsByStatus(Operation.Status opStatus, Operation.PushNotificationStatus pushNotificationStatus,
int limit) throws OperationManagementDAOException;
-}
\ No newline at end of file
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java
index 0078ce11d7f..3ea9ba1f5e5 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java
@@ -86,6 +86,37 @@ public class GenericOperationDAOImpl implements OperationDAO {
}
}
+ //This implementation has been done this way due to H2 not supporting batch inserts properly.
+ //Even though records are added in batch mode, only the id of the last added record will be returned, which is a problem.
+ public List addOperations(List operations) throws OperationManagementDAOException {
+ List ids = new LinkedList();
+ for (Operation operation : operations) {
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ Connection connection = OperationManagementDAOFactory.getConnection();
+ String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE) " +
+ "VALUES (?, ?, ?, ?)";
+ stmt = connection.prepareStatement(sql, new String[]{"id"});
+ stmt.setString(1, operation.getType().toString());
+ stmt.setTimestamp(2, new Timestamp(new Date().getTime()));
+ stmt.setTimestamp(3, null);
+ stmt.setString(4, operation.getCode());
+ stmt.executeUpdate();
+ rs = stmt.getGeneratedKeys();
+ int id = -1;
+ if (rs.next()) {
+ ids.add(rs.getInt(1));
+ }
+ } catch (SQLException e) {
+ throw new OperationManagementDAOException("Error occurred while adding operation metadata", e);
+ } finally {
+ OperationManagementDAOUtil.cleanupResources(stmt, rs);
+ }
+ }
+ return ids;
+ }
+
public boolean updateOperationStatus(int enrolmentId, int operationId, Operation.Status status)
throws OperationManagementDAOException {
PreparedStatement stmt = null;
@@ -150,14 +181,14 @@ public class GenericOperationDAOImpl implements OperationDAO {
}
@Override
- public boolean updateTaskOperation(int enrolmentId, String operationCode)
+ public int getExistingOperationID(int enrolmentId, String operationCode)
throws OperationManagementDAOException {
PreparedStatement stmt = null;
ResultSet rs = null;
- boolean result = false;
+ int result = -1;
try {
Connection connection = OperationManagementDAOFactory.getConnection();
- String query = "SELECT EOM.ID FROM DM_ENROLMENT_OP_MAPPING EOM INNER JOIN DM_OPERATION DM "
+ String query = "SELECT DM.ID FROM DM_ENROLMENT_OP_MAPPING EOM INNER JOIN DM_OPERATION DM "
+ "ON DM.ID = EOM.OPERATION_ID WHERE EOM.ENROLMENT_ID = ? AND DM.OPERATION_CODE = ? AND "
+ "EOM.STATUS = ?";
stmt = connection.prepareStatement(query);
@@ -167,7 +198,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
// This will return only one result always.
rs = stmt.executeQuery();
if (rs.next()) {
- result = true;
+ result = rs.getInt("ID");
}
} catch (SQLException e) {
throw new OperationManagementDAOException(
@@ -705,6 +736,171 @@ public class GenericOperationDAOImpl implements OperationDAO {
return 0;
}
+ @Override
+ public List getActivitiesUpdatedAfterByUser(long timestamp, String user, int limit, int offset)
+ throws OperationManagementDAOException {
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ List activities = new ArrayList<>();
+ try {
+ Connection conn = OperationManagementDAOFactory.getConnection();
+
+ int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
+ String sql = "SELECT " +
+ " opr.ENROLMENT_ID, " +
+ " opr.CREATED_TIMESTAMP, " +
+ " opr.UPDATED_TIMESTAMP, " +
+ " opr.OPERATION_ID, " +
+ " opr.OPERATION_CODE, " +
+ " opr.OPERATION_TYPE, " +
+ " opr.STATUS, " +
+ " opr.DEVICE_ID, " +
+ " opr.DEVICE_IDENTIFICATION, " +
+ " opr.DEVICE_TYPE, " +
+ " ops.RECEIVED_TIMESTAMP, " +
+ " ops.ID OP_RES_ID, " +
+ " ops.OPERATION_RESPONSE , " +
+ " opr.INITIATED_BY " +
+ " FROM " +
+ " (SELECT " +
+ " opm.ID MAPPING_ID, " +
+ " opm.ENROLMENT_ID, " +
+ " opm.CREATED_TIMESTAMP, " +
+ " opm.UPDATED_TIMESTAMP, " +
+ " opm.OPERATION_ID, " +
+ " op.OPERATION_CODE, " +
+ " op.INITIATED_BY, " +
+ " op.TYPE OPERATION_TYPE, " +
+ " opm.STATUS, " +
+ " en.DEVICE_ID, " +
+ " de.DEVICE_IDENTIFICATION, " +
+ " dt.NAME DEVICE_TYPE, " +
+ " de.TENANT_ID " +
+ " FROM" +
+ " DM_ENROLMENT_OP_MAPPING opm " +
+ " INNER JOIN DM_OPERATION op ON opm.OPERATION_ID = op.ID " +
+ " INNER JOIN DM_ENROLMENT en ON opm.ENROLMENT_ID = en.ID " +
+ " INNER JOIN DM_DEVICE de ON en.DEVICE_ID = de.ID " +
+ " INNER JOIN DM_DEVICE_TYPE dt ON dt.ID = de.DEVICE_TYPE_ID " +
+ " WHERE " +
+ " opm.UPDATED_TIMESTAMP > ? AND op.INITIATED_BY = ?" +
+ " AND de.TENANT_ID = ? " +
+ " ORDER BY opm.UPDATED_TIMESTAMP " +
+ " LIMIT ? OFFSET ?) opr " +
+ " LEFT JOIN DM_DEVICE_OPERATION_RESPONSE ops ON opr.MAPPING_ID = ops.EN_OP_MAP_ID " +
+ " WHERE " +
+ " opr.UPDATED_TIMESTAMP > ? AND opr.INITIATED_BY = ?" +
+ " AND opr.TENANT_ID = ? ";
+
+ stmt = conn.prepareStatement(sql);
+
+ stmt.setLong(1, timestamp);
+ stmt.setString(2, user);
+ stmt.setInt(3, tenantId);
+ stmt.setInt(4, limit);
+ stmt.setInt(5, offset);
+ stmt.setLong(6, timestamp);
+ stmt.setString(7, user);
+ stmt.setInt(8, tenantId);
+
+ rs = stmt.executeQuery();
+
+ int operationId = 0;
+ int enrolmentId = 0;
+ int responseId = 0;
+ Activity activity = null;
+ ActivityStatus activityStatus = null;
+ while (rs.next()) {
+
+ if (operationId != rs.getInt("OPERATION_ID")) {
+ activity = new Activity();
+ activities.add(activity);
+ List statusList = new ArrayList<>();
+ activityStatus = new ActivityStatus();
+
+ operationId = rs.getInt("OPERATION_ID");
+ enrolmentId = rs.getInt("ENROLMENT_ID");
+
+ activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
+ activity.setCreatedTimeStamp(new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
+ activity.setCode(rs.getString("OPERATION_CODE"));
+ activity.setInitiatedBy(rs.getString("INITIATED_BY"));
+
+ DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
+ deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION"));
+ deviceIdentifier.setType(rs.getString("DEVICE_TYPE"));
+ activityStatus.setDeviceIdentifier(deviceIdentifier);
+
+ activityStatus.setStatus(ActivityStatus.Status.valueOf(rs.getString("STATUS")));
+
+ List operationResponses = new ArrayList<>();
+ if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
+ activityStatus.setUpdatedTimestamp(new java.util.Date(
+ rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
+
+ }
+ if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) {
+ operationResponses.add(OperationDAOUtil.getOperationResponse(rs));
+ responseId = rs.getInt("OP_RES_ID");
+ }
+ activityStatus.setResponses(operationResponses);
+ statusList.add(activityStatus);
+ activity.setActivityStatus(statusList);
+ activity.setActivityId(OperationDAOUtil.getActivityId(rs.getInt("OPERATION_ID")));
+
+ }
+
+ if (operationId == rs.getInt("OPERATION_ID") && enrolmentId != rs.getInt("ENROLMENT_ID")) {
+ activityStatus = new ActivityStatus();
+
+ activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
+ activity.setCreatedTimeStamp(new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
+ activity.setCode(rs.getString("OPERATION_CODE"));
+
+ DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
+ deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION"));
+ deviceIdentifier.setType(rs.getString("DEVICE_TYPE"));
+ activityStatus.setDeviceIdentifier(deviceIdentifier);
+
+ activityStatus.setStatus(ActivityStatus.Status.valueOf(rs.getString("STATUS")));
+
+ List operationResponses = new ArrayList<>();
+ if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
+ activityStatus.setUpdatedTimestamp(new java.util.Date(
+ rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
+ }
+ if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) {
+ operationResponses.add(OperationDAOUtil.getOperationResponse(rs));
+ responseId = rs.getInt("OP_RES_ID");
+ }
+ activityStatus.setResponses(operationResponses);
+ activity.getActivityStatus().add(activityStatus);
+
+ enrolmentId = rs.getInt("ENROLMENT_ID");
+ }
+
+ if (rs.getInt("OP_RES_ID") != 0 && responseId != rs.getInt("OP_RES_ID")) {
+ if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) {
+ activityStatus.getResponses().add(OperationDAOUtil.getOperationResponse(rs));
+ responseId = rs.getInt("OP_RES_ID");
+ }
+ }
+ }
+ } catch (SQLException e) {
+ throw new OperationManagementDAOException("Error occurred while getting the operation details from " +
+ "the database.", e);
+ } catch (ClassNotFoundException e) {
+ throw new OperationManagementDAOException("Error occurred while converting the operation response to string.", e);
+ } catch (IOException e) {
+ throw new OperationManagementDAOException("IO exception occurred while converting the operations responses.", e);
+ } finally {
+ OperationManagementDAOUtil.cleanupResources(stmt, rs);
+ }
+
+ return activities;
+
+ }
+
@Override
public List getActivitiesUpdatedAfter(long timestamp, int limit,
@@ -888,6 +1084,40 @@ public class GenericOperationDAOImpl implements OperationDAO {
return 0;
}
+ @Override
+ public int getActivityCountUpdatedAfterByUser(long timestamp, String user) throws OperationManagementDAOException {
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ Connection conn = OperationManagementDAOFactory.getConnection();
+ String sql = "SELECT \n" +
+ " COUNT(*) AS COUNT\n" +
+ "FROM\n" +
+ " DM_ENROLMENT_OP_MAPPING AS m\n" +
+ " INNER JOIN\n" +
+ " DM_ENROLMENT AS d ON m.ENROLMENT_ID = d.ID\n" +
+ " INNER JOIN \n" +
+ " DM_OPERATION dp ON dp.ID = m.OPERATION_ID \n" +
+ "WHERE\n" +
+ " m.UPDATED_TIMESTAMP > ? AND dp.INITIATED_BY = ?\n" +
+ " AND d.TENANT_ID = ?";
+ stmt = conn.prepareStatement(sql);
+ stmt.setLong(1, timestamp);
+ stmt.setString(2, user);
+ stmt.setInt(3, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
+ rs = stmt.executeQuery();
+ if (rs.next()) {
+ return rs.getInt("COUNT");
+ }
+ } catch (SQLException e) {
+ throw new OperationManagementDAOException("Error occurred while getting the activity count from " +
+ "the database.", e);
+ } finally {
+ OperationManagementDAOUtil.cleanupResources(stmt, rs);
+ }
+ return 0;
+ }
+
@Override
public Operation getOperation(int id) throws OperationManagementDAOException {
PreparedStatement stmt = null;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java
index 7f142b7d04c..15bf7cbe65d 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java
@@ -20,6 +20,7 @@ package org.wso2.carbon.device.mgt.core.operation.mgt.dao.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation;
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.PolicyOperation;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOException;
@@ -46,7 +47,6 @@ public class PolicyOperationDAOImpl extends GenericOperationDAOImpl {
operation.setCreatedTimeStamp(new Timestamp(new java.util.Date().getTime()).toString());
operation.setId(operationId);
operation.setEnabled(true);
- PolicyOperation policyOperation = (PolicyOperation) operation;
Connection conn = OperationManagementDAOFactory.getConnection();
stmt = conn.prepareStatement("INSERT INTO DM_POLICY_OPERATION(OPERATION_ID, OPERATION_DETAILS) " +
"VALUES(?, ?)");
@@ -82,6 +82,79 @@ public class PolicyOperationDAOImpl extends GenericOperationDAOImpl {
return operationId;
}
+
+ private int addCommandOperation(int operationId, Operation operation) throws OperationManagementDAOException {
+ CommandOperation commandOp = (CommandOperation) operation;
+ PreparedStatement stmt = null;
+ try {
+ Connection conn = OperationManagementDAOFactory.getConnection();
+ stmt = conn.prepareStatement("INSERT INTO DM_COMMAND_OPERATION(OPERATION_ID, ENABLED) VALUES(?, ?)");
+ stmt.setInt(1, operationId);
+ stmt.setBoolean(2, commandOp.isEnabled());
+ stmt.executeUpdate();
+ } catch (SQLException e) {
+ throw new OperationManagementDAOException("Error occurred while adding command operation", e);
+ } finally {
+ OperationManagementDAOUtil.cleanupResources(stmt);
+ }
+ return operationId;
+ }
+ @Override
+ public List addOperations(List operations) throws OperationManagementDAOException {
+ List operationIds;
+ int counter = 0;
+ operationIds = super.addOperations(operations);
+ for(Operation operation : operations) {
+ if(operation.getType().equals(Operation.Type.COMMAND)){
+ addCommandOperation(operationIds.get(counter), operation);
+ } else if(operation.getType().equals(Operation.Type.POLICY)){
+ addPolicyOperation(operationIds.get(counter), operation);
+ }
+ counter++;
+ }
+ return operationIds;
+ }
+ private void addPolicyOperation(int operationId, Operation operation) throws OperationManagementDAOException {
+ PreparedStatement stmt = null;
+ ByteArrayOutputStream bao = null;
+ ObjectOutputStream oos = null;
+ try {
+ operation.setCreatedTimeStamp(new Timestamp(new java.util.Date().getTime()).toString());
+ operation.setId(operationId);
+ operation.setEnabled(true);
+ Connection conn = OperationManagementDAOFactory.getConnection();
+ stmt = conn.prepareStatement("INSERT INTO DM_POLICY_OPERATION(OPERATION_ID, OPERATION_DETAILS) " +
+ "VALUES(?, ?)");
+ bao = new ByteArrayOutputStream();
+ oos = new ObjectOutputStream(bao);
+ oos.writeObject(operation);
+ stmt.setInt(1, operationId);
+ stmt.setBytes(2, bao.toByteArray());
+ stmt.executeUpdate();
+ } catch (SQLException e) {
+ throw new OperationManagementDAOException("Error occurred while adding policy operation", e);
+ } catch (IOException e) {
+ throw new OperationManagementDAOException("Error occurred while serializing policy operation object", e);
+ } finally {
+ if (bao != null) {
+ try {
+ bao.close();
+ } catch (IOException e) {
+ log.warn("Error occurred while closing ByteArrayOutputStream", e);
+ }
+ }
+ if (oos != null) {
+ try {
+ oos.close();
+ } catch (IOException e) {
+ log.warn("Error occurred while closing ObjectOutputStream", e);
+ }
+ }
+ OperationManagementDAOUtil.cleanupResources(stmt);
+ }
+ }
+
+
@Override
public Operation getOperation(int operationId) throws OperationManagementDAOException {
PreparedStatement stmt = null;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java
index 23377c695cf..0aa25c8c84b 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java
@@ -375,6 +375,170 @@ public class MySQLOperationDAOImpl extends GenericOperationDAOImpl {
return activities;
}
+ @Override
+ public List getActivitiesUpdatedAfterByUser(long timestamp, String user, int limit, int offset)
+ throws OperationManagementDAOException {
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ List activities = new ArrayList<>();
+ try {
+ Connection conn = OperationManagementDAOFactory.getConnection();
+
+ int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
+ String sql = "SELECT " +
+ " opr.ENROLMENT_ID, " +
+ " opr.CREATED_TIMESTAMP, " +
+ " opr.UPDATED_TIMESTAMP, " +
+ " opr.OPERATION_ID, " +
+ " opr.OPERATION_CODE, " +
+ " opr.INITIATED_BY, " +
+ " opr.OPERATION_TYPE, " +
+ " opr.STATUS, " +
+ " opr.DEVICE_ID, " +
+ " opr.DEVICE_IDENTIFICATION, " +
+ " opr.DEVICE_TYPE, " +
+ " ops.RECEIVED_TIMESTAMP, " +
+ " ops.ID OP_RES_ID, " +
+ " ops.OPERATION_RESPONSE " +
+ " FROM " +
+ " (SELECT " +
+ " opm.ID MAPPING_ID, " +
+ " opm.ENROLMENT_ID, " +
+ " opm.CREATED_TIMESTAMP, " +
+ " opm.UPDATED_TIMESTAMP, " +
+ " opm.OPERATION_ID, " +
+ " op.OPERATION_CODE, " +
+ " op.INITIATED_BY, " +
+ " op.TYPE OPERATION_TYPE, " +
+ " opm.STATUS, " +
+ " en.DEVICE_ID, " +
+ " de.DEVICE_IDENTIFICATION, " +
+ " dt.NAME DEVICE_TYPE, " +
+ " de.TENANT_ID " +
+ " FROM" +
+ " DM_ENROLMENT_OP_MAPPING opm FORCE INDEX (IDX_ENROLMENT_OP_MAPPING) " +
+ " INNER JOIN DM_OPERATION op ON opm.OPERATION_ID = op.ID " +
+ " INNER JOIN DM_ENROLMENT en ON opm.ENROLMENT_ID = en.ID " +
+ " INNER JOIN DM_DEVICE de ON en.DEVICE_ID = de.ID " +
+ " INNER JOIN DM_DEVICE_TYPE dt ON dt.ID = de.DEVICE_TYPE_ID " +
+ " WHERE" +
+ " opm.UPDATED_TIMESTAMP > ? AND op.INITIATED_BY = ?" +
+ " AND de.TENANT_ID = ? " +
+ " ORDER BY opm.UPDATED_TIMESTAMP " +
+ " LIMIT ? OFFSET ?) opr " +
+ " LEFT JOIN DM_DEVICE_OPERATION_RESPONSE ops ON opr.MAPPING_ID = ops.EN_OP_MAP_ID " +
+ " WHERE " +
+ " opr.UPDATED_TIMESTAMP > ? AND opr.INITIATED_BY = ? " +
+ " AND opr.TENANT_ID = ? ";
+
+ stmt = conn.prepareStatement(sql);
+
+ stmt.setLong(1, timestamp);
+ stmt.setString(2, user);
+ stmt.setInt(3, tenantId);
+ stmt.setInt(4, limit);
+ stmt.setInt(5, offset);
+ stmt.setLong(6, timestamp);
+ stmt.setString(7, user);
+ stmt.setInt(8, tenantId);
+
+ rs = stmt.executeQuery();
+
+ int operationId = 0;
+ int enrolmentId = 0;
+ int responseId = 0;
+ Activity activity = null;
+ ActivityStatus activityStatus = null;
+ while (rs.next()) {
+
+ if (operationId != rs.getInt("OPERATION_ID")) {
+ activity = new Activity();
+ activities.add(activity);
+ List statusList = new ArrayList<>();
+ activityStatus = new ActivityStatus();
+
+ operationId = rs.getInt("OPERATION_ID");
+ enrolmentId = rs.getInt("ENROLMENT_ID");
+
+ activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
+ activity.setCreatedTimeStamp(new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
+ activity.setCode(rs.getString("OPERATION_CODE"));
+ activity.setInitiatedBy(rs.getString("INITIATED_BY"));
+
+ DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
+ deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION"));
+ deviceIdentifier.setType(rs.getString("DEVICE_TYPE"));
+ activityStatus.setDeviceIdentifier(deviceIdentifier);
+
+ activityStatus.setStatus(ActivityStatus.Status.valueOf(rs.getString("STATUS")));
+
+ List operationResponses = new ArrayList<>();
+ if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
+ activityStatus.setUpdatedTimestamp(new java.util.Date(
+ rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
+
+ }
+ if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) {
+ operationResponses.add(OperationDAOUtil.getOperationResponse(rs));
+ responseId = rs.getInt("OP_RES_ID");
+ }
+ activityStatus.setResponses(operationResponses);
+ statusList.add(activityStatus);
+ activity.setActivityStatus(statusList);
+ activity.setActivityId(OperationDAOUtil.getActivityId(rs.getInt("OPERATION_ID")));
+
+ }
+
+ if (operationId == rs.getInt("OPERATION_ID") && enrolmentId != rs.getInt("ENROLMENT_ID")) {
+ activityStatus = new ActivityStatus();
+
+ activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
+ activity.setCreatedTimeStamp(new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
+ activity.setCode(rs.getString("OPERATION_CODE"));
+ activity.setInitiatedBy(rs.getString("INITIATED_BY"));
+
+ DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
+ deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION"));
+ deviceIdentifier.setType(rs.getString("DEVICE_TYPE"));
+ activityStatus.setDeviceIdentifier(deviceIdentifier);
+
+ activityStatus.setStatus(ActivityStatus.Status.valueOf(rs.getString("STATUS")));
+
+ List operationResponses = new ArrayList<>();
+ if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
+ activityStatus.setUpdatedTimestamp(new java.util.Date(
+ rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
+ }
+ if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) {
+ operationResponses.add(OperationDAOUtil.getOperationResponse(rs));
+ responseId = rs.getInt("OP_RES_ID");
+ }
+ activityStatus.setResponses(operationResponses);
+ activity.getActivityStatus().add(activityStatus);
+
+ enrolmentId = rs.getInt("ENROLMENT_ID");
+ }
+
+ if (rs.getInt("OP_RES_ID") != 0 && responseId != rs.getInt("OP_RES_ID")) {
+ if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) {
+ activityStatus.getResponses().add(OperationDAOUtil.getOperationResponse(rs));
+ responseId = rs.getInt("OP_RES_ID");
+ }
+ }
+ }
+ } catch (SQLException e) {
+ throw new OperationManagementDAOException("Error occurred while getting the operation details from " +
+ "the database.", e);
+ } catch (ClassNotFoundException e) {
+ throw new OperationManagementDAOException("Error occurred while converting the operation response to string.", e);
+ } catch (IOException e) {
+ throw new OperationManagementDAOException("IO exception occurred while converting the operations responses.", e);
+ } finally {
+ OperationManagementDAOUtil.cleanupResources(stmt, rs);
+ }
+ return activities;
+ }
+
private Integer[] getIntArrayOfActivityIds(List activityIds) {
Integer[] arr = new Integer[activityIds.size()];
int x = 0;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java
index 96967441d0e..4c27f08efd1 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java
@@ -33,6 +33,7 @@ import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
+import org.wso2.carbon.device.mgt.common.policy.mgt.Policy;
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationExecutionFailedException;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
@@ -542,6 +543,10 @@ public interface DeviceManagementProviderService {
Activity addOperation(String type, Operation operation,
List devices) throws OperationManagementException, InvalidDeviceException;
+ void addPolicyOperations(String type, Policy policy,
+ List devices) throws OperationManagementException, InvalidDeviceException;
+
+
List extends Operation> getOperations(DeviceIdentifier deviceId) throws OperationManagementException;
PaginationResult getOperations(DeviceIdentifier deviceId,
@@ -577,8 +582,12 @@ public interface DeviceManagementProviderService {
int getTotalCountOfFilteredActivities(String operationCode) throws OperationManagementException;
+ List getActivitiesUpdatedAfterByUser(long timestamp, String user, int limit, int offset) throws OperationManagementException;
+
int getActivityCountUpdatedAfter(long timestamp) throws OperationManagementException;
+ int getActivityCountUpdatedAfterByUser(long timestamp, String user) throws OperationManagementException;
+
List getMonitoringOperationList(String deviceType);
int getDeviceMonitoringFrequency(String deviceType);
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
index b9e309b54b2..d5170a620d2 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
@@ -58,6 +58,7 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
+import org.wso2.carbon.device.mgt.common.policy.mgt.Policy;
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationExecutionFailedException;
import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationSubscriber;
@@ -1430,6 +1431,12 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
return pluginRepository.getOperationManager(type, this.getTenantId()).addOperation(operation, devices);
}
+ @Override
+ public void addPolicyOperations(String type, Policy policy,
+ List devices) throws OperationManagementException, InvalidDeviceException {
+ pluginRepository.getOperationManager(type, this.getTenantId()).addOperationsForPolicyRevoke(policy, devices);
+ }
+
@Override
public List extends Operation> getOperations(DeviceIdentifier deviceId) throws OperationManagementException {
return pluginRepository.getOperationManager(deviceId.getType(), this.getTenantId()).getOperations(deviceId);
@@ -1563,11 +1570,22 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
return DeviceManagementDataHolder.getInstance().getOperationManager().getTotalCountOfFilteredActivities(operationCode);
}
+ @Override
+ public List getActivitiesUpdatedAfterByUser(long timestamp, String user, int limit, int offset) throws OperationManagementException {
+ limit = DeviceManagerUtil.validateActivityListPageSize(limit);
+ return DeviceManagementDataHolder.getInstance().getOperationManager().getActivitiesUpdatedAfterByUser(timestamp, user, limit, offset);
+ }
+
@Override
public int getActivityCountUpdatedAfter(long timestamp) throws OperationManagementException {
return DeviceManagementDataHolder.getInstance().getOperationManager().getActivityCountUpdatedAfter(timestamp);
}
+ @Override
+ public int getActivityCountUpdatedAfterByUser(long timestamp, String user) throws OperationManagementException {
+ return DeviceManagementDataHolder.getInstance().getOperationManager().getActivityCountUpdatedAfterByUser(timestamp, user);
+ }
+
@Override
public List getMonitoringOperationList(String deviceType) {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml
index eab1586373f..2d2c40b3b48 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml
@@ -22,7 +22,7 @@
device-mgt
org.wso2.carbon.devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml
index 136d8c91f9f..8aec5fcc0da 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml
@@ -22,7 +22,7 @@
device-mgt
org.wso2.carbon.devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json
index 6a59e99d0fa..406dde9f3a0 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json
@@ -5,8 +5,8 @@
"managerHTTPSURL": "https://%iot.manager.host%:%iot.manager.https.port%",
"httpsURL": "https://%iot.gateway.host%:%iot.gateway.https.port%",
"httpURL": "http://%iot.gateway.host%:%iot.gateway.http.port%",
- "wssURL": "https://%iot.analytics.host%:%iot.analytics.https.port%",
- "remoteSessionWSURL": "https://%iot.core.host%:%iot.core.https.port%",
+ "wssURL": "https://%iot.core.host%:%iot.core.https.port%",
+ "remoteSessionWSURL": "https://%iot.manager.host%:%iot.manager.https.port%",
"portalURL": "https://%iot.analytics.host%:%iot.analytics.https.port%",
"dashboardServerURL": "%https.ip%",
"androidAgentDownloadURL": "%https.ip%/devicemgt/public/cdmf.unit.device.type.android.type-view/assets/android-agent.apk",
@@ -56,7 +56,7 @@
"roleNameHelpMsg": "should be in minimum 3 characters long and do not include any whitespaces."
},
"generalConfig": {
- "host": "%http.ip%",
+ "host": "https://%iot.manager.host%:%iot.manager.https.port%",
"companyName": "WSO2 Carbon Device Manager",
"browserTitle": "WSO2 Device Manager",
"copyrightPrefix": "\u00A9 %date-year%, ",
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/analytics-view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/analytics-view.js
index cfefa850e02..a13b87502f8 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/analytics-view.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/analytics-view.js
@@ -43,14 +43,14 @@ function onRequest(context) {
if (tokenPair) {
token = tokenPair.accessToken;
}
- websocketEndpoint = websocketEndpoint + "/secured-websocket/iot.per.device.stream." + tenantDomain + "." + device.type + "/1.0.0?"
+ websocketEndpoint = websocketEndpoint + "/secured-websocket-proxy/secured-websocket/iot.per.device.stream." + tenantDomain + "." + device.type + "/1.0.0?"
+ "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token;
} else {
var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username + "@" + tenantDomain,"default", {});
if (tokenPair) {
token = tokenPair.accessToken;
}
- websocketEndpoint = websocketEndpoint + "/secured-websocket" + "/t/" + tenantDomain + "/iot.per.device.stream." + tenantDomain
+ websocketEndpoint = websocketEndpoint + "/secured-websocket-proxy/secured-websocket/t/" + tenantDomain + "/iot.per.device.stream." + tenantDomain
+ "." + device.type + "/1.0.0?" + "deviceId=" + device.deviceIdentifier + "&deviceType="
+ device.type + "&websocketToken=" + token;
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.footer/footer.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.footer/footer.hbs
index 2a6e296cc4b..5dc662d3dbb 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.footer/footer.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.footer/footer.hbs
@@ -17,8 +17,8 @@
}}
{{#zone "footer"}}
- WSO2 IoT Server{{#unless isCloud}} 3.2.0{{/unless}}
- WSO2 IoT Server{{#unless isCloud}} 3.2.0{{/unless}} | © ,
+ WSO2 IoT Server{{#unless isCloud}} 3.3.1{{/unless}}
+ WSO2 IoT Server{{#unless isCloud}} 3.3.1{{/unless}} | © ,
Inc. All Rights Reserved.
{{/zone}}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js
index de15fc40e46..b44eb2be496 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js
@@ -37,14 +37,14 @@ function onRequest(context) {
tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username,"default", {});
if (tokenPair) {
token = tokenPair.accessToken;
- wsEndpoint = devicemgtProps["wssURL"].replace("https", "wss") + "/secured-websocket/";
+ wsEndpoint = devicemgtProps["wssURL"].replace("https", "wss") + "/secured-websocket-proxy/secured-websocket/";
}
} else {
tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username + "@" +
context.user.domain, "default", {});
if (tokenPair) {
token = tokenPair.accessToken;
- wsEndpoint = devicemgtProps["wssURL"].replace("https", "wss") + "/secured-websocket/t/" +
+ wsEndpoint = devicemgtProps["wssURL"].replace("https", "wss") + "/secured-websocket-proxy/secured-websocket/t/" +
context.user.domain + "/";
}
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/application_options.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/application_options.js
index cd1915e67a9..8b18b96158b 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/application_options.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/application_options.js
@@ -32,7 +32,7 @@ var ApplicationOptions = {
CEP_WEB_SOCKET_OUTPUT_ADAPTOR_NAME: 'iot.per.device.stream.geo.FusedSpatialEvent',
CEP_ON_ALERT_WEB_SOCKET_OUTPUT_ADAPTOR_NAME: 'org.wso2.geo.AlertsNotifications',
CEP_Traffic_STREAM_WEB_SOCKET_OUTPUT_ADAPTOR_NAME: 'DefaultWebsocketOutputAdaptorOnTrafficStream',
- CEP_WEB_SOCKET_OUTPUT_ADAPTOR_WEBAPP_NAME: 'secured-websocket',
+ CEP_WEB_SOCKET_OUTPUT_ADAPTOR_WEBAPP_NAME: 'secured-websocket-proxy',
TENANT_INDEX: 't',
COLON : ':',
PATH_SEPARATOR : '/',
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/geo-devices.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/geo-devices.js
index eddb14ea91b..9db76cedadf 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/geo-devices.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/geo-devices.js
@@ -38,13 +38,13 @@ function onRequest(context) {
tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username,"default", {});
if (tokenPair) {
token = tokenPair.accessToken;
- wsEndpoint = devicemgtProps["wssURL"].replace("https", "wss") + "/secured-websocket/";
+ wsEndpoint = devicemgtProps["wssURL"].replace("https", "wss") + "/secured-websocket-proxy/secured-websocket/";
}
} else {
tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username + "@" + context.user.domain,"default", {});
if (tokenPair) {
token = tokenPair.accessToken;
- wsEndpoint = devicemgtProps["wssURL"].replace("https", "wss") + "/secured-websocket/t/"+context.user.domain+"/";
+ wsEndpoint = devicemgtProps["wssURL"].replace("https", "wss") + "/secured-websocket-proxy/secured-websocket/t/"+context.user.domain+"/";
}
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/application_options.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/application_options.js
index 2ca6536b452..bba55e27002 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/application_options.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-devices/public/js/application_options.js
@@ -32,7 +32,7 @@ var ApplicationOptions = {
CEP_WEB_SOCKET_OUTPUT_ADAPTOR_NAME: 'iot.per.device.stream.geo.FusedSpatialEvent',
CEP_ON_ALERT_WEB_SOCKET_OUTPUT_ADAPTOR_NAME: 'org.wso2.geo.AlertsNotifications',
CEP_Traffic_STREAM_WEB_SOCKET_OUTPUT_ADAPTOR_NAME: 'DefaultWebsocketOutputAdaptorOnTrafficStream',
- CEP_WEB_SOCKET_OUTPUT_ADAPTOR_WEBAPP_NAME: 'secured-websocket',
+ CEP_WEB_SOCKET_OUTPUT_ADAPTOR_WEBAPP_NAME: 'secured-websocket-proxy',
TENANT_INDEX: 't',
COLON : ':',
PATH_SEPARATOR : '/',
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.hbs
index a5127d5622f..f981d80ffc7 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.hbs
@@ -17,8 +17,8 @@
}}
{{#zone "footer"}}
- WSO2 IoT Server 3.2.0
- WSO2 IoT Server 3.2.0 | © ,
+ WSO2 IoT Server 3.3.1
+ WSO2 IoT Server 3.3.1 | © ,
Inc. All Rights Reserved.
{{/zone}}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml
index bd7ff13ac44..efce704909b 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml
@@ -23,7 +23,7 @@
device-mgt
org.wso2.carbon.devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/pom.xml
index 5b18baf745f..4db9aba1092 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/pom.xml
@@ -22,7 +22,7 @@
device-mgt
org.wso2.carbon.devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml
index 7ec456690fa..956cecaab09 100644
--- a/components/device-mgt/pom.xml
+++ b/components/device-mgt/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
@@ -41,6 +41,7 @@
org.wso2.carbon.device.mgt.v09.api
org.wso2.carbon.device.mgt.analytics.data.publisher
org.wso2.carbon.device.mgt.url.printer
+ org.wso2.carbon.device.mgt.analytics.wsproxy
diff --git a/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml b/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml
index 165a0031361..6b0cf581e56 100644
--- a/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml
+++ b/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
email-sender
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/components/email-sender/pom.xml b/components/email-sender/pom.xml
index 3128e1d5359..71457804e7a 100644
--- a/components/email-sender/pom.xml
+++ b/components/email-sender/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml
index 11a8a6b89e2..64740b93fb0 100644
--- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml
+++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml
@@ -22,13 +22,13 @@
org.wso2.carbon.devicemgt
identity-extensions
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.device.mgt.oauth.extensions
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
bundle
WSO2 Carbon - OAuth Extensions
http://wso2.org
diff --git a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml
index f4398939c9d..f31f23be368 100644
--- a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml
+++ b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml
@@ -21,7 +21,7 @@
identity-extensions
org.wso2.carbon.devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
4.0.0
diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml
index a3bfc5c39e0..f226f70e1f1 100644
--- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml
+++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
identity-extensions
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml
index 1978500c005..f8df563ab36 100644
--- a/components/identity-extensions/pom.xml
+++ b/components/identity-extensions/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
diff --git a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml
index fa505e75f5a..ade03b5551b 100644
--- a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml
+++ b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
policy-mgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.devicemgt
org.wso2.carbon.complex.policy.decision.point
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
bundle
WSO2 Carbon - Policy Decision Point
WSO2 Carbon - Policy Decision Point
diff --git a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml
index df4a1d4e53b..4af9ff57237 100644
--- a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml
+++ b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml
@@ -3,14 +3,14 @@
org.wso2.carbon.devicemgt
policy-mgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.devicemgt
org.wso2.carbon.policy.decision.point
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
bundle
WSO2 Carbon - Policy Decision Point
WSO2 Carbon - Policy Decision Point
diff --git a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml
index b0420139bd0..1f664458e5b 100644
--- a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml
+++ b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml
@@ -3,7 +3,7 @@
org.wso2.carbon.devicemgt
policy-mgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
@@ -11,7 +11,7 @@
4.0.0
org.wso2.carbon.devicemgt
org.wso2.carbon.policy.information.point
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
bundle
WSO2 Carbon - Policy Information Point
WSO2 Carbon - Policy Information Point
diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml
index 4e2f3e57801..6b117fe4211 100644
--- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml
+++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
policy-mgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.devicemgt
org.wso2.carbon.policy.mgt.common
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
bundle
WSO2 Carbon - Policy Management Common
WSO2 Carbon - Policy Management Common
diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml
index 53436fc9591..d0e55b8c065 100644
--- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml
+++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
policy-mgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.devicemgt
org.wso2.carbon.policy.mgt.core
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
bundle
WSO2 Carbon - Policy Management Core
WSO2 Carbon - Policy Management Core
diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegator.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegator.java
index aac07ce6000..c603be7d842 100644
--- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegator.java
+++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegator.java
@@ -33,4 +33,7 @@ public interface PolicyEnforcementDelegator {
void addPolicyRevokeOperation(List deviceIdentifiers) throws PolicyDelegationException;
+ void revokePolicyOperation(List deviceIdentifiers, Policy policy) throws PolicyDelegationException;
+
+
}
diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java
index fa02314460f..7471b7ae9f4 100644
--- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java
+++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java
@@ -81,8 +81,7 @@ public class PolicyEnforcementDelegatorImpl implements PolicyEnforcementDelegato
*/
if (devicePolicy == null || devicePolicy.getId() != policy.getId() || updatedPolicyIds.contains
(policy.getId())) {
- this.addPolicyRevokeOperation(deviceIdentifiers);
- this.addPolicyOperation(deviceIdentifiers, policy);
+ this.revokePolicyOperation(deviceIdentifiers, policy);
}
} else {
//This means all the applicable policies have been removed from device. Hence calling a policy revoke.
@@ -167,6 +166,27 @@ public class PolicyEnforcementDelegatorImpl implements PolicyEnforcementDelegato
return policyRevokeOperation;
}
+ @Override
+ public void revokePolicyOperation(List deviceIdentifiers, Policy policy) throws
+ PolicyDelegationException {
+ try {
+ String type = null;
+ if (deviceIdentifiers.size() > 0) {
+ type = deviceIdentifiers.get(0).getType();
+ }
+ PolicyManagementDataHolder.getInstance().getDeviceManagementService().addPolicyOperations(type, policy,
+ deviceIdentifiers);
+ } catch (InvalidDeviceException e) {
+ String msg = "Invalid DeviceIdentifiers found.";
+ log.error(msg, e);
+ throw new PolicyDelegationException(msg, e);
+ } catch (OperationManagementException e) {
+ String msg = "Error occurred while adding the operation to device.";
+ log.error(msg, e);
+ throw new PolicyDelegationException(msg, e);
+ }
+ }
+
/**
* Provides the applied policy for give device
*
diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml
index d10a353cb0e..fe86127fcc6 100644
--- a/components/policy-mgt/pom.xml
+++ b/components/policy-mgt/pom.xml
@@ -23,13 +23,13 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
4.0.0
policy-mgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
pom
WSO2 Carbon - Policy Management Component
http://wso2.org
diff --git a/components/test-coverage/pom.xml b/components/test-coverage/pom.xml
index 27f904b310e..bdd3c31c121 100644
--- a/components/test-coverage/pom.xml
+++ b/components/test-coverage/pom.xml
@@ -21,7 +21,7 @@
carbon-devicemgt
org.wso2.carbon.devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
4.0.0
diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml
index 3c4bc0c3be5..2abd6ce664f 100644
--- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml
+++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml
@@ -21,14 +21,14 @@
org.wso2.carbon.devicemgt
webapp-authenticator-framework
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.devicemgt
org.wso2.carbon.webapp.authenticator.framework
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
bundle
WSO2 Carbon - Web Application Authenticator Framework Bundle
WSO2 Carbon - Web Application Authenticator Framework Bundle
diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml
index 16429f6b033..84b26e6ff97 100644
--- a/components/webapp-authenticator-framework/pom.xml
+++ b/components/webapp-authenticator-framework/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
4.0.0
org.wso2.carbon.devicemgt
webapp-authenticator-framework
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
pom
WSO2 Carbon - Webapp Authenticator Framework
http://wso2.org
diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml
index ef9ee953dff..c274e075f43 100644
--- a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml
+++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml
@@ -21,14 +21,14 @@
org.wso2.carbon.devicemgt
apimgt-extensions-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.apimgt.application.extension.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - API Management Application Extension Feature
http://wso2.org
This feature contains an implementation of a api application registration, which takes care of subscription
diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml
index 020e7e41319..1c6417c2fc4 100644
--- a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml
+++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
apimgt-extensions-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.apimgt.handler.server.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - Device Management - APIM handler Server Feature
http://wso2.org
This feature contains the handler for the api authentications
diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml
index a2a856c92cf..e840d193cf7 100644
--- a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml
+++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml
@@ -21,13 +21,13 @@
org.wso2.carbon.devicemgt
apimgt-extensions-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.apimgt.integration.client.feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
pom
WSO2 Carbon - APIM Integration Client Feature
http://wso2.org
diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml
index d58b098ed8a..166063800f2 100644
--- a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml
+++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml
@@ -21,14 +21,14 @@
org.wso2.carbon.devicemgt
apimgt-extensions-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.apimgt.webapp.publisher.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - API Management Webapp Publisher Feature
http://wso2.org
This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing
diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml
index 43cc7ec3bc1..745a2a13c16 100644
--- a/features/apimgt-extensions/pom.xml
+++ b/features/apimgt-extensions/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
4.0.0
org.wso2.carbon.devicemgt
apimgt-extensions-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
pom
WSO2 Carbon - API Management Extensions Feature
http://wso2.org
diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml
index 86ce3dd5c14..47566f02fd4 100644
--- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml
+++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
certificate-mgt-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml
index 30fd9d28b98..5bd2da78e22 100644
--- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml
+++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
certificate-mgt-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml
index bdc83d82baa..a33d6301bf9 100644
--- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml
+++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
certificate-mgt-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.certificate.mgt.server.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - Certificate Management Server Feature
http://wso2.org
This feature contains the core bundles required for back-end Certificate Management functionality
diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml
index abd1046616c..53270854fbe 100644
--- a/features/certificate-mgt/pom.xml
+++ b/features/certificate-mgt/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
4.0.0
org.wso2.carbon.devicemgt
certificate-mgt-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
pom
WSO2 Carbon - Certificate Management Feature
http://wso2.org
diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml
index 970d029acf8..1345a8c8934 100644
--- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml
+++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
device-mgt-extensions-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - Device Type Deployer Feature
http://wso2.org
WSO2 Carbon - Device Type Deployer Feature
diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml
index c61b38a9340..ab9703cad27 100644
--- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml
+++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
device-mgt-extensions-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - FCM Based Push Notification Provider Feature
http://wso2.org
WSO2 Carbon - MQTT Based Push Notification Provider Feature
diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml
index ddd5573447e..e5d2eaf644f 100644
--- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml
+++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
device-mgt-extensions-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - MQTT Based Push Notification Provider Feature
http://wso2.org
WSO2 Carbon - MQTT Based Push Notification Provider Feature
diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml
index 6f782cc2c06..1e045ac88a0 100644
--- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml
+++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
device-mgt-extensions-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - MQTT Based Push Notification Provider Feature
http://wso2.org
WSO2 Carbon - MQTT Based Push Notification Provider Feature
diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml
index 299d02fa117..391d971aa81 100644
--- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml
+++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
device-mgt-extensions-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - XMPP Based Push Notification Provider Feature
http://wso2.org
WSO2 Carbon - XMPP Based Push Notification Provider Feature
diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml
index 8275b908b39..a6d152ad1d5 100644
--- a/features/device-mgt-extensions/pom.xml
+++ b/features/device-mgt-extensions/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/src/main/resources/p2.inf b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/src/main/resources/p2.inf
deleted file mode 100644
index 70f1acd33f8..00000000000
--- a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/src/main/resources/p2.inf
+++ /dev/null
@@ -1,2 +0,0 @@
-instructions.configure = \
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.analytics.data.publisher_${feature.version}/conf/device-analytics-config.xml,target:${installFolder}/../../conf/etc/device-analytics-config.xml,overwrite:true);\
\ No newline at end of file
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.feature/pom.xml
similarity index 74%
rename from features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml
rename to features/device-mgt/org.wso2.carbon.device.mgt.analytics.feature/pom.xml
index f59d768e6c4..ada5e767487 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.feature/pom.xml
@@ -1,6 +1,6 @@
+ true
- false
- tcp://localhost:7612
+ tcp://${iot.analytics.host}:${iot.analytics.thrift.port}
+
+ wss://${iot.analytics.host}:${iot.analytics.https.port}
admin
admin
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.feature/src/main/resources/p2.inf b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.feature/src/main/resources/p2.inf
new file mode 100644
index 00000000000..a0a1b3d0058
--- /dev/null
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.feature/src/main/resources/p2.inf
@@ -0,0 +1,4 @@
+instructions.configure = \
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.analytics_${feature.version}/conf/device-analytics-config.xml,target:${installFolder}/../../conf/etc/device-analytics-config.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.analytics_${feature.version}/webapps/secured-websocket-proxy.war,target:${installFolder}/../../deployment/server/webapps/secured-websocket-proxy.war,overwrite:true);\
\ No newline at end of file
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml
index b34626ff573..8866f6a624b 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
device-mgt-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml
index bf9b2075ac2..fce238a85b6 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
device-mgt-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml
index cb9ec56f1ee..d022f0a089b 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml
@@ -4,14 +4,14 @@
org.wso2.carbon.devicemgt
device-mgt-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.device.mgt.extensions.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - Device Management Extensions Feature
http://wso2.org
This feature contains common extensions used by key device management functionalities
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml
index 0d730bc030a..2cb920b0963 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
device-mgt-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml
index 1a565a139b2..6ce6a14b886 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
device-mgt-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.device.mgt.server.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - Device Management Server Feature
http://wso2.org
This feature contains the core bundles required for Back-end Device Management functionality
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml
index bf0aae0b0b0..411739ea506 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
device-mgt-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml
index fe70581b8a9..9c13ebb88f7 100644
--- a/features/device-mgt/pom.xml
+++ b/features/device-mgt/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
@@ -39,7 +39,7 @@
org.wso2.carbon.device.mgt.api.feature
org.wso2.carbon.device.mgt.feature
org.wso2.carbon.device.mgt.extensions.feature
- org.wso2.carbon.device.mgt.analytics.data.publisher.feature
+ org.wso2.carbon.device.mgt.analytics.feature
diff --git a/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml b/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml
index 7b373067dde..d2306d35f53 100644
--- a/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml
+++ b/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
email-sender-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.email.sender.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - Email Sender Feature
http://wso2.org
This feature contains the core bundles required for email sender related functionality
diff --git a/features/email-sender/pom.xml b/features/email-sender/pom.xml
index 8dc9237d46d..27a19920d64 100644
--- a/features/email-sender/pom.xml
+++ b/features/email-sender/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
4.0.0
org.wso2.carbon.devicemgt
email-sender-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
pom
WSO2 Carbon - Email Sender Feature
http://wso2.org
diff --git a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml
index 9136c38f147..3bb5043ccbe 100644
--- a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml
+++ b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml
@@ -23,14 +23,14 @@
org.wso2.carbon.devicemgt
jwt-client-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.identity.jwt.client.extension.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - JWT Client Feature
http://wso2.org
This feature contains jwt client implementation from which we can get a access token using the jwt
diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml
index d8c03de017a..79c53c0d2fd 100644
--- a/features/jwt-client/pom.xml
+++ b/features/jwt-client/pom.xml
@@ -23,13 +23,13 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
4.0.0
jwt-client-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
pom
WSO2 Carbon - JWT Client Extension Feature
http://wso2.org
diff --git a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml
index d71e5f9c69e..2b06e5c5ff0 100644
--- a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml
+++ b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml
@@ -23,14 +23,14 @@
org.wso2.carbon.devicemgt
oauth-extensions-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.device.mgt.oauth.extensions.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - Device Mgt OAuth Extensions Feature
http://wso2.org
This feature contains devicemgt related OAuth extensions
diff --git a/features/oauth-extensions/pom.xml b/features/oauth-extensions/pom.xml
index ae22ee1ad66..d183fe0bb4e 100644
--- a/features/oauth-extensions/pom.xml
+++ b/features/oauth-extensions/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
4.0.0
org.wso2.carbon.devicemgt
oauth-extensions-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
pom
WSO2 Carbon - Device Management OAuth Extensions Feature
http://wso2.org
diff --git a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml
index e7cff33fdbe..d7f2aff01bf 100644
--- a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml
+++ b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml
@@ -23,14 +23,14 @@
org.wso2.carbon.devicemgt
policy-mgt-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.policy.mgt.server.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - Policy Management Server Feature
http://wso2.org
This feature contains the core bundles required for Back-end Device Management functionality
diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml
index 2f137eadd95..2c940317d6c 100644
--- a/features/policy-mgt/pom.xml
+++ b/features/policy-mgt/pom.xml
@@ -23,14 +23,14 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
4.0.0
org.wso2.carbon.devicemgt
policy-mgt-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
pom
WSO2 Carbon - Policy Management Feature
http://wso2.org
diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml
index fc474d0f18a..1d0bd6a4a0e 100644
--- a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml
+++ b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
webapp-authenticator-framework-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../pom.xml
4.0.0
org.wso2.carbon.webapp.authenticator.framework.server.feature
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - Webapp Authenticator Framework Server Feature
http://wso2.org
This feature contains the core bundles required for Back-end Device Management functionality
diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml
index 07762e66faf..eca35681ecc 100644
--- a/features/webapp-authenticator-framework/pom.xml
+++ b/features/webapp-authenticator-framework/pom.xml
@@ -22,14 +22,14 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
../../pom.xml
4.0.0
org.wso2.carbon.devicemgt
webapp-authenticator-framework-feature
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
pom
WSO2 Carbon - Webapp Authenticator Framework Feature
http://wso2.org
diff --git a/pom.xml b/pom.xml
index 43e2268bf2d..129a80971c0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
pom
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
WSO2 Carbon - Device Management - Parent
http://wso2.org
WSO2 Connected Device Manager Components
@@ -277,6 +277,11 @@
org.wso2.carbon.device.mgt.analytics.data.publisher
${carbon.device.mgt.version}
+
+ org.wso2.carbon.devicemgt
+ org.wso2.carbon.device.mgt.analytics.wsproxy
+ ${carbon.device.mgt.version}
+
org.wso2.carbon.devicemgt
org.wso2.carbon.device.mgt.server.feature
@@ -1385,11 +1390,11 @@
provided
-
+
mysql
mysql-connector-java
- ${tomcat.version}
+ ${mysql.connector.version}
test
@@ -1735,6 +1740,19 @@
apk-parser
${net.dongliu.version}
+
+
+
+ javax.websocket
+ javax.websocket-api
+ ${javax.websocket.version}
+
+
+ org.apache.tomcat
+ tomcat-websocket-api
+ ${tomcat.websocket.version}
+ provided
+
@@ -1997,8 +2015,8 @@
1.2.140.wso2v3
- 7.0.59.wso2v1
- 7.0.59.wso2v1
+ 7.0.85.wso2v1
+ 7.0.85.wso2v1
7.0.34.wso2v2
@@ -2028,7 +2046,7 @@
1.2.11.wso2v10
- 3.1.34-SNAPSHOT
+ 3.1.40-SNAPSHOT
4.6.21
@@ -2106,8 +2124,8 @@
(3.2.0, 3.3.0]
1.8
-
- 5.1.34
+
+ 5.1.34
3.0.4.wso2v1
@@ -2179,6 +2197,10 @@
1.8
2.4.2
+
+ 7.0.85
+ 1.0
+ 1.13.1