merge-requests/7/head
mharindu 10 years ago
commit 937530087d

@ -20,6 +20,7 @@ package org.wso2.carbon.device.mgt.core.operation.mgt;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
@ -195,20 +196,33 @@ public class OperationManagerImpl implements OperationManager {
}
@Override
public Operation getNextPendingOperation(DeviceIdentifier deviceId) throws OperationManagementException {
public Operation getNextPendingOperation(DeviceIdentifier deviceIdentifier) throws OperationManagementException {
if (log.isDebugEnabled()) {
log.debug("device identifier id:[" + deviceId.getId() + "] type:[" + deviceId.getType() + "]");
log.debug("device identifier id:[" + deviceIdentifier.getId() + "] type:[" + deviceIdentifier.getType() + "]");
}
Operation operation = null;
Device device;
try {
device = deviceManagementService.getCoreDevice(deviceIdentifier);
if (device == null) {
throw new OperationManagementException("Device not found for given device " +
"Identifier:" + deviceIdentifier.getId() + " and given type" + deviceIdentifier.getType());
}
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO
.getNextOperation(deviceId);
.getNextOperation(device.getId());
if (dtoOperation != null) {
operation = OperationDAOUtil.convertOperation(dtoOperation);
}
return operation;
} catch (OperationManagementDAOException e) {
} catch (DeviceManagementException deviceMgtException) {
String errorMsg = "Error occurred while retrieving the device " +
"for device Identifier type -'" + deviceIdentifier.getType() + "' and device Id '"
+ deviceIdentifier.getId();
log.error(errorMsg, deviceMgtException);
throw new OperationManagementException(errorMsg, deviceMgtException);
} catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving next pending operation", e);
}
}

@ -42,6 +42,6 @@ public interface OperationDAO {
List<? extends Operation> getOperationsForStatus(Operation.Status status) throws OperationManagementDAOException;
Operation getNextOperation(DeviceIdentifier deviceId) throws OperationManagementDAOException;
Operation getNextOperation(int deviceId) throws OperationManagementDAOException;
}

