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 e2a56958e3..4e123090d8 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 @@ -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); } } 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 bd7699e670..07572f98c7 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 @@ -42,6 +42,6 @@ public interface OperationDAO { List getOperationsForStatus(Operation.Status status) throws OperationManagementDAOException; - Operation getNextOperation(DeviceIdentifier deviceId) throws OperationManagementDAOException; + Operation getNextOperation(int deviceId) throws OperationManagementDAOException; } 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/OperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java index 9b996e1069..fdf39f8ddf 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java @@ -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; 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/ProfileOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java index f59fe6452d..f23e77eafa 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java @@ -59,7 +59,6 @@ public class ProfileOperationDAOImpl extends OperationDAOImpl { return operationId; } - @Override public Operation getNextOperation(DeviceIdentifier deviceId) throws OperationManagementDAOException { PreparedStatement stmt = null; diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyAdministratorPoint.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyAdministratorPoint.java index 7d1e7244ab..53f8411bbc 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyAdministratorPoint.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyAdministratorPoint.java @@ -62,6 +62,8 @@ public interface PolicyAdministratorPoint { List getPolicies() throws PolicyManagementException; + Policy getPolicy(int policyId) throws PolicyManagementException; + /** * This method gives the device specific policy. * diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java index 27edad84f5..eef48b2710 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java @@ -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; diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyAdministratorPointImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyAdministratorPointImpl.java index 0029b26983..c1c8f73d92 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyAdministratorPointImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyAdministratorPointImpl.java @@ -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 getPoliciesOfDevice(DeviceIdentifier deviceIdentifier) throws PolicyManagementException { return policyManager.getPoliciesOfDevice(deviceIdentifier); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java index 811a7f087c..fb8b27c2fe 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java @@ -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); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql index a5c29692d9..ae97ac9a6e 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql @@ -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), diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/WebappAuthenticatorFrameworkValve.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/WebappAuthenticatorFrameworkValve.java index e14480d822..66982112bd 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/WebappAuthenticatorFrameworkValve.java +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/WebappAuthenticatorFrameworkValve.java @@ -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; } } diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/cdm-config.xml b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/cdm-config.xml deleted file mode 100644 index 0991207a54..0000000000 --- a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/cdm-config.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - jdbc/DM_DS - - - - 8 - 100 - 20 - 1000 - - - - diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/license-config.xml b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/license-config.xml deleted file mode 100644 index e182e58bb9..0000000000 --- a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/license-config.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - wso2 - android - 1.0.0 - 1.0.0 - 01-01-2014 - 31-12-2035 - - - - wso2 - ios - 1.0.0 - 1.0.0 - 01-01-2014 - 31-12-2035 - - - - wso2 - windows - 1.0.0 - 1.0.0 - 01-01-2014 - 31-12-2035 - - - - \ No newline at end of file diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/notification-messages.xml b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/notification-messages.xml deleted file mode 100644 index 563b4a58c0..0000000000 --- a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/notification-messages.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - -
Dear {title} {user-name},
- You have been registered to the WSO2 MDM. Below is the link to enroll. - {downloadUrl} -
-Best Regards, -WSO2 Carbon Team -http://www.wso2.com -
- Enrol your device with WSO2 MDM -
-
\ No newline at end of file diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/user-api-publisher-config.xml b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/user-api-publisher-config.xml deleted file mode 100644 index 3221092ae9..0000000000 --- a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/user-api-publisher-config.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - appmanager - admin - enrollment - 1.0.0 - http://localhost:9763/ - http,https - - - diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/webapp-authenticator-config.xml b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/webapp-authenticator-config.xml new file mode 100644 index 0000000000..d4c9638d49 --- /dev/null +++ b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/conf/webapp-authenticator-config.xml @@ -0,0 +1,8 @@ + + + + OAuth + org.wso2.carbon.webapp.authenticator.framework.authenticator.OAuthAuthenticator + + + diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/p2.inf b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/p2.inf index 36ac4e31ef..91ac161b4e 100644 --- a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/p2.inf +++ b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/src/main/resources/p2.inf @@ -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);\ \ No newline at end of file +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);\ \ No newline at end of file diff --git a/pom.xml b/pom.xml index 66efc3f230..087a6647e3 100644 --- a/pom.xml +++ b/pom.xml @@ -1078,29 +1078,40 @@ false + + wso2-staging + WSO2 Staging Repository + http://maven.wso2.org/nexus/content/repositories/orgwso2carbonapimgt-004/ + + true + daily + ignore + + 6.1.1 - 4.3.0 + 4.4.0 1.5.4 1.3 [1.6.1.wso2v11, 1.7.0) 1.6.1.wso2v11 + 1.1.0-wso2v10 1.0.0.Final 1.5.4 - - 0.9.0 - 1.0.0 - 1.2.0 - 1.1.0 - 1.1.0 + + 0.10.0 + 1.3.0 + 1.3.0 + 1.3.0 + 1.3.0 - + 4.3.1 4.3.0 6.8 @@ -1118,32 +1129,33 @@ 7.0.34.wso2v2 - 4.3.1 + 4.4.0 - - 4.3.3 + + 4.4.0 + + 4.4.0 - - 4.3.3 + + 4.4.1 - - 4.3.0 + + 4.4.1 - - 4.3.0 - - 1.1.0-wso2v10 + 1.2.11-wso2v5 [1.2.11.wso2v5, 1.3.0) 1.2.11.wso2v5 - + 0.9.2-SNAPSHOT - 4.3.6 - - 1.3.1 + + 4.4.0 + + + 1.4.0 2.6.1