Adding partial commit to add a interface for plugins to implement to notify devices for monotoring

4.x.x
geethkokila 10 years ago
parent dea6d12173
commit 388701c3a2

@ -21,7 +21,7 @@ package org.wso2.carbon.device.mgt.common;
public class EnrolmentInfo { public class EnrolmentInfo {
public enum Status { public enum Status {
CREATED, ACTIVE, INACTIVE, UNCLAIMED, SUSPENDED, BLOCKED, REMOVED CREATED, ACTIVE, INACTIVE, UNREACHABLE, UNCLAIMED, SUSPENDED, BLOCKED, REMOVED
} }
public enum OwnerShip { public enum OwnerShip {

@ -19,6 +19,7 @@
package org.wso2.carbon.policy.mgt.common.spi; package org.wso2.carbon.policy.mgt.common.spi;
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.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;
@ -28,6 +29,8 @@ import java.util.List;
public interface PolicyMonitoringService { public interface PolicyMonitoringService {
void notifyDevices(List<Device> devices) throws PolicyComplianceException;
List<ComplianceFeature> checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy, Object response) List<ComplianceFeature> checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy, Object response)
throws PolicyComplianceException; throws PolicyComplianceException;
} }

@ -19,15 +19,36 @@
package org.wso2.carbon.policy.mgt.core.impl; package org.wso2.carbon.policy.mgt.core.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; 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.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.dao.EnrolmentDAO;
import org.wso2.carbon.policy.mgt.common.Policy; 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.ComplianceDecisionPoint;
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.mgt.PolicyManager;
import org.wso2.carbon.policy.mgt.core.mgt.impl.PolicyManagerImpl;
public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint { public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint {
private static final Log log = LogFactory.getLog(ComplianceDecisionPointImpl.class);
private EnrolmentDAO enrolmentDAO;
private DeviceDAO deviceDAO;
private PolicyManager policyManager;
public ComplianceDecisionPointImpl() {
enrolmentDAO = DeviceManagementDAOFactory.getEnrollmentDAO();
deviceDAO = DeviceManagementDAOFactory.getDeviceDAO();
policyManager = new PolicyManagerImpl();
}
@Override @Override
public String getNoneComplianceRule(Policy policy) throws PolicyComplianceException { public String getNoneComplianceRule(Policy policy) throws PolicyComplianceException {
return null; return policy.getCompliance();
} }
@Override @Override
@ -66,7 +87,8 @@ public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint {
} }
@Override @Override
public void validateDevicePolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy) throws PolicyComplianceException { public void validateDevicePolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy) throws
PolicyComplianceException {
} }
} }

Loading…
Cancel
Save