@ -462,7 +462,7 @@ public class OperationDAOImpl implements OperationDAO {
}
@Override
public Operation getNextOperation(DeviceIdentifier deviceId) throws OperationManagementDAOException {
public Operation getNextOperation(int deviceId) throws OperationManagementDAOException {
PreparedStatement stmt = null;
ResultSet rs = null;
@ -483,9 +483,9 @@ public class OperationDAOImpl implements OperationDAO {
"o.ID =po.OPERATION_ID LEFT OUTER JOIN DM_COMMAND_OPERATION co ON co.OPERATION_ID=o.ID " +
"ORDER BY o.CREATED_TIMESTAMP ASC LIMIT 1");
stmt.setString(1, deviceId.getType());
stmt.setString(2, deviceId.getId());
stmt.setString(3, Operation.Status.PENDING.toString());
stmt.setString(1, Operation.Status.PENDING.toString());
stmt.setInt(2, deviceId);
rs = stmt.executeQuery();
Operation operation = null;

@ -59,7 +59,6 @@ public class ProfileOperationDAOImpl extends OperationDAOImpl {
return operationId;
}
@Override
public Operation getNextOperation(DeviceIdentifier deviceId) throws OperationManagementDAOException {
PreparedStatement stmt = null;

@ -62,6 +62,8 @@ public interface PolicyAdministratorPoint {
List<Policy> getPolicies() throws PolicyManagementException;
Policy getPolicy(int policyId) throws PolicyManagementException;
/**
* This method gives the device specific policy.
*

@ -445,11 +445,11 @@ public class PolicyDAOImpl implements PolicyDAO {
resultSet = stmt.executeQuery();
while (resultSet.next()) {
policy.setId(policyId);
policy.setPolicyName(resultSet.getString("NAME"));
policy.setTenantId(resultSet.getInt("TENANT_ID"));
policy.setPriorityId(resultSet.getInt("PRIORITY"));
policy.setProfileId(resultSet.getInt("PROFILE_ID"));
}
return policy;

@ -83,6 +83,10 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint {
return policyManager.getPolicies();
}
@Override public Policy getPolicy(int policyId) throws PolicyManagementException {
return policyManager.getPolicy(policyId);
}
@Override
public List<Policy> getPoliciesOfDevice(DeviceIdentifier deviceIdentifier) throws PolicyManagementException {
return policyManager.getPoliciesOfDevice(deviceIdentifier);

@ -372,7 +372,7 @@ public class PolicyManagerImpl implements PolicyManager {
policyDAO.getTimesOfPolicy(policy);
policyDAO.getLocationsOfPolicy(policy);
Profile profile = profileDAO.getProfiles(policy.getProfile().getProfileId());
Profile profile = profileDAO.getProfiles(policy.getProfileId());
policy.setProfile(profile);
policy.setRoles(roleNames);

@ -140,7 +140,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
ID INT(11) NOT NULL AUTO_INCREMENT,
PROFILE_ID INT(11) NOT NULL,
FEATURE_CODE VARCHAR(10) NOT NULL,
FEATURE_CODE VARCHAR(30) NOT NULL,
DEVICE_TYPE_ID INT NOT NULL,
CONTENT BLOB NULL DEFAULT NULL,
PRIMARY KEY (ID),

@ -44,9 +44,11 @@ public class WebappAuthenticatorFrameworkValve extends CarbonTomcatValve {
case SUCCESS:
case CONTINUE:
this.getNext().invoke(request, response, compositeValve);
break;
case FAILURE:
AuthenticationFrameworkUtil.handleResponse(request, response, HttpServletResponse.SC_UNAUTHORIZED,
"Failed to authorize the incoming request");
break;
}
}

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2015, 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.
-->
<DeviceMgtConfiguration>
<ManagementRepository>
<DataSourceConfiguration>
<JndiLookupDefinition>
<Name>jdbc/DM_DS</Name>
</JndiLookupDefinition>
</DataSourceConfiguration>
<EmailClientConfiguration>
<minimumThread>8</minimumThread>
<maximumThread>100</maximumThread>
<keepAliveTime>20</keepAliveTime>
<ThreadQueueCapacity>1000</ThreadQueueCapacity>
</EmailClientConfiguration>
</ManagementRepository>
</DeviceMgtConfiguration>

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2015, 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.
-->
<LicenseConfig>
<Licenses>
<License>
<Provider>wso2</Provider>
<Name>android</Name>
<Version>1.0.0</Version>
<Language>1.0.0</Language>
<ValidFrom>01-01-2014</ValidFrom>
<ValidTo>31-12-2035</ValidTo>
<Text><![CDATA[Test License]]></Text>
</License>
<License>
<Provider>wso2</Provider>
<Name>ios</Name>
<Version>1.0.0</Version>
<Language>1.0.0</Language>
<ValidFrom>01-01-2014</ValidFrom>
<ValidTo>31-12-2035</ValidTo>
<Text><![CDATA[IOS License]]></Text>
</License>
<License>
<Provider>wso2</Provider>
<Name>windows</Name>
<Version>1.0.0</Version>
<Language>1.0.0</Language>
<ValidFrom>01-01-2014</ValidFrom>
<ValidTo>31-12-2035</ValidTo>
<Text><![CDATA[Windows License]]></Text>
</License>
</Licenses>
</LicenseConfig>

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2015, 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.
-->
<Notifications>
<EnrolmentNotifications>
<Header>Dear {title} {user-name},</Header>
<Body>You have been registered to the WSO2 MDM. Below is the link to enroll.</Body>
<Url>{downloadUrl}</Url>
<Footer>
Best Regards,
WSO2 Carbon Team
http://www.wso2.com
</Footer>
<Subject>Enrol your device with WSO2 MDM</Subject>
</EnrolmentNotifications>
</Notifications>

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2015, 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.
-->
<APIPublisherConfig>
<APIs>
<API>
<Name>appmanager</Name>
<Owner>admin</Owner>
<Context>enrollment</Context>
<Version>1.0.0</Version>
<Endpoint>http://localhost:9763/</Endpoint>
<Transports>http,https</Transports>
</API>
</APIs>
</APIPublisherConfig>

@ -0,0 +1,8 @@
<WebappAuthenticatorConfig>
<Authenticators>
<Authenticator>
<Name>OAuth</Name>
<ClassName>org.wso2.carbon.webapp.authenticator.framework.authenticator.OAuthAuthenticator</ClassName>
</Authenticator>
</Authenticators>
</WebappAuthenticatorConfig>

@ -1,7 +1,2 @@
instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/conf/cdm-config.xml,target:${installFolder}/../../conf/cdm-config.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/conf/notification-messages.xml,target:${installFolder}/../../conf/notification-messages.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/conf/license-config.xml,target:${installFolder}/../../conf/etc/license-config.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/conf/user-api-publisher-config.xml,target:${installFolder}/../../conf/etc/user-api-publisher-config.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/dbscripts/cdm,target:${installFolder}/../../../dbscripts/cdm,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/rxts/license.rxt,target:${installFolder}/../../../repository/resources/rxts/license.rxt,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.webapp.authenticator.framework.server_${feature.version}/conf/webapp-authenticator-config.xml,target:${installFolder}/../../conf/etc/webapp-authenticator-config.xml,overwrite:true);\

@ -1078,29 +1078,40 @@
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>wso2-staging</id>
<name>WSO2 Staging Repository</name>
<url>http://maven.wso2.org/nexus/content/repositories/orgwso2carbonapimgt-004/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>
</repositories>
<properties>
<testng.version>6.1.1</testng.version>
<carbon.kernel.version>4.3.0</carbon.kernel.version>
<carbon.kernel.version>4.4.0</carbon.kernel.version>
<carbon.p2.plugin.version>1.5.4</carbon.p2.plugin.version>
<maven-buildnumber-plugin.version>1.3</maven-buildnumber-plugin.version>
<!-- Axis2 -->
<axis2.osgi.version.range>[1.6.1.wso2v11, 1.7.0)</axis2.osgi.version.range>
<axis2.orbit.version>1.6.1.wso2v11</axis2.orbit.version>
<axis2-transports.version>1.1.0-wso2v10</axis2-transports.version>
<jboss-transaction-api.version>1.0.0.Final</jboss-transaction-api.version>
<carbon.p2.plugin.version>1.5.4</carbon.p2.plugin.version>
<!--Jaggery -->
<jaggery.version>0.9.0</jaggery.version>
<jaggery.extensions.version>1.0.0</jaggery.extensions.version>
<jaggery.extensions.sso.version>1.2.0</jaggery.extensions.sso.version>
<jaggery.extensions.carbon.version>1.1.0</jaggery.extensions.carbon.version>
<jaggery.extensions.test.version>1.1.0</jaggery.extensions.test.version>
<!-- Jaggery -->
<jaggery.version>0.10.0</jaggery.version>
<jaggery.extensions.version>1.3.0</jaggery.extensions.version>
<jaggery.extensions.sso.version>1.3.0</jaggery.extensions.sso.version>
<jaggery.extensions.carbon.version>1.3.0</jaggery.extensions.carbon.version>
<jaggery.extensions.test.version>1.3.0</jaggery.extensions.test.version>
<!--Testing -->
<!-- Testing -->
<automation.test.framework.version>4.3.1</automation.test.framework.version>
<automation.utils.version>4.3.0</automation.utils.version>
<testng.version>6.8</testng.version>
@ -1118,32 +1129,33 @@
<tomcat.jdbc.pooling.version>7.0.34.wso2v2</tomcat.jdbc.pooling.version>
<!-- Carbon Deployment -->
<carbon.deployment.version>4.3.1</carbon.deployment.version>
<carbon.deployment.version>4.4.0</carbon.deployment.version>
<!-- Identity -->
<carbon.identity.version>4.3.3</carbon.identity.version>
<!-- Carbon Identity -->
<carbon.identity.version>4.4.0</carbon.identity.version>
<!-- Carbon Multi-tenancy -->
<carbon.multitenancy.version>4.4.0</carbon.multitenancy.version>
<!-- Multi-tenancy -->
<carbon.multitenancy.version>4.3.3</carbon.multitenancy.version>
<!-- Carbon Registry -->
<carbon.registry.version>4.4.1</carbon.registry.version>
<!-- Registry -->
<carbon.registry.version>4.3.0</carbon.registry.version>
<!-- Carbon Governance -->
<carbon.governance.version>4.4.1</carbon.governance.version>
<!-- Governance -->
<carbon.governance.version>4.3.0</carbon.governance.version>
<!-- axis2 versions -->
<axis2-transports.version>1.1.0-wso2v10</axis2-transports.version>
<!-- Axiom -->
<axiom.version>1.2.11-wso2v5</axiom.version>
<axiom.osgi.version.range>[1.2.11.wso2v5, 1.3.0)</axiom.osgi.version.range>
<axiom.wso2.version>1.2.11.wso2v5</axiom.wso2.version>
<!-- Device Management -->
<!-- Carbon Device Management -->
<carbon.device.mgt.version>0.9.2-SNAPSHOT</carbon.device.mgt.version>
<carbon.commons.version>4.3.6</carbon.commons.version>
<!-- API Management -->
<carbon.api.mgt.version>1.3.1</carbon.api.mgt.version>
<!-- Carbon Commons -->
<carbon.commons.version>4.4.0</carbon.commons.version>
<!-- Carbon API Management -->
<carbon.api.mgt.version>1.4.0</carbon.api.mgt.version>
<!--CXF properties-->
<cxf.version>2.6.1</cxf.version>

Loading…
Cancel
Save