* Objects of the following type(s) are allowed in the list
- * {@link Attribute }
+ * {@link String }
*
*
*/
- public List getAttribute() {
+ public List getAttribute() {
if (attribute == null) {
- attribute = new ArrayList();
+ attribute = new ArrayList();
}
return this.attribute;
}
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/Properties.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/ConfigProperties.java
similarity index 93%
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/Properties.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/ConfigProperties.java
index 177b8fd90b..1280d8165c 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/Properties.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/ConfigProperties.java
@@ -27,12 +27,12 @@ import javax.xml.bind.annotation.XmlType;
/**
- *
Java class for Properties complex type.
+ *
Java class for ConfigProperties complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
- * <complexType name="Properties">
+ * <complexType name="ConfigProperties">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
@@ -46,10 +46,10 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Properties", propOrder = {
+@XmlType(name = "ConfigProperties", propOrder = {
"property"
})
-public class Properties {
+public class ConfigProperties {
@XmlElement(name = "Property")
protected List 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/config/DataSource.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/DataSource.java
new file mode 100644
index 0000000000..d55db0e6cb
--- /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/DataSource.java
@@ -0,0 +1,107 @@
+/*
+ * 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 DataSource complex type.
+ *
+ *
The following schema fragment specifies the expected content contained within this class.
+ *
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "DataSource", propOrder = {
+ "jndiConfig",
+ "tableConfig"
+})
+public class DataSource {
+
+ @XmlElement(required = true)
+ protected JndiConfig jndiConfig;
+ @XmlElement(required = true)
+ protected TableConfig tableConfig;
+
+ /**
+ * Gets the value of the jndiConfig property.
+ *
+ * @return
+ * possible object is
+ * {@link JndiConfig }
+ *
+ */
+ public JndiConfig getJndiConfig() {
+ return jndiConfig;
+ }
+
+ /**
+ * Sets the value of the jndiConfig property.
+ *
+ * @param value
+ * allowed object is
+ * {@link JndiConfig }
+ *
+ */
+ public void setJndiConfig(JndiConfig value) {
+ this.jndiConfig = value;
+ }
+
+ /**
+ * Gets the value of the tableConfig property.
+ *
+ * @return
+ * possible object is
+ * {@link TableConfig }
+ *
+ */
+ public TableConfig getTableConfig() {
+ return tableConfig;
+ }
+
+ /**
+ * Sets the value of the tableConfig property.
+ *
+ * @param value
+ * allowed object is
+ * {@link TableConfig }
+ *
+ */
+ public void setTableConfig(TableConfig value) {
+ this.tableConfig = 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/Attribute.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/DeviceDetails.java
similarity index 69%
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/Attribute.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/DeviceDetails.java
index 19e177e829..6428bf097f 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/Attribute.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/DeviceDetails.java
@@ -26,15 +26,15 @@ import javax.xml.bind.annotation.XmlValue;
/**
- *
Java class for Attribute complex type.
+ *
Java class for DeviceDetails complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
- * <complexType name="Attribute">
+ * <complexType name="DeviceDetails">
* <simpleContent>
* <extension base="<http://www.w3.org/2001/XMLSchema>string">
- * <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="table-id" type="{http://www.w3.org/2001/XMLSchema}string" />
* </extension>
* </simpleContent>
* </complexType>
@@ -43,11 +43,15 @@ import javax.xml.bind.annotation.XmlValue;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-public class Attribute {
+@XmlType(name = "DeviceDetails", propOrder = {
+ "value"
+})
+public class DeviceDetails {
@XmlValue
protected String value;
-
+ @XmlAttribute(name = "table-id")
+ protected String tableId;
/**
* Gets the value of the value property.
@@ -73,4 +77,28 @@ public class Attribute {
this.value = value;
}
+ /**
+ * Gets the value of the tableId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTableId() {
+ return tableId;
+ }
+
+ /**
+ * Sets the value of the tableId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTableId(String value) {
+ this.tableId = 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/DeviceManagementConfiguration.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/DeviceManagementConfiguration.java
deleted file mode 100644
index 2491390f5e..0000000000
--- 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/DeviceManagementConfiguration.java
+++ /dev/null
@@ -1,141 +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.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- *
Java class for DeviceManagementConfiguration complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlRootElement(name = "DeviceTypeConfiguration")
+public class DeviceTypeConfiguration {
+
+ @XmlElement(name = "DeviceDetails", required = true)
+ protected DeviceDetails deviceDetails;
+ @XmlElement(name = "Features", required = true)
+ protected Features features;
+ @XmlElement(name = "ProvisioningConfig", required = true)
+ protected ProvisioningConfig provisioningConfig;
+ @XmlElement(name = "PushNotificationProvider", required = true)
+ protected PushNotificationProvider pushNotificationProvider;
+ @XmlElement(name = "License", required = true)
+ protected License license;
+ @XmlElement(name = "DataSource", required = true)
+ protected DataSource dataSource;
+ @XmlAttribute(name = "name")
+ protected String name;
+
+ /**
+ * Gets the value of the deviceDetails property.
+ *
+ * @return
+ * possible object is
+ * {@link DeviceDetails }
+ *
+ */
+ public DeviceDetails getDeviceDetails() {
+ return deviceDetails;
+ }
+
+ /**
+ * Sets the value of the deviceDetails property.
+ *
+ * @param value
+ * allowed object is
+ * {@link DeviceDetails }
+ *
+ */
+ public void setDeviceDetails(DeviceDetails value) {
+ this.deviceDetails = value;
+ }
+
+ /**
+ * Gets the value of the features property.
+ *
+ * @return
+ * possible object is
+ * {@link Features }
+ *
+ */
+ public Features getFeatures() {
+ return features;
+ }
+
+ /**
+ * Sets the value of the features property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Features }
+ *
+ */
+ public void setFeatures(Features value) {
+ this.features = 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;
+ }
+
+ /**
+ * Gets the value of the pushNotificationProvider property.
+ *
+ * @return
+ * possible object is
+ * {@link PushNotificationProvider }
+ *
+ */
+ public PushNotificationProvider getPushNotificationProvider() {
+ return pushNotificationProvider;
+ }
+
+ /**
+ * Sets the value of the pushNotificationProvider property.
+ *
+ * @param value
+ * allowed object is
+ * {@link PushNotificationProvider }
+ *
+ */
+ public void setPushNotificationProvider(PushNotificationProvider value) {
+ this.pushNotificationProvider = value;
+ }
+
+ /**
+ * Gets the value of the license 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 dataSource property.
+ *
+ * @return
+ * possible object is
+ * {@link DataSource }
+ *
+ */
+ public DataSource getDataSource() {
+ return dataSource;
+ }
+
+ /**
+ * Sets the value of the dataSource property.
+ *
+ * @param value
+ * allowed object is
+ * {@link DataSource }
+ *
+ */
+ public void setDataSource(DataSource value) {
+ this.dataSource = value;
+ }
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ 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/Feature.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/Feature.java
index 00d3768af7..0fd247cddc 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/Feature.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/Feature.java
@@ -20,6 +20,7 @@ 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;
@@ -34,10 +35,11 @@ import javax.xml.bind.annotation.XmlType;
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="Code" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="Description" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="Operation" type="{}Operation"/>
* </sequence>
+ * <attribute name="code" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
@@ -47,89 +49,115 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Feature", propOrder = {
- "code",
"name",
- "description"
+ "description",
+ "operation"
})
public class Feature {
- @XmlElement(name = "Code", required = true)
- protected String code;
@XmlElement(name = "Name", required = true)
protected String name;
@XmlElement(name = "Description", required = true)
protected String description;
+ @XmlElement(name = "Operation", required = true)
+ protected Operation operation;
+ @XmlAttribute(name = "code")
+ protected String code;
/**
- * Gets the value of the code property.
+ * Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
- public String getCode() {
- return code;
+ public String getName() {
+ return name;
}
/**
- * Sets the value of the code property.
+ * Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
- public void setCode(String value) {
- this.code = value;
+ public void setName(String value) {
+ this.name = value;
}
/**
- * Gets the value of the name property.
+ * Gets the value of the description property.
*
* @return
* possible object is
* {@link String }
*
*/
- public String getName() {
- return name;
+ public String getDescription() {
+ return description;
}
/**
- * Sets the value of the name property.
+ * Sets the value of the description property.
*
* @param value
* allowed object is
* {@link String }
*
*/
- public void setName(String value) {
- this.name = value;
+ public void setDescription(String value) {
+ this.description = value;
}
/**
- * Gets the value of the description property.
+ * Gets the value of the operation property.
+ *
+ * @return
+ * possible object is
+ * {@link Operation }
+ *
+ */
+ public Operation getOperation() {
+ return operation;
+ }
+
+ /**
+ * Sets the value of the operation property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Operation }
+ *
+ */
+ public void setOperation(Operation value) {
+ this.operation = value;
+ }
+
+ /**
+ * Gets the value of the code property.
*
* @return
* possible object is
* {@link String }
*
*/
- public String getDescription() {
- return description;
+ public String getCode() {
+ return code;
}
/**
- * Sets the value of the description property.
+ * Sets the value of the code property.
*
* @param value
* allowed object is
* {@link String }
*
*/
- public void setDescription(String value) {
- this.description = value;
+ public void setCode(String value) {
+ this.code = 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/Features.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/Features.java
index 8a84374a63..7e00b18688 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/Features.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/Features.java
@@ -18,13 +18,12 @@
*/
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.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
+import java.util.ArrayList;
+import java.util.List;
/**
@@ -37,9 +36,8 @@ import javax.xml.bind.annotation.XmlType;
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="Feature" type="{}Feature" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="Feature" type="{}Feature"/>
* </sequence>
- * <attribute name="generate" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
@@ -55,30 +53,14 @@ public class Features {
@XmlElement(name = "Feature")
protected List feature;
- @XmlAttribute(name = "generate")
- protected boolean generate;
/**
* Gets the value of the feature 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 feature property.
- *
- *
- * For example, to add a new item, do as follows:
- *
- * getFeature().add(newItem);
- *
- *
- *
- *
- * Objects of the following type(s) are allowed in the list
- * {@link Feature }
- *
- *
+ * @return
+ * possible object is
+ * {@link Feature }
+ *
*/
public List getFeature() {
if (feature == null) {
@@ -87,28 +69,4 @@ public class Features {
return this.feature;
}
- /**
- * Gets the value of the generate property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public boolean isGenerate() {
- return generate;
- }
-
- /**
- * Sets the value of the generate property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setGenerate(boolean value) {
- this.generate = 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/DataSourceConfiguration.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/FormParameters.java
similarity index 57%
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/DataSourceConfiguration.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/FormParameters.java
index a118ee41ab..6cdda89299 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/DataSourceConfiguration.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/FormParameters.java
@@ -22,19 +22,21 @@ 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 DataSourceConfiguration complex type.
+ *
Java class for FormParameters complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
- * <complexType name="DataSourceConfiguration">
+ * <complexType name="FormParameters">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="JndiLookupDefinition" type="{}JndiLookupDefinition"/>
+ * <element name="Parameter" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
@@ -44,36 +46,19 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "DataSourceConfiguration", propOrder = {
- "jndiLookupDefinition"
+@XmlType(name = "FormParameters", propOrder = {
+ "parameter"
})
-public class DataSourceConfiguration {
+public class FormParameters {
- @XmlElement(name = "JndiLookupDefinition", required = true)
- protected JndiLookupDefinition jndiLookupDefinition;
+ @XmlElement(name = "Parameter")
+ protected List parameter;
- /**
- * Gets the value of the jndiLookupDefinition property.
- *
- * @return
- * possible object is
- * {@link JndiLookupDefinition }
- *
- */
- public JndiLookupDefinition getJndiLookupDefinition() {
- return jndiLookupDefinition;
- }
-
- /**
- * Sets the value of the jndiLookupDefinition property.
- *
- * @param value
- * allowed object is
- * {@link JndiLookupDefinition }
- *
- */
- public void setJndiLookupDefinition(JndiLookupDefinition value) {
- this.jndiLookupDefinition = value;
+ 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/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 9064215fe2..a43dc26b9c 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 c7eccfd5f2..0000000000
--- 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.
- *
- *
- *
- *
- */
-@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 0000000000..be089a9ccc
--- /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 0000000000..81ab8fdaf2
--- /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.
+ *
+ *
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
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 4d92b73c04..6602141b0e 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 b9be593ecb..4df77a9a2c 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 4840d73fd4..49d500ee0e 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
@@ -41,11 +41,17 @@ public class DeviceTypePluginDAO {
private static final Log log = LogFactory.getLog(DeviceTypePluginDAO.class);
private DeviceTypeDAOHandler deviceTypeDAOHandler;
private DeviceDAODefinition deviceDAODefinition;
+ private String selectDBQueryForGetDevice;
+ private String createDBqueryForAddDevice;
+ private String updateDBQueryForUpdateDevice;
+ private String deleteDBQueryToRemoveDevicd;
+ private String selectDBQueryToGetAllDevice;
public DeviceTypePluginDAO(DeviceDAODefinition deviceDAODefinition,
DeviceTypeDAOHandler deviceTypeDAOHandler) {
this.deviceTypeDAOHandler = deviceTypeDAOHandler;
this.deviceDAODefinition = deviceDAODefinition;
+ initializeDbQueries();
}
public Device getDevice(String deviceId) throws DeviceTypeMgtPluginException {
@@ -55,9 +61,7 @@ public class DeviceTypePluginDAO {
ResultSet resultSet = null;
try {
conn = deviceTypeDAOHandler.getConnection();
- String selectDBQuery = "SELECT " + getDeviceTableColumnNames() + " FROM " +
- deviceDAODefinition.getDeviceTableName() + " WHERE " + deviceDAODefinition.getPrimarkey() + " = ?";
- stmt = conn.prepareStatement(selectDBQuery);
+ stmt = conn.prepareStatement(selectDBQueryForGetDevice);
stmt.setString(1, deviceId);
resultSet = stmt.executeQuery();
@@ -96,10 +100,7 @@ public class DeviceTypePluginDAO {
PreparedStatement stmt = null;
try {
conn = deviceTypeDAOHandler.getConnection();
- String createDBQuery = "INSERT INTO " + deviceDAODefinition.getDeviceTableName() + "("
- + deviceDAODefinition.getPrimarkey() + " , " + getDeviceTableColumnNames() + ") VALUES ("
- + getPreparedInputString(deviceDAODefinition.getColumnNames().size() + 1) + ")";
- stmt = conn.prepareStatement(createDBQuery);
+ stmt = conn.prepareStatement(createDBqueryForAddDevice);
stmt.setString(1, device.getDeviceIdentifier());
int columnIndex = 2;
for (String columnName : deviceDAODefinition.getColumnNames()) {
@@ -131,11 +132,7 @@ public class DeviceTypePluginDAO {
PreparedStatement stmt = null;
try {
conn = deviceTypeDAOHandler.getConnection();
- String updateDBQuery = "UPDATE " + deviceDAODefinition.getDeviceTableName() + " SET "
- + getDeviceTableColumnNamesForUpdateQuery()+ " WHERE " + deviceDAODefinition.getPrimarkey()
- + " = ?";
-
- stmt = conn.prepareStatement(updateDBQuery);
+ stmt = conn.prepareStatement(updateDBQueryForUpdateDevice);
int columnIndex = 1;
for (String columnName : deviceDAODefinition.getColumnNames()) {
stmt.setString(columnIndex, getPropertString(device.getProperties(), columnName));
@@ -166,9 +163,7 @@ public class DeviceTypePluginDAO {
PreparedStatement stmt = null;
try {
conn = deviceTypeDAOHandler.getConnection();
- String deleteDBQuery = "DELETE FROM " + deviceDAODefinition.getDeviceTableName()
- + " WHERE " + deviceDAODefinition.getPrimarkey() + " = ?";
- stmt = conn.prepareStatement(deleteDBQuery);
+ stmt = conn.prepareStatement(deleteDBQueryToRemoveDevicd);
stmt.setString(1, deviceId);
int rows = stmt.executeUpdate();
if (rows > 0) {
@@ -197,13 +192,11 @@ public class DeviceTypePluginDAO {
List devices = new ArrayList<>();
try {
conn = deviceTypeDAOHandler.getConnection();
- String selectDBQuery = "SELECT " + getDeviceTableColumnNames() + " FROM "
- + deviceDAODefinition.getDeviceTableName();
- stmt = conn.prepareStatement(selectDBQuery);
+ stmt = conn.prepareStatement(selectDBQueryToGetAllDevice);
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();
@@ -254,4 +247,23 @@ public class DeviceTypePluginDAO {
}
return null;
}
+
+ private void initializeDbQueries() {
+ selectDBQueryForGetDevice = "SELECT " + getDeviceTableColumnNames() + " FROM " +
+ deviceDAODefinition.getDeviceTableName() + " WHERE " + deviceDAODefinition.getPrimaryKey() + " = ?";
+
+ createDBqueryForAddDevice = "INSERT INTO " + deviceDAODefinition.getDeviceTableName() + "("
+ + deviceDAODefinition.getPrimaryKey() + " , " + getDeviceTableColumnNames() + ") VALUES ("
+ + getPreparedInputString(deviceDAODefinition.getColumnNames().size() + 1) + ")";
+
+ updateDBQueryForUpdateDevice = "UPDATE " + deviceDAODefinition.getDeviceTableName() + " SET "
+ + getDeviceTableColumnNamesForUpdateQuery()+ " WHERE " + deviceDAODefinition.getPrimaryKey()
+ + " = ?";
+
+ deleteDBQueryToRemoveDevicd = "DELETE FROM " + deviceDAODefinition.getDeviceTableName()
+ + " WHERE " + deviceDAODefinition.getPrimaryKey() + " = ?";
+
+ selectDBQueryToGetAllDevice = "SELECT " + getDeviceTableColumnNames() + " FROM "
+ + deviceDAODefinition.getDeviceTableName();
+ }
}
\ No newline at end of file
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 8b17957046..0000000000
--- 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 35689afcec..fb100be94b 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,31 @@ 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("\\{(.*?)\\}");
+ private List pathParams = new ArrayList<>();
+ private List queryParams = new ArrayList<>();
+ private List formParams = new ArrayList<>();
+
public ConfigurationBasedFeatureManager(
List features) {
@@ -38,6 +54,28 @@ 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());
+ setPathParams(operation.getContext());
+ apiParams.put(PATH_PARAMS, pathParams);
+ if (operation.getQueryParameters() != null) {
+ queryParams = operation.getQueryParameters().getParameter();
+ }
+ apiParams.put(QUERY_PARAMS, queryParams);
+ if (operation.getFormParameters() != null) {
+ formParams = operation.getFormParameters().getParameter();
+ }
+ apiParams.put(FORM_PARAMS, formParams);
+ 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 +115,11 @@ public class ConfigurationBasedFeatureManager implements FeatureManager {
public boolean addSupportedFeaturesToDB() throws DeviceManagementException {
return false;
}
+
+ private void setPathParams(String context) {
+ Matcher regexMatcher = PATH_PARAM_REGEX.matcher(context);
+ while (regexMatcher.find()) {
+ pathParams.add(regexMatcher.group(1));
+ }
+ }
}
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 2f6d1525b8..466b3edcfe 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 7e5a1f9536..1f0584227c 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_IDcolumn1column2
-
+
-
-
-
- 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
diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/gcm/GCMNotificationStrategy.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/gcm/GCMNotificationStrategy.java
index 05c8105e4b..4990de95f5 100644
--- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/gcm/GCMNotificationStrategy.java
+++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/gcm/GCMNotificationStrategy.java
@@ -71,6 +71,11 @@ public class GCMNotificationStrategy implements NotificationStrategy {
return null;
}
+ @Override
+ public void undeploy() {
+
+ }
+
private void sendWakeUpCall(String message,
Device device) throws IOException, PushNotificationExecutionFailedException {
OutputStream os = null;
diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategy.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategy.java
index fae2658228..4229bc5337 100644
--- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategy.java
+++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategy.java
@@ -101,4 +101,9 @@ public class MQTTNotificationStrategy implements NotificationStrategy {
return null;
}
+ @Override
+ public void undeploy() {
+ MQTTDataHolder.getInstance().getOutputEventAdapterService().destroy(mqttAdapterName);
+ }
+
}
diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/xmpp/XMPPNotificationStrategy.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/xmpp/XMPPNotificationStrategy.java
index a885f11cd4..0e82bec7ce 100644
--- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/xmpp/XMPPNotificationStrategy.java
+++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/xmpp/XMPPNotificationStrategy.java
@@ -89,4 +89,9 @@ public class XMPPNotificationStrategy implements NotificationStrategy {
return null;
}
+ @Override
+ public void undeploy() {
+ XMPPDataHolder.getInstance().getOutputEventAdapterService().destroy(xmppAdapterName);
+ }
+
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java
index 44ab59eefb..8c8818f736 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java
@@ -18,6 +18,7 @@
package org.wso2.carbon.device.mgt.common.operation.mgt;
import org.wso2.carbon.device.mgt.common.*;
+import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
import java.util.List;
@@ -93,4 +94,16 @@ public interface OperationManager {
int getActivityCountUpdatedAfter(long timestamp) throws OperationManagementException;
+ /**
+ * Operation manger implementation can have a push notification stratergy
+ * @param notificationStrategy eg: mqtt/xmpp
+ */
+ void setNotificationStrategy(NotificationStrategy notificationStrategy);
+
+ /**
+ * retrive the push notification strategy.
+ * @return NotificationStrategy
+ */
+ NotificationStrategy getNotificationStrategy();
+
}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/push/notification/NotificationStrategy.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/push/notification/NotificationStrategy.java
index 137c87034b..bce041a2f2 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/push/notification/NotificationStrategy.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/push/notification/NotificationStrategy.java
@@ -26,4 +26,9 @@ public interface NotificationStrategy {
NotificationContext buildContext();
+ /**
+ * This will be executed when undeploying the device type.
+ */
+ void undeploy();
+
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java
index 8246c7e283..2526ece305 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java
@@ -99,7 +99,14 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
deviceTypeIdentifier = new DeviceTypeIdentifier(deviceTypeName, providerTenantId);
providers.remove(deviceTypeIdentifier);
}
- operationManagerRepository.removeOperationManager(deviceTypeIdentifier);
+ OperationManager operationManager = operationManagerRepository.getOperationManager(deviceTypeIdentifier);
+ if (operationManager != null) {
+ NotificationStrategy notificationStrategy = operationManager.getNotificationStrategy();
+ if (notificationStrategy != null) {
+ notificationStrategy.undeploy();
+ }
+ operationManagerRepository.removeOperationManager(deviceTypeIdentifier);
+ }
}
public DeviceManagementService getDeviceManagementService(String type, int tenantId) {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java
index 0b6f4e1997..b5a7bad285 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java
@@ -83,6 +83,14 @@ public class OperationManagerImpl implements OperationManager {
enrollmentDAO = DeviceManagementDAOFactory.getEnrollmentDAO();
}
+ public NotificationStrategy getNotificationStrategy() {
+ return notificationStrategy;
+ }
+
+ public void setNotificationStrategy(NotificationStrategy notificationStrategy) {
+ this.notificationStrategy = notificationStrategy;
+ }
+
public OperationManagerImpl(NotificationStrategy notificationStrategy) {
this();
this.notificationStrategy = notificationStrategy;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/push/notification/mgt/PushNotificationBasedOperationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/push/notification/mgt/PushNotificationBasedOperationManager.java
index 6f0f020482..0d92577135 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/push/notification/mgt/PushNotificationBasedOperationManager.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/push/notification/mgt/PushNotificationBasedOperationManager.java
@@ -136,4 +136,14 @@ public class PushNotificationBasedOperationManager implements OperationManager {
return this.operationManager.getActivityCountUpdatedAfter(timestamp);
}
+ @Override
+ public void setNotificationStrategy(NotificationStrategy notificationStrategy) {
+
+ }
+
+ @Override
+ public NotificationStrategy getNotificationStrategy() {
+ return notificationProvider;
+ }
+
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/invoker-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/invoker-api.jag
index b701ad3f01..8ac28da95f 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/invoker-api.jag
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/invoker-api.jag
@@ -30,8 +30,10 @@ if (uriMatcher.match("/{context}/api/invoker/execute/")) {
//NOTE: We are only interested in Content-Type headers. Appending all request headers to the back-end call
// will cause unforeseen security issues.
var contentType = request.getHeader(constants.CONTENT_TYPE_IDENTIFIER);
+ var acceptType = request.getHeader(constants.ACCEPT_IDENTIFIER);
var requestHeaders = [];
requestHeaders.push({"name": constants.CONTENT_TYPE_IDENTIFIER, "value" : contentType});
+ requestHeaders.push({"name": constants.ACCEPT_IDENTIFIER, "value" : acceptType});
var restAPIRequestDetails = request.getContent();
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/constants.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/constants.js
index b79f0160c8..ed2dc01a8e 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/constants.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/constants.js
@@ -63,6 +63,7 @@ var CONTENT_TYPE_IDENTIFIER = "Content-Type";
var CONTENT_DISPOSITION_IDENTIFIER = "Content-Disposition";
var APPLICATION_JSON = "application/json";
var APPLICATION_ZIP = "application/zip";
+var STREAMING_FILES_ACCEPT_HEADERS = ["application/zip", "application/pdf", "application/octet-stream"];
var ACCEPT_IDENTIFIER = "Accept";
var AUTHORIZATION_HEADER= "Authorization";
var BEARER_PREFIX = "Bearer ";
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-protected-service-invokers.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-protected-service-invokers.js
index bb260ae5ea..d29498a318 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-protected-service-invokers.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-protected-service-invokers.js
@@ -301,6 +301,7 @@ var invokers = function () {
var Header = Packages.org.apache.commons.httpclient.Header;
var contentTypeFound = false;
var acceptTypeFound = false;
+ var acceptTypeValue = constants["APPLICATION_JSON"];
for (var i in headers) {
var header = new Header();
header.setName(headers[i].name);
@@ -312,6 +313,7 @@ var invokers = function () {
}
if(constants["ACCEPT_IDENTIFIER"] == headers[i].name){
acceptTypeFound = true;
+ acceptTypeValue = headers[i].value;
}
}
@@ -356,10 +358,8 @@ var invokers = function () {
client.executeMethod(httpMethodObject);
//noinspection JSUnresolvedFunction
var status = httpMethodObject.getStatusCode();
- if (status == 200) {
- var responseContentDispositionHeader = httpMethodObject.getResponseHeader(
- constants["CONTENT_DISPOSITION_IDENTIFIER"]);
- if (responseContentDispositionHeader) {
+ if (status >= 200 && status < 300) {
+ if (constants["STREAMING_FILES_ACCEPT_HEADERS"].indexOf(acceptTypeValue) > -1) {
return successCallback(httpMethodObject.getResponseBodyAsStream(),
httpMethodObject.getResponseHeaders());
} else {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.js
index a41d4cc69a..33a4088306 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.js
@@ -28,7 +28,7 @@ function onRequest(context) {
}
});
var page = {};
- var policyModule = require("/app/modules/business-controllers/group.js")["groupModule"];
+ var policyModule = require("/app/modules/business-controllers/policy.js")["policyModule"];
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var response = policyModule.getAllPolicies();
if (response["status"] == "success") {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/public/js/validate-register.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/public/js/validate-register.js
new file mode 100644
index 0000000000..ea67fcc832
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/public/js/validate-register.js
@@ -0,0 +1,163 @@
+/*
+ * 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.
+ */
+
+/**
+ * Checks if provided input is valid against RegEx input.
+ *
+ * @param regExp Regular expression
+ * @param inputString Input string to check
+ * @returns {boolean} Returns true if input matches RegEx
+ */
+function inputIsValid(regExp, inputString) {
+ regExp = new RegExp(regExp);
+ return regExp.test(inputString);
+}
+
+/**
+ * Checks if an email address has the valid format or not.
+ *
+ * @param email Email address
+ * @returns {boolean} true if email has the valid format, otherwise false.
+ */
+function emailIsValid(email) {
+ var regExp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
+ return regExp.test(email);
+}
+
+$(document).ready(function(){
+
+ /**
+ * Following click function would execute
+ * when a user clicks on "Add User" button
+ * on Add User page in WSO2 Devicemgt Console.
+ */
+ $("button#add-user-btn").click(function () {
+
+ var usernameInput = $("input#user_name");
+ var firstnameInput = $("input#first_name");
+ var lastnameInput = $("input#last_name");
+ var emailInput = $("input#email");
+ var passwordInput = $("input#password");
+ var passwordConfirmationInput = $("input#password_confirmation");
+
+ var username = usernameInput.val().trim();
+ var firstname = firstnameInput.val();
+ var lastname = lastnameInput.val();
+ var emailAddress = emailInput.val();
+ var password = passwordInput.val();
+ var passwordConfirmation = passwordConfirmationInput.val();
+ var errorMsgWrapper = "#user-create-error-msg";
+ var errorMsg = "#user-create-error-msg span";
+
+ if (!firstname) {
+ $(errorMsg).text("Firstname is a required field. It cannot be empty.");
+ $(errorMsgWrapper).removeClass("hidden");
+ } else if (!inputIsValid(firstnameInput.data("regex"), firstname)) {
+ $(errorMsg).text(firstnameInput.data("errormsg"));
+ $(errorMsgWrapper).removeClass("hidden");
+ } else if (!lastname) {
+ $(errorMsg).text("Lastname is a required field. It cannot be empty.");
+ $(errorMsgWrapper).removeClass("hidden");
+ } else if (!inputIsValid(lastnameInput.data("regex"), lastname)) {
+ $(errorMsg).text(lastnameInput.data("errormsg"));
+ $(errorMsgWrapper).removeClass("hidden");
+ } else if (!username) {
+ $(errorMsg).text("Username is a required field. It cannot be empty.");
+ $(errorMsgWrapper).removeClass("hidden");
+ } else if (!inputIsValid(usernameInput.data("regex"), username)) {
+ $(errorMsg).text(usernameInput.data("errormsg"));
+ $(errorMsgWrapper).removeClass("hidden");
+ } else if (!emailAddress) {
+ $(errorMsg).text("Email is a required field. It cannot be empty.");
+ $(errorMsgWrapper).removeClass("hidden");
+ } else if (!emailIsValid(emailAddress)) {
+ $(errorMsg).text(emailInput.data("errormsg"));
+ $(errorMsgWrapper).removeClass("hidden");
+ } else if (!password) {
+ $(errorMsg).text("Password is a required field. It cannot be empty.");
+ $(errorMsgWrapper).removeClass("hidden");
+ } else if (password.length < 6) {
+ $(errorMsg).text("Password is a required field. It cannot be empty.");
+ $(errorMsgWrapper).removeClass("hidden");
+ } else if (password != passwordConfirmation) {
+ $(errorMsg).text("Please enter the same password for confirmation.");
+ $(errorMsgWrapper).removeClass("hidden");
+ } else {
+ $(errorMsgWrapper).addClass("hidden");
+ $("#add-user-btn").prop('disabled', true);
+
+ var addUserFormData = {};
+ addUserFormData.username = username;
+ addUserFormData.firstname = firstname;
+ addUserFormData.lastname = lastname;
+ addUserFormData.emailAddress = emailAddress;
+ addUserFormData.password = $("input#password").val();
+ addUserFormData.userRoles = null;
+
+ var context = $(".form-login-box").data("context");
+ var addUserAPI = context + "/api/user/register";
+
+ $.ajax({
+ type: 'POST',
+ url: addUserAPI,
+ contentType: 'application/json',
+ data: JSON.stringify(addUserFormData),
+ success: function (data) {
+ $("#add-user-btn").prop('disabled', false);
+ if (data == 200) {
+ $('.wr-validation-summary strong').html(
+ " Successfully Submitted.");
+ $('.wr-validation-summary').removeClass("alert-danger");
+ $('.wr-validation-summary').addClass("alert-success");
+ } else if (data == 201) {
+ $('.wr-validation-summary strong').html(
+ " User created succssfully. You will be " +
+ "redirected to login page.");
+ $('.wr-validation-summary').removeClass("alert-danger");
+ $('.wr-validation-summary').addClass("alert-success");
+ $("#add-user-btn").prop('disabled', true);
+ setTimeout(function () {
+ window.location = context + "/login";
+ }, 2000);
+ } else if (data == 400) {
+ $('.wr-validation-summary strong').html(
+ " Exception at backend.");
+ $('.wr-validation-summary').removeClass("alert-danger");
+ $('.wr-validation-summary').addClass("alert-warning");
+ } else if (data == 403) {
+ $('.wr-validation-summary strong').html("Action not permitted.");
+ } else if (data == 409) {
+ $('.wr-validation-summary strong').html(
+ " User name already exists.");
+ $('.wr-validation-summary').removeClass("alert-default");
+ $('.wr-validation-summary').addClass("alert-success");
+ }
+ $('.wr-validation-summary').removeClass("hidden");
+ $('#password').val('');
+ $('#password_confirmation').val('');
+ },
+ error: function (err) {
+ $("#add-user-btn").prop('disabled', false);
+ $('.wr-validation-summary strong').html(
+ " An unexpected error occurred.");
+ $('.wr-validation-summary').removeClass("hidden");
+ }
+ });
+ }
+ });
+});
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.hbs
new file mode 100644
index 0000000000..5544708f93
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.hbs
@@ -0,0 +1,75 @@
+{{unit "cdmf.unit.ui.title" pageTitle="Register"}}
+
+{{#zone "content"}}
+ {{unit "uuf.unit.lib.form-validation"}}
+
+
+
+
Register
+
+
Create new account on WSO2 IoT (All fields are required.)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{{/zone}}
+
+{{#zone "bottomJs"}}
+ {{js "js/validate-register.js"}}
+{{/zone}}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.js
new file mode 100644
index 0000000000..f359aabc94
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.js
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+/**
+ * Returns the dynamic state to be populated by add-user page.
+ *
+ * @param context Object that gets updated with the dynamic state of this page to be presented
+ * @returns {*} A context object that returns the dynamic state of this page to be presented
+ */
+function onRequest(context) {
+ var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
+ var page = {};
+ page["usernameJSRegEx"] = devicemgtProps.userValidationConfig.usernameJSRegEx;
+ page["usernameHelpText"] = devicemgtProps.userValidationConfig.usernameHelpMsg;
+ page["usernameRegExViolationErrorMsg"] = devicemgtProps.userValidationConfig.usernameRegExViolationErrorMsg;
+ page["firstnameJSRegEx"] = devicemgtProps.userValidationConfig.firstnameJSRegEx;
+ page["firstnameRegExViolationErrorMsg"] = devicemgtProps.userValidationConfig.firstnameRegExViolationErrorMsg;
+ page["lastnameJSRegEx"] = devicemgtProps.userValidationConfig.lastnameJSRegEx;
+ page["lastnameRegExViolationErrorMsg"] = devicemgtProps.userValidationConfig.lastnameRegExViolationErrorMsg;
+ page["emailJSRegEx"] = devicemgtProps.userValidationConfig.emailJSRegEx;
+ page["emailRegExViolationErrorMsg"] = devicemgtProps.userValidationConfig.emailRegExViolationErrorMsg;
+ return page;
+}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.json
new file mode 100644
index 0000000000..58346ba14a
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.json
@@ -0,0 +1,6 @@
+{
+ "version": "1.0.0",
+ "uri": "/register",
+ "isAnonymous": true,
+ "layout": "uuf.layout.sign-in"
+}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-bar/operation-bar.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-bar/operation-bar.hbs
index 1dbd763801..ca52690eb0 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-bar/operation-bar.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-bar/operation-bar.hbs
@@ -15,11 +15,106 @@
specific language governing permissions and limitations
under the License.
}}
+{{#if control_operations}}
+