forked from community/device-mgt-core
Merge branch 'release-2.0.x' of https://github.com/wso2/carbon-device-mgt into release-2.0.x
commit
d65557e03e
@ -0,0 +1,178 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.device.mgt.extensions.device.type.deployer;
|
||||
|
||||
import org.apache.axis2.deployment.Deployer;
|
||||
import org.apache.axis2.deployment.DeploymentException;
|
||||
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
|
||||
import org.apache.axis2.engine.AxisConfiguration;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.application.deployer.AppDeployerConstants;
|
||||
import org.wso2.carbon.application.deployer.AppDeployerUtils;
|
||||
import org.wso2.carbon.application.deployer.CarbonApplication;
|
||||
import org.wso2.carbon.application.deployer.config.Artifact;
|
||||
import org.wso2.carbon.application.deployer.config.CappFile;
|
||||
import org.wso2.carbon.application.deployer.handler.AppDeploymentHandler;
|
||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.util.DeviceTypePluginConstants;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is the device deployer that will read and deploy the device type files from
|
||||
* "deployment/server/carbonapps"
|
||||
* directory.
|
||||
*/
|
||||
public class DeviceTypeCAppDeployer implements AppDeploymentHandler {
|
||||
|
||||
|
||||
private static Log log = LogFactory.getLog(DeviceTypeCAppDeployer.class);
|
||||
private List<Artifact> deviceTypePlugins = new ArrayList<Artifact>();
|
||||
private List<Artifact> deviceTypeUIs = new ArrayList<Artifact>();
|
||||
|
||||
@Override
|
||||
public void deployArtifacts(CarbonApplication carbonApplication, AxisConfiguration axisConfig)
|
||||
throws DeploymentException {
|
||||
List<Artifact.Dependency> artifacts =
|
||||
carbonApplication.getAppConfig().getApplicationArtifact().getDependencies();
|
||||
|
||||
for (Artifact.Dependency dep : artifacts) {
|
||||
Artifact artifact = dep.getArtifact();
|
||||
if (!validateArtifact(artifact)) {
|
||||
continue;
|
||||
}
|
||||
addArtifact(artifact);
|
||||
}
|
||||
|
||||
try {
|
||||
deployTypeSpecifiedArtifacts(deviceTypeUIs, axisConfig, null,
|
||||
DeviceTypePluginConstants.CDMF_UI_TYPE_DIR);
|
||||
deployTypeSpecifiedArtifacts(deviceTypePlugins, axisConfig,
|
||||
DeviceTypePluginConstants.CDMF_PLUGIN_TYPE_EXTENSION,
|
||||
DeviceTypePluginConstants.CDMF_PLUGIN_TYPE_DIR);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new DeploymentException(e.getMessage(), e);
|
||||
} finally {
|
||||
deviceTypePlugins.clear();
|
||||
deviceTypeUIs.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void deployTypeSpecifiedArtifacts(List<Artifact> artifacts, AxisConfiguration axisConfig,
|
||||
String fileType, String directory) throws DeploymentException {
|
||||
for (Artifact artifact : artifacts) {
|
||||
Deployer deployer = AppDeployerUtils.getArtifactDeployer(axisConfig, directory, fileType);
|
||||
if (deployer != null) {
|
||||
deploy(deployer, artifact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undeployArtifacts(CarbonApplication carbonApplication, AxisConfiguration axisConfig)
|
||||
throws DeploymentException {
|
||||
List<Artifact.Dependency> artifacts =
|
||||
carbonApplication.getAppConfig().getApplicationArtifact().getDependencies();
|
||||
|
||||
deviceTypePlugins.clear();
|
||||
deviceTypeUIs.clear();
|
||||
|
||||
for (Artifact.Dependency dep : artifacts) {
|
||||
Artifact artifact = dep.getArtifact();
|
||||
if (!validateArtifact(artifact)) {
|
||||
continue;
|
||||
}
|
||||
addArtifact(artifact);
|
||||
}
|
||||
|
||||
try {
|
||||
undeployTypeSpecifiedArtifacts(deviceTypeUIs, axisConfig, null,
|
||||
DeviceTypePluginConstants.CDMF_UI_TYPE_DIR);
|
||||
undeployTypeSpecifiedArtifacts(deviceTypePlugins, axisConfig,
|
||||
DeviceTypePluginConstants.CDMF_PLUGIN_TYPE_EXTENSION,
|
||||
DeviceTypePluginConstants.CDMF_PLUGIN_TYPE_DIR);
|
||||
} finally {
|
||||
deviceTypePlugins.clear();
|
||||
deviceTypeUIs.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void undeployTypeSpecifiedArtifacts(List<Artifact> artifacts, AxisConfiguration axisConfig, String fileType
|
||||
, String directory) throws DeploymentException {
|
||||
for (Artifact artifact : artifacts) {
|
||||
Deployer deployer = AppDeployerUtils.getArtifactDeployer(axisConfig, directory, fileType);
|
||||
if (deployer != null &&
|
||||
AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED.equals(artifact.getDeploymentStatus())) {
|
||||
undeploy(deployer, artifact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean validateArtifact(Artifact artifact) {
|
||||
if (artifact == null) {
|
||||
return false;
|
||||
}
|
||||
List<CappFile> files = artifact.getFiles();
|
||||
if (files.size() != 1) {
|
||||
log.error("Synapse artifact types must have a single file to " +
|
||||
"be deployed. But " + files.size() + " files found.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void addArtifact(Artifact artifact) {
|
||||
if (DeviceTypePluginConstants.CDMF_PLUGIN_TYPE.equals(artifact.getType())) {
|
||||
deviceTypePlugins.add(artifact);
|
||||
} else if (DeviceTypePluginConstants.CDMF_UI_TYPE.equals(artifact.getType())) {
|
||||
deviceTypeUIs.add(artifact);
|
||||
}
|
||||
}
|
||||
|
||||
void deploy(Deployer deployer, Artifact artifact) throws DeploymentException {
|
||||
String fileName = artifact.getFiles().get(0).getName();
|
||||
String artifactPath = artifact.getExtractedPath() + File.separator + fileName;
|
||||
try {
|
||||
deployer.deploy(new DeploymentFileData(new File(artifactPath)));
|
||||
artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED);
|
||||
} catch (Exception e) {
|
||||
artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED);
|
||||
log.error("Deployment is failed due to " + e.getMessage(), e);
|
||||
throw new DeploymentException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void undeploy(Deployer deployer, Artifact artifact) throws DeploymentException {
|
||||
String fileName = artifact.getFiles().get(0).getName();
|
||||
String artifactPath = artifact.getExtractedPath() + File.separator + fileName;
|
||||
try {
|
||||
deployer.undeploy(new DeploymentFileData(new File(artifactPath), deployer).getAbsolutePath());
|
||||
artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_PENDING);
|
||||
} catch (Exception e) {
|
||||
artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED);
|
||||
log.error("Undeployment is failed due to " + e.getMessage(), e);
|
||||
throw new DeploymentException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
6
components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypeDeployer.java → components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployer.java
6
components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypeDeployer.java → components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployer.java
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.device.mgt.extensions.device.type.deployer;
|
||||
|
||||
import org.apache.axis2.context.ConfigurationContext;
|
||||
import org.apache.axis2.deployment.AbstractDeployer;
|
||||
import org.apache.axis2.deployment.DeploymentException;
|
||||
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.utils.CarbonUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* This is the device deployer that will read and deploy the device type ui files from
|
||||
* "deployment/server/devicetypes-ui"
|
||||
* directory.
|
||||
*/
|
||||
public class DeviceTypeUIDeployer extends AbstractDeployer {
|
||||
|
||||
private static Log log = LogFactory.getLog(DeviceTypeUIDeployer.class);
|
||||
protected Map<String, String> deviceTypeDeployedUIMap = new ConcurrentHashMap<String, String>();
|
||||
private static final String DEVICEMGT_JAGGERY_APP_PATH = CarbonUtils.getCarbonRepository() + File.separator
|
||||
+ "jaggeryapps" + File.separator + "devicemgt" + File.separator + "app" + File.separator + "units"
|
||||
+ File.separator;
|
||||
|
||||
private static final String UNIT_PREFIX = "cdmf.unit.device.type";
|
||||
|
||||
@Override
|
||||
public void init(ConfigurationContext configurationContext) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirectory(String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtension(String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException {
|
||||
if (!deploymentFileData.getFile().isDirectory()) {
|
||||
return;
|
||||
}
|
||||
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true);
|
||||
if (tenantDomain != null && !tenantDomain.isEmpty()) {
|
||||
File jaggeryAppPath = new File(
|
||||
DEVICEMGT_JAGGERY_APP_PATH + tenantDomain + "." + deploymentFileData.getName());
|
||||
try {
|
||||
if (!jaggeryAppPath.exists()) {
|
||||
FileUtils.forceMkdir(jaggeryAppPath);
|
||||
FileUtils.copyDirectory(deploymentFileData.getFile(), jaggeryAppPath);
|
||||
File[] listOfFiles = jaggeryAppPath.listFiles();
|
||||
|
||||
for (int i = 0; i < listOfFiles.length; i++) {
|
||||
if (listOfFiles[i].isFile()) {
|
||||
String content = FileUtils.readFileToString(listOfFiles[i]);
|
||||
FileUtils.writeStringToFile(listOfFiles[i], content.replaceAll(UNIT_PREFIX
|
||||
, tenantDomain + "." + UNIT_PREFIX));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.debug("units already exists " + deploymentFileData.getName());
|
||||
}
|
||||
this.deviceTypeDeployedUIMap.put(deploymentFileData.getAbsolutePath(),
|
||||
jaggeryAppPath.getAbsolutePath());
|
||||
} catch (IOException e) {
|
||||
if (jaggeryAppPath.exists()) {
|
||||
try {
|
||||
FileUtils.deleteDirectory(jaggeryAppPath);
|
||||
} catch (IOException e1) {
|
||||
log.error("Failed to delete directory " + jaggeryAppPath.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
log.error("Cannot deploy deviceType ui : " + deploymentFileData.getName(), e);
|
||||
throw new DeploymentException(
|
||||
"Device type ui file " + deploymentFileData.getName() + " is not deployed ", e);
|
||||
}
|
||||
|
||||
} else {
|
||||
log.error("Cannot deploy deviceType ui: " + deploymentFileData.getName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undeploy(String filePath) throws DeploymentException {
|
||||
try {
|
||||
String jaggeryUnitPath = this.deviceTypeDeployedUIMap.remove(filePath);
|
||||
FileUtils.deleteDirectory(new File(jaggeryUnitPath));
|
||||
log.info("Device Type units un deployed successfully.");
|
||||
} catch (IOException e) {
|
||||
throw new DeploymentException("Failed to remove the units: " + filePath);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.device.mgt.extensions.device.type.deployer.config;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlValue;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for PolicyMonitoring complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="PolicyMonitoring">
|
||||
* <simpleContent>
|
||||
* <extension base="<http://www.w3.org/2001/XMLSchema>string">
|
||||
* <attribute name="enabled" type="{http://www.w3.org/2001/XMLSchema}boolean" />
|
||||
* </extension>
|
||||
* </simpleContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "PolicyMonitoring", propOrder = {
|
||||
"value"
|
||||
})
|
||||
public class PolicyMonitoring {
|
||||
|
||||
@XmlValue
|
||||
protected String value;
|
||||
@XmlAttribute(name = "enabled")
|
||||
protected boolean enabled;
|
||||
|
||||
/**
|
||||
* Gets the value of the value property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the value property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the enabled property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the enabled property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setEnabled(boolean value) {
|
||||
this.enabled = value;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.device.mgt.extensions.device.type.deployer.template.policy.mgt;
|
||||
|
||||
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.DeviceManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.Feature;
|
||||
import org.wso2.carbon.device.mgt.common.FeatureManager;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.Policy;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.ComplianceFeature;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.NonComplianceData;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException;
|
||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.Operation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* This implementation policy monitoring manager.
|
||||
*/
|
||||
public class DefaultPolicyMonitoringManager implements PolicyMonitoringManager {
|
||||
|
||||
private static Log log = LogFactory.getLog(DefaultPolicyMonitoringManager.class);
|
||||
@Override
|
||||
public NonComplianceData checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy, Object response)
|
||||
throws PolicyComplianceException {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Checking policy compliance status of device '" + deviceIdentifier.getId() + "'");
|
||||
}
|
||||
NonComplianceData nonComplianceData = new NonComplianceData();
|
||||
if (response == null || policy == null) {
|
||||
return nonComplianceData;
|
||||
}
|
||||
|
||||
List<ComplianceFeature> complianceFeatures = (List<ComplianceFeature>) response;
|
||||
List<ComplianceFeature> nonComplianceFeatures = new ArrayList<>();
|
||||
|
||||
for (ComplianceFeature complianceFeature : complianceFeatures) {
|
||||
if (!complianceFeature.isCompliant()) {
|
||||
nonComplianceFeatures.add(complianceFeature);
|
||||
nonComplianceData.setStatus(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
nonComplianceData.setComplianceFeatures(nonComplianceFeatures);
|
||||
|
||||
return nonComplianceData;
|
||||
}
|
||||
}
|
2
components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/monitor/PolicyComplianceException.java → components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/monitor/PolicyComplianceException.java
2
components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/monitor/PolicyComplianceException.java → components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/monitor/PolicyComplianceException.java
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
|
||||
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl;
|
||||
import org.wso2.carbon.policy.mgt.core.services.PolicyMonitoringManagerTest;
|
||||
|
||||
public class TestDeviceManagementProviderService extends DeviceManagementProviderServiceImpl {
|
||||
private PolicyMonitoringManager policyMonitoringManager;
|
||||
|
||||
@Override
|
||||
public PolicyMonitoringManager getPolicyMonitoringManager(String deviceType) {
|
||||
return policyMonitoringManager;
|
||||
}
|
||||
|
||||
public void setPolicyMonitoringManager(PolicyMonitoringManager policyMonitoringManager) {
|
||||
this.policyMonitoringManager = policyMonitoringManager;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue