Fixed indentation

revert-70aa11f8
Dulitha Wijewantha 10 years ago
parent 2360d1ae8c
commit 49a46ca909

@ -19,7 +19,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import java.util.List; import java.util.List;
@XmlRootElement public class Device { @XmlRootElement
public class Device {
private int id; private int id;
private String type; private String type;
@ -35,7 +36,8 @@ import java.util.List;
private List<Feature> features; private List<Feature> features;
private List<Device.Property> properties; private List<Device.Property> properties;
@XmlElement public int getId() { @XmlElement
public int getId() {
return id; return id;
} }
@ -43,7 +45,8 @@ import java.util.List;
this.id = id; this.id = id;
} }
@XmlElement public String getDescription() { @XmlElement
public String getDescription() {
return description; return description;
} }
@ -51,7 +54,8 @@ import java.util.List;
this.description = description; this.description = description;
} }
@XmlElement public String getName() { @XmlElement
public String getName() {
return name; return name;
} }
@ -59,7 +63,8 @@ import java.util.List;
this.name = name; this.name = name;
} }
@XmlElement public Long getDateOfEnrolment() { @XmlElement
public Long getDateOfEnrolment() {
return dateOfEnrolment; return dateOfEnrolment;
} }
@ -67,7 +72,8 @@ import java.util.List;
this.dateOfEnrolment = dateOfEnrolment; this.dateOfEnrolment = dateOfEnrolment;
} }
@XmlElement public Long getDateOfLastUpdate() { @XmlElement
public Long getDateOfLastUpdate() {
return dateOfLastUpdate; return dateOfLastUpdate;
} }
@ -75,7 +81,8 @@ import java.util.List;
this.dateOfLastUpdate = dateOfLastUpdate; this.dateOfLastUpdate = dateOfLastUpdate;
} }
@XmlElement public String getOwnership() { @XmlElement
public String getOwnership() {
return ownership; return ownership;
} }
@ -83,7 +90,8 @@ import java.util.List;
this.ownership = ownership; this.ownership = ownership;
} }
@XmlElement public boolean isStatus() { @XmlElement
public boolean isStatus() {
return status; return status;
} }
@ -91,7 +99,8 @@ import java.util.List;
this.status = status; this.status = status;
} }
@XmlElement public int getDeviceTypeId() { @XmlElement
public int getDeviceTypeId() {
return deviceTypeId; return deviceTypeId;
} }
@ -99,7 +108,8 @@ import java.util.List;
this.deviceTypeId = deviceTypeId; this.deviceTypeId = deviceTypeId;
} }
@XmlElement public String getDeviceIdentifier() { @XmlElement
public String getDeviceIdentifier() {
return deviceIdentifier; return deviceIdentifier;
} }
@ -107,7 +117,8 @@ import java.util.List;
this.deviceIdentifier = deviceIdentifier; this.deviceIdentifier = deviceIdentifier;
} }
@XmlElement public String getOwner() { @XmlElement
public String getOwner() {
return owner; return owner;
} }
@ -115,7 +126,8 @@ import java.util.List;
this.owner = owner; this.owner = owner;
} }
@XmlElement public List<Feature> getFeatures() { @XmlElement
public List<Feature> getFeatures() {
return features; return features;
} }
@ -123,7 +135,8 @@ import java.util.List;
this.features = features; this.features = features;
} }
@XmlElement public String getType() { @XmlElement
public String getType() {
return type; return type;
} }
@ -131,7 +144,8 @@ import java.util.List;
this.type = type; this.type = type;
} }
@XmlElement public List<Device.Property> getProperties() { @XmlElement
public List<Device.Property> getProperties() {
return properties; return properties;
} }

@ -18,6 +18,7 @@ package org.wso2.carbon.device.mgt.core.util;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig; import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig;
import org.wso2.carbon.device.mgt.core.config.datasource.JNDILookupDefinition; import org.wso2.carbon.device.mgt.core.config.datasource.JNDILookupDefinition;
@ -31,8 +32,10 @@ import javax.sql.DataSource;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File; import java.io.File;
import java.util.HashMap;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.List; import java.util.List;
import java.util.Map;
public final class DeviceManagerUtil { public final class DeviceManagerUtil {
@ -59,24 +62,22 @@ public final class DeviceManagerUtil {
public static DataSource resolveDataSource(DataSourceConfig config) { public static DataSource resolveDataSource(DataSourceConfig config) {
DataSource dataSource = null; DataSource dataSource = null;
if (config == null) { if (config == null) {
throw new RuntimeException("Device Management Repository data source configuration " + throw new RuntimeException(
"is null and thus, is not initialized"); "Device Management Repository data source configuration " + "is null and thus, is not initialized");
} }
JNDILookupDefinition jndiConfig = config.getJndiLookupDefintion(); JNDILookupDefinition jndiConfig = config.getJndiLookupDefintion();
if (jndiConfig != null) { if (jndiConfig != null) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Initializing Device Management Repository data source using the JNDI " + log.debug(
"Lookup Definition"); "Initializing Device Management Repository data source using the JNDI " + "Lookup Definition");
} }
List<JNDILookupDefinition.JNDIProperty> jndiPropertyList = List<JNDILookupDefinition.JNDIProperty> jndiPropertyList = jndiConfig.getJndiProperties();
jndiConfig.getJndiProperties();
if (jndiPropertyList != null) { if (jndiPropertyList != null) {
Hashtable<Object, Object> jndiProperties = new Hashtable<Object, Object>(); Hashtable<Object, Object> jndiProperties = new Hashtable<Object, Object>();
for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) { for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) {
jndiProperties.put(prop.getName(), prop.getValue()); jndiProperties.put(prop.getName(), prop.getValue());
} }
dataSource = dataSource = DeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), jndiProperties);
DeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), jndiProperties);
} else { } else {
dataSource = DeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), null); dataSource = DeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), null);
} }
@ -130,4 +131,12 @@ public final class DeviceManagerUtil {
} }
} }
public static Map<String, String> convertPropertiesToMap(List<Device.Property> properties) {
Map<String, String> propertiesMap = new HashMap<String, String>();
for (Device.Property prop : properties) {
propertiesMap.put(prop.getName(), prop.getValue());
}
return propertiesMap;
}
} }

Loading…
Cancel
Save