mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'master' of https://github.com/wso2/carbon-device-mgt
This commit is contained in:
commit
286a04dd31
@ -115,10 +115,10 @@ public class DeviceDAOImpl implements DeviceDAO {
|
|||||||
try {
|
try {
|
||||||
conn = this.getConnection();
|
conn = this.getConnection();
|
||||||
String sql =
|
String sql =
|
||||||
"SELECT d1.ID AS DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, " +
|
"SELECT d1.ID AS DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, d1.DEVICE_IDENTIFICATION, " +
|
||||||
"e.OWNER, e.OWNERSHIP, e.STATUS, e.DATE_OF_LAST_UPDATE, e.DATE_OF_ENROLMENT FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, d.NAME, " +
|
"e.OWNER, e.OWNERSHIP, e.STATUS, e.DATE_OF_LAST_UPDATE, e.DATE_OF_ENROLMENT FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, d.NAME, " +
|
||||||
"t.NAME AS DEVICE_TYPE, d.DEVICE_IDENTIFICATION FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE " +
|
"t.NAME AS DEVICE_TYPE, d.DEVICE_IDENTIFICATION FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE " +
|
||||||
"t.NAME = ? AND d.DEVICE_IDENTIFICATION = ? AND d.TENANT_ID = ?) d1 WHERE d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ?";
|
"t.NAME = ? AND d.DEVICE_IDENTIFICATION = ? AND d.TENANT_ID = ?) d1 WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ?";
|
||||||
stmt = conn.prepareStatement(sql);
|
stmt = conn.prepareStatement(sql);
|
||||||
stmt.setString(1, deviceId.getType());
|
stmt.setString(1, deviceId.getType());
|
||||||
stmt.setString(2, deviceId.getId());
|
stmt.setString(2, deviceId.getId());
|
||||||
|
|||||||
@ -52,12 +52,9 @@
|
|||||||
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
||||||
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
|
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
|
||||||
<Bundle-Description>Policy Management Common Bundle</Bundle-Description>
|
<Bundle-Description>Policy Management Common Bundle</Bundle-Description>
|
||||||
<Private-Package>org.wso2.carbon.policy.mgt.common.internal</Private-Package>
|
|
||||||
<Import-Package>
|
<Import-Package>
|
||||||
org.apache.commons.logging,
|
|
||||||
org.wso2.carbon.device.mgt.common.*,
|
org.wso2.carbon.device.mgt.common.*,
|
||||||
org.wso2.carbon.device.mgt.core.dto.*,
|
org.wso2.carbon.device.mgt.core.dto.*,
|
||||||
org.wso2.carbon.device.mgt.core.operation.*,
|
|
||||||
javax.xml.bind.*,
|
javax.xml.bind.*,
|
||||||
</Import-Package>
|
</Import-Package>
|
||||||
<Export-Package>
|
<Export-Package>
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package org.wso2.carbon.policy.mgt.common.Monitor;
|
package org.wso2.carbon.policy.mgt.common.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.wso2.carbon.policy.mgt.common.monitor;
|
||||||
|
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
|
import org.wso2.carbon.policy.mgt.common.Policy;
|
||||||
|
|
||||||
|
public interface ComplianceDecisionPoint {
|
||||||
|
|
||||||
|
String getNoneComplianceRule(Policy policy) throws PolicyComplianceException;
|
||||||
|
|
||||||
|
void setDeviceAsUnreachable(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException;
|
||||||
|
|
||||||
|
void setDeviceAsReachable(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException;
|
||||||
|
|
||||||
|
void reEnforcePolicy(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException;
|
||||||
|
|
||||||
|
void markDeviceAsNoneCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException;
|
||||||
|
|
||||||
|
void markDeviceAsCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException;
|
||||||
|
|
||||||
|
void deactivateDevice(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException;
|
||||||
|
|
||||||
|
void activateDevice(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException;
|
||||||
|
|
||||||
|
void validateDevicePolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy) throws
|
||||||
|
PolicyComplianceException;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package org.wso2.carbon.policy.mgt.common.Monitor;
|
package org.wso2.carbon.policy.mgt.common.monitor;
|
||||||
|
|
||||||
import org.wso2.carbon.policy.mgt.common.ProfileFeature;
|
import org.wso2.carbon.policy.mgt.common.ProfileFeature;
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package org.wso2.carbon.policy.mgt.common.Monitor;
|
package org.wso2.carbon.policy.mgt.common.monitor;
|
||||||
|
|
||||||
public class PolicyComplianceException extends Exception {
|
public class PolicyComplianceException extends Exception {
|
||||||
|
|
||||||
|
|||||||
@ -20,8 +20,8 @@
|
|||||||
package org.wso2.carbon.policy.mgt.common.spi;
|
package org.wso2.carbon.policy.mgt.common.spi;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.ComplianceFeature;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.PolicyComplianceException;
|
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
|
||||||
import org.wso2.carbon.policy.mgt.common.Policy;
|
import org.wso2.carbon.policy.mgt.common.Policy;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@ -71,7 +71,8 @@
|
|||||||
org.wso2.carbon.context.*,
|
org.wso2.carbon.context.*,
|
||||||
org.wso2.carbon.user.api.*,
|
org.wso2.carbon.user.api.*,
|
||||||
org.wso2.carbon.device.mgt.core.*,
|
org.wso2.carbon.device.mgt.core.*,
|
||||||
org.wso2.carbon.device.mgt.common.*
|
org.wso2.carbon.device.mgt.common.*,
|
||||||
|
org.wso2.carbon.ntask.*
|
||||||
</Import-Package>
|
</Import-Package>
|
||||||
<Export-Package>
|
<Export-Package>
|
||||||
!org.wso2.carbon.policy.mgt.core.internal,
|
!org.wso2.carbon.policy.mgt.core.internal,
|
||||||
@ -132,6 +133,12 @@
|
|||||||
<artifactId>org.wso2.carbon.ndatasource.rdbms</artifactId>
|
<artifactId>org.wso2.carbon.ndatasource.rdbms</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--Ntask dependencies-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.commons</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.ntask.core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Policy Management Dependencies-->
|
<!-- Policy Management Dependencies-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
|||||||
@ -22,9 +22,9 @@ package org.wso2.carbon.policy.mgt.core;
|
|||||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
import org.wso2.carbon.device.mgt.common.Feature;
|
import org.wso2.carbon.device.mgt.common.Feature;
|
||||||
import org.wso2.carbon.policy.mgt.common.FeatureManagementException;
|
import org.wso2.carbon.policy.mgt.common.FeatureManagementException;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.ComplianceData;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.ComplianceFeature;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.PolicyComplianceException;
|
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
|
||||||
import org.wso2.carbon.policy.mgt.common.Policy;
|
import org.wso2.carbon.policy.mgt.common.Policy;
|
||||||
import org.wso2.carbon.policy.mgt.common.PolicyAdministratorPoint;
|
import org.wso2.carbon.policy.mgt.common.PolicyAdministratorPoint;
|
||||||
import org.wso2.carbon.policy.mgt.common.PolicyEvaluationPoint;
|
import org.wso2.carbon.policy.mgt.common.PolicyEvaluationPoint;
|
||||||
@ -77,4 +77,6 @@ public interface PolicyManagerService {
|
|||||||
boolean checkCompliance(DeviceIdentifier deviceIdentifier, Object response) throws PolicyComplianceException;
|
boolean checkCompliance(DeviceIdentifier deviceIdentifier, Object response) throws PolicyComplianceException;
|
||||||
|
|
||||||
ComplianceData getDeviceCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException;
|
ComplianceData getDeviceCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException;
|
||||||
|
|
||||||
|
boolean isCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,18 +27,16 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementExcept
|
|||||||
import org.wso2.carbon.device.mgt.core.operation.mgt.PolicyOperation;
|
import org.wso2.carbon.device.mgt.core.operation.mgt.PolicyOperation;
|
||||||
import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation;
|
import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation;
|
||||||
import org.wso2.carbon.policy.mgt.common.*;
|
import org.wso2.carbon.policy.mgt.common.*;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.ComplianceData;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.ComplianceFeature;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.PolicyComplianceException;
|
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
|
||||||
import org.wso2.carbon.policy.mgt.core.impl.PolicyAdministratorPointImpl;
|
import org.wso2.carbon.policy.mgt.core.impl.PolicyAdministratorPointImpl;
|
||||||
import org.wso2.carbon.policy.mgt.core.impl.PolicyInformationPointImpl;
|
import org.wso2.carbon.policy.mgt.core.impl.PolicyInformationPointImpl;
|
||||||
import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder;
|
import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder;
|
||||||
import org.wso2.carbon.policy.mgt.core.mgt.MonitoringManager;
|
import org.wso2.carbon.policy.mgt.core.mgt.MonitoringManager;
|
||||||
import org.wso2.carbon.policy.mgt.core.mgt.impl.MonitoringManagerImpl;
|
import org.wso2.carbon.policy.mgt.core.mgt.impl.MonitoringManagerImpl;
|
||||||
import org.wso2.carbon.policy.mgt.core.util.PolicyManagementConstants;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PolicyManagerServiceImpl implements PolicyManagerService {
|
public class PolicyManagerServiceImpl implements PolicyManagerService {
|
||||||
@ -232,4 +230,9 @@ public class PolicyManagerServiceImpl implements PolicyManagerService {
|
|||||||
public ComplianceData getDeviceCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
public ComplianceData getDeviceCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
||||||
return monitoringManager.getDevicePolicyCompliance(deviceIdentifier);
|
return monitoringManager.getDevicePolicyCompliance(deviceIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
||||||
|
return monitoringManager.isCompliance(deviceIdentifier);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,11 +19,10 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.policy.mgt.core.dao;
|
package org.wso2.carbon.policy.mgt.core.dao;
|
||||||
|
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.ComplianceData;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.ComplianceFeature;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public interface MonitoringDAO {
|
public interface MonitoringDAO {
|
||||||
|
|
||||||
|
|||||||
@ -21,8 +21,8 @@ package org.wso2.carbon.policy.mgt.core.dao.impl;
|
|||||||
|
|
||||||
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.wso2.carbon.policy.mgt.common.Monitor.ComplianceData;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.ComplianceFeature;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature;
|
||||||
import org.wso2.carbon.policy.mgt.core.dao.MonitoringDAO;
|
import org.wso2.carbon.policy.mgt.core.dao.MonitoringDAO;
|
||||||
import org.wso2.carbon.policy.mgt.core.dao.MonitoringDAOException;
|
import org.wso2.carbon.policy.mgt.core.dao.MonitoringDAOException;
|
||||||
import org.wso2.carbon.policy.mgt.core.dao.PolicyManagementDAOFactory;
|
import org.wso2.carbon.policy.mgt.core.dao.PolicyManagementDAOFactory;
|
||||||
|
|||||||
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.wso2.carbon.policy.mgt.core.impl;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
|
import org.wso2.carbon.policy.mgt.common.Policy;
|
||||||
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceDecisionPoint;
|
||||||
|
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
|
||||||
|
|
||||||
|
public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint {
|
||||||
|
@Override
|
||||||
|
public String getNoneComplianceRule(Policy policy) throws PolicyComplianceException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDeviceAsUnreachable(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDeviceAsReachable(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reEnforcePolicy(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void markDeviceAsNoneCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void markDeviceAsCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateDevice(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void activateDevice(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validateDevicePolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy) throws PolicyComplianceException {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -20,9 +20,9 @@
|
|||||||
package org.wso2.carbon.policy.mgt.core.mgt;
|
package org.wso2.carbon.policy.mgt.core.mgt;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.ComplianceData;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.ComplianceFeature;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.PolicyComplianceException;
|
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@ -26,9 +26,9 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
|||||||
import org.wso2.carbon.device.mgt.core.dao.DeviceDAO;
|
import org.wso2.carbon.device.mgt.core.dao.DeviceDAO;
|
||||||
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
|
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
|
||||||
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
|
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.ComplianceData;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.ComplianceFeature;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.PolicyComplianceException;
|
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
|
||||||
import org.wso2.carbon.policy.mgt.common.Policy;
|
import org.wso2.carbon.policy.mgt.common.Policy;
|
||||||
import org.wso2.carbon.policy.mgt.common.ProfileFeature;
|
import org.wso2.carbon.policy.mgt.common.ProfileFeature;
|
||||||
import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService;
|
import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService;
|
||||||
|
|||||||
@ -21,9 +21,9 @@ package org.wso2.carbon.policy.mgt.core.service;
|
|||||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
import org.wso2.carbon.device.mgt.common.Feature;
|
import org.wso2.carbon.device.mgt.common.Feature;
|
||||||
import org.wso2.carbon.policy.mgt.common.FeatureManagementException;
|
import org.wso2.carbon.policy.mgt.common.FeatureManagementException;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.ComplianceData;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.ComplianceFeature;
|
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature;
|
||||||
import org.wso2.carbon.policy.mgt.common.Monitor.PolicyComplianceException;
|
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
|
||||||
import org.wso2.carbon.policy.mgt.common.Policy;
|
import org.wso2.carbon.policy.mgt.common.Policy;
|
||||||
import org.wso2.carbon.policy.mgt.common.PolicyAdministratorPoint;
|
import org.wso2.carbon.policy.mgt.common.PolicyAdministratorPoint;
|
||||||
import org.wso2.carbon.policy.mgt.common.PolicyEvaluationPoint;
|
import org.wso2.carbon.policy.mgt.common.PolicyEvaluationPoint;
|
||||||
@ -132,4 +132,9 @@ public class PolicyManagementService implements PolicyManagerService {
|
|||||||
public ComplianceData getDeviceCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
public ComplianceData getDeviceCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
||||||
return policyManagerService.getDeviceCompliance(deviceIdentifier);
|
return policyManagerService.getDeviceCompliance(deviceIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
||||||
|
return policyManagerService.isCompliance(deviceIdentifier);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.wso2.carbon.policy.mgt.core.task;
|
||||||
|
|
||||||
|
import org.wso2.carbon.ntask.core.Task;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class MonitoringTask implements Task {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProperties(Map<String, String> map) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -24,10 +24,7 @@ import org.testng.annotations.Test;
|
|||||||
import org.wso2.carbon.device.mgt.common.Device;
|
import org.wso2.carbon.device.mgt.common.Device;
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
import org.wso2.carbon.device.mgt.common.Feature;
|
import org.wso2.carbon.device.mgt.common.Feature;
|
||||||
import org.wso2.carbon.device.mgt.core.dao.DeviceDAO;
|
import org.wso2.carbon.device.mgt.core.dao.*;
|
||||||
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
|
|
||||||
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
|
|
||||||
import org.wso2.carbon.device.mgt.core.dao.DeviceTypeDAO;
|
|
||||||
import org.wso2.carbon.device.mgt.core.dto.DeviceType;
|
import org.wso2.carbon.device.mgt.core.dto.DeviceType;
|
||||||
import org.wso2.carbon.policy.mgt.common.*;
|
import org.wso2.carbon.policy.mgt.common.*;
|
||||||
import org.wso2.carbon.policy.mgt.core.impl.PolicyAdministratorPointImpl;
|
import org.wso2.carbon.policy.mgt.core.impl.PolicyAdministratorPointImpl;
|
||||||
@ -56,6 +53,7 @@ public class PolicyDAOTestCase extends BasePolicyManagementDAOTest {
|
|||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
initDatSource();
|
initDatSource();
|
||||||
|
System.setProperty("GetTenantIDForTest", "Super");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -69,10 +67,12 @@ public class PolicyDAOTestCase extends BasePolicyManagementDAOTest {
|
|||||||
public void addDevice() throws DeviceManagementDAOException {
|
public void addDevice() throws DeviceManagementDAOException {
|
||||||
|
|
||||||
DeviceDAO deviceTypeDAO = DeviceManagementDAOFactory.getDeviceDAO();
|
DeviceDAO deviceTypeDAO = DeviceManagementDAOFactory.getDeviceDAO();
|
||||||
|
EnrolmentDAO enrolmentDAO = DeviceManagementDAOFactory.getEnrollmentDAO();
|
||||||
DeviceType type = DeviceTypeCreator.getDeviceType();
|
DeviceType type = DeviceTypeCreator.getDeviceType();
|
||||||
devices = DeviceCreator.getDeviceList(type);
|
devices = DeviceCreator.getDeviceList(type);
|
||||||
for (Device device : devices) {
|
for (Device device : devices) {
|
||||||
deviceTypeDAO.addDevice(type.getId(), device, -1234);
|
int id = deviceTypeDAO.addDevice(type.getId(), device, -1234);
|
||||||
|
enrolmentDAO.addEnrollment(id, device.getEnrolmentInfo(), -1234);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,21 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
|||||||
REFERENCES DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
REFERENCES DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
|
||||||
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
||||||
|
DEVICE_ID INTEGER NOT NULL,
|
||||||
|
OWNER VARCHAR(50) NOT NULL,
|
||||||
|
OWNERSHIP VARCHAR(45) NULL DEFAULT NULL,
|
||||||
|
STATUS VARCHAR(50) NULL,
|
||||||
|
DATE_OF_ENROLMENT TIMESTAMP NULL DEFAULT NULL,
|
||||||
|
DATE_OF_LAST_UPDATE TIMESTAMP NULL DEFAULT NULL,
|
||||||
|
TENANT_ID INT NOT NULL,
|
||||||
|
PRIMARY KEY (ID),
|
||||||
|
CONSTRAINT fk_dm_device_enrolment FOREIGN KEY (DEVICE_ID) REFERENCES
|
||||||
|
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
||||||
ID INTEGER AUTO_INCREMENT NOT NULL,
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
||||||
TYPE VARCHAR(50) NOT NULL,
|
TYPE VARCHAR(50) NOT NULL,
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
<test name="DAO Unit Tests" preserve-order="true">
|
<test name="DAO Unit Tests" preserve-order="true">
|
||||||
<parameter name="dbType" value="H2"/>
|
<parameter name="dbType" value="H2"/>
|
||||||
<classes>
|
<classes>
|
||||||
<!--<class name="org.wso2.carbon.policy.mgt.core.PolicyDAOTestCase"/>-->
|
<class name="org.wso2.carbon.policy.mgt.core.PolicyDAOTestCase"/>
|
||||||
</classes>
|
</classes>
|
||||||
</test>
|
</test>
|
||||||
</suite>
|
</suite>
|
||||||
7
pom.xml
7
pom.xml
@ -905,6 +905,13 @@
|
|||||||
<artifactId>jackson-jaxrs</artifactId>
|
<artifactId>jackson-jaxrs</artifactId>
|
||||||
<version>${jackson.version}</version>
|
<version>${jackson.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.commons</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.ntask.core</artifactId>
|
||||||
|
<version>${carbon.commons.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user