();
+ }
+ return this.parameter;
}
}
diff --git a/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/config/JndiLookupDefinition.java b/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/config/JndiConfig.java
similarity index 85%
rename from 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/config/JndiLookupDefinition.java
rename to 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/config/JndiConfig.java
index 9064215fe26..a43dc26b9ca 100644
--- a/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/config/JndiLookupDefinition.java
+++ b/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/config/JndiConfig.java
@@ -25,16 +25,16 @@ import javax.xml.bind.annotation.XmlType;
/**
- * Java class for JndiLookupDefinition complex type.
+ *
Java class for jndiConfig complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
- * <complexType name="JndiLookupDefinition">
+ * <complexType name="jndiConfig">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
@@ -44,12 +44,12 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "JndiLookupDefinition", propOrder = {
+@XmlType(name = "jndiConfig", propOrder = {
"name"
})
-public class JndiLookupDefinition {
+public class JndiConfig {
- @XmlElement(name = "Name", required = true)
+ @XmlElement(required = true)
protected String name;
/**
diff --git a/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/config/ManagementRepository.java b/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/config/ManagementRepository.java
deleted file mode 100644
index c7eccfd5f25..00000000000
--- a/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/config/ManagementRepository.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Java class for ManagementRepository complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="ManagementRepository">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="DataSourceConfiguration" type="{}DataSourceConfiguration"/>
- * <element name="DeviceDefinition" type="{}DeviceDefinition"/>
- * <element name="ProvisioningConfig" type="{}ProvisioningConfig"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "ManagementRepository", propOrder = {
- "dataSourceConfiguration",
- "deviceDefinition",
- "provisioningConfig"
-})
-public class ManagementRepository {
-
- @XmlElement(name = "DataSourceConfiguration", required = true)
- protected DataSourceConfiguration dataSourceConfiguration;
- @XmlElement(name = "DeviceDefinition", required = true)
- protected DeviceDefinition deviceDefinition;
- @XmlElement(name = "ProvisioningConfig", required = true)
- protected ProvisioningConfig provisioningConfig;
-
- /**
- * Gets the value of the dataSourceConfiguration property.
- *
- * @return
- * possible object is
- * {@link DataSourceConfiguration }
- *
- */
- public DataSourceConfiguration getDataSourceConfiguration() {
- return dataSourceConfiguration;
- }
-
- /**
- * Sets the value of the dataSourceConfiguration property.
- *
- * @param value
- * allowed object is
- * {@link DataSourceConfiguration }
- *
- */
- public void setDataSourceConfiguration(DataSourceConfiguration value) {
- this.dataSourceConfiguration = value;
- }
-
- /**
- * Gets the value of the deviceDefinition property.
- *
- * @return
- * possible object is
- * {@link DeviceDefinition }
- *
- */
- public DeviceDefinition getDeviceDefinition() {
- return deviceDefinition;
- }
-
- /**
- * Sets the value of the deviceDefinition property.
- *
- * @param value
- * allowed object is
- * {@link DeviceDefinition }
- *
- */
- public void setDeviceDefinition(DeviceDefinition value) {
- this.deviceDefinition = value;
- }
-
- /**
- * Gets the value of the provisioningConfig property.
- *
- * @return
- * possible object is
- * {@link ProvisioningConfig }
- *
- */
- public ProvisioningConfig getProvisioningConfig() {
- return provisioningConfig;
- }
-
- /**
- * Sets the value of the provisioningConfig property.
- *
- * @param value
- * allowed object is
- * {@link ProvisioningConfig }
- *
- */
- public void setProvisioningConfig(ProvisioningConfig value) {
- this.provisioningConfig = value;
- }
-
-}
diff --git a/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/config/ObjectFactory.java b/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/config/ObjectFactory.java
new file mode 100644
index 00000000000..be089a9ccc8
--- /dev/null
+++ b/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/config/ObjectFactory.java
@@ -0,0 +1,198 @@
+/*
+ * 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.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.wso2.carbon package.
+ * An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _DeviceTypeConfiguration_QNAME = new QName("", "DeviceTypeConfiguration");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.wso2.carbon
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link DeviceTypeConfiguration }
+ *
+ */
+ public DeviceTypeConfiguration createDeviceTypeConfiguration() {
+ return new DeviceTypeConfiguration();
+ }
+
+ /**
+ * Create an instance of {@link Operation }
+ *
+ */
+ public Operation createOperation() {
+ return new Operation();
+ }
+
+ /**
+ * Create an instance of {@link Attributes }
+ *
+ */
+ public Attributes createAttributes() {
+ return new Attributes();
+ }
+
+ /**
+ * Create an instance of {@link ProvisioningConfig }
+ *
+ */
+ public ProvisioningConfig createProvisioningConfig() {
+ return new ProvisioningConfig();
+ }
+
+ /**
+ * Create an instance of {@link TableConfig }
+ *
+ */
+ public TableConfig createTableConfig() {
+ return new TableConfig();
+ }
+
+ /**
+ * Create an instance of {@link Table }
+ *
+ */
+ public Table createTable() {
+ return new Table();
+ }
+
+ /**
+ * Create an instance of {@link Property }
+ *
+ */
+ public Property createProperty() {
+ return new Property();
+ }
+
+ /**
+ * Create an instance of {@link JndiConfig }
+ *
+ */
+ public JndiConfig createJndiConfig() {
+ return new JndiConfig();
+ }
+
+ /**
+ * Create an instance of {@link FormParameters }
+ *
+ */
+ public FormParameters createFormParameters() {
+ return new FormParameters();
+ }
+
+ /**
+ * Create an instance of {@link Features }
+ *
+ */
+ public Features createFeatures() {
+ return new Features();
+ }
+
+ /**
+ * Create an instance of {@link Feature }
+ *
+ */
+ public Feature createFeature() {
+ return new Feature();
+ }
+
+ /**
+ * Create an instance of {@link PushNotificationProvider }
+ *
+ */
+ public PushNotificationProvider createPushNotificationProvider() {
+ return new PushNotificationProvider();
+ }
+
+ /**
+ * Create an instance of {@link DataSource }
+ *
+ */
+ public DataSource createDataSource() {
+ return new DataSource();
+ }
+
+ /**
+ * Create an instance of {@link ConfigProperties }
+ *
+ */
+ public ConfigProperties createConfigProperties() {
+ return new ConfigProperties();
+ }
+
+ /**
+ * Create an instance of {@link License }
+ *
+ */
+ public License createLicense() {
+ return new License();
+ }
+
+ /**
+ * Create an instance of {@link DeviceDetails }
+ *
+ */
+ public DeviceDetails createDeviceDetails() {
+ return new DeviceDetails();
+ }
+
+ /**
+ * Create an instance of {@link QueryParameters }
+ *
+ */
+ public QueryParameters createQueryParameters() {
+ return new QueryParameters();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link DeviceTypeConfiguration }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "", name = "DeviceTypeConfiguration")
+ public JAXBElement createDeviceTypeConfiguration(DeviceTypeConfiguration value) {
+ return new JAXBElement(_DeviceTypeConfiguration_QNAME, DeviceTypeConfiguration.class, null, value);
+ }
+
+}
diff --git a/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/config/Operation.java b/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/config/Operation.java
new file mode 100644
index 00000000000..81ab8fdaf29
--- /dev/null
+++ b/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/config/Operation.java
@@ -0,0 +1,162 @@
+/*
+ * 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.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * Java class for Operation complex type.
+ *
+ *
The following schema fragment specifies the expected content contained within this class.
+ *
+ *
+ * <complexType name="Operation">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="QueryParameters" type="{}QueryParameters"/>
+ * <element name="FormParameters" type="{}FormParameters"/>
+ * </sequence>
+ * <attribute name="context" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="method" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "Operation", propOrder = {
+ "queryParameters",
+ "formParameters"
+})
+public class Operation {
+
+ @XmlElement(name = "QueryParameters")
+ protected QueryParameters queryParameters;
+ @XmlElement(name = "FormParameters")
+ protected FormParameters formParameters;
+ @XmlAttribute(name = "context")
+ protected String context;
+ @XmlAttribute(name = "method")
+ protected String method;
+
+ /**
+ * Gets the value of the queryParameters property.
+ *
+ * @return
+ * possible object is
+ * {@link QueryParameters }
+ *
+ */
+ public QueryParameters getQueryParameters() {
+ return queryParameters;
+ }
+
+ /**
+ * Sets the value of the queryParameters property.
+ *
+ * @param value
+ * allowed object is
+ * {@link QueryParameters }
+ *
+ */
+ public void setQueryParameters(QueryParameters value) {
+ this.queryParameters = value;
+ }
+
+ /**
+ * Gets the value of the formParameters property.
+ *
+ * @return
+ * possible object is
+ * {@link FormParameters }
+ *
+ */
+ public FormParameters getFormParameters() {
+ return formParameters;
+ }
+
+ /**
+ * Sets the value of the formParameters property.
+ *
+ * @param value
+ * allowed object is
+ * {@link FormParameters }
+ *
+ */
+ public void setFormParameters(FormParameters value) {
+ this.formParameters = value;
+ }
+
+ /**
+ * Gets the value of the context property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getContext() {
+ return context;
+ }
+
+ /**
+ * Sets the value of the context property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setContext(String value) {
+ this.context = value;
+ }
+
+ /**
+ * Gets the value of the method property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMethod() {
+ return method;
+ }
+
+ /**
+ * Sets the value of the method property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMethod(String value) {
+ this.method = value;
+ }
+
+}
diff --git a/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/config/ProvisioningConfig.java b/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/config/ProvisioningConfig.java
index 9b1861e2548..e6caf2f5620 100644
--- a/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/config/ProvisioningConfig.java
+++ b/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/config/ProvisioningConfig.java
@@ -34,7 +34,7 @@ import javax.xml.bind.annotation.XmlType;
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="SharedWithAllTenants" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="SharedWithAllTenants" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* </sequence>
* </restriction>
* </complexContent>
@@ -49,16 +49,12 @@ import javax.xml.bind.annotation.XmlType;
})
public class ProvisioningConfig {
- @XmlElement(name = "SharedWithAllTenants", required = true)
+ @XmlElement(name = "SharedWithAllTenants")
protected boolean sharedWithAllTenants;
/**
* Gets the value of the sharedWithAllTenants property.
*
- * @return
- * possible object is
- * {@link boolean }
- *
*/
public boolean isSharedWithAllTenants() {
return sharedWithAllTenants;
@@ -67,10 +63,6 @@ public class ProvisioningConfig {
/**
* Sets the value of the sharedWithAllTenants property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
*/
public void setSharedWithAllTenants(boolean value) {
this.sharedWithAllTenants = value;
diff --git a/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/config/PushNotificationConfiguration.java b/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/config/PushNotificationProvider.java
similarity index 59%
rename from 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/config/PushNotificationConfiguration.java
rename to 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/config/PushNotificationProvider.java
index 0dacc5622d1..43aee84397d 100644
--- a/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/config/PushNotificationConfiguration.java
+++ b/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/config/PushNotificationProvider.java
@@ -20,24 +20,25 @@ 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.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
- * Java class for PushNotificationConfiguration complex type.
+ *
Java class for PushNotificationProvider complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
- * <complexType name="PushNotificationConfiguration">
+ * <complexType name="PushNotificationProvider">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="PushNotificationProvider" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="FileBasedProperties" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="Properties" type="{}Properties"/>
+ * <element name="FileBasedProperties" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * <element name="ConfigProperties" type="{}ConfigProperties"/>
* </sequence>
+ * <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
@@ -46,90 +47,81 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "PushNotificationConfiguration", propOrder = {
- "pushNotificationProvider",
+@XmlType(name = "PushNotificationProvider", propOrder = {
"fileBasedProperties",
- "properties"
+ "configProperties"
})
-public class PushNotificationConfiguration {
+public class PushNotificationProvider {
- @XmlElement(name = "PushNotificationProvider", required = true)
- protected String pushNotificationProvider;
- @XmlElement(name = "FileBasedProperties", required = true)
+ @XmlElement(name = "FileBasedProperties")
protected boolean fileBasedProperties;
- @XmlElement(name = "Properties", required = true)
- protected Properties properties;
+ @XmlElement(name = "ConfigProperties", required = true)
+ protected ConfigProperties configProperties;
+ @XmlAttribute(name = "type")
+ protected String type;
/**
- * Gets the value of the pushNotificationProvider property.
+ * Gets the value of the fileBasedProperties property.
*
- * @return
- * possible object is
- * {@link String }
- *
*/
- public String getPushNotificationProvider() {
- return pushNotificationProvider;
+ public boolean isFileBasedProperties() {
+ return fileBasedProperties;
}
/**
- * Sets the value of the pushNotificationProvider property.
+ * Sets the value of the fileBasedProperties property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
*/
- public void setPushNotificationProvider(String value) {
- this.pushNotificationProvider = value;
+ public void setFileBasedProperties(boolean value) {
+ this.fileBasedProperties = value;
}
/**
- * Gets the value of the fileBasedProperties property.
+ * Gets the value of the configProperties property.
*
* @return
* possible object is
- * {@link String }
+ * {@link ConfigProperties }
*
*/
- public boolean isFileBasedProperties() {
- return fileBasedProperties;
+ public ConfigProperties getConfigProperties() {
+ return configProperties;
}
/**
- * Sets the value of the fileBasedProperties property.
+ * Sets the value of the configProperties property.
*
* @param value
* allowed object is
- * {@link String }
+ * {@link ConfigProperties }
*
*/
- public void setFileBasedProperties(boolean value) {
- this.fileBasedProperties = value;
+ public void setConfigProperties(ConfigProperties value) {
+ this.configProperties = value;
}
/**
- * Gets the value of the properties property.
+ * Gets the value of the type property.
*
* @return
* possible object is
- * {@link Properties }
+ * {@link String }
*
*/
- public Properties getProperties() {
- return properties;
+ public String getType() {
+ return type;
}
/**
- * Sets the value of the properties property.
+ * Sets the value of the type property.
*
* @param value
* allowed object is
- * {@link Properties }
+ * {@link String }
*
*/
- public void setProperties(Properties value) {
- this.properties = value;
+ public void setType(String value) {
+ this.type = value;
}
}
diff --git a/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/config/QueryParameters.java b/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/config/QueryParameters.java
new file mode 100644
index 00000000000..0f37d496517
--- /dev/null
+++ b/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/config/QueryParameters.java
@@ -0,0 +1,64 @@
+/*
+ * 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.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Java class for QueryParameters complex type.
+ *
+ *
The following schema fragment specifies the expected content contained within this class.
+ *
+ *
+ * <complexType name="QueryParameters">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="Parameter" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "QueryParameters", propOrder = {
+ "parameter"
+})
+public class QueryParameters {
+
+ @XmlElement(name = "Parameter")
+ protected List parameter;
+
+ public List getParameter() {
+ if (parameter == null) {
+ parameter = new ArrayList();
+ }
+ return this.parameter;
+ }
+
+}
diff --git a/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/config/DeviceDefinition.java b/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/config/Table.java
similarity index 60%
rename from 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/config/DeviceDefinition.java
rename to 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/config/Table.java
index e49c3a553ba..9cb5a926b3a 100644
--- a/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/config/DeviceDefinition.java
+++ b/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/config/Table.java
@@ -20,26 +20,25 @@ 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.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
- * Java class for DeviceDefinition complex type.
+ *
Java class for Table complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
- * <complexType name="DeviceDefinition">
+ * <complexType name="Table">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="TableName" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="PrimaryKey" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="Attributes" type="{}Attributes"/>
- * <element name="License" type="{}License"/>
- * <element name="Features" type="{}Features"/>
* </sequence>
+ * <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
@@ -48,49 +47,18 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "DeviceDefinition", propOrder = {
- "tableName",
+@XmlType(name = "Table", propOrder = {
"primaryKey",
- "attributes",
- "license",
- "features"
+ "attributes"
})
-public class DeviceDefinition {
+public class Table {
- @XmlElement(name = "TableName", required = true)
- protected String tableName;
@XmlElement(name = "PrimaryKey", required = true)
protected String primaryKey;
@XmlElement(name = "Attributes", required = true)
protected Attributes attributes;
- @XmlElement(name = "License", required = true)
- protected License license;
- @XmlElement(name = "Features", required = true)
- protected Features features;
-
- /**
- * Gets the value of the tableName property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getTableName() {
- return tableName;
- }
-
- /**
- * Sets the value of the tableName property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setTableName(String value) {
- this.tableName = value;
- }
+ @XmlAttribute(name = "name")
+ protected String name;
/**
* Gets the value of the primaryKey property.
@@ -141,51 +109,27 @@ public class DeviceDefinition {
}
/**
- * Gets the value of the license property.
+ * Gets the value of the name property.
*
* @return
* possible object is
- * {@link License }
- *
- */
- public License getLicense() {
- return license;
- }
-
- /**
- * Sets the value of the license property.
- *
- * @param value
- * allowed object is
- * {@link License }
- *
- */
- public void setLicense(License value) {
- this.license = value;
- }
-
- /**
- * Gets the value of the features property.
- *
- * @return
- * possible object is
- * {@link Features }
+ * {@link String }
*
*/
- public Features getFeatures() {
- return features;
+ public String getName() {
+ return name;
}
/**
- * Sets the value of the features property.
+ * Sets the value of the name property.
*
* @param value
* allowed object is
- * {@link Features }
+ * {@link String }
*
*/
- public void setFeatures(Features value) {
- this.features = value;
+ public void setName(String value) {
+ this.name = value;
}
}
diff --git a/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/config/TableConfig.java b/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/config/TableConfig.java
new file mode 100644
index 00000000000..c587844033d
--- /dev/null
+++ b/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/config/TableConfig.java
@@ -0,0 +1,86 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * Java class for tableConfig complex type.
+ *
+ *
The following schema fragment specifies the expected content contained within this class.
+ *
+ *
+ * <complexType name="tableConfig">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="Table" type="{}Table" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "tableConfig", propOrder = {
+ "table"
+})
+public class TableConfig {
+
+ @XmlElement(name = "Table")
+ protected List
table;
+
+ /**
+ * Gets the value of the table property.
+ *
+ *
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a set
method for the table property.
+ *
+ *
+ * For example, to add a new item, do as follows:
+ *
+ * getTable().add(newItem);
+ *
+ *
+ *
+ *
+ * Objects of the following type(s) are allowed in the list
+ * {@link Table }
+ *
+ *
+ */
+ public List
getTable() {
+ if (table == null) {
+ table = new ArrayList();
+ }
+ return this.table;
+ }
+
+}
diff --git a/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/template/DeviceTypeManager.java b/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/template/DeviceTypeManager.java
index c52aff0a9d3..e0f2d45f10f 100644
--- a/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/template/DeviceTypeManager.java
+++ b/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/template/DeviceTypeManager.java
@@ -20,28 +20,25 @@ package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager;
-import org.wso2.carbon.device.mgt.common.DeviceTypeIdentifier;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.FeatureManager;
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.LicenseManagementException;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
+import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.DeviceDetails;
+import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.DeviceTypeConfiguration;
+import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.Table;
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.util.DeviceTypePluginConstants;
-import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.DeviceDefinition;
-import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.DeviceManagementConfiguration;
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.Feature;
-import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.Features;
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.exception.DeviceTypeDeployerFileException;
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.exception.DeviceTypeMgtPluginException;
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.dao.DeviceDAODefinition;
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.dao.DeviceTypePluginDAOManager;
-import org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.feature.AnnotationBasedFeatureManager;
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.feature.ConfigurationBasedFeatureManager;
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.util.DeviceTypeUtils;
import org.wso2.carbon.device.mgt.extensions.license.mgt.registry.RegistryBasedLicenseManager;
@@ -71,61 +68,53 @@ public class DeviceTypeManager implements DeviceManager {
private FeatureManager featureManager;
public DeviceTypeManager(DeviceTypeConfigIdentifier deviceTypeConfigIdentifier,
- DeviceManagementConfiguration deviceManagementConfiguration) {
-
- int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
- boolean isSharedWithAllTenants = deviceManagementConfiguration.getManagementRepository().getProvisioningConfig()
- .isSharedWithAllTenants();
- DeviceTypeIdentifier deviceTypeIdentifier;
+ DeviceTypeConfiguration deviceTypeConfiguration) {
deviceType = deviceTypeConfigIdentifier.getDeviceType();
- if (isSharedWithAllTenants) {
- deviceTypeIdentifier = new DeviceTypeIdentifier(deviceType);
- } else {
- deviceTypeIdentifier = new DeviceTypeIdentifier(deviceType, tenantId);
+ if (deviceTypeConfiguration.getFeatures() != null && deviceTypeConfiguration.getFeatures().getFeature() != null ) {
+ List features = deviceTypeConfiguration.getFeatures().getFeature();
+ if (features != null) {
+ featureManager = new ConfigurationBasedFeatureManager(features);
+ }
}
- DeviceDefinition deviceDefinition = deviceManagementConfiguration.getManagementRepository().getDeviceDefinition();
- if (deviceDefinition != null) {
- //generate features.
- Features featuresList = deviceManagementConfiguration.getManagementRepository().getDeviceDefinition().getFeatures();
- if (featuresList != null) {
- if (featuresList.isGenerate()) {
- featureManager = new AnnotationBasedFeatureManager(deviceTypeIdentifier);
- } else {
- List features = deviceDefinition.getFeatures().getFeature();
- if (features != null) {
- featureManager = new ConfigurationBasedFeatureManager(features);
- }
+ //add license to registry.
+ this.licenseManager = new RegistryBasedLicenseManager();
+ try {
+ if (licenseManager.getLicense(deviceType, DeviceTypePluginConstants.LANGUAGE_CODE_ENGLISH_US) == null) {
+
+ if (deviceTypeConfiguration.getLicense() != null) {
+ License defaultLicense = new License();
+ defaultLicense.setLanguage(deviceTypeConfiguration.getLicense().getLanguage());
+ defaultLicense.setVersion(deviceTypeConfiguration.getLicense().getVersion());
+ defaultLicense.setText(deviceTypeConfiguration.getLicense().getText());
+ licenseManager.addLicense(deviceType, defaultLicense);
}
}
+ } catch (LicenseManagementException e) {
+ String msg = "Error occurred while adding default license for " + deviceType + " devices";
+ throw new DeviceTypeDeployerFileException(msg, e);
+ }
- //add license to registry.
- this.licenseManager = new RegistryBasedLicenseManager();
- try {
- if (licenseManager.getLicense(deviceType, DeviceTypePluginConstants.LANGUAGE_CODE_ENGLISH_US) == null) {
-
- if (deviceDefinition.getLicense() != null) {
- License defaultLicense = new License();
- defaultLicense.setLanguage(deviceDefinition.getLicense().getLanguage());
- defaultLicense.setVersion(deviceDefinition.getLicense().getVersion());
- defaultLicense.setText(deviceDefinition.getLicense().getText());
- licenseManager.addLicense(deviceType, defaultLicense);
- }
- }
- } catch (LicenseManagementException e) {
- String msg = "Error occurred while adding default license for " + deviceType + " devices";
- throw new DeviceTypeDeployerFileException(msg, e);
- }
+ DeviceDetails deviceDetails = deviceTypeConfiguration.getDeviceDetails();
+ if (deviceDetails != null) {
//Check whether device dao definition exist.
-
- String tableName = deviceManagementConfiguration.getManagementRepository().getDeviceDefinition()
- .getTableName();
+ String tableName = deviceTypeConfiguration.getDeviceDetails().getTableId();
if (tableName != null && !tableName.isEmpty()) {
+ List tables = deviceTypeConfiguration.getDataSource().getTableConfig().getTable();
+ Table deviceDefinitionTable = null;
+ for (Table table : tables) {
+ if (tableName.equals(table.getName())) {
+ deviceDefinitionTable = table;
+ break;
+ }
+ }
+ if (deviceDefinitionTable == null) {
+ throw new DeviceTypeDeployerFileException("Could not find definition for table: " + tableName);
+ }
propertiesExist = true;
- DeviceDAODefinition deviceDAODefinition = new DeviceDAODefinition(deviceDefinition);
- String datasourceName = deviceManagementConfiguration.getManagementRepository()
- .getDataSourceConfiguration().getJndiLookupDefinition().getName();
+ DeviceDAODefinition deviceDAODefinition = new DeviceDAODefinition(deviceDefinitionTable);
+ String datasourceName = deviceTypeConfiguration.getDataSource().getJndiConfig().getName();
if (datasourceName != null && !datasourceName.isEmpty()) {
String setupOption = System.getProperty("setup");
if (setupOption != null) {
diff --git a/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/template/DeviceTypeManagerService.java b/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/template/DeviceTypeManagerService.java
index 4d92b73c04b..6602141b0ef 100644
--- a/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/template/DeviceTypeManagerService.java
+++ b/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/template/DeviceTypeManagerService.java
@@ -28,9 +28,9 @@ import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
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.extensions.device.type.deployer.config.DeviceManagementConfiguration;
+import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.DeviceTypeConfiguration;
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.Property;
-import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.PushNotificationConfiguration;
+import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.PushNotificationProvider;
import java.util.HashMap;
import java.util.List;
@@ -50,11 +50,11 @@ public class DeviceTypeManagerService implements DeviceManagementService {
private String type;
public DeviceTypeManagerService(DeviceTypeConfigIdentifier deviceTypeConfigIdentifier,
- DeviceManagementConfiguration deviceManagementConfiguration) {
- this.setProvisioningConfig(deviceTypeConfigIdentifier.getTenantDomain(), deviceManagementConfiguration);
- this.deviceManager = new DeviceTypeManager(deviceTypeConfigIdentifier, deviceManagementConfiguration);
- this.setType(deviceManagementConfiguration.getDeviceType());
- this.populatePushNotificationConfig(deviceManagementConfiguration.getPushNotificationConfiguration());
+ DeviceTypeConfiguration deviceTypeConfiguration) {
+ this.setProvisioningConfig(deviceTypeConfigIdentifier.getTenantDomain(), deviceTypeConfiguration);
+ this.deviceManager = new DeviceTypeManager(deviceTypeConfigIdentifier, deviceTypeConfiguration);
+ this.setType(deviceTypeConfiguration.getName());
+ this.populatePushNotificationConfig(deviceTypeConfiguration.getPushNotificationProvider());
}
@Override
@@ -66,15 +66,14 @@ public class DeviceTypeManagerService implements DeviceManagementService {
public void init() throws DeviceManagementException {
}
- private void populatePushNotificationConfig(PushNotificationConfiguration sourceConfig) {
- if (sourceConfig != null) {
- if (sourceConfig.isFileBasedProperties()) {
+ private void populatePushNotificationConfig(PushNotificationProvider pushNotificationProvider) {
+ if (pushNotificationProvider != null) {
+ if (pushNotificationProvider.isFileBasedProperties()) {
Map staticProps = new HashMap<>();
- for (Property property : sourceConfig.getProperties().getProperty()) {
+ for (Property property : pushNotificationProvider.getConfigProperties().getProperty()) {
staticProps.put(property.getName(), property.getValue());
}
- pushNotificationConfig = new PushNotificationConfig(sourceConfig.getPushNotificationProvider(),
- staticProps);
+ pushNotificationConfig = new PushNotificationConfig(pushNotificationProvider.getType(), staticProps);
} else {
try {
PlatformConfiguration deviceTypeConfig = deviceManager.getConfiguration();
@@ -83,7 +82,7 @@ public class DeviceTypeManagerService implements DeviceManagementService {
if (configuration.size() > 0) {
Map properties = this.getConfigProperty(configuration);
pushNotificationConfig = new PushNotificationConfig(
- sourceConfig.getPushNotificationProvider(), properties);
+ pushNotificationProvider.getType(), properties);
}
}
} catch (DeviceManagementException e) {
@@ -113,10 +112,13 @@ public class DeviceTypeManagerService implements DeviceManagementService {
return pushNotificationConfig;
}
- private void setProvisioningConfig(String tenantDomain, DeviceManagementConfiguration deviceManagementConfiguration) {
- boolean sharedWithAllTenants = deviceManagementConfiguration
- .getManagementRepository().getProvisioningConfig().isSharedWithAllTenants();
- provisioningConfig = new ProvisioningConfig(tenantDomain, sharedWithAllTenants);
+ private void setProvisioningConfig(String tenantDomain, DeviceTypeConfiguration deviceTypeConfiguration) {
+ if (deviceTypeConfiguration.getProvisioningConfig() != null) {
+ boolean sharedWithAllTenants = deviceTypeConfiguration.getProvisioningConfig().isSharedWithAllTenants();
+ provisioningConfig = new ProvisioningConfig(tenantDomain, sharedWithAllTenants);
+ } else {
+ provisioningConfig = new ProvisioningConfig(tenantDomain, false);
+ }
}
private void setType(String type) {
diff --git a/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/template/dao/DeviceDAODefinition.java b/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/template/dao/DeviceDAODefinition.java
index b9be593ecb7..4df77a9a2c5 100644
--- a/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/template/dao/DeviceDAODefinition.java
+++ b/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/template/dao/DeviceDAODefinition.java
@@ -18,8 +18,7 @@
*/
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.dao;
-import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.Attribute;
-import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.DeviceDefinition;
+import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.Table;
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.exception.DeviceTypeDeployerFileException;
import java.util.ArrayList;
@@ -32,7 +31,7 @@ import java.util.List;
public class DeviceDAODefinition {
private String deviceTableName;
- private String primarkey;
+ private String primarykey;
public List getColumnNames() {
return columnNames;
@@ -41,26 +40,26 @@ public class DeviceDAODefinition {
private List columnNames = new ArrayList<>();
- public DeviceDAODefinition(DeviceDefinition deviceDefinition) {
- deviceTableName = deviceDefinition.getTableName();
- primarkey = deviceDefinition.getPrimaryKey();
- List attributes = deviceDefinition.getAttributes().getAttribute();
+ public DeviceDAODefinition(Table table) {
+ deviceTableName = table.getName();
+ primarykey = table.getPrimaryKey();
+ List attributes = table.getAttributes().getAttribute();
if (deviceTableName == null || deviceTableName.isEmpty()) {
throw new DeviceTypeDeployerFileException("Missing deviceTableName");
}
- if (primarkey == null || primarkey.isEmpty()) {
+ if (primarykey == null || primarykey.isEmpty()) {
throw new DeviceTypeDeployerFileException("Missing primaryKey ");
}
if (attributes == null || attributes.size() == 0) {
throw new DeviceTypeDeployerFileException("Missing Attributes ");
}
- for (Attribute attribute : attributes) {
- if (attribute.getValue() == null ||attribute.getValue().isEmpty()) {
+ for (String attribute : attributes) {
+ if (attribute.isEmpty()) {
throw new DeviceTypeDeployerFileException("Unsupported attribute format for device definition");
}
- columnNames.add(attribute.getValue());
+ columnNames.add(attribute);
}
}
@@ -68,8 +67,8 @@ public class DeviceDAODefinition {
return deviceTableName;
}
- public String getPrimarkey() {
- return primarkey;
+ public String getPrimaryKey() {
+ return primarykey;
}
diff --git a/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/template/dao/DeviceTypePluginDAO.java b/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/template/dao/DeviceTypePluginDAO.java
index 4840d73fd45..fba1f121935 100644
--- a/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/template/dao/DeviceTypePluginDAO.java
+++ b/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/template/dao/DeviceTypePluginDAO.java
@@ -56,7 +56,7 @@ public class DeviceTypePluginDAO {
try {
conn = deviceTypeDAOHandler.getConnection();
String selectDBQuery = "SELECT " + getDeviceTableColumnNames() + " FROM " +
- deviceDAODefinition.getDeviceTableName() + " WHERE " + deviceDAODefinition.getPrimarkey() + " = ?";
+ deviceDAODefinition.getDeviceTableName() + " WHERE " + deviceDAODefinition.getPrimaryKey() + " = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, deviceId);
resultSet = stmt.executeQuery();
@@ -97,7 +97,7 @@ public class DeviceTypePluginDAO {
try {
conn = deviceTypeDAOHandler.getConnection();
String createDBQuery = "INSERT INTO " + deviceDAODefinition.getDeviceTableName() + "("
- + deviceDAODefinition.getPrimarkey() + " , " + getDeviceTableColumnNames() + ") VALUES ("
+ + deviceDAODefinition.getPrimaryKey() + " , " + getDeviceTableColumnNames() + ") VALUES ("
+ getPreparedInputString(deviceDAODefinition.getColumnNames().size() + 1) + ")";
stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, device.getDeviceIdentifier());
@@ -132,7 +132,7 @@ public class DeviceTypePluginDAO {
try {
conn = deviceTypeDAOHandler.getConnection();
String updateDBQuery = "UPDATE " + deviceDAODefinition.getDeviceTableName() + " SET "
- + getDeviceTableColumnNamesForUpdateQuery()+ " WHERE " + deviceDAODefinition.getPrimarkey()
+ + getDeviceTableColumnNamesForUpdateQuery()+ " WHERE " + deviceDAODefinition.getPrimaryKey()
+ " = ?";
stmt = conn.prepareStatement(updateDBQuery);
@@ -167,7 +167,7 @@ public class DeviceTypePluginDAO {
try {
conn = deviceTypeDAOHandler.getConnection();
String deleteDBQuery = "DELETE FROM " + deviceDAODefinition.getDeviceTableName()
- + " WHERE " + deviceDAODefinition.getPrimarkey() + " = ?";
+ + " WHERE " + deviceDAODefinition.getPrimaryKey() + " = ?";
stmt = conn.prepareStatement(deleteDBQuery);
stmt.setString(1, deviceId);
int rows = stmt.executeUpdate();
@@ -203,7 +203,7 @@ public class DeviceTypePluginDAO {
resultSet = stmt.executeQuery();
while (resultSet.next()) {
device = new Device();
- device.setDeviceIdentifier(resultSet.getString(deviceDAODefinition.getPrimarkey()));
+ device.setDeviceIdentifier(resultSet.getString(deviceDAODefinition.getPrimaryKey()));
List properties = new ArrayList<>();
for (String columnName : deviceDAODefinition.getColumnNames()) {
Device.Property property = new Device.Property();
diff --git a/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/template/feature/AnnotationBasedFeatureManager.java b/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/template/feature/AnnotationBasedFeatureManager.java
deleted file mode 100644
index 8b179570460..00000000000
--- a/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/template/feature/AnnotationBasedFeatureManager.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed 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.feature;
-
-import org.wso2.carbon.device.mgt.common.DeviceManagementException;
-import org.wso2.carbon.device.mgt.common.DeviceTypeIdentifier;
-import org.wso2.carbon.device.mgt.common.Feature;
-import org.wso2.carbon.device.mgt.common.FeatureManager;
-import org.wso2.carbon.device.mgt.extensions.feature.mgt.GenericFeatureManager;
-
-import java.util.List;
-
-/**
- * This feature manager implementation reads the annotation @Feature and creates a feature manager.
- */
-public class AnnotationBasedFeatureManager implements FeatureManager {
- private DeviceTypeIdentifier deviceType;
-
- public AnnotationBasedFeatureManager(DeviceTypeIdentifier deviceTypeIdentifier) {
- this.deviceType = deviceTypeIdentifier;
- }
-
- @Override
- public boolean addFeature(Feature feature) throws DeviceManagementException {
- return false;
- }
-
- @Override
- public boolean addFeatures(List features) throws DeviceManagementException {
- return false;
- }
-
- @Override
- public Feature getFeature(String name) throws DeviceManagementException {
- return GenericFeatureManager.getInstance().getFeature(deviceType, name);
- }
-
- @Override
- public List getFeatures() throws DeviceManagementException {
- return GenericFeatureManager.getInstance().getFeatures(deviceType);
- }
-
- @Override
- public boolean removeFeature(String name) throws DeviceManagementException {
- return false;
- }
-
- @Override
- public boolean addSupportedFeaturesToDB() throws DeviceManagementException {
- return false;
- }
-}
diff --git a/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/template/feature/ConfigurationBasedFeatureManager.java b/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/template/feature/ConfigurationBasedFeatureManager.java
index 35689afcec9..64303fa206d 100644
--- a/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/template/feature/ConfigurationBasedFeatureManager.java
+++ b/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/template/feature/ConfigurationBasedFeatureManager.java
@@ -21,15 +21,27 @@ package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.feat
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.extensions.device.type.deployer.config.Operation;
+import javax.ws.rs.HttpMethod;
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 retreives the features that are configured through the deployer.
*/
public class ConfigurationBasedFeatureManager implements FeatureManager {
private List features = new ArrayList<>();
+ private static final String METHOD = "method";
+ private static final String URI = "uri";
+ private static final String PATH_PARAMS = "pathParams";
+ private static final String QUERY_PARAMS = "queryParams";
+ private static final String FORM_PARAMS = "formParams";
+ private static final Pattern PATH_PARAM_REGEX = Pattern.compile("\\{(.*?)\\}");
public ConfigurationBasedFeatureManager(
List features) {
@@ -38,6 +50,29 @@ public class ConfigurationBasedFeatureManager implements FeatureManager {
deviceFeature.setCode(feature.getCode());
deviceFeature.setName(feature.getName());
deviceFeature.setDescription(feature.getDescription());
+ Operation operation = feature.getOperation();
+ if (operation != null) {
+ Map apiParams = new HashMap<>();
+ apiParams.put(METHOD, operation.getMethod().toUpperCase());
+ apiParams.put(URI, operation.getContext());
+ List pathParams = getPathParams(operation.getContext());
+ if (!pathParams.isEmpty()) {
+ apiParams.put(PATH_PARAMS, pathParams);
+ }
+
+ if (operation.getQueryParameters() != null) {
+ apiParams.put(QUERY_PARAMS, operation.getQueryParameters().getParameter());
+ }
+ if (operation.getFormParameters() != null) {
+ apiParams.put(FORM_PARAMS, operation.getFormParameters().getParameter());
+ }
+ List metadataEntries = new ArrayList<>();
+ Feature.MetadataEntry metadataEntry = new Feature.MetadataEntry();
+ metadataEntry.setId(-1);
+ metadataEntry.setValue(apiParams);
+ metadataEntries.add(metadataEntry);
+ deviceFeature.setMetadataEntries(metadataEntries);
+ }
this.features.add(deviceFeature);
}
}
@@ -77,4 +112,13 @@ public class ConfigurationBasedFeatureManager implements FeatureManager {
public boolean addSupportedFeaturesToDB() throws DeviceManagementException {
return false;
}
+
+ private List getPathParams(String context) {
+ List matchList = new ArrayList();
+ Matcher regexMatcher = PATH_PARAM_REGEX.matcher(context);
+ while (regexMatcher.find()) {
+ matchList.add(regexMatcher.group(1));
+ }
+ return matchList;
+ }
}
diff --git a/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/template/util/DeviceTypeUtils.java b/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/template/util/DeviceTypeUtils.java
index 2f6d1525b84..466b3edcfea 100644
--- a/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/template/util/DeviceTypeUtils.java
+++ b/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/template/util/DeviceTypeUtils.java
@@ -21,7 +21,6 @@ package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template.util
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
-import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.DeviceManagementConfiguration;
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.exception.DeviceTypeMgtPluginException;
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.internal.DeviceTypeManagementDataHolder;
import org.wso2.carbon.registry.api.RegistryException;
@@ -30,7 +29,6 @@ import org.wso2.carbon.registry.core.Registry;
import javax.naming.Context;
import javax.naming.InitialContext;
-import javax.naming.NamingException;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -89,8 +87,6 @@ public class DeviceTypeUtils {
} else {
log.info("Device management repository database already exists. Not creating a new database.");
}
- } catch (NamingException e) {
- log.error("Error while looking up the data source: " + datasourceName, e);
} catch (Exception e) {
throw new DeviceTypeMgtPluginException("Error occurred while initializing Device " +
"Management database schema", e);
diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml
index 7e5a1f9536e..1f0584227ca 100644
--- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml
+++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml
@@ -17,7 +17,65 @@
~ specific language governing permissions and limitations
~ under the License.
-->
-
+
+
+
+
+
+
+ abc
+ this is a feature
+
+
+ deviceId
+
+
+ test
+
+
+
+
+
+
+
+
+ false
+
+
+
+ true
+
+
+ sample.mqtt.adapter
+ tcp://localhost:1883
+ admin
+ https://localhost:9443/dynamic-client-web/register
+ 0
+
+ true
+
+
en_US
@@ -29,49 +87,15 @@
jdbc/SampleDM_DB
-
-
+
+
SAMPLE_DEVICE_ID
column1
column2
-
+
-
-
-
- abc
- 5.0.0
- this is a feature
-
- place_holder
- place_holder
- place_holder
-
-
-
-
-
- false
-
-
-
-
- true
-
-
- sample.mqtt.adapter
- tcp://localhost:1883
- admin
- https://localhost:9443/dynamic-client-web/register
- 0
-
- true
-
-
-
-
-
+
\ No newline at end of file