From 62d0f3720eb8de94efa1ef730d47344b6882b260 Mon Sep 17 00:00:00 2001 From: warunalakshitha Date: Sun, 1 Oct 2017 10:49:51 +0530 Subject: [PATCH] add remote session configurations --- .../core/config/DeviceManagementConfig.java | 11 ++ .../session/RemoteSessionConfiguration.java | 102 ++++++++++++++++-- 2 files changed, 107 insertions(+), 6 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java index ae47eaf6a54..464980e3d7f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java @@ -20,6 +20,7 @@ package org.wso2.carbon.device.mgt.core.config; import org.wso2.carbon.device.mgt.core.config.geo.location.GeoLocationConfiguration; import org.wso2.carbon.device.mgt.core.config.cache.DeviceCacheConfiguration; import org.wso2.carbon.device.mgt.core.config.identity.IdentityConfigurations; +import org.wso2.carbon.device.mgt.core.config.keymanager.KeyManagerConfigurations; import org.wso2.carbon.device.mgt.core.config.pagination.PaginationConfiguration; import org.wso2.carbon.device.mgt.core.config.policy.PolicyConfiguration; import org.wso2.carbon.device.mgt.core.config.pull.notification.PullNotificationConfiguration; @@ -41,6 +42,7 @@ public final class DeviceManagementConfig { private DeviceManagementConfigRepository deviceManagementConfigRepository; private TaskConfiguration taskConfiguration; private IdentityConfigurations identityConfigurations; + private KeyManagerConfigurations keyManagerConfigurations; private PolicyConfiguration policyConfiguration; private PaginationConfiguration paginationConfiguration; private PushNotificationConfiguration pushNotificationConfiguration; @@ -71,6 +73,15 @@ public final class DeviceManagementConfig { this.identityConfigurations = identityConfigurations; } + @XmlElement(name = "KeyManagerConfiguration", required = true) + public KeyManagerConfigurations getKeyManagerConfigurations() { + return keyManagerConfigurations; + } + + public void setKeyManagerConfigurations(KeyManagerConfigurations keyManagerConfigurations) { + this.keyManagerConfigurations = keyManagerConfigurations; + } + @XmlElement(name = "PolicyConfiguration", required = true) public PolicyConfiguration getPolicyConfiguration() { return policyConfiguration; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/remote/session/RemoteSessionConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/remote/session/RemoteSessionConfiguration.java index e422d979451..426e2db3080 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/remote/session/RemoteSessionConfiguration.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/remote/session/RemoteSessionConfiguration.java @@ -28,26 +28,116 @@ import javax.xml.bind.annotation.XmlRootElement; public class RemoteSessionConfiguration { private String remoteSessionServerUrl; - private boolean isEnabled; + private boolean enabled; + private int maxHTTPConnectionPerHost; + private int maxTotalHTTPConnections; + private int maxMessagesPerSecond; + private int sessionIdleTimeOut; + private int maxSessionDuration; + private int sessionBufferSize; - @XmlElement(name = "RemoteSessionServerUrl", required = true) public void setRemoteSessionServerUrl(String remoteSessionServerUrl) { this.remoteSessionServerUrl = remoteSessionServerUrl; } + /** + * Remote session server url + * @return + */ + @XmlElement(name = "RemoteSessionServerUrl", required = true) public String getRemoteSessionServerUrl() { return remoteSessionServerUrl; } - public boolean getIsEnabled() { - return isEnabled; + /** + * Remote session enabled + * @return + */ + @XmlElement(name = "Enabled", required = true) + public boolean isEnabled() { + return enabled; } - @XmlElement(name = "isEnabled", required = true) public void setEnabled(boolean enabled) { - isEnabled = enabled; + this.enabled = enabled; + } + + /** + * Maximum connections per host for external http invocations + * @return + */ + @XmlElement(name = "MaximumHTTPConnectionPerHost", required = true, defaultValue = "2") + public int getMaxHTTPConnectionPerHost() { + return maxHTTPConnectionPerHost; } + public void setMaxHTTPConnectionPerHost(int maxHTTPConnectionPerHost) { + this.maxHTTPConnectionPerHost = maxHTTPConnectionPerHost; + } + + /** + * Maximum total connections for external http invocation + */ + @XmlElement(name = "MaximumTotalHTTPConnections", required = true, defaultValue = "100") + public int getMaxTotalHTTPConnections() { + return maxTotalHTTPConnections; + } + + public void setMaxTotalHTTPConnections(int maxTotalHTTPConnections) { + this.maxTotalHTTPConnections = maxTotalHTTPConnections; + } + + /** + * This is for protect device from message spamming. Throttling limit in term of messages for device + * @return + */ + @XmlElement(name = "MaximumMessagesPerSecond", required = true, defaultValue = "10") + public int getMaxMessagesPerSession() { + return maxMessagesPerSecond; + } + + public void setMaxMessagesPerSession(int maxMessagesPerSession) { + this.maxMessagesPerSecond = maxMessagesPerSession; + } + + /** + * Maximum idle timeout in minutes + * @return + */ + @XmlElement(name = "SessionIdleTimeOut", required = true, defaultValue = "5") + public int getSessionIdleTimeOut() { + return sessionIdleTimeOut; + } + + public void setSessionIdleTimeOut(int sessionIdleTimeOut) { + this.sessionIdleTimeOut = sessionIdleTimeOut; + } + + /** + * Maximum session duration in minutes + * @return + */ + @XmlElement(name = "MaximumSessionDuration", required = true, defaultValue = "15") + public int getMaxSessionDuration() { + return maxSessionDuration; + } + + public void setMaxSessionDuration(int maxSessionDuration) { + this.maxSessionDuration = maxSessionDuration; + } + + /** + * Maximum session buffer size in kilo bytes + * @return + */ + @XmlElement(name = "SessionBufferSize", required = true, defaultValue = "640") + public int getSessionBufferSize() { + return sessionBufferSize; + } + + public void setSessionBufferSize(int sessionBufferSize) { + this.sessionBufferSize = sessionBufferSize; + } }