mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Added Pluggable Device Type
This commit is contained in:
parent
6ab219c9dd
commit
ed366867d1
@ -15,7 +15,7 @@
|
|||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@ -32,14 +32,14 @@ import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration
|
|||||||
import org.wso2.carbon.device.mgt.common.license.mgt.License;
|
import org.wso2.carbon.device.mgt.common.license.mgt.License;
|
||||||
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
|
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
|
||||||
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
|
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.*;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.*;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.util.DeviceTypePluginConstants;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeDeployerPayloadException;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.exception.DeviceTypeDeployerFileException;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeMgtPluginException;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.exception.DeviceTypeMgtPluginException;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.dao.DeviceDAODefinition;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.dao.DeviceDAODefinition;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.dao.DeviceTypePluginDAOManager;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.dao.DeviceTypePluginDAOManager;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.feature.ConfigurationBasedFeatureManager;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.feature.ConfigurationBasedFeatureManager;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.util.DeviceTypePluginConstants;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.util.DeviceTypeUtils;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.util.DeviceTypeUtils;
|
||||||
import org.wso2.carbon.device.mgt.extensions.license.mgt.registry.RegistryBasedLicenseManager;
|
import org.wso2.carbon.device.mgt.extensions.license.mgt.registry.RegistryBasedLicenseManager;
|
||||||
import org.wso2.carbon.registry.api.RegistryException;
|
import org.wso2.carbon.registry.api.RegistryException;
|
||||||
import org.wso2.carbon.registry.api.Resource;
|
import org.wso2.carbon.registry.api.Resource;
|
||||||
@ -108,7 +108,7 @@ public class DeviceTypeManager implements DeviceManager {
|
|||||||
}
|
}
|
||||||
} catch (LicenseManagementException e) {
|
} catch (LicenseManagementException e) {
|
||||||
String msg = "Error occurred while adding default license for " + deviceType + " devices";
|
String msg = "Error occurred while adding default license for " + deviceType + " devices";
|
||||||
throw new DeviceTypeDeployerFileException(msg, e);
|
throw new DeviceTypeDeployerPayloadException(msg, e);
|
||||||
}
|
}
|
||||||
claimable = false;
|
claimable = false;
|
||||||
if (deviceTypeConfiguration.getClaimable() != null ) {
|
if (deviceTypeConfiguration.getClaimable() != null ) {
|
||||||
@ -120,7 +120,7 @@ public class DeviceTypeManager implements DeviceManager {
|
|||||||
defaultPlatformConfiguration = this.getDefaultConfiguration();
|
defaultPlatformConfiguration = this.getDefaultConfiguration();
|
||||||
} catch (DeviceManagementException e) {
|
} catch (DeviceManagementException e) {
|
||||||
String msg = "Error occurred while default platform configuration";
|
String msg = "Error occurred while default platform configuration";
|
||||||
throw new DeviceTypeDeployerFileException(msg, e);
|
throw new DeviceTypeDeployerPayloadException(msg, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceDetails deviceDetails = deviceTypeConfiguration.getDeviceDetails();
|
DeviceDetails deviceDetails = deviceTypeConfiguration.getDeviceDetails();
|
||||||
@ -139,7 +139,7 @@ public class DeviceTypeManager implements DeviceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (deviceDefinitionTable == null) {
|
if (deviceDefinitionTable == null) {
|
||||||
throw new DeviceTypeDeployerFileException("Could not find definition for table: " + tableName);
|
throw new DeviceTypeDeployerPayloadException("Could not find definition for table: " + tableName);
|
||||||
}
|
}
|
||||||
propertiesExist = true;
|
propertiesExist = true;
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ public class DeviceTypeManager implements DeviceManager {
|
|||||||
}
|
}
|
||||||
deviceTypePluginDAOManager = new DeviceTypePluginDAOManager(datasourceName, deviceDAODefinition);
|
deviceTypePluginDAOManager = new DeviceTypePluginDAOManager(datasourceName, deviceDAODefinition);
|
||||||
} else {
|
} else {
|
||||||
throw new DeviceTypeDeployerFileException("Invalid datasource name.");
|
throw new DeviceTypeDeployerPayloadException("Invalid datasource name.");
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
PrivilegedCarbonContext.endTenantFlow();
|
PrivilegedCarbonContext.endTenantFlow();
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@ -32,12 +32,13 @@ import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration
|
|||||||
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
|
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
|
||||||
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
|
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
|
||||||
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.ConfigProperties;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.ConfigProperties;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.DeviceTypeConfiguration;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.Property;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Feature;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.PushNotificationProvider;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Property;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.TaskConfiguration;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PushNotificationProvider;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.policy.mgt.DefaultPolicyMonitoringManager;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.TaskConfiguration;
|
||||||
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.policy.mgt.DefaultPolicyMonitoringManager;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -186,8 +187,24 @@ public class DeviceTypeManagerService implements DeviceManagementService {
|
|||||||
protected void setInitialOperationConfig(DeviceTypeConfiguration deviceTypeConfiguration) {
|
protected void setInitialOperationConfig(DeviceTypeConfiguration deviceTypeConfiguration) {
|
||||||
if (deviceTypeConfiguration.getOperations() != null) {
|
if (deviceTypeConfiguration.getOperations() != null) {
|
||||||
List<String> ops = deviceTypeConfiguration.getOperations();
|
List<String> ops = deviceTypeConfiguration.getOperations();
|
||||||
if (ops != null && !ops.isEmpty()) {
|
if (!ops.isEmpty() && deviceTypeConfiguration.getFeatures() != null
|
||||||
initialOperationConfig.setOperations(ops);
|
&& deviceTypeConfiguration.getFeatures().getFeature() != null) {
|
||||||
|
List<String> validOps = new ArrayList<>();
|
||||||
|
for (String operation : ops) {
|
||||||
|
boolean isFeatureExist = false;
|
||||||
|
for (Feature feature : deviceTypeConfiguration.getFeatures().getFeature()) {
|
||||||
|
if (feature.getCode().equals(operation)) {
|
||||||
|
isFeatureExist = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isFeatureExist) {
|
||||||
|
validOps.add(operation);
|
||||||
|
} else {
|
||||||
|
log.warn("Couldn't fine a valid feature for the operation : " + operation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
initialOperationConfig.setOperations(validOps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -83,4 +83,8 @@ public class ConfigProperties {
|
|||||||
return this.property;
|
return this.property;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addProperties(List<Property> property) {
|
||||||
|
this.property = property;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -17,7 +17,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.*;
|
import javax.xml.bind.annotation.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -85,10 +85,6 @@ public class DeviceTypeConfiguration {
|
|||||||
this.operations = operations;
|
this.operations = operations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of the taskConfiguration property.
|
* Gets the value of the taskConfiguration property.
|
||||||
*
|
*
|
||||||
@ -170,7 +166,7 @@ public class DeviceTypeConfiguration {
|
|||||||
* @param value allowed object is
|
* @param value allowed object is
|
||||||
* {@link DeviceDetails }
|
* {@link DeviceDetails }
|
||||||
*/
|
*/
|
||||||
public void setDeviceDetails(PolicyMonitoring value) {
|
public void setPolicyMonitoring(PolicyMonitoring value) {
|
||||||
this.policyMonitoring = value;
|
this.policyMonitoring = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,13 +16,15 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlType;
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,7 +53,7 @@ import javax.xml.bind.annotation.XmlType;
|
|||||||
@XmlType(name = "Feature", propOrder = {
|
@XmlType(name = "Feature", propOrder = {
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"operation"
|
"operation", "metaData"
|
||||||
})
|
})
|
||||||
public class Feature {
|
public class Feature {
|
||||||
|
|
||||||
@ -63,6 +65,9 @@ public class Feature {
|
|||||||
protected Operation operation;
|
protected Operation operation;
|
||||||
@XmlAttribute(name = "code")
|
@XmlAttribute(name = "code")
|
||||||
protected String code;
|
protected String code;
|
||||||
|
@XmlElementWrapper(name = "MetaData")
|
||||||
|
@XmlElement(name = "Property", required = true)
|
||||||
|
protected List<String> metaData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of the name property.
|
* Gets the value of the name property.
|
||||||
@ -160,4 +165,11 @@ public class Feature {
|
|||||||
this.code = value;
|
this.code = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getMetaData() {
|
||||||
|
return metaData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMetaData(List<String> metaData) {
|
||||||
|
this.metaData = metaData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -69,4 +69,8 @@ public class Features {
|
|||||||
return this.feature;
|
return this.feature;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addFeatures(List<Feature> features) {
|
||||||
|
this.feature = features;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.*;
|
import javax.xml.bind.annotation.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -73,4 +73,8 @@ public class Properties {
|
|||||||
return this.property;
|
return this.property;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addProperties(List<String> property) {
|
||||||
|
this.property = property;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -17,7 +17,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.exception;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config.exception;
|
||||||
|
|
||||||
public class DeviceTypeConfigurationException extends Exception {
|
public class DeviceTypeConfigurationException extends Exception {
|
||||||
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.exception;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config.exception;
|
||||||
|
|
||||||
public class InvalidConfigurationStateException extends RuntimeException {
|
public class InvalidConfigurationStateException extends RuntimeException {
|
||||||
|
|
||||||
@ -16,10 +16,10 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.dao;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.dao;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.Table;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Table;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.exception.DeviceTypeDeployerFileException;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeDeployerPayloadException;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -45,19 +45,19 @@ public class DeviceDAODefinition {
|
|||||||
primarykey = table.getPrimaryKey();
|
primarykey = table.getPrimaryKey();
|
||||||
List<String> attributes = table.getAttributes().getAttribute();
|
List<String> attributes = table.getAttributes().getAttribute();
|
||||||
if (deviceTableName == null || deviceTableName.isEmpty()) {
|
if (deviceTableName == null || deviceTableName.isEmpty()) {
|
||||||
throw new DeviceTypeDeployerFileException("Missing deviceTableName");
|
throw new DeviceTypeDeployerPayloadException("Missing deviceTableName");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (primarykey == null || primarykey.isEmpty()) {
|
if (primarykey == null || primarykey.isEmpty()) {
|
||||||
throw new DeviceTypeDeployerFileException("Missing primaryKey ");
|
throw new DeviceTypeDeployerPayloadException("Missing primaryKey ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attributes == null || attributes.size() == 0) {
|
if (attributes == null || attributes.size() == 0) {
|
||||||
throw new DeviceTypeDeployerFileException("Missing Attributes ");
|
throw new DeviceTypeDeployerPayloadException("Missing Attributes ");
|
||||||
}
|
}
|
||||||
for (String attribute : attributes) {
|
for (String attribute : attributes) {
|
||||||
if (attribute.isEmpty()) {
|
if (attribute.isEmpty()) {
|
||||||
throw new DeviceTypeDeployerFileException("Unsupported attribute format for device definition");
|
throw new DeviceTypeDeployerPayloadException("Unsupported attribute format for device definition");
|
||||||
}
|
}
|
||||||
columnNames.add(attribute);
|
columnNames.add(attribute);
|
||||||
}
|
}
|
||||||
@ -1,9 +1,9 @@
|
|||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.dao;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.dao;
|
||||||
|
|
||||||
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.device.mgt.extensions.device.type.deployer.exception.DeviceTypeDeployerFileException;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeDeployerPayloadException;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.exception.DeviceTypeMgtPluginException;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeMgtPluginException;
|
||||||
|
|
||||||
import javax.naming.Context;
|
import javax.naming.Context;
|
||||||
import javax.naming.InitialContext;
|
import javax.naming.InitialContext;
|
||||||
@ -31,7 +31,7 @@ public class DeviceTypeDAOHandler {
|
|||||||
Context ctx = new InitialContext();
|
Context ctx = new InitialContext();
|
||||||
dataSource = (DataSource) ctx.lookup(datasourceName);
|
dataSource = (DataSource) ctx.lookup(datasourceName);
|
||||||
} catch (NamingException e) {
|
} catch (NamingException e) {
|
||||||
throw new DeviceTypeDeployerFileException("Error while looking up the data source: " + datasourceName, e);
|
throw new DeviceTypeDeployerPayloadException("Error while looking up the data source: " + datasourceName, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,14 +16,14 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.dao;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.dao;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
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.device.mgt.common.Device;
|
import org.wso2.carbon.device.mgt.common.Device;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.exception.DeviceTypeMgtPluginException;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeMgtPluginException;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.util.DeviceTypeUtils;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.util.DeviceTypeUtils;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -17,9 +17,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.dao;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.dao;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.DeviceDetails;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceDetails;
|
||||||
|
|
||||||
public class DeviceTypePluginDAOManager {
|
public class DeviceTypePluginDAOManager {
|
||||||
|
|
||||||
@ -16,10 +16,10 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.dao;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.dao;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.common.Device;
|
import org.wso2.carbon.device.mgt.common.Device;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.exception.DeviceTypeMgtPluginException;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeMgtPluginException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface PluginDAO {
|
public interface PluginDAO {
|
||||||
@ -16,15 +16,15 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.dao;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.dao;
|
||||||
|
|
||||||
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.context.PrivilegedCarbonContext;
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||||
import org.wso2.carbon.device.mgt.common.Device;
|
import org.wso2.carbon.device.mgt.common.Device;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.DeviceDetails;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceDetails;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.exception.DeviceTypeMgtPluginException;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeMgtPluginException;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.util.DeviceTypeUtils;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.util.DeviceTypeUtils;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -15,30 +15,30 @@
|
|||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.exception;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This exception will be thrown if there are any issues with the content of the deployer.
|
* This exception will be thrown if there are any issues with the content of the deployer.
|
||||||
*/
|
*/
|
||||||
public class DeviceTypeDeployerFileException extends RuntimeException {
|
public class DeviceTypeDeployerPayloadException extends RuntimeException {
|
||||||
|
|
||||||
public DeviceTypeDeployerFileException(String msg, Exception nestedEx) {
|
public DeviceTypeDeployerPayloadException(String msg, Exception nestedEx) {
|
||||||
super(msg, nestedEx);
|
super(msg, nestedEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeviceTypeDeployerFileException(String message, Throwable cause) {
|
public DeviceTypeDeployerPayloadException(String message, Throwable cause) {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeviceTypeDeployerFileException(String msg) {
|
public DeviceTypeDeployerPayloadException(String msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeviceTypeDeployerFileException() {
|
public DeviceTypeDeployerPayloadException() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeviceTypeDeployerFileException(Throwable cause) {
|
public DeviceTypeDeployerPayloadException(Throwable cause) {
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,7 +15,7 @@
|
|||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.exception;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This exception will be thrown when there is an issues with the plugin generation.
|
* This exception will be thrown when there is an issues with the plugin generation.
|
||||||
@ -16,14 +16,13 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.feature;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.feature;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||||
import org.wso2.carbon.device.mgt.common.Feature;
|
import org.wso2.carbon.device.mgt.common.Feature;
|
||||||
import org.wso2.carbon.device.mgt.common.FeatureManager;
|
import org.wso2.carbon.device.mgt.common.FeatureManager;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.Operation;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Operation;
|
||||||
|
|
||||||
import javax.ws.rs.HttpMethod;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -45,13 +44,25 @@ public class ConfigurationBasedFeatureManager implements FeatureManager {
|
|||||||
private static final Pattern PATH_PARAM_REGEX = Pattern.compile("\\{(.*?)\\}");
|
private static final Pattern PATH_PARAM_REGEX = Pattern.compile("\\{(.*?)\\}");
|
||||||
|
|
||||||
public ConfigurationBasedFeatureManager(
|
public ConfigurationBasedFeatureManager(
|
||||||
List<org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.Feature> features) {
|
List<org.wso2.carbon.device.mgt.extensions.device.type.template.config.Feature> features) {
|
||||||
for (org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.Feature feature : features) {
|
for (org.wso2.carbon.device.mgt.extensions.device.type.template.config.Feature feature : features) {
|
||||||
Feature deviceFeature = new Feature();
|
Feature deviceFeature = new Feature();
|
||||||
deviceFeature.setCode(feature.getCode());
|
deviceFeature.setCode(feature.getCode());
|
||||||
deviceFeature.setName(feature.getName());
|
deviceFeature.setName(feature.getName());
|
||||||
deviceFeature.setDescription(feature.getDescription());
|
deviceFeature.setDescription(feature.getDescription());
|
||||||
Operation operation = feature.getOperation();
|
Operation operation = feature.getOperation();
|
||||||
|
List<Feature.MetadataEntry> metadataEntries = null;
|
||||||
|
if (feature.getMetaData() != null) {
|
||||||
|
metadataEntries = new ArrayList<>();
|
||||||
|
int id = 0;
|
||||||
|
for (String metaData : feature.getMetaData()) {
|
||||||
|
Feature.MetadataEntry metadataEntry = new Feature.MetadataEntry();
|
||||||
|
metadataEntry.setId(id);
|
||||||
|
metadataEntry.setValue(metaData);
|
||||||
|
metadataEntries.add(metadataEntry);
|
||||||
|
id++;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (operation != null) {
|
if (operation != null) {
|
||||||
Map<String, Object> apiParams = new HashMap<>();
|
Map<String, Object> apiParams = new HashMap<>();
|
||||||
apiParams.put(METHOD, operation.getMethod().toUpperCase());
|
apiParams.put(METHOD, operation.getMethod().toUpperCase());
|
||||||
@ -70,7 +81,9 @@ public class ConfigurationBasedFeatureManager implements FeatureManager {
|
|||||||
formParams = operation.getFormParameters().getParameter();
|
formParams = operation.getFormParameters().getParameter();
|
||||||
}
|
}
|
||||||
apiParams.put(FORM_PARAMS, formParams);
|
apiParams.put(FORM_PARAMS, formParams);
|
||||||
List<Feature.MetadataEntry> metadataEntries = new ArrayList<>();
|
if (metadataEntries == null) {
|
||||||
|
metadataEntries = new ArrayList<>();
|
||||||
|
}
|
||||||
Feature.MetadataEntry metadataEntry = new Feature.MetadataEntry();
|
Feature.MetadataEntry metadataEntry = new Feature.MetadataEntry();
|
||||||
metadataEntry.setId(-1);
|
metadataEntry.setId(-1);
|
||||||
metadataEntry.setValue(apiParams);
|
metadataEntry.setValue(apiParams);
|
||||||
@ -16,27 +16,19 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.policy.mgt;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.policy.mgt;
|
||||||
|
|
||||||
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.device.mgt.common.DeviceIdentifier;
|
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.Policy;
|
||||||
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
|
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.ComplianceFeature;
|
||||||
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.NonComplianceData;
|
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.common.policy.mgt.monitor.PolicyComplianceException;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.Operation;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This implementation policy monitoring manager.
|
* This implementation policy monitoring manager.
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.util;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.util;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@ -16,14 +16,14 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.util;
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.util;
|
||||||
|
|
||||||
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.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.exception.DeviceTypeMgtPluginException;
|
import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeMgtPluginException;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.internal.DeviceTypeManagementDataHolder;
|
import org.wso2.carbon.device.mgt.extensions.internal.DeviceTypeExtensionDataHolder;
|
||||||
import org.wso2.carbon.registry.api.RegistryException;
|
import org.wso2.carbon.registry.api.RegistryException;
|
||||||
import org.wso2.carbon.registry.api.Resource;
|
import org.wso2.carbon.registry.api.Resource;
|
||||||
import org.wso2.carbon.registry.core.Registry;
|
import org.wso2.carbon.registry.core.Registry;
|
||||||
@ -101,7 +101,7 @@ public class DeviceTypeUtils {
|
|||||||
public static Registry getConfigurationRegistry() throws DeviceTypeMgtPluginException {
|
public static Registry getConfigurationRegistry() throws DeviceTypeMgtPluginException {
|
||||||
try {
|
try {
|
||||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||||
return DeviceTypeManagementDataHolder.getInstance().getRegistryService()
|
return DeviceTypeExtensionDataHolder.getInstance().getRegistryService()
|
||||||
.getConfigSystemRegistry(tenantId);
|
.getConfigSystemRegistry(tenantId);
|
||||||
} catch (RegistryException e) {
|
} catch (RegistryException e) {
|
||||||
throw new DeviceTypeMgtPluginException("Error in retrieving conf registry instance: " + e.getMessage(), e);
|
throw new DeviceTypeMgtPluginException("Error in retrieving conf registry instance: " + e.getMessage(), e);
|
||||||
Loading…
Reference in New Issue
Block a user