Merge pull request #849 from warunalakshitha/remote-control

Fix osgi issuees and remove unwanted dependencies
revert-dabc3590
Charitha Goonetilleke 7 years ago committed by GitHub
commit 55ae9081fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -38,26 +38,6 @@
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId> <artifactId>org.wso2.carbon.logging</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.core</artifactId>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.wso2</groupId>
<artifactId>httpcore</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.orbit.org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId> <groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>org.wso2.carbon.identity.oauth.stub</artifactId> <artifactId>org.wso2.carbon.identity.oauth.stub</artifactId>
@ -66,10 +46,6 @@
<groupId>commons-pool.wso2</groupId> <groupId>commons-pool.wso2</groupId>
<artifactId>commons-pool</artifactId> <artifactId>commons-pool</artifactId>
</dependency> </dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.core</artifactId> <artifactId>org.wso2.carbon.device.mgt.core</artifactId>
@ -111,7 +87,28 @@
org.wso2.carbon.device.mgt.extensions.remote.session.* org.wso2.carbon.device.mgt.extensions.remote.session.*
</Export-Package> </Export-Package>
<Import-Package> <Import-Package>
*;resolution:=optional javax.websocket,
org.apache.axis2; version="${axis2.osgi.version.range}",
org.apache.axis2.client; version="${axis2.osgi.version.range}",
org.apache.axis2.context; version="${axis2.osgi.version.range}",
org.apache.axis2.transport.http; version="${axis2.osgi.version.range}",
org.apache.commons.httpclient,
org.apache.commons.httpclient.contrib.ssl,
org.apache.commons.httpclient.params,
org.apache.commons.httpclient.protocol,
org.apache.commons.logging,
org.apache.commons.pool,
org.apache.commons.pool.impl,
org.json,
org.osgi.framework,
org.osgi.service.component,
org.wso2.carbon.context,
org.wso2.carbon.core,
org.wso2.carbon.device.mgt.common.*,
org.wso2.carbon.device.mgt.core.*,
org.wso2.carbon.identity.oauth2.stub,
org.wso2.carbon.identity.oauth2.stub.dto,
org.wso2.carbon.utils.multitenancy
</Import-Package> </Import-Package>
</instructions> </instructions>
</configuration> </configuration>

@ -17,7 +17,6 @@
*/ */
package org.wso2.carbon.device.mgt.extensions.remote.session; package org.wso2.carbon.device.mgt.extensions.remote.session;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.json.JSONObject; import org.json.JSONObject;
@ -43,6 +42,7 @@ import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -67,7 +67,7 @@ public class RemoteSessionManagementServiceImpl implements RemoteSessionManageme
} }
// Read Query Parameters for obtain the token // Read Query Parameters for obtain the token
Map<String, List<String>> sessionQueryParam = new HashedMap(); Map<String, List<String>> sessionQueryParam = new HashMap();
List<String> sessionQueryParamList = new LinkedList<>(); List<String> sessionQueryParamList = new LinkedList<>();
sessionQueryParamList.add(session.getQueryString()); sessionQueryParamList.add(session.getQueryString());
sessionQueryParam.put(RemoteSessionConstants.QUERY_STRING, sessionQueryParamList); sessionQueryParam.put(RemoteSessionConstants.QUERY_STRING, sessionQueryParamList);
@ -94,8 +94,10 @@ public class RemoteSessionManagementServiceImpl implements RemoteSessionManageme
.isUserAuthorized(deviceIdentifier, authenticationInfo.getUsername()); .isUserAuthorized(deviceIdentifier, authenticationInfo.getUsername());
if (userAuthorized) { if (userAuthorized) {
// set common settings for session // set common settings for session
session.setMaxBinaryMessageBufferSize(RemoteSessionConstants.MAX_BUFFER_SIZE); session.setMaxBinaryMessageBufferSize(RemoteSessionManagementDataHolder.getInstance()
session.setMaxTextMessageBufferSize(RemoteSessionConstants.MAX_BUFFER_SIZE); .getMaxMessageBufferSize());
session.setMaxTextMessageBufferSize(RemoteSessionManagementDataHolder.getInstance()
.getMaxMessageBufferSize());
session.setMaxIdleTimeout(RemoteSessionManagementDataHolder.getInstance().getMaxIdleTimeout()); session.setMaxIdleTimeout(RemoteSessionManagementDataHolder.getInstance().getMaxIdleTimeout());
// if session initiated using operation id means request came from device // if session initiated using operation id means request came from device

@ -38,6 +38,7 @@ public class RemoteSessionManagementDataHolder {
private boolean isEnabled; private boolean isEnabled;
private String serverUrl; private String serverUrl;
private long maxIdleTimeout; private long maxIdleTimeout;
private int maxMessageBufferSize;
private int maxMessagesPerSecond; private int maxMessagesPerSecond;
private OAuthAuthenticator oAuthAuthenticator; private OAuthAuthenticator oAuthAuthenticator;
private Map<String, RemoteSession> activeDeviceClientSessionMap = new ConcurrentHashMap<String, RemoteSession>(); private Map<String, RemoteSession> activeDeviceClientSessionMap = new ConcurrentHashMap<String, RemoteSession>();
@ -110,4 +111,12 @@ public class RemoteSessionManagementDataHolder {
public void setMaxIdleTimeout(long maxIdleTimeout) { public void setMaxIdleTimeout(long maxIdleTimeout) {
this.maxIdleTimeout = maxIdleTimeout; this.maxIdleTimeout = maxIdleTimeout;
} }
public int getMaxMessageBufferSize() {
return maxMessageBufferSize;
}
public void setMaxMessageBufferSize(int MaxMessageBufferSize) {
this.maxMessageBufferSize = MaxMessageBufferSize;
}
} }

@ -64,6 +64,14 @@ public class RemoteSessionManagerStartupListener implements ServerStartupObserve
// Set max idle timeout in milliseconds // Set max idle timeout in milliseconds
RemoteSessionManagementDataHolder.getInstance().setMaxIdleTimeout((long) rsConfig.getSessionIdleTimeOut() * RemoteSessionManagementDataHolder.getInstance().setMaxIdleTimeout((long) rsConfig.getSessionIdleTimeOut() *
60000); 60000);
// Set max buffer size for messages.
if (rsConfig.getMaxMessageBufferSize() > 0) {
RemoteSessionManagementDataHolder.getInstance()
.setMaxMessageBufferSize(rsConfig.getMaxMessageBufferSize() * 1024);
} else {
RemoteSessionManagementDataHolder.getInstance().
setMaxMessageBufferSize(RemoteSessionConstants.MAX_BUFFER_SIZE);
}
// Set max messages per second. // Set max messages per second.
if (rsConfig.getMaxMessagesPerSession() > 0) { if (rsConfig.getMaxMessagesPerSession() > 0) {

@ -43,7 +43,7 @@
<plugin> <plugin>
<groupId>org.apache.felix</groupId> <groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId> <artifactId>maven-scr-plugin</artifactId>
<version>1.7.2</version> <version>${maven.scr.version}</version>
<executions> <executions>
<execution> <execution>
<id>generate-scr-scrdescriptor</id> <id>generate-scr-scrdescriptor</id>

Loading…
Cancel
Save