forked from community/device-mgt-core
Merge pull request #413 from ayyoob/IoTS-1.0.0
refactored device type deployer and few changes in UI after testing the operation flowrevert-70aa11f8
commit
24586d0f2a
8
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 → 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
8
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 → 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
@ -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;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for DataSource complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="DataSource">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="jndiConfig" type="{}jndiConfig"/>
|
||||
* <element name="tableConfig" type="{}tableConfig"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
38
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 → 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
38
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 → 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
@ -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;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for DeviceManagementConfiguration complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="DeviceManagementConfiguration">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Device" type="{http://www.w3.org/2001/XMLSchema}string"/>
|
||||
* <element name="ManagementRepository" type="{}ManagementRepository"/>
|
||||
* <element name="PushNotificationConfiguration" type="{}PushNotificationConfiguration"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
//@XmlType(name = "DeviceManagementConfiguration", propOrder = {
|
||||
// "deviceType",
|
||||
// "managementRepository",
|
||||
// "pushNotificationConfiguration"
|
||||
//})
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "DeviceManagementConfiguration")
|
||||
public class DeviceManagementConfiguration {
|
||||
|
||||
@XmlElement(name = "DeviceType", required = true)
|
||||
protected String deviceType;
|
||||
@XmlElement(name = "ManagementRepository", required = true)
|
||||
protected ManagementRepository managementRepository;
|
||||
@XmlElement(name = "PushNotificationConfiguration", required = true)
|
||||
protected PushNotificationConfiguration pushNotificationConfiguration;
|
||||
|
||||
private DeviceManagementConfiguration() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the device property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getDeviceType() {
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the device property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setDeviceType(String value) {
|
||||
this.deviceType = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the managementRepository property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link ManagementRepository }
|
||||
*
|
||||
*/
|
||||
public ManagementRepository getManagementRepository() {
|
||||
return managementRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the managementRepository property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link ManagementRepository }
|
||||
*
|
||||
*/
|
||||
public void setManagementRepository(ManagementRepository value) {
|
||||
this.managementRepository = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the pushNotificationConfiguration property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link PushNotificationConfiguration }
|
||||
*
|
||||
*/
|
||||
public PushNotificationConfiguration getPushNotificationConfiguration() {
|
||||
return pushNotificationConfiguration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the pushNotificationConfiguration property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link PushNotificationConfiguration }
|
||||
*
|
||||
*/
|
||||
public void setPushNotificationConfiguration(PushNotificationConfiguration value) {
|
||||
this.pushNotificationConfiguration = value;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,240 @@
|
||||
/*
|
||||
* 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.XmlRootElement;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for DeviceTypeConfiguration complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="DeviceTypeConfiguration">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="DeviceDetails" type="{}DeviceDetails"/>
|
||||
* <element name="Features" type="{}Features"/>
|
||||
* <element name="ProvisioningConfig" type="{}ProvisioningConfig"/>
|
||||
* <element name="PushNotificationProvider" type="{}PushNotificationProvider"/>
|
||||
* <element name="License" type="{}License"/>
|
||||
* <element name="DataSource" type="{}DataSource"/>
|
||||
* </sequence>
|
||||
* <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
45
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 → 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
45
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 → 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
12
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 → 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
12
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 → 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
@ -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;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for ManagementRepository complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <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>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
@ -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.
|
||||
* <p>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<DeviceTypeConfiguration> createDeviceTypeConfiguration(DeviceTypeConfiguration value) {
|
||||
return new JAXBElement<DeviceTypeConfiguration>(_DeviceTypeConfiguration_QNAME, DeviceTypeConfiguration.class, null, value);
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for Operation complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <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>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
80
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 → 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
80
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 → 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
@ -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;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for QueryParameters complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <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>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "QueryParameters", propOrder = {
|
||||
"parameter"
|
||||
})
|
||||
public class QueryParameters {
|
||||
|
||||
@XmlElement(name = "Parameter")
|
||||
protected List<String> parameter;
|
||||
|
||||
public List<String> getParameter() {
|
||||
if (parameter == null) {
|
||||
parameter = new ArrayList<String>();
|
||||
}
|
||||
return this.parameter;
|
||||
}
|
||||
|
||||
}
|
90
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 → 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
90
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 → 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
@ -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;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for tableConfig complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <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>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "tableConfig", propOrder = {
|
||||
"table"
|
||||
})
|
||||
public class TableConfig {
|
||||
|
||||
@XmlElement(name = "Table")
|
||||
protected List<Table> table;
|
||||
|
||||
/**
|
||||
* Gets the value of the table property.
|
||||
*
|
||||
* <p>
|
||||
* 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 <CODE>set</CODE> method for the table property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getTable().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link Table }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<Table> getTable() {
|
||||
if (table == null) {
|
||||
table = new ArrayList<Table>();
|
||||
}
|
||||
return this.table;
|
||||
}
|
||||
|
||||
}
|
@ -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<Feature> features) throws DeviceManagementException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Feature getFeature(String name) throws DeviceManagementException {
|
||||
return GenericFeatureManager.getInstance().getFeature(deviceType, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Feature> 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;
|
||||
}
|
||||
}
|
@ -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(
|
||||
"<i class=\"icon fw fw-ok\"></i> Successfully Submitted.");
|
||||
$('.wr-validation-summary').removeClass("alert-danger");
|
||||
$('.wr-validation-summary').addClass("alert-success");
|
||||
} else if (data == 201) {
|
||||
$('.wr-validation-summary strong').html(
|
||||
"<i class=\"icon fw fw-ok\"></i> 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(
|
||||
"<i class=\"icon fw fw-error\"></i> 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(
|
||||
"<i class=\"icon fw fw-info\"></i> 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(
|
||||
"<i class=\"icon fw fw-error\"></i> An unexpected error occurred.");
|
||||
$('.wr-validation-summary').removeClass("hidden");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,75 @@
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Register"}}
|
||||
|
||||
{{#zone "content"}}
|
||||
{{unit "uuf.unit.lib.form-validation"}}
|
||||
|
||||
<div class="container col-xs-12 col-sm-10 col-md-8 col-lg-6 col-centered wr-content wr-login col-centered sign-panel">
|
||||
|
||||
<p class="page-sub-title">Register</p>
|
||||
|
||||
<p>Create new account on WSO2 IoT (All fields are required.)</p>
|
||||
<hr/>
|
||||
<!-- validation -->
|
||||
<div class="wr-validation-summary hidden alert alert-danger">
|
||||
<strong></strong>
|
||||
<button type="button" class="close" aria-label="close" data-dismiss="alert">
|
||||
<span aria-hidden="true">
|
||||
<i class="fw fw-cancel"></i>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="form-login-box" id="registerForm" data-context="{{@app.context}}">
|
||||
<div id="user-create-error-msg" class="alert alert-danger hidden" role="alert">
|
||||
<i class="icon fw fw-error"></i><span></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="first_name" class="wr-input-label">First Name</label>
|
||||
<input type="text" id="first_name" name="first_name" class="form-control" placeholder="First Name"
|
||||
data-regex="{{usernameJSRegEx}}" data-lengthmsg="{{usernameHelpText}}"
|
||||
data-errormsg="{{usernameRegExViolationErrorMsg}}"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="last_name" class="wr-input-label">Last Name</label>
|
||||
<input type="text" id="last_name" name="last_name" class="form-control" placeholder="Last Name"
|
||||
data-regex="{{usernameJSRegEx}}" data-errormsg="{{usernameRegExViolationErrorMsg}}"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="user_name" class="wr-input-label">Username ( {{usernameHelpText}} )</label>
|
||||
<input type="text" id="user_name" name="user_name" class="form-control" placeholder="Username"
|
||||
data-regex="{{usernameJSRegEx}}" data-errormsg="{{usernameRegExViolationErrorMsg}}"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="email" class="wr-input-label">Email</label>
|
||||
<input type="text" id="email" name="email" class="form-control" placeholder="Email"
|
||||
data-regex="{{emailJSRegEx}}" data-errormsg="{{emailRegExViolationErrorMsg}}"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password" class="wr-input-label">Password</label>
|
||||
<input type="password" id="password" name="password" class="form-control"
|
||||
placeholder="Password"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password_confirmation" class="wr-input-label">Confirm Password</label>
|
||||
<input type="password" id="password_confirmation" name="password_confirmation"
|
||||
class="form-control" placeholder="Confirm Password"/>
|
||||
</div>
|
||||
|
||||
<div class="wr-input-control">
|
||||
<button class="wr-btn" id="add-user-btn">Register</button>
|
||||
<button class="wr-btn" onclick="document.location.href='{{@app.context}}/login';">
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "bottomJs"}}
|
||||
{{js "js/validate-register.js"}}
|
||||
{{/zone}}
|
@ -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;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"uri": "/register",
|
||||
"isAnonymous": true,
|
||||
"layout": "uuf.layout.sign-in"
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
function onRequest(context) {
|
||||
var log = new Log("operation.js");
|
||||
var operationModule = require("/app/modules/business-controllers/operation.js")["operationModule"];
|
||||
var device = context.unit.params.device;
|
||||
var autoCompleteParams = context.unit.params.autoCompleteParams;
|
||||
var controlOperations = operationModule.getControlOperations(device.type);
|
||||
var queryParams = [];
|
||||
var formParams = [];
|
||||
var pathParams = [];
|
||||
for (var i = 0; i < controlOperations.length; i++) {
|
||||
var currentParamList = controlOperations[i]["params"];
|
||||
for (var j = 0; j < currentParamList.length; j++) {
|
||||
var currentParam = currentParamList[j];
|
||||
currentParamList[j]["formParams"] = processParams(currentParam["formParams"], autoCompleteParams);
|
||||
currentParamList[j]["queryParams"] = processParams(currentParam["queryParams"], autoCompleteParams);
|
||||
currentParamList[j]["pathParams"] = processParams(currentParam["pathParams"], autoCompleteParams);
|
||||
}
|
||||
controlOperations[i]["params"] = currentParamList;
|
||||
}
|
||||
return {"control_operations": controlOperations, "device": device};
|
||||
}
|
||||
|
||||
function processParams(paramsList, autoCompleteParams) {
|
||||
for (var i = 0; i < paramsList.length; i++) {
|
||||
var paramName = paramsList[i];
|
||||
var paramValue = "";
|
||||
var paramType = "text";
|
||||
for (var k = 0; k < autoCompleteParams.length; k++) {
|
||||
if (paramName == autoCompleteParams[k].name) {
|
||||
paramValue = autoCompleteParams[k].value;
|
||||
paramType = "hidden";
|
||||
}
|
||||
}
|
||||
paramsList[i] = {"name": paramName, "value": paramValue, "type": paramType};
|
||||
}
|
||||
return paramsList;
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* On operation click function.
|
||||
* @param selection: Selected operation
|
||||
*/
|
||||
function operationSelect(selection) {
|
||||
$(modalPopupContent).addClass("operation-data");
|
||||
$(modalPopupContent).html($(" .operation[data-operation-code=" + selection + "]").html());
|
||||
$(modalPopupContent).data("operation-code", selection);
|
||||
showPopup();
|
||||
}
|
||||
|
||||
function submitForm(formId) {
|
||||
var form = $("#" + formId);
|
||||
var uri = form.attr("action");
|
||||
var uriencodedQueryStr = "";
|
||||
var uriencodedFormStr = "";
|
||||
var payload = {};
|
||||
form.find("input").each(function () {
|
||||
var input = $(this);
|
||||
if (input.data("param-type") == "path") {
|
||||
uri = uri.replace("{" + input.attr("id") + "}", input.val());
|
||||
} else if (input.data("param-type") == "query") {
|
||||
var prefix = (uriencodedQueryStr == "") ? "?" : "&";
|
||||
uriencodedQueryStr += prefix + input.attr("id") + "=" + input.val();
|
||||
} else if (input.data("param-type") == "form") {
|
||||
var prefix = (uriencodedFormStr == "") ? "" : "&";
|
||||
uriencodedFormStr += prefix + input.attr("id") + "=" + input.val();
|
||||
//payload[input.attr("id")] = input.val();
|
||||
}
|
||||
});
|
||||
uri += uriencodedQueryStr;
|
||||
var httpMethod = form.attr("method").toUpperCase();
|
||||
var contentType = form.attr("enctype");
|
||||
console.log(payload);
|
||||
if (contentType == undefined || contentType.isEmpty()) {
|
||||
contentType = "application/x-www-form-urlencoded";
|
||||
payload = uriencodedFormStr;
|
||||
}
|
||||
//setting responses callbacks
|
||||
var defaultStatusClasses = "fw fw-stack-1x";
|
||||
var content = $("#operation-response-template").find(".content");
|
||||
var title = content.find("#title");
|
||||
var statusIcon = content.find("#status-icon");
|
||||
var description = content.find("#description");
|
||||
var successCallBack = function (response) {
|
||||
var res = response;
|
||||
try {
|
||||
res = JSON.parse(response).messageFromServer;
|
||||
} catch (err) {
|
||||
//do nothing
|
||||
}
|
||||
title.html("Operation Triggered!");
|
||||
statusIcon.attr("class", defaultStatusClasses + " fw-check");
|
||||
description.html(res);
|
||||
$(modalPopupContent).html(content.html());
|
||||
};
|
||||
var errorCallBack = function (response) {
|
||||
console.log(response);
|
||||
title.html("An Error Occurred!");
|
||||
statusIcon.attr("class", defaultStatusClasses + " fw-error");
|
||||
var reason = (response.responseText == "null")?response.statusText:response.responseText;
|
||||
description.html(reason);
|
||||
$(modalPopupContent).html(content.html());
|
||||
};
|
||||
//executing http request
|
||||
if (httpMethod == "GET") {
|
||||
invokerUtil.get(uri, successCallBack, errorCallBack, contentType);
|
||||
} else if (httpMethod == "POST") {
|
||||
invokerUtil.post(uri, payload, successCallBack, errorCallBack, contentType);
|
||||
} else if (httpMethod == "PUT") {
|
||||
invokerUtil.put(uri, payload, successCallBack, errorCallBack, contentType);
|
||||
} else if (httpMethod == "DELETE") {
|
||||
invokerUtil.delete(uri, successCallBack, errorCallBack, contentType);
|
||||
} else {
|
||||
title.html("An Error Occurred!");
|
||||
statusIcon.attr("class", defaultStatusClasses + " fw-error");
|
||||
description.html("This operation requires http method: " + httpMethod + " which is not supported yet!");
|
||||
$(modalPopupContent).html(content.html());
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('submit', 'form', function (e) {
|
||||
e.preventDefault();
|
||||
var postOperationRequest = $.ajax({
|
||||
url: $(this).attr("action") + '&' + $(this).serialize(),
|
||||
method: "post"
|
||||
});
|
||||
|
||||
var btnSubmit = $('#btnSend', this);
|
||||
btnSubmit.addClass('hidden');
|
||||
|
||||
var lblSending = $('#lblSending', this);
|
||||
lblSending.removeClass('hidden');
|
||||
|
||||
var lblSent = $('#lblSent', this);
|
||||
postOperationRequest.done(function (data) {
|
||||
lblSending.addClass('hidden');
|
||||
lblSent.removeClass('hidden');
|
||||
setTimeout(function () {
|
||||
hidePopup();
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
postOperationRequest.fail(function (jqXHR, textStatus) {
|
||||
lblSending.addClass('hidden');
|
||||
lblSent.addClass('hidden');
|
||||
});
|
||||
});
|
Loading…
Reference in new issue