Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / service / simulator / java / eclipse-plugin / ServiceProviderPlugin / src / oic / simulator / serviceprovider / manager / ResourceManager.java
index e6cca32..dc11654 100644 (file)
 
 package oic.simulator.serviceprovider.manager;
 
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.swt.widgets.Display;
+
+import java.text.NumberFormat;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-
-import oic.simulator.serviceprovider.Activator;
-import oic.simulator.serviceprovider.listener.IAutomationUIListener;
-import oic.simulator.serviceprovider.listener.IObserverListChangedUIListener;
-import oic.simulator.serviceprovider.listener.IResourceListChangedUIListener;
-import oic.simulator.serviceprovider.listener.IResourceModelChangedUIListener;
-import oic.simulator.serviceprovider.listener.IResourceSelectionChangedUIListener;
-import oic.simulator.serviceprovider.resource.LocalResourceAttribute;
-import oic.simulator.serviceprovider.resource.MetaProperty;
-import oic.simulator.serviceprovider.resource.ModelChangeNotificationType;
-import oic.simulator.serviceprovider.resource.SimulatorResource;
-import oic.simulator.serviceprovider.resource.StandardConfiguration;
-import oic.simulator.serviceprovider.utils.Constants;
-import oic.simulator.serviceprovider.utils.Utility;
-
-import org.eclipse.swt.graphics.Image;
-import org.oic.simulator.IAutomation;
+import java.util.Vector;
+
+import org.oic.simulator.ArrayProperty;
+import org.oic.simulator.AttributeProperty;
+import org.oic.simulator.AttributeProperty.Type;
+import org.oic.simulator.AttributeValue;
+import org.oic.simulator.AttributeValue.TypeInfo;
+import org.oic.simulator.AttributeValue.ValueType;
+import org.oic.simulator.BooleanProperty;
+import org.oic.simulator.DeviceInfo;
+import org.oic.simulator.DeviceListener;
+import org.oic.simulator.DoubleProperty;
 import org.oic.simulator.ILogger.Level;
-import org.oic.simulator.ResourceAttribute;
-import org.oic.simulator.ResourceAttribute.Range;
-import org.oic.simulator.ResourceAttribute.Type;
+import org.oic.simulator.IntegerProperty;
+import org.oic.simulator.PlatformInfo;
 import org.oic.simulator.SimulatorException;
 import org.oic.simulator.SimulatorManager;
+import org.oic.simulator.SimulatorResourceAttribute;
 import org.oic.simulator.SimulatorResourceModel;
-import org.oic.simulator.serviceprovider.AutomationType;
-import org.oic.simulator.serviceprovider.IObserver;
-import org.oic.simulator.serviceprovider.IResourceModelChangedListener;
-import org.oic.simulator.serviceprovider.ObserverInfo;
-import org.oic.simulator.serviceprovider.SimulatorResourceServer;
+import org.oic.simulator.StringProperty;
+import org.oic.simulator.server.Observer;
+import org.oic.simulator.server.SimulatorResource;
+import org.oic.simulator.server.SimulatorResource.AutoUpdateListener;
+import org.oic.simulator.server.SimulatorResource.AutoUpdateType;
+import org.oic.simulator.server.SimulatorResource.ObserverListener;
+import org.oic.simulator.server.SimulatorResource.ResourceModelChangeListener;
+import org.oic.simulator.server.SimulatorSingleResource;
+
+import oic.simulator.serviceprovider.Activator;
+import oic.simulator.serviceprovider.model.AttributeElement;
+import oic.simulator.serviceprovider.model.MetaProperty;
+import oic.simulator.serviceprovider.model.Resource;
+import oic.simulator.serviceprovider.model.ResourceType;
+import oic.simulator.serviceprovider.model.SingleResource;
+import oic.simulator.serviceprovider.utils.AttributeValueStringConverter;
+import oic.simulator.serviceprovider.utils.Constants;
+import oic.simulator.serviceprovider.utils.Utility;
 
 /**
  * This class acts as an interface between the simulator java SDK and the
@@ -65,49 +76,59 @@ import org.oic.simulator.serviceprovider.SimulatorResourceServer;
  */
 public class ResourceManager {
 
-    private Map<String, Map<String, SimulatorResource>> resourceMap;
-
-    private Map<String, ArrayList<String>>              orderedResourceUriMap;
-
-    private Map<String, String>                         displayNameMap;
+    private Data                           data;
 
-    private StandardConfiguration                       stdConfig;
+    private Resource                       currentResourceInSelection;
 
-    private SimulatorResource                           currentResourceInSelection;
+    private ResourceModelChangeListener    resourceModelChangeListener;
 
-    private List<IResourceListChangedUIListener>        resourceListChangedUIListeners;
+    private AutoUpdateListener             automationListener;
 
-    private List<IResourceSelectionChangedUIListener>   resourceSelectionChangedUIListeners;
+    private ObserverListener               observer;
 
-    private List<IResourceModelChangedUIListener>       resourceModelChangedUIListeners;
+    private DeviceListener                 deviceListener;
 
-    private List<IAutomationUIListener>                 automationUIListeners;
+    private NotificationSynchronizerThread synchronizerThread;
 
-    private List<IObserverListChangedUIListener>        observerUIListeners;
+    private Thread                         threadHandle;
 
-    private IResourceModelChangedListener               resourceModelChangeListener;
+    private DeviceInfo                     deviceInfo;
+    private PlatformInfo                   platformInfo;
 
-    private IAutomation                                 automationListener;
+    private String                         deviceName;
 
-    private IObserver                                   observer;
-
-    private NotificationSynchronizerThread              synchronizerThread;
+    public ResourceManager() {
+        data = new Data();
 
-    private Thread                                      threadHandle;
+        deviceListener = new DeviceListener() {
 
-    public ResourceManager() {
-        resourceMap = new HashMap<String, Map<String, SimulatorResource>>();
-        orderedResourceUriMap = new HashMap<String, ArrayList<String>>();
-        displayNameMap = new HashMap<String, String>();
-        stdConfig = new StandardConfiguration();
+            @Override
+            public void onDeviceFound(final String host,
+                    final DeviceInfo deviceInfo) {
+                if (null != ResourceManager.this.deviceInfo
+                        || null == deviceInfo || null == host) {
+                    return;
+                }
+                synchronizerThread.addToQueue(new Runnable() {
+                    @Override
+                    public void run() {
+                        String rcvdDeviceName = deviceInfo.getName();
+                        if (null == rcvdDeviceName) {
+                            return;
+                        }
+                        if (deviceName.equalsIgnoreCase(rcvdDeviceName)) {
+                            ResourceManager.this.deviceInfo = deviceInfo;
 
-        resourceListChangedUIListeners = new ArrayList<IResourceListChangedUIListener>();
-        resourceSelectionChangedUIListeners = new ArrayList<IResourceSelectionChangedUIListener>();
-        resourceModelChangedUIListeners = new ArrayList<IResourceModelChangedUIListener>();
-        automationUIListeners = new ArrayList<IAutomationUIListener>();
-        observerUIListeners = new ArrayList<IObserverListChangedUIListener>();
+                            // Notify the UI Listeners
+                            UiListenerHandler.getInstance()
+                                    .deviceInfoReceivedNotification();
+                        }
+                    }
+                });
+            }
+        };
 
-        resourceModelChangeListener = new IResourceModelChangedListener() {
+        resourceModelChangeListener = new ResourceModelChangeListener() {
 
             @Override
             public void onResourceModelChanged(final String resourceURI,
@@ -119,59 +140,46 @@ public class ResourceManager {
                         if (null == resourceURI || null == resourceModelN) {
                             return;
                         }
-                        SimulatorResource resource = getSimulatorResourceByURI(resourceURI);
-                        if (null == resource) {
-                            return;
-                        }
-
-                        ModelChangeNotificationType notificationType;
-                        // Fetch the resource attributes
-                        Map<String, LocalResourceAttribute> resourceAttributeMapNew;
-                        resourceAttributeMapNew = fetchResourceAttributesFromModel(resourceModelN);
-                        if (null == resourceAttributeMapNew) {
-                            resource.setResourceAttributesMap(null);
-                            resourceModelChangedUINotification(
-                                    ModelChangeNotificationType.NO_ATTRIBUTES_IN_MODEL,
-                                    resourceURI, null);
-                            return;
-                        }
 
-                        // Update the resource with new model data
-                        Map<String, LocalResourceAttribute> resourceAttributeMapOld;
-                        resourceAttributeMapOld = resource
-                                .getResourceAttributesMap();
-                        if (null == resourceAttributeMapOld) {
-                            resource.setResourceAttributesMap(resourceAttributeMapNew);
-                            resourceModelChangedUINotification(
-                                    ModelChangeNotificationType.ATTRIBUTE_ADDED,
-                                    resourceURI, null);
-                            return;
-                        }
-                        Set<LocalResourceAttribute> valueChangeSet = new HashSet<LocalResourceAttribute>();
-                        notificationType = compareAndUpdateLocalAttributes(
-                                resourceAttributeMapOld,
-                                resourceAttributeMapNew, valueChangeSet);
-                        if (notificationType != ModelChangeNotificationType.NONE) {
-                            // Update the UI listeners
-                            resourceModelChangedUINotification(
-                                    notificationType, resourceURI,
-                                    valueChangeSet);
-                        }
+                        Display.getDefault().asyncExec(new Runnable() {
+                            @Override
+                            public void run() {
+                                Resource resource = data
+                                        .getResourceByURI(resourceURI);
+                                if (null != resource) {
+                                    try {
+                                        resource.updateResourceRepresentation(resourceModelN);
+                                    } catch (NumberFormatException e) {
+                                        Activator
+                                                .getDefault()
+                                                .getLogManager()
+                                                .log(Level.ERROR.ordinal(),
+                                                        new Date(),
+                                                        "Error while trying to update the attributes.\n"
+                                                                + Utility
+                                                                        .getSimulatorErrorString(
+                                                                                e,
+                                                                                null));
+                                    }
+                                }
+                            }
+                        });
                     }
                 });
             }
         };
 
-        automationListener = new IAutomation() {
+        automationListener = new AutoUpdateListener() {
 
             @Override
-            public void onAutomationComplete(final String resourceURI,
+            public void onUpdateComplete(final String resourceURI,
                     final int automationId) {
                 synchronizerThread.addToQueue(new Runnable() {
 
                     @Override
                     public void run() {
-                        SimulatorResource resource = getSimulatorResourceByURI(resourceURI);
+                        SingleResource resource = data
+                                .getSingleResourceByURI(resourceURI);
                         if (null == resource) {
                             return;
                         }
@@ -180,40 +188,38 @@ public class ResourceManager {
                         if (resource.isResourceAutomationInProgress()) {
                             changeResourceLevelAutomationStatus(resource, false);
                             // Notify the UI listeners
-                            automationCompleteUINotification(resourceURI, null);
+                            UiListenerHandler.getInstance()
+                                    .automationCompleteUINotification(resource,
+                                            null);
                         } else if (resource.isAttributeAutomationInProgress()) {
                             // Find the attribute with the given automation id
-                            LocalResourceAttribute attribute;
-                            attribute = getAttributeWithGivenAutomationId(
+                            final AttributeElement attribute = getAttributeWithGivenAutomationId(
                                     resource, automationId);
                             if (null != attribute) {
-                                attribute.setAutomationInProgress(false);
+                                attribute.setAutoUpdateState(false);
                                 resource.setAttributeAutomationInProgress(isAnyAttributeInAutomation(resource));
-                                // Notify the UI listeners
-                                automationCompleteUINotification(resourceURI,
-                                        attribute.getAttributeName());
+                            } else {
+                                // Setting the attribute automation status to
+                                // false.
+                                resource.setAttributeAutomationInProgress(false);
                             }
-                        } else {
-                            // Ignoring the notification as there are no
-                            // known automation for the current resource.
                         }
                     }
                 });
             }
         };
 
-        observer = new IObserver() {
+        observer = new ObserverListener() {
 
-            @Override
             public void onObserverChanged(final String resourceURI,
-                    final int status, final ObserverInfo observer) {
+                    final int status, final Observer observer) {
                 new Thread() {
                     @Override
                     public void run() {
                         if (null == resourceURI || null == observer) {
                             return;
                         }
-                        SimulatorResource resource = getSimulatorResourceByURI(resourceURI);
+                        Resource resource = data.getResourceByURI(resourceURI);
                         if (null == resource) {
                             return;
                         }
@@ -224,16 +230,79 @@ public class ResourceManager {
                             resource.removeObserverInfo(observer);
                         }
                         // Notify the UI listeners
-                        observerListChangedUINotification(resourceURI);
+                        UiListenerHandler.getInstance()
+                                .observerListChangedUINotification(resource);
                     }
                 }.start();
             }
+
+            @Override
+            public void onObserverAdded(String resourceURI, Observer observer) {
+                onObserverChanged(resourceURI, 0, observer);
+            }
+
+            @Override
+            public void onObserverRemoved(String resourceURI, Observer observer) {
+                onObserverChanged(resourceURI, 1, observer);
+            }
         };
 
         synchronizerThread = new NotificationSynchronizerThread();
         threadHandle = new Thread(synchronizerThread);
         threadHandle.setName("Simulator service provider event queue");
         threadHandle.start();
+
+        // Set the default device name.
+        deviceName = "IoTivity Simulator";
+        try {
+            SimulatorManager.setDeviceInfo(deviceName);
+        } catch (SimulatorException e) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(),
+                            new Date(),
+                            "Error while registering the device info.\n"
+                                    + Utility.getSimulatorErrorString(e, null));
+        }
+
+        // Set the default platform information.
+        platformInfo = new PlatformInfo();
+        platformInfo.setPlatformID("Samsung Platform Identifier");
+        platformInfo.setManufacturerName("Samsung");
+        platformInfo.setManufacturerUrl("www.samsung.com");
+        platformInfo.setModelNumber("Samsung Model Num01");
+        platformInfo.setDateOfManufacture("2015-09-10T11:10:30Z");
+        platformInfo.setPlatformVersion("PlatformVersion01");
+        platformInfo.setOperationSystemVersion("OSVersion01");
+        platformInfo.setHardwareVersion("HardwareVersion01");
+        platformInfo.setFirmwareVersion("FirwareVersion01");
+        platformInfo.setSupportUrl("http://www.samsung.com/support");
+        platformInfo.setSystemTime("2015-09-10T11:10:30Z");
+        try {
+            SimulatorManager.setPlatformInfo(platformInfo);
+        } catch (SimulatorException e) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(),
+                            new Date(),
+                            "Error while registering the platform info.\n"
+                                    + Utility.getSimulatorErrorString(e, null));
+        }
+
+        // Get the device information to show other details of the device in UI.
+        try {
+            SimulatorManager.findDevices("", deviceListener);
+        } catch (SimulatorException e) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(),
+                            new Date(),
+                            "Failed to get the local device information.\n"
+                                    + Utility.getSimulatorErrorString(e, null));
+        }
     }
 
     private static class NotificationSynchronizerThread implements Runnable {
@@ -277,1079 +346,1037 @@ public class ResourceManager {
         }
     }
 
-    // This method gives a list of available RAML resource configurations.
-    public Map<String, String> getResourceConfigurationList() {
-        return stdConfig.getStandardResourceConfigurationList();
-    }
-
-    public String getConfigFilePath(String fileName) {
-        return stdConfig.getFilePath(fileName);
-    }
-
-    public void addResourceListChangedUIListener(
-            IResourceListChangedUIListener resourceListChangedUIListener) {
-        synchronized (resourceListChangedUIListeners) {
-            resourceListChangedUIListeners.add(resourceListChangedUIListener);
+    public void setDeviceInfo(List<MetaProperty> metaProperties) {
+        if (null == metaProperties || metaProperties.size() < 1) {
+            return;
         }
-    }
-
-    public void addResourceSelectionChangedUIListener(
-            IResourceSelectionChangedUIListener resourceSelectionChangedUIListener) {
-        synchronized (resourceSelectionChangedUIListeners) {
-            resourceSelectionChangedUIListeners
-                    .add(resourceSelectionChangedUIListener);
+        Iterator<MetaProperty> itr = metaProperties.iterator();
+        MetaProperty prop;
+        String propName;
+        String propValue;
+        boolean found = false;
+        while (itr.hasNext()) {
+            prop = itr.next();
+            propName = prop.getPropName();
+            propValue = prop.getPropValue();
+            if (propName.equals(Constants.DEVICE_NAME)) {
+                this.deviceName = propValue;
+                found = true;
+                break;
+            }
         }
-    }
 
-    public void addResourceModelChangedUIListener(
-            IResourceModelChangedUIListener resourceModelChangedUIListener) {
-        synchronized (resourceModelChangedUIListeners) {
-            resourceModelChangedUIListeners.add(resourceModelChangedUIListener);
+        if (!found) {
+            return;
         }
-    }
 
-    public void addAutomationUIListener(
-            IAutomationUIListener automationUIListener) {
-        synchronized (automationUIListeners) {
-            automationUIListeners.add(automationUIListener);
+        try {
+            SimulatorManager.setDeviceInfo(deviceName);
+        } catch (SimulatorException e) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(),
+                            new Date(),
+                            "Error while registering the device info.\n"
+                                    + Utility.getSimulatorErrorString(e, null));
         }
     }
 
-    public void addObserverListChangedUIListener(
-            IObserverListChangedUIListener observerListChangedUIListener) {
-        synchronized (observerUIListeners) {
-            observerUIListeners.add(observerListChangedUIListener);
+    public boolean isDeviceInfoValid(List<MetaProperty> metaProperties) {
+        if (null == metaProperties || metaProperties.size() < 1) {
+            return false;
         }
-    }
 
-    public void removeResourceListChangedUIListener(
-            IResourceListChangedUIListener listener) {
-        synchronized (resourceListChangedUIListeners) {
-            if (null != listener && resourceListChangedUIListeners.size() > 0) {
-                resourceListChangedUIListeners.remove(listener);
+        Iterator<MetaProperty> itr = metaProperties.iterator();
+        MetaProperty prop;
+        String propName;
+        String propValue;
+        while (itr.hasNext()) {
+            prop = itr.next();
+            propName = prop.getPropName();
+            propValue = prop.getPropValue();
+            if (propName.equals(Constants.DEVICE_NAME)) {
+                if (null == propValue || propValue.length() < 1) {
+                    return false;
+                }
+                break;
             }
         }
+        return true;
     }
 
-    public void removeResourceSelectionChangedUIListener(
-            IResourceSelectionChangedUIListener listener) {
-        synchronized (resourceSelectionChangedUIListeners) {
-            if (null != listener
-                    && resourceSelectionChangedUIListeners.size() > 0) {
-                resourceSelectionChangedUIListeners.remove(listener);
-            }
+    public List<MetaProperty> getDeviceInfo() {
+        List<MetaProperty> metaProperties = new ArrayList<MetaProperty>();
+        metaProperties.add(new MetaProperty(Constants.DEVICE_NAME, deviceName));
+        if (null != deviceInfo) {
+            metaProperties.add(new MetaProperty(Constants.DEVICE_ID, deviceInfo
+                    .getID()));
+            metaProperties.add(new MetaProperty(Constants.DEVICE_SPEC_VERSION,
+                    deviceInfo.getSpecVersion()));
+            metaProperties.add(new MetaProperty(Constants.DEVICE_DMV,
+                    deviceInfo.getDataModelVersion()));
+        }
+        return metaProperties;
+    }
+
+    public List<MetaProperty> getPlatformInfo() {
+        List<MetaProperty> metaProperties = new ArrayList<MetaProperty>();
+        metaProperties.add(new MetaProperty(Constants.PLATFORM_ID, platformInfo
+                .getPlatformID()));
+        metaProperties.add(new MetaProperty(Constants.PLATFORM_MANUFAC_NAME,
+                platformInfo.getManufacturerName()));
+        metaProperties.add(new MetaProperty(Constants.PLATFORM_MANUFAC_URL,
+                platformInfo.getManufacturerUrl()));
+        metaProperties.add(new MetaProperty(Constants.PLATFORM_MODEL_NO,
+                platformInfo.getModelNumber()));
+        metaProperties.add(new MetaProperty(Constants.PLATFORM_DATE_OF_MANUFAC,
+                platformInfo.getDateOfManufacture()));
+        metaProperties.add(new MetaProperty(Constants.PLATFORM_VERSION,
+                platformInfo.getPlatformVersion()));
+        metaProperties.add(new MetaProperty(Constants.PLATFORM_OS_VERSION,
+                platformInfo.getOperationSystemVersion()));
+        metaProperties.add(new MetaProperty(
+                Constants.PLATFORM_HARDWARE_VERSION, platformInfo
+                        .getHardwareVersion()));
+        metaProperties.add(new MetaProperty(
+                Constants.PLATFORM_FIRMWARE_VERSION, platformInfo
+                        .getFirmwareVersion()));
+        metaProperties.add(new MetaProperty(Constants.PLATFORM_SUPPORT_URL,
+                platformInfo.getSupportUrl()));
+        metaProperties.add(new MetaProperty(Constants.PLATFORM_SYSTEM_TIME,
+                platformInfo.getSystemTime()));
+        return metaProperties;
+    }
+
+    public void setPlatformInfo(List<MetaProperty> metaProperties) {
+        if (null == metaProperties || metaProperties.size() < 1) {
+            return;
         }
-    }
-
-    public void removeResourceModelChangedUIListener(
-            IResourceModelChangedUIListener listener) {
-        synchronized (resourceModelChangedUIListeners) {
-            if (null != listener && resourceModelChangedUIListeners.size() > 0) {
-                resourceModelChangedUIListeners.remove(listener);
+        Iterator<MetaProperty> itr = metaProperties.iterator();
+        MetaProperty prop;
+        String propName;
+        String propValue;
+        while (itr.hasNext()) {
+            prop = itr.next();
+            propName = prop.getPropName();
+            propValue = prop.getPropValue();
+            if (propName.equals(Constants.PLATFORM_ID)) {
+                platformInfo.setPlatformID(propValue);
+            } else if (propName.equals(Constants.PLATFORM_MANUFAC_NAME)) {
+                platformInfo.setManufacturerName(propValue);
+            } else if (propName.equals(Constants.PLATFORM_MANUFAC_URL)) {
+                platformInfo.setManufacturerUrl(propValue);
+            } else if (propName.equals(Constants.PLATFORM_MODEL_NO)) {
+                platformInfo.setModelNumber(propValue);
+            } else if (propName.equals(Constants.PLATFORM_DATE_OF_MANUFAC)) {
+                platformInfo.setDateOfManufacture(propValue);
+            } else if (propName.equals(Constants.PLATFORM_VERSION)) {
+                platformInfo.setPlatformVersion(propValue);
+            } else if (propName.equals(Constants.PLATFORM_OS_VERSION)) {
+                platformInfo.setOperationSystemVersion(propValue);
+            } else if (propName.equals(Constants.PLATFORM_HARDWARE_VERSION)) {
+                platformInfo.setHardwareVersion(propValue);
+            } else if (propName.equals(Constants.PLATFORM_FIRMWARE_VERSION)) {
+                platformInfo.setFirmwareVersion(propValue);
+            } else if (propName.equals(Constants.PLATFORM_SUPPORT_URL)) {
+                platformInfo.setSupportUrl(propValue);
+            } else if (propName.equals(Constants.PLATFORM_SYSTEM_TIME)) {
+                platformInfo.setSystemTime(propValue);
             }
         }
-    }
-
-    public void removeAutomationUIListener(IAutomationUIListener listener) {
-        synchronized (automationUIListeners) {
-            if (null != listener && automationUIListeners.size() > 0) {
-                automationUIListeners.remove(listener);
-            }
+        try {
+            SimulatorManager.setPlatformInfo(platformInfo);
+        } catch (SimulatorException e) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(),
+                            new Date(),
+                            "Error while registering the platform info.\n"
+                                    + Utility.getSimulatorErrorString(e, null));
         }
     }
 
-    public void removeObserverListChangedUIListener(
-            IObserverListChangedUIListener listener) {
-        synchronized (observerUIListeners) {
-            if (null != listener && observerUIListeners.size() > 0) {
-                observerUIListeners.remove(listener);
+    public boolean isPlatformInfoValid(List<MetaProperty> metaProperties) {
+        if (null == metaProperties || metaProperties.size() < 1) {
+            return false;
+        }
+        Iterator<MetaProperty> itr = metaProperties.iterator();
+        MetaProperty prop;
+        String propValue;
+        while (itr.hasNext()) {
+            prop = itr.next();
+            propValue = prop.getPropValue();
+            if (null == propValue || propValue.length() < 1) {
+                return false;
             }
         }
+        return true;
     }
 
-    public synchronized SimulatorResource getCurrentResourceInSelection() {
+    public synchronized Resource getCurrentResourceInSelection() {
         return currentResourceInSelection;
     }
 
-    public synchronized void setCurrentResourceInSelection(
-            SimulatorResource resource) {
+    public synchronized void setCurrentResourceInSelection(Resource resource) {
         this.currentResourceInSelection = resource;
     }
 
-    private void addResourceUriToOrderedMap(String resourceType,
-            String resourceURI) {
-        if (null != resourceURI && null != resourceType) {
-            synchronized (orderedResourceUriMap) {
-                ArrayList<String> uriListForType = orderedResourceUriMap
-                        .get(resourceType);
-                if (null == uriListForType) {
-                    uriListForType = new ArrayList<String>();
-                    orderedResourceUriMap.put(resourceType, uriListForType);
-                }
-                uriListForType.add(resourceURI);
-            }
-        }
+    public boolean isResourceExist(String resourceURI) {
+        return data.isResourceExist(resourceURI);
     }
 
-    private void removeResourceUriFromOrderedMap(String resourceType,
-            String resourceURI) {
-        synchronized (orderedResourceUriMap) {
-            if (null != resourceURI && null != resourceType) {
-                ArrayList<String> uriListForType = orderedResourceUriMap
-                        .get(resourceType);
-                if (null != uriListForType) {
-                    uriListForType.remove(resourceURI);
-                    if (uriListForType.size() < 1) {
-                        orderedResourceUriMap.remove(resourceType);
-                    }
+    public boolean isAnyResourceExist() {
+        return data.isAnyResourceExist();
+    }
+
+    public boolean createSingleResource(SingleResource resource,
+            Map<String, SimulatorResourceAttribute> attributes)
+            throws SimulatorException {
+        if (null == resource) {
+            return false;
+        }
+
+        try {
+            // Create the resource.
+            SimulatorResource jSimulatorResource = SimulatorManager
+                    .createResource(SimulatorResource.Type.SINGLE,
+                            resource.getResourceName(),
+                            resource.getResourceURI(),
+                            resource.getResourceType());
+            if (null == jSimulatorResource
+                    || !(jSimulatorResource instanceof SimulatorSingleResource)) {
+                return false;
+            }
+            SimulatorSingleResource jSimulatorSingleResource = (SimulatorSingleResource) jSimulatorResource;
+            resource.setSimulatorResource(jSimulatorSingleResource);
+
+            // Cancel discoverable property if requested by user.
+            if (!resource.isDiscoverable()) {
+                jSimulatorSingleResource.setDiscoverable(false);
+            }
+
+            // Cancel observable property if requested by user.
+            if (!resource.isObservable()) {
+                jSimulatorSingleResource.setObservable(false);
+            }
+
+            // Set the model change listener.
+            jSimulatorSingleResource
+                    .setResourceModelChangeListener(resourceModelChangeListener);
+
+            // Set the observer listener if the resource is observable.
+            if (resource.isObservable()) {
+                jSimulatorSingleResource.setObserverListener(observer);
+            }
+
+            // Add attributes.
+            if (null != attributes && !attributes.isEmpty()) {
+                SimulatorResourceAttribute value;
+                for (Map.Entry<String, SimulatorResourceAttribute> entry : attributes
+                        .entrySet()) {
+                    value = entry.getValue();
+                    if (null != value)
+                        jSimulatorSingleResource.addAttribute(value);
                 }
-            } else if (null != resourceType) {
-                orderedResourceUriMap.remove(resourceType);
-            } else {
-                orderedResourceUriMap.clear();
+
+                // Get the resource model java object reference.
+                resource.setResourceModel(jSimulatorSingleResource
+                        .getResourceModel());
+
+                resource.createResourceRepresentation(jSimulatorSingleResource
+                        .getAttributes());
             }
+
+            // Set the resource interfaces.
+            jSimulatorSingleResource
+                    .setInterface(Utility.convertSetToVectorString(resource
+                            .getResourceInterfaces()));
+
+            // Register the resource with the platform.
+            jSimulatorSingleResource.start();
+            resource.setStarted(true);
+        } catch (SimulatorException e) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(), new Date(),
+                            Utility.getSimulatorErrorString(e, null));
+            throw e;
         }
+
+        // Add to local cache.
+        data.addResource(resource);
+
+        // Update UI listeners
+        UiListenerHandler.getInstance().resourceCreatedUINotification(
+                ResourceType.SINGLE);
+
+        Activator
+                .getDefault()
+                .getLogManager()
+                .log(Level.INFO.ordinal(), new Date(),
+                        "Resource created [" + resource.getResourceURI() + "].");
+
+        return true;
     }
 
-    private void addResourceToMap(SimulatorResource simulatorResource) {
-        if (null != simulatorResource) {
-            synchronized (resourceMap) {
-                Map<String, SimulatorResource> resourceTypeMap;
-                resourceTypeMap = resourceMap.get(simulatorResource
-                        .getResourceType());
-                if (null == resourceTypeMap) {
-                    resourceTypeMap = new HashMap<String, SimulatorResource>();
-                    resourceMap.put(simulatorResource.getResourceType(),
-                            resourceTypeMap);
-                }
-                resourceTypeMap.put(simulatorResource.getResourceURI(),
-                        simulatorResource);
+    public Resource createResourceByRAML(String configFilePath)
+            throws SimulatorException {
+        SimulatorResource jSimulatorResource;
+        try {
+            // Create the resource
+            jSimulatorResource = SimulatorManager
+                    .createResource(configFilePath);
+            if (null == jSimulatorResource) {
+                return null;
             }
+        } catch (SimulatorException e) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(), new Date(),
+                            Utility.getSimulatorErrorString(e, null));
+            throw e;
+        }
+
+        if (!(jSimulatorResource instanceof SimulatorSingleResource)) {
+            return null;
+        }
+
+        Resource resource = new SingleResource();
+        resource.setSimulatorResource(jSimulatorResource);
+
+        // Fetch and locally store the resource name and uri.
+        String uri = jSimulatorResource.getURI();
+        if (null == uri || uri.trim().isEmpty()) {
+            return null;
+        }
+        resource.setResourceURI(uri.trim());
+
+        String name = jSimulatorResource.getName();
+        if (null == name || name.trim().isEmpty()) {
+            return null;
         }
+
+        resource.setResourceName(name.trim());
+
+        return resource;
     }
 
-    private void addResourceToMap(String resourceType,
-            Map<String, SimulatorResource> newResourceTypeMap) {
-        if (null != resourceType && null != newResourceTypeMap) {
-            synchronized (resourceMap) {
-                Map<String, SimulatorResource> resourceTypeMap = resourceMap
-                        .get(resourceType);
-                if (null != resourceTypeMap) {
-                    resourceTypeMap.putAll(newResourceTypeMap);
-                } else {
-                    resourceMap.put(resourceType, newResourceTypeMap);
+    /**
+     * This method can set/change the resource uri and name of an already
+     * created resource which is not yet registered with the platform. This
+     * method registers the model change and observer listeners, registers the
+     * resource, fetches the resource attributes, updates the local cache and
+     * notifies the UI listeners.
+     */
+    public boolean completeSingleResourceCreationByRAML(Resource resource,
+            String uri, String name, boolean multiInstance)
+            throws SimulatorException {
+        if (null == resource || !(resource instanceof SingleResource)) {
+            return false;
+        }
+        try {
+            SingleResource singleRes = (SingleResource) resource;
+
+            SimulatorSingleResource jSimulatorSingleResource = (SimulatorSingleResource) resource
+                    .getSimulatorResource();
+            if (null == jSimulatorSingleResource) {
+                return false;
+            }
+
+            // Update resource URI and Name if they are changed.
+            String newUri = uri.trim();
+            String newName = name.trim();
+
+            if (multiInstance) {
+                singleRes.setResourceURI(newUri);
+                singleRes.setResourceName(newName);
+            } else {
+                if (!singleRes.getResourceURI().equals(newUri)) {
+                    jSimulatorSingleResource.setURI(newUri);
+                    singleRes.setResourceURI(newUri);
                 }
+                if (!singleRes.getResourceName().equals(newName)) {
+                    jSimulatorSingleResource.setName(newName);
+                    singleRes.setResourceName(newName);
+                }
+            }
+
+            // Set the model change listener.
+            jSimulatorSingleResource
+                    .setResourceModelChangeListener(resourceModelChangeListener);
+
+            // Set the observer listener if the resource is observable.
+            if (jSimulatorSingleResource.isObservable()) {
+                jSimulatorSingleResource.setObserverListener(observer);
+                singleRes.setObservable(true);
             }
+
+            // Fetch the resource model.
+            SimulatorResourceModel jResModel = jSimulatorSingleResource
+                    .getResourceModel();
+            if (null == jResModel) {
+                return false;
+            }
+            singleRes.setResourceModel(jResModel);
+
+            // Fetch the basic details of the resource.
+            singleRes.setResourceType(jSimulatorSingleResource
+                    .getResourceType());
+            singleRes
+                    .setResourceInterfaces(Utility
+                            .convertVectorToSet(jSimulatorSingleResource
+                                    .getInterface()));
+
+            // Fetch the resource attributes.
+            singleRes.createResourceRepresentation(jSimulatorSingleResource
+                    .getAttributes());
+
+            // Register the resource with the platform.
+            jSimulatorSingleResource.start();
+            singleRes.setStarted(true);
+
+            // Add to local cache.
+            data.addResource(singleRes);
+
+            // Update UI listeners for single instance creation
+            if (!multiInstance)
+                UiListenerHandler.getInstance().resourceCreatedUINotification(
+                        ResourceType.SINGLE);
+        } catch (Exception e) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(), new Date(),
+                            Utility.getSimulatorErrorString(e, null));
+            throw e;
         }
+
+        Activator
+                .getDefault()
+                .getLogManager()
+                .log(Level.INFO.ordinal(), new Date(),
+                        "Resource created [" + resource.getResourceURI() + "].");
+        return true;
     }
 
-    private void removeResourceFromMap(String resourceType, String resourceURI) {
-        if (null != resourceURI && null != resourceType) {
-            synchronized (resourceMap) {
-                Map<String, SimulatorResource> resourceTypeMap = resourceMap
-                        .get(resourceType);
-                if (null != resourceTypeMap) {
-                    resourceTypeMap.remove(resourceURI);
-                    if (resourceTypeMap.size() < 1) {
-                        resourceMap.remove(resourceType);
+    public Set<SingleResource> createSingleResourceMultiInstances(
+            String configFile, int count, IProgressMonitor progressMonitor)
+            throws SimulatorException {
+        Set<SingleResource> resultSet;
+        try {
+            resultSet = new HashSet<SingleResource>();
+            Vector<SimulatorResource> jSimulatorResources = SimulatorManager
+                    .createResource(configFile, count);
+            if (null == jSimulatorResources || jSimulatorResources.size() < 1) {
+                return null;
+            }
+            SimulatorSingleResource jResource;
+            SingleResource resource;
+            boolean result;
+            for (SimulatorResource jSimulatorResource : jSimulatorResources) {
+                // If the resource creation progress is canceled, then stop the
+                // creation and stop/delete
+                // the resources created already.
+                if (progressMonitor.isCanceled()) {
+                    removeSingleResources(resultSet);
+                    return null;
+                }
+                jResource = (SimulatorSingleResource) jSimulatorResource;
+                resource = new SingleResource();
+                resource.setSimulatorResource(jResource);
+                try {
+                    result = completeSingleResourceCreationByRAML(resource,
+                            jResource.getURI(), jResource.getName(), true);
+                    if (result) {
+                        resultSet.add(resource);
                     }
+                } catch (SimulatorException eInner) {
+                    Activator
+                            .getDefault()
+                            .getLogManager()
+                            .log(Level.ERROR.ordinal(),
+                                    new Date(),
+                                    Utility.getSimulatorErrorString(eInner,
+                                            null));
                 }
+                progressMonitor.worked(1);
             }
+        } catch (SimulatorException eOuter) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(), new Date(),
+                            Utility.getSimulatorErrorString(eOuter, null));
+            throw eOuter;
         }
+        return resultSet;
     }
 
-    public boolean isResourceExist(String resourceURI) {
-        boolean result = false;
-        if (null != resourceURI) {
-            SimulatorResource resource = getSimulatorResourceByURI(resourceURI);
-            if (null != resource) {
-                result = true;
-            }
+    public List<Resource> getResourceList() {
+        List<Resource> resourceList = data.getResources();
+        if (null == resourceList) {
+            return null;
         }
-        return result;
+        // Sort the list
+        Collections.sort(resourceList, Utility.resourceComparator);
+
+        return resourceList;
     }
 
-    public void addResourceDisplayName(String displayName, String completeURI) {
-        synchronized (displayNameMap) {
-            displayNameMap.put(displayName, completeURI);
+    public List<SingleResource> getSingleResourceList() {
+        List<SingleResource> resourceList = data.getSingleResources();
+        if (null == resourceList) {
+            return null;
         }
+        // Sort the list
+        Collections.sort(resourceList, Utility.singleResourceComparator);
+
+        return resourceList;
     }
 
-    public void removeResourceDisplayName(String displayName) {
-        synchronized (displayNameMap) {
-            displayNameMap.remove(displayName);
+    public void removeSingleResources(Set<SingleResource> resources)
+            throws SimulatorException {
+        if (null == resources) {
+            return;
+        }
+        Iterator<SingleResource> itr = resources.iterator();
+        while (itr.hasNext()) {
+            removeResource(itr.next());
         }
     }
 
-    public boolean isDisplayName(String displayName) {
-        boolean exist = false;
-        synchronized (displayNameMap) {
-            exist = displayNameMap.containsKey(displayName);
+    public void removeResource(Resource res) throws SimulatorException {
+        // Unregister the resource from the platform.
+        SimulatorResource simRes = res.getSimulatorResource();
+        try {
+            simRes.stop();
+        } catch (SimulatorException e) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(), new Date(),
+                            Utility.getSimulatorErrorString(e, null));
+            throw e;
         }
-        return exist;
+
+        // Delete this resource
+        data.deleteResource(res);
+
+        Activator
+                .getDefault()
+                .getLogManager()
+                .log(Level.INFO.ordinal(), new Date(),
+                        "Resource deleted [" + res.getResourceURI() + "].");
     }
 
-    public String getCompleteUriFromDisplayName(String displayName) {
-        String completeURI = null;
-        synchronized (displayNameMap) {
-            completeURI = displayNameMap.get(displayName);
+    public boolean isUriUnique(List<MetaProperty> properties) {
+        if (null == properties) {
+            return false;
         }
-        return completeURI;
+        MetaProperty prop;
+        Iterator<MetaProperty> itr = properties.iterator();
+        while (itr.hasNext()) {
+            prop = itr.next();
+            if (prop.getPropName().equals(Constants.RESOURCE_URI)) {
+                String uri = prop.getPropValue();
+                return !data.isResourceExist(uri);
+            }
+        }
+        return false;
     }
 
-    public void createResource(final String configFilePath) {
+    public void resourceSelectionChanged(final Resource selectedResource) {
         new Thread() {
             @Override
             public void run() {
-                SimulatorResourceServer resourceServerN;
-                try {
-                    resourceServerN = SimulatorManager.createResource(
-                            configFilePath, resourceModelChangeListener);
-                } catch (SimulatorException e) {
-                    Activator
-                            .getDefault()
-                            .getLogManager()
-                            .log(Level.ERROR.ordinal(),
-                                    new Date(),
-                                    "[" + e.getClass().getSimpleName() + "]"
-                                            + e.code().toString() + "-"
-                                            + e.message());
-                    return;
-                }
-                SimulatorResource simulatorResource;
-                simulatorResource = fetchResourceData(resourceServerN);
-                if (null != simulatorResource) {
-                    String uri = simulatorResource.getResourceURI();
-                    addResourceToMap(simulatorResource);
-                    addResourceUriToOrderedMap(
-                            simulatorResource.getResourceType(), uri);
-                    resourceCreatedUINotification();
-
-                    // Form the display URI
-                    String displayName = Utility.uriToDisplayName(uri);
-                    if (null != displayName) {
-                        addResourceDisplayName(displayName, uri);
-                    } else {
-                        Activator
-                                .getDefault()
-                                .getLogManager()
-                                .log(Level.ERROR.ordinal(),
-                                        new Date(),
-                                        "Converting the URI to display format for "
-                                                + uri + "failed!");
-                    }
-
-                    // Set the observer for the created resource
-                    try {
-                        resourceServerN.setObserverCallback(observer);
-                    } catch (SimulatorException e) {
-                        Activator
-                                .getDefault()
-                                .getLogManager()
-                                .log(Level.ERROR.ordinal(),
-                                        new Date(),
-                                        "[" + e.getClass().getSimpleName()
-                                                + "]" + e.code().toString()
-                                                + "-" + e.message());
-                    }
-
-                    // Print the resource data
-                    simulatorResource.printResourceInfo();
+                if (null != selectedResource) {
+                    setCurrentResourceInSelection(selectedResource);
+                } else {
+                    setCurrentResourceInSelection(null);
                 }
+                // Notify all observers for resource selection change event
+                UiListenerHandler.getInstance()
+                        .resourceSelectionChangedUINotification(
+                                selectedResource);
             }
         }.start();
     }
 
-    public void createResource(final String configFilePath,
-            final int noOfInstances) {
-        new Thread() {
-            @Override
-            public void run() {
-                Map<String, SimulatorResource> resourceTypeMap;
-                SimulatorResourceServer[] simulatorResourceServers = null;
-                try {
-                    simulatorResourceServers = SimulatorManager.createResource(
-                            configFilePath, noOfInstances,
-                            resourceModelChangeListener);
-                } catch (SimulatorException e) {
-                    Activator
-                            .getDefault()
-                            .getLogManager()
-                            .log(Level.ERROR.ordinal(),
-                                    new Date(),
-                                    "[" + e.getClass().getSimpleName() + "]"
-                                            + e.code().toString() + "-"
-                                            + e.message());
-                    return;
-                }
-                if (null == simulatorResourceServers) {
-                    return;
-                }
-                resourceTypeMap = new HashMap<String, SimulatorResource>();
-                SimulatorResource resource;
-                String uri;
-                String displayName;
-                for (SimulatorResourceServer resourceServerN : simulatorResourceServers) {
-                    resource = fetchResourceData(resourceServerN);
-                    if (null != resource) {
-                        uri = resource.getResourceURI();
-                        resourceTypeMap.put(uri, resource);
-                        addResourceUriToOrderedMap(resource.getResourceType(),
-                                uri);
-
-                        // Form the display URI
-                        displayName = Utility.uriToDisplayName(uri);
-                        if (null != displayName) {
-                            addResourceDisplayName(displayName, uri);
-                        } else {
-                            Activator
-                                    .getDefault()
-                                    .getLogManager()
-                                    .log(Level.ERROR.ordinal(),
-                                            new Date(),
-                                            "Converting the URI to display format for "
-                                                    + uri + "failed!");
-                        }
-                    }
-                    // Set the observer for the created resource
-                    try {
-                        resourceServerN.setObserverCallback(observer);
-                    } catch (SimulatorException e) {
-                        Activator
-                                .getDefault()
-                                .getLogManager()
-                                .log(Level.ERROR.ordinal(),
-                                        new Date(),
-                                        "[" + e.getClass().getSimpleName()
-                                                + "]" + e.code().toString()
-                                                + "-" + e.message());
-                    }
-                }
+    public List<MetaProperty> getMetaProperties(Resource resource) {
+        if (null != resource) {
+            String propName;
+            StringBuilder propValue;
+            List<MetaProperty> metaPropertyList = new ArrayList<MetaProperty>();
 
-                // Find the resourceType and add it to the local data
-                // structure and notify UI Listeners
-                if (resourceTypeMap.size() > 0) {
-                    String resourceType;
-                    Set<String> uriSet = resourceTypeMap.keySet();
-                    Iterator<String> itr = uriSet.iterator();
-                    if (itr.hasNext()) {
-                        SimulatorResource simResource = resourceTypeMap.get(itr
-                                .next());
-                        if (null != simResource) {
-                            resourceType = simResource.getResourceType();
-
-                            addResourceToMap(resourceType, resourceTypeMap);
-                            resourceCreatedUINotification();
+            for (int index = 0; index < Constants.META_PROPERTY_COUNT; index++) {
+                propName = Constants.META_PROPERTIES[index];
+                propValue = new StringBuilder();
+                if (propName.equals(Constants.RESOURCE_NAME)) {
+                    propValue.append(resource.getResourceName());
+                } else if (propName.equals(Constants.RESOURCE_URI)) {
+                    propValue.append(resource.getResourceURI());
+                } else if (propName.equals(Constants.RESOURCE_TYPE)) {
+                    propValue.append(resource.getResourceType());
+                } else if (propName.equals(Constants.INTERFACE_TYPES)) {
+                    Set<String> ifTypes = resource.getResourceInterfaces();
+                    if (null != ifTypes && !ifTypes.isEmpty()) {
+                        Iterator<String> itr = ifTypes.iterator();
+                        while (itr.hasNext()) {
+                            propValue.append(itr.next());
+                            if (itr.hasNext()) {
+                                propValue.append(", ");
+                            }
                         }
+                    } else {
+                        propValue = null;
                     }
+                } else {
+                    propValue = null;
                 }
-            }
-        }.start();
-    }
-
-    private SimulatorResource fetchResourceData(
-            SimulatorResourceServer resourceServerN) {
-        SimulatorResource simulatorResource = null;
-        if (null != resourceServerN) {
-            simulatorResource = new SimulatorResource();
-            simulatorResource.setResourceServer(resourceServerN);
-            simulatorResource.setResourceURI(resourceServerN.getURI());
-            simulatorResource
-                    .setResourceType(resourceServerN.getResourceType());
-            simulatorResource.setResourceName(resourceServerN.getName());
-            simulatorResource.setResourceInterface(resourceServerN
-                    .getInterfaceType());
-
-            SimulatorResourceModel resourceModelN;
-            try {
-                resourceModelN = resourceServerN.getModel();
-            } catch (SimulatorException e) {
-                Activator
-                        .getDefault()
-                        .getLogManager()
-                        .log(Level.ERROR.ordinal(),
-                                new Date(),
-                                "[" + e.getClass().getSimpleName() + "]"
-                                        + e.code().toString() + "-"
-                                        + e.message());
-                return null;
-            }
-            if (null != resourceModelN) {
-                simulatorResource.setResourceModel(resourceModelN);
-
-                // Fetch the resource attributes
-                Map<String, LocalResourceAttribute> resourceAttributeMap;
-                resourceAttributeMap = fetchResourceAttributesFromModel(resourceModelN);
-                if (null != resourceAttributeMap) {
-                    simulatorResource
-                            .setResourceAttributesMap(resourceAttributeMap);
+                if (null != propValue) {
+                    metaPropertyList.add(new MetaProperty(propName, propValue
+                            .toString()));
                 }
             }
+            return metaPropertyList;
         }
-        return simulatorResource;
+        return null;
     }
 
-    private Map<String, LocalResourceAttribute> fetchResourceAttributesFromModel(
-            SimulatorResourceModel resourceModelN) {
-        Map<String, LocalResourceAttribute> resourceAttributeMap = null;
-        if (null != resourceModelN) {
-            Map<String, ResourceAttribute> attributeMapN;
-            try {
-                attributeMapN = resourceModelN.getAttributes();
-            } catch (SimulatorException e) {
-                Activator
-                        .getDefault()
-                        .getLogManager()
-                        .log(Level.ERROR.ordinal(),
-                                new Date(),
-                                "[" + e.getClass().getSimpleName() + "]"
-                                        + e.code().toString() + "-"
-                                        + e.message());
-                return null;
-            }
-            if (null != attributeMapN) {
-                resourceAttributeMap = new HashMap<String, LocalResourceAttribute>();
-
-                Set<String> attNameSet = attributeMapN.keySet();
-                String attName;
-                ResourceAttribute attributeN;
-                LocalResourceAttribute attribute;
-                Iterator<String> attNameItr = attNameSet.iterator();
-                while (attNameItr.hasNext()) {
-                    attName = attNameItr.next();
-                    attributeN = attributeMapN.get(attName);
-                    if (null != attributeN) {
-                        attribute = new LocalResourceAttribute();
-                        attribute.setResourceAttribute(attributeN);
-
-                        // Set the attribute value
-                        Object valueObj = attributeN.getValue();
-                        if (null != valueObj) {
-                            attribute.setAttributeValue(valueObj);
-                        }
-
-                        // Set the attribute value list.
-                        attribute.setAttValues(getValueList(attributeN));
-
-                        // Initially disabling the automation
-                        attribute.setAutomationInProgress(false);
-
-                        // TODO: Temporarily setting the interval to 500.
-                        // This value should come from the native layer.
-                        // Native implementation is in progress.
-                        attribute
-                                .setAutomationUpdateInterval(Constants.DEFAULT_AUTOMATION_INTERVAL);
-
-                        // Setting the default automation type
-                        attribute
-                                .setAutomationType(Constants.DEFAULT_AUTOMATION_TYPE);
-
-                        resourceAttributeMap.put(attName, attribute);
-                    }
-                }
-            }
+    public boolean startResource(Resource resource) throws SimulatorException {
+        if (null == resource) {
+            return false;
+        }
+        SimulatorResource server = resource.getSimulatorResource();
+        if (null == server) {
+            return false;
+        }
+        try {
+            server.start();
+            resource.setStarted(true);
+        } catch (SimulatorException e) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(),
+                            new Date(),
+                            "There is an error while starting the resource.\n"
+                                    + Utility.getSimulatorErrorString(e, null));
+            throw e;
         }
-        return resourceAttributeMap;
+        return true;
     }
 
-    // This method gives all known possible values of the attribute in string
-    // format. It takes allowed values or range of values whichever is available
-    private List<String> getValueList(ResourceAttribute attributeN) {
-        Object[] allowedValues = attributeN.getAllowedValues();
-        List<String> valueList = new ArrayList<String>();
-        if (null != allowedValues && allowedValues.length > 0) {
-            for (Object value : allowedValues) {
-                if (null != value) {
-                    valueList.add(String.valueOf(value));
-                }
-            }
-        } else {
-            Type valueType = attributeN.getBaseType();
-            Range range = attributeN.getRange();
-            if (null != range) {
-                Object min = range.getMin();
-                Object max = range.getMax();
-                if (valueType == Type.INT) {
-                    int minI = (Integer) min;
-                    int maxI = (Integer) max;
-                    for (int value = minI; value <= maxI; value++) {
-                        valueList.add(String.valueOf(value));
-                    }
-                } else if (valueType == Type.DOUBLE) {
-                    double minD = (Double) min;
-                    double maxD = (Double) max;
-                    for (double value = minD; value <= maxD; value++) {
-                        valueList.add(String.valueOf(value));
-                    }
-                }
-            }
+    public boolean stopResource(Resource resource) throws SimulatorException {
+        if (null == resource) {
+            return false;
         }
-        Object attValue = attributeN.getValue();
-        if (valueList.size() < 1 && null != attValue) {
-            valueList.add(String.valueOf(attValue));
+        SimulatorResource server = resource.getSimulatorResource();
+        if (null == server) {
+            return false;
+        }
+        try {
+            server.stop();
+            resource.setStarted(false);
+        } catch (SimulatorException e) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(),
+                            new Date(),
+                            "There is an error while stopping the resource.\n"
+                                    + Utility.getSimulatorErrorString(e, null));
+            throw e;
         }
-        return valueList;
+        return true;
     }
 
-    public void deleteResourceByURI(final String resourceURI) {
-        if (null != resourceURI) {
-            new Thread() {
-                @Override
-                public void run() {
-                    SimulatorResource resource = getSimulatorResourceByURI(resourceURI);
-                    if (null != resource) {
-                        String resourceType = resource.getResourceType();
-
-                        // Unregister the resource from the platform
-                        deleteResource(resource);
-
-                        // Delete from the local data structure
-                        deleteLocalResourceDetails(resourceType, resourceURI);
-
-                        // Notify the UI listener for removing this resource
-                        // from UI
-                        resourceDeletedUINotification();
-
-                        if (null != currentResourceInSelection
-                                && resource == currentResourceInSelection) {
-                            // Listeners might query the resource being deleted
-                            // if exists. So set the currently selection to
-                            // null.
-                            setCurrentResourceInSelection(null);
-
-                            // Notify all observers for resource selection
-                            // change event
-                            resourceSelectionChangedUINotification();
-                        }
-                    }
-                }
-            }.start();
+    public boolean changeResourceName(Resource resource, String newName)
+            throws SimulatorException {
+        if (null == resource || null == newName) {
+            return false;
         }
-    }
 
-    private SimulatorResource getSimulatorResourceByURI(String resourceURI) {
-        SimulatorResource resource = null;
-        if (null != resourceURI) {
-            synchronized (resourceMap) {
-                Set<String> typeSet = resourceMap.keySet();
-                Iterator<String> typeItr = typeSet.iterator();
-                String resourceType;
-                Map<String, SimulatorResource> resourceTypeMap;
-                while (typeItr.hasNext()) {
-                    resourceType = typeItr.next();
-                    resourceTypeMap = resourceMap.get(resourceType);
-                    if (null != resourceTypeMap) {
-                        resource = resourceTypeMap.get(resourceURI);
-                        if (null != resource) {
-                            break;
-                        }
-                    }
-                }
-            }
+        if (!stopResource(resource)) {
+            return false;
         }
-        return resource;
-    }
 
-    private void deleteResource(SimulatorResource resource) {
-        if (null != resource) {
-            SimulatorResourceServer resourceServerN = resource
-                    .getResourceServer();
-            if (null != resourceServerN) {
-                try {
-                    SimulatorManager.deleteResource(resourceServerN);
-                } catch (SimulatorException e) {
-                    Activator
-                            .getDefault()
-                            .getLogManager()
-                            .log(Level.ERROR.ordinal(),
-                                    new Date(),
-                                    "[" + e.getClass().getSimpleName() + "]"
-                                            + e.code().toString() + "-"
-                                            + e.message());
-                }
-            }
+        SimulatorResource server = resource.getSimulatorResource();
+        try {
+            server.setName(newName);
+            resource.setResourceName(newName);
+        } catch (SimulatorException e) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(),
+                            new Date(),
+                            "There is an error while changing the resource name.\n"
+                                    + Utility.getSimulatorErrorString(e, null));
+            throw e;
         }
-    }
 
-    public void deleteResourceByType(final String resourceType) {
-        if (null != resourceType) {
-            new Thread() {
-                @Override
-                public void run() {
-                    // Unregister the resources from the platform
-                    deleteResource(resourceType);
-
-                    // Delete from the local data structure
-                    deleteLocalResourceDetails(resourceType, null);
-
-                    // Notify the UI listener for removing this resource from UI
-                    resourceDeletedUINotification();
-
-                    if (null != currentResourceInSelection
-                            && resourceType.equals(currentResourceInSelection
-                                    .getResourceType())) {
-                        // Listeners might query the resource being deleted if
-                        // exists. So set the currently selection to null.
-                        setCurrentResourceInSelection(null);
-
-                        // Notify all observers for resource selection change
-                        // event
-                        resourceSelectionChangedUINotification();
-                    }
-                }
-            }.start();
+        if (!startResource(resource)) {
+            return false;
         }
+
+        return true;
     }
 
-    private void deleteResource(String resourceType) {
-        if (null != resourceType) {
-            try {
-                SimulatorManager.deleteResources(resourceType);
-            } catch (SimulatorException e) {
-                Activator
-                        .getDefault()
-                        .getLogManager()
-                        .log(Level.ERROR.ordinal(),
-                                new Date(),
-                                "[" + e.getClass().getSimpleName() + "]"
-                                        + e.code().toString() + "-"
-                                        + e.message());
+    public boolean changeResourceURI(Resource resource, String newURI)
+            throws SimulatorException {
+        if (null == resource || null == newURI) {
+            return false;
+        }
+
+        if (!stopResource(resource)) {
+            return false;
+        }
+
+        String curURI = resource.getResourceURI();
+        setResourceURI(resource, newURI);
+
+        try {
+            if (!startResource(resource)) {
+                return false;
             }
+        } catch (SimulatorException e) {
+            setResourceURI(resource, curURI);
         }
-    }
 
-    public void deleteAllResources() {
-        new Thread() {
-            @Override
-            public void run() {
-                // Unregister the resources from the platform
-                deleteResource();
+        return true;
+    }
 
-                // Delete from the local data structure
-                deleteLocalResourceDetails(null, null);
+    public boolean changeResourceType(Resource resource, String newResourceType)
+            throws SimulatorException {
+        if (null == resource || null == newResourceType) {
+            return false;
+        }
 
-                // Notify the UI listener for removing this resource from UI
-                resourceDeletedUINotification();
+        if (!stopResource(resource)) {
+            return false;
+        }
 
-                // Listeners might query the resource being deleted if exists.
-                // So set the currently selection to null.
-                setCurrentResourceInSelection(null);
+        String curResourceType = resource.getResourceType();
+        setResourceType(resource, newResourceType);
 
-                // Notify all observers for resource selection change event
-                resourceSelectionChangedUINotification();
+        try {
+            if (!startResource(resource)) {
+                return false;
             }
-        }.start();
+        } catch (SimulatorException e) {
+            setResourceType(resource, curResourceType);
+        }
+
+        return true;
     }
 
-    private void deleteResource() {
+    public void setResourceURI(Resource resource, String newURI)
+            throws SimulatorException {
+        String curURI = resource.getResourceURI();
+        SimulatorResource server = resource.getSimulatorResource();
         try {
-            SimulatorManager.deleteResources(null);
+            server.setURI(newURI);
+            data.changeResourceURI(resource, curURI, newURI);
         } catch (SimulatorException e) {
             Activator
                     .getDefault()
                     .getLogManager()
                     .log(Level.ERROR.ordinal(),
                             new Date(),
-                            "[" + e.getClass().getSimpleName() + "]"
-                                    + e.code().toString() + "-" + e.message());
+                            "There is an error while changing the resource URI.\n"
+                                    + Utility.getSimulatorErrorString(e, null));
+            throw e;
         }
     }
 
-    private void deleteLocalResourceDetails(String resourceType,
-            String resourceURI) {
-        if (null != resourceType && null != resourceURI) {
-            removeResourceFromMap(resourceType, resourceURI);
-            removeResourceUriFromOrderedMap(resourceType, resourceURI);
-        } else {
-            synchronized (resourceMap) {
-                if (null != resourceType) {
-                    removeResourceUriFromOrderedMap(resourceType, null);
-                    resourceMap.remove(resourceType);
-                } else {
-                    resourceMap.clear();
-                    removeResourceUriFromOrderedMap(null, null);
-                }
-            }
-        }
-        // Remove the display name from the map
-        if (null != resourceURI) {
-            String dispName = Utility.uriToDisplayName(resourceURI);
-            if (null != dispName)
-                removeResourceDisplayName(dispName);
+    public void setResourceType(Resource resource, String newResourceType)
+            throws SimulatorException {
+        SimulatorResource server = resource.getSimulatorResource();
+        try {
+            server.setResourceType(newResourceType);
+            resource.setResourceType(newResourceType);
+        } catch (SimulatorException e) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(),
+                            new Date(),
+                            "There is an error while changing the resource Type.\n"
+                                    + Utility.getSimulatorErrorString(e, null));
+            throw e;
         }
     }
 
-    private void resourceCreatedUINotification() {
-        synchronized (resourceListChangedUIListeners) {
-            if (resourceListChangedUIListeners.size() > 0) {
-                IResourceListChangedUIListener listener;
-                Iterator<IResourceListChangedUIListener> listenerItr = resourceListChangedUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onResourceCreation();
-                    }
-                }
-            }
+    public boolean updateResourceProperties(Resource resource,
+            List<MetaProperty> properties, boolean uriChanged,
+            boolean nameChanged, boolean resTypeChanged)
+            throws SimulatorException {
+        if (null == resource || null == properties) {
+            return false;
         }
-    }
 
-    private void resourceDeletedUINotification() {
-        synchronized (resourceListChangedUIListeners) {
-            if (resourceListChangedUIListeners.size() > 0) {
-                IResourceListChangedUIListener listener;
-                Iterator<IResourceListChangedUIListener> listenerItr = resourceListChangedUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onResourceDeletion();
-                    }
-                }
+        // Updating the properties
+        Iterator<MetaProperty> itr = properties.iterator();
+        MetaProperty property;
+        String propName;
+        String propValue;
+        String resName = null;
+        String resURI = null;
+        String resType = null;
+        while (itr.hasNext()) {
+            property = itr.next();
+            if (null == property) {
+                continue;
             }
-        }
-    }
-
-    private void resourceSelectionChangedUINotification() {
-        synchronized (resourceSelectionChangedUIListeners) {
-            if (resourceSelectionChangedUIListeners.size() > 0) {
-                IResourceSelectionChangedUIListener listener;
-                Iterator<IResourceSelectionChangedUIListener> listenerItr = resourceSelectionChangedUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onResourceSelectionChange();
-                    }
-                }
+            propName = property.getPropName();
+            propValue = property.getPropValue();
+            if (propName.equals(Constants.RESOURCE_NAME)) {
+                resName = propValue;
+            } else if (propName.equals(Constants.RESOURCE_URI)) {
+                resURI = propValue;
+            } else if (propName.equals(Constants.RESOURCE_TYPE)) {
+                resType = propValue;
             }
         }
-    }
 
-    private void resourceModelChangedUINotification(
-            ModelChangeNotificationType notificationType, String resourceURI,
-            Set<LocalResourceAttribute> valueChangeSet) {
-        synchronized (resourceModelChangedUIListeners) {
-            if (resourceModelChangedUIListeners.size() > 0
-                    && notificationType != ModelChangeNotificationType.NONE
-                    && null != resourceURI) {
-                IResourceModelChangedUIListener listener;
-                Iterator<IResourceModelChangedUIListener> listenerItr = resourceModelChangedUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onResourceModelChange(notificationType,
-                                resourceURI, valueChangeSet);
-                    }
-                }
+        if (nameChanged) {
+            if (!changeResourceName(resource, resName)) {
+                return false;
             }
+
+            // Notify UI Listeners
+            UiListenerHandler.getInstance().propertiesChangedUINotification(
+                    Resource.class);
         }
-    }
 
-    private void resourceAutomationStartedUINotification(String resourceURI) {
-        synchronized (automationUIListeners) {
-            if (automationUIListeners.size() > 0 && null != resourceURI) {
-                IAutomationUIListener listener;
-                Iterator<IAutomationUIListener> listenerItr = automationUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onResourceAutomationStart(resourceURI);
-                    }
-                }
+        if (uriChanged) {
+            if (!changeResourceURI(resource, resURI)) {
+                return false;
             }
         }
-    }
 
-    private void automationCompleteUINotification(String resourceURI,
-            String attName) {
-        synchronized (automationUIListeners) {
-            if (automationUIListeners.size() > 0 && null != resourceURI) {
-                IAutomationUIListener listener;
-                Iterator<IAutomationUIListener> listenerItr = automationUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onAutomationComplete(resourceURI, attName);
-                    }
-                }
+        if (resTypeChanged) {
+            if (!changeResourceType(resource, resType)) {
+                return false;
             }
         }
+
+        return true;
     }
 
-    private void observerListChangedUINotification(String resourceURI) {
-        synchronized (observerUIListeners) {
-            if (observerUIListeners.size() > 0 && null != resourceURI) {
-                IObserverListChangedUIListener listener;
-                Iterator<IObserverListChangedUIListener> listenerItr = observerUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onObserverListChanged(resourceURI);
-                    }
-                }
-            }
+    public boolean updateResourceInterfaces(Resource resource,
+            Set<String> newIfSet) throws SimulatorException {
+        if (null == resource || null == newIfSet || newIfSet.isEmpty()) {
+            return false;
         }
-    }
 
-    public List<String> getResourceTypeList() {
-        List<String> typeList = null;
-        synchronized (resourceMap) {
-            if (resourceMap.size() > 0) {
-                typeList = new ArrayList<String>();
-                Set<String> typeSet = resourceMap.keySet();
-                Iterator<String> typeItr = typeSet.iterator();
-                while (typeItr.hasNext()) {
-                    typeList.add(typeItr.next());
-                }
-            }
+        SimulatorResource jResource = resource.getSimulatorResource();
+        if (null == jResource) {
+            return false;
         }
-        return typeList;
-    }
 
-    public boolean isTypeExist(String resType) {
-        synchronized (resourceMap) {
-            if (resourceMap.containsKey(resType)) {
-                return true;
-            }
+        Set<String> curIfSet = resource.getResourceInterfaces();
+        if (null == curIfSet || curIfSet.isEmpty()) {
+            return false;
         }
-        return false;
-    }
 
-    public List<String> getURIList() {
-        List<String> list = null;
-        synchronized (orderedResourceUriMap) {
-            Set<String> typeSet = orderedResourceUriMap.keySet();
-            List<String> typeList = Utility.convertSetToList(typeSet);
-            if (null == typeList || typeList.size() < 1) {
-                return list;
+        Iterator<String> itr = curIfSet.iterator();
+        String interfaceType;
+        boolean resourceRestartRequired = false;
+        while (itr.hasNext()) {
+            interfaceType = itr.next();
+            if (!newIfSet.contains(interfaceType)) {
+                resourceRestartRequired = true;
+                break;
             }
-            list = new ArrayList<String>();
-
-            // Sort the types
-            Collections.sort(typeList);
+        }
 
-            // Add all URIs to the output list
-            Iterator<String> typeItr = typeList.iterator();
-            while (typeItr.hasNext()) {
-                List<String> l = orderedResourceUriMap.get(typeItr.next());
-                if (null != l) {
-                    list.addAll(l);
+        try {
+            // As there is no support from native layer for interface removal,
+            // supporting it from the simulator requires restarting the resource
+            // if any existing interfaces are removed.
+
+            if (resourceRestartRequired) {
+                stopResource(resource);
+                jResource.setInterface(Utility
+                        .convertSetToVectorString(newIfSet));
+                startResource(resource);
+            } else {
+                // Existing interfaces are not removed.
+                itr = newIfSet.iterator();
+                while (itr.hasNext()) {
+                    interfaceType = itr.next();
+                    if (!curIfSet.contains(interfaceType)) {
+                        jResource.addInterface(interfaceType);
+                    }
                 }
             }
+        } catch (SimulatorException e) {
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.ERROR.ordinal(),
+                            new Date(),
+                            "There is an error while changing the interface types."
+                                    + Utility.getSimulatorErrorString(e, null));
+            throw e;
         }
-        return list;
+
+        // Set the resource interfaces.
+        resource.setResourceInterfaces(newIfSet);
+
+        return true;
     }
 
-    public void resourceSelectionChanged(final String selectedItem) {
-        new Thread() {
-            @Override
-            public void run() {
-                // Check whether the item selected is a resource or resource
-                // category
-                if (isTypeExist(selectedItem)) {
-                    // Given item is a resource Type
-                    setCurrentResourceInSelection(null);
-                } else {
-                    // Given item is a resource URI
-                    SimulatorResource resource = getSimulatorResourceByURI(selectedItem);
-                    if (null != resource) {
-                        setCurrentResourceInSelection(resource);
-                    } else {
-                        setCurrentResourceInSelection(null);
-                    }
+    public boolean attributeValueUpdated(SingleResource resource,
+            String attributeName, AttributeValue value) {
+        if (null != resource && null != attributeName && null != value) {
+            SimulatorSingleResource simRes = (SimulatorSingleResource) resource
+                    .getSimulatorResource();
+            if (null != simRes) {
+                try {
+                    simRes.updateAttribute(attributeName, value);
+                    return true;
+                } catch (SimulatorException e) {
+                    Activator
+                            .getDefault()
+                            .getLogManager()
+                            .log(Level.ERROR.ordinal(), new Date(),
+                                    Utility.getSimulatorErrorString(e, null));
                 }
-                // Notify all observers for resource selection change event
-                resourceSelectionChangedUINotification();
             }
-        }.start();
+        }
+        return false;
     }
 
-    public List<MetaProperty> getMetaProperties(SimulatorResource resource) {
-        if (null != resource) {
-            String propName;
-            String propValue;
-
-            List<MetaProperty> metaPropertyList = new ArrayList<MetaProperty>();
+    public boolean isResourceStarted(Resource resource) {
+        if (null == resource) {
+            return false;
+        }
+        return resource.isStarted();
+    }
 
-            for (int index = 0; index < Constants.META_PROPERTY_COUNT; index++) {
-                propName = Constants.META_PROPERTIES[index];
+    public boolean isPropertyValueInvalid(Resource resource,
+            List<MetaProperty> properties, String propName) {
+        if (null == resource || null == properties || null == propName) {
+            return false;
+        }
+        boolean invalid = false;
+        MetaProperty prop;
+        Iterator<MetaProperty> itr = properties.iterator();
+        while (itr.hasNext()) {
+            prop = itr.next();
+            if (prop.getPropName().equals(propName)) {
+                String value = prop.getPropValue();
                 if (propName.equals(Constants.RESOURCE_URI)) {
-                    propValue = resource.getResourceURI();
+                    if (!Utility.isUriValid(value)) {
+                        invalid = true;
+                    }
                 } else if (propName.equals(Constants.RESOURCE_TYPE)) {
-                    propValue = resource.getResourceType();
-                } else if (propName.equals(Constants.CONNECTIVITY_TYPE)) {
-                    // TODO: Temporarily ignoring till the implementation.
-                    propValue = null;
+                    if (!Utility.isResourceTypeValid(value)) {
+                        invalid = true;
+                    }
                 } else {
-                    propValue = null;
-                }
-                if (null != propValue) {
-                    metaPropertyList.add(new MetaProperty(propName, propValue));
+                    if (null == value || value.trim().isEmpty()) {
+                        invalid = true;
+                    }
                 }
             }
-
-            return metaPropertyList;
         }
-        return null;
+        return invalid;
     }
 
-    public List<LocalResourceAttribute> getAttributes(SimulatorResource resource) {
-        List<LocalResourceAttribute> attList = null;
-        if (null != resource) {
-            Map<String, LocalResourceAttribute> attMap = resource
-                    .getResourceAttributesMap();
-            if (null != attMap && attMap.size() > 0) {
-                attList = new ArrayList<LocalResourceAttribute>();
-                Set<String> attNameSet = attMap.keySet();
-                String attName;
-                LocalResourceAttribute attribute;
-                Iterator<String> attNameItr = attNameSet.iterator();
-                while (attNameItr.hasNext()) {
-                    attName = attNameItr.next();
-                    attribute = attMap.get(attName);
-                    if (null != attribute) {
-                        attList.add(attribute);
-                    }
+    public boolean isPropValueChanged(Resource resource,
+            List<MetaProperty> properties, String propName) {
+        if (null == resource || null == properties || null == propName) {
+            return false;
+        }
+        boolean changed = false;
+        MetaProperty prop;
+        String oldValue;
+        Iterator<MetaProperty> itr = properties.iterator();
+        while (itr.hasNext()) {
+            prop = itr.next();
+            if (prop.getPropName().equals(propName)) {
+                oldValue = getPropertyValueFromResource(resource, propName);
+                if (null != oldValue && !prop.getPropValue().equals(oldValue)) {
+                    changed = true;
                 }
+                break;
             }
         }
-        return attList;
+        return changed;
     }
 
-    public void attributeValueUpdated(SimulatorResource resource,
-            String attributeName, String value) {
-        if (null != resource && null != attributeName && null != value) {
-            SimulatorResourceServer server = resource.getResourceServer();
-            if (null != server) {
-                LocalResourceAttribute att = resource
-                        .getAttribute(attributeName);
-                if (null == att) {
-                    return;
-                }
-                Type baseType = att.getAttValBaseType();
-                try {
-                    if (baseType == Type.STRING) {
-                        server.updateAttributeString(attributeName, value);
-                    } else if (baseType == Type.INT) {
-                        int val;
-                        try {
-                            val = Integer.parseInt(value);
-                            server.updateAttributeInteger(attributeName, val);
-                        } catch (NumberFormatException nfe) {
-                            return;
-                        }
-                    } else if (baseType == Type.DOUBLE) {
-                        double val;
-                        try {
-                            val = Double.parseDouble(value);
-                            server.updateAttributeDouble(attributeName, val);
-                        } catch (NumberFormatException nfe) {
-                            return;
-                        }
-                    } else if (baseType == Type.BOOL) {
-                        boolean val;
-                        val = Boolean.parseBoolean(value);
-                        server.updateAttributeBoolean(attributeName, val);
-                    }
-                } catch (SimulatorException e) {
-                    Activator
-                            .getDefault()
-                            .getLogManager()
-                            .log(Level.ERROR.ordinal(),
-                                    new Date(),
-                                    "[" + e.getClass().getSimpleName() + "]"
-                                            + e.code().toString() + "-"
-                                            + e.message());
-                }
-            }
+    private String getPropertyValueFromResource(Resource resource,
+            String propName) {
+        if (null == resource || null == propName) {
+            return null;
+        }
+        if (propName.equals(Constants.RESOURCE_URI)) {
+            return resource.getResourceURI();
+        } else if (propName.equals(Constants.RESOURCE_NAME)) {
+            return resource.getResourceName();
+        } else if (propName.equals(Constants.RESOURCE_TYPE)) {
+            return resource.getResourceType();
+        } else {
+            return null;
         }
     }
 
-    private ModelChangeNotificationType compareAndUpdateLocalAttributes(
-            Map<String, LocalResourceAttribute> resourceAttributeMapOld,
-            Map<String, LocalResourceAttribute> resourceAttributeMapNew,
-            Set<LocalResourceAttribute> valueChangeSet) {
-        ModelChangeNotificationType notificationType = ModelChangeNotificationType.NONE;
-        if (null != resourceAttributeMapOld && null != resourceAttributeMapNew) {
-            Set<String> oldMapKeySet = resourceAttributeMapOld.keySet();
-            Iterator<String> attributeMapOldItr = oldMapKeySet.iterator();
-            String attName;
-            LocalResourceAttribute attributeOld;
-            LocalResourceAttribute attributeNew;
-            Object attValueOld;
-            Object attValueNew;
-            String oldValueStr;
-            String newValueStr;
-            while (attributeMapOldItr.hasNext()) {
-                attName = attributeMapOldItr.next();
-                if (resourceAttributeMapNew.containsKey(attName)) {
-                    attributeOld = resourceAttributeMapOld.get(attName);
-                    attributeNew = resourceAttributeMapNew.get(attName);
-                    // Copy the attribute value from new to old if the value
-                    // has been changed
-                    // Comparing only the attribute's value considering the
-                    // fact that only the value can be changed
-                    if (null != attributeOld && null != attributeNew) {
-                        attValueOld = attributeOld.getAttributeValue();
-                        attValueNew = attributeNew.getAttributeValue();
-
-                        oldValueStr = String.valueOf(attValueOld);
-                        newValueStr = String.valueOf(attValueNew);
-
-                        if (null != oldValueStr && null != newValueStr) {
-                            if (!oldValueStr.equals(newValueStr)) {
-                                attributeOld.setAttributeValue(attValueNew);
-                                notificationType = ModelChangeNotificationType.ATTRIBUTE_VALUE_CHANGED;
-                                valueChangeSet.add(attributeOld);
-                            }
-                        }
-                    }
-                    resourceAttributeMapNew.remove(attName);
-                } else {
-                    // Attribute doesn't exist in the new model. Hence
-                    // removing it from the model.
-                    resourceAttributeMapOld.remove(attName);
-                    notificationType = ModelChangeNotificationType.ATTRIBUTE_REMOVED;
-                }
+    public boolean isAttHasRangeOrAllowedValues(SimulatorResourceAttribute att) {
+        if (null == att) {
+            return false;
+        }
+        AttributeProperty prop = att.property();
+        if (null == prop) {
+            return false;
+        }
+
+        if (prop.getType() == Type.INTEGER) {
+            IntegerProperty intProperty = prop.asInteger();
+            if (null != intProperty) {
+                return (intProperty.hasRange() || intProperty.hasValues());
+            } else {
+                return false;
             }
-            // Check for new attributes in the new model
-            if (resourceAttributeMapNew.size() > 0) {
-                Set<String> remainingAttSet = resourceAttributeMapNew.keySet();
-                Iterator<String> remainingAttItr = remainingAttSet.iterator();
-                LocalResourceAttribute attribute;
-                while (remainingAttItr.hasNext()) {
-                    attName = remainingAttItr.next();
-                    if (null != attName) {
-                        attribute = resourceAttributeMapNew.get(attName);
-                        if (null != attribute) {
-                            resourceAttributeMapOld.put(attName, attribute);
-                        }
-                    }
-                }
-                notificationType = ModelChangeNotificationType.ATTRIBUTE_ADDED;
+        } else if (prop.getType() == Type.DOUBLE) {
+            DoubleProperty dblProperty = prop.asDouble();
+            if (null != dblProperty) {
+                return (dblProperty.hasRange() || dblProperty.hasValues());
+            } else {
+                return false;
+            }
+        } else if (prop.getType() == Type.STRING) {
+            StringProperty stringProperty = prop.asString();
+            if (null != stringProperty) {
+                return stringProperty.hasValues();
+            } else {
+                return false;
             }
         }
-        return notificationType;
+
+        return true;
     }
 
-    public int startAutomation(SimulatorResource resource,
-            LocalResourceAttribute attribute, AutomationType autoType,
+    public int startAutomation(SingleResource resource,
+            AttributeElement attribute, AutoUpdateType autoType,
             int autoUpdateInterval) {
         int autoId = -1;
         if (null != resource && null != attribute) {
-            SimulatorResourceServer resourceServerN = resource
-                    .getResourceServer();
-            if (null != resourceServerN) {
-                String attrName = attribute.getAttributeName();
+            SimulatorSingleResource server = (SimulatorSingleResource) resource
+                    .getSimulatorResource();
+            if (null != server) {
+                String attrName = attribute.getSimulatorResourceAttribute()
+                        .name();
                 try {
-                    autoId = resourceServerN.startAttributeAutomation(attrName,
-                            autoType, autoUpdateInterval, automationListener);
+                    autoId = server.startAttributeUpdation(attrName, autoType,
+                            autoUpdateInterval, automationListener);
                 } catch (SimulatorException e) {
                     Activator
                             .getDefault()
@@ -1362,27 +1389,25 @@ public class ResourceManager {
                     return -1;
                 }
                 if (-1 != autoId) {
-                    attribute.setAutomationId(autoId);
-                    attribute.setAutomationType(autoType);
-                    attribute.setAutomationUpdateInterval(autoUpdateInterval);
-                    attribute.setAutomationInProgress(true);
+                    attribute.setAutoUpdateId(autoId);
+                    attribute.setAutoUpdateType(autoType);
+                    attribute.setAutoUpdateInterval(autoUpdateInterval);
+                    attribute.setAutoUpdateState(true);
                     resource.setAttributeAutomationInProgress(true);
-                } else {
-                    attribute.setAutomationInProgress(false);
                 }
             }
         }
         return autoId;
     }
 
-    public void stopAutomation(SimulatorResource resource,
-            LocalResourceAttribute att, int autoId) {
+    public void stopAutomation(SingleResource resource, AttributeElement att,
+            int autoId) {
         if (null != resource) {
-            SimulatorResourceServer resourceServerN = resource
-                    .getResourceServer();
-            if (null != resourceServerN) {
+            SimulatorSingleResource server = (SimulatorSingleResource) resource
+                    .getSimulatorResource();
+            if (null != server) {
                 try {
-                    resourceServerN.stopAutomation(autoId);
+                    server.stopUpdation(autoId);
                 } catch (SimulatorException e) {
                     Activator
                             .getDefault()
@@ -1395,119 +1420,58 @@ public class ResourceManager {
                     return;
                 }
                 // Change the automation status
-                att.setAutomationInProgress(false);
+                att.setAutoUpdateState(false);
                 resource.setAttributeAutomationInProgress(isAnyAttributeInAutomation(resource));
             }
         }
     }
 
-    private boolean isAnyAttributeInAutomation(SimulatorResource resource) {
+    public boolean startResourceAutomationUIRequest(AutoUpdateType autoType,
+            int autoUpdateInterval, final SingleResource resource) {
         if (null == resource) {
             return false;
         }
-        Map<String, LocalResourceAttribute> attMap = resource
-                .getResourceAttributesMap();
-        if (null == attMap) {
-            return false;
-        }
         boolean status = false;
-        Set<String> keySet = attMap.keySet();
-        Iterator<String> attItr = keySet.iterator();
-        while (attItr.hasNext()) {
-            LocalResourceAttribute attribute = attMap.get(attItr.next());
-            if (attribute.isAutomationInProgress()) {
-                status = true;
-                break;
+        // Invoke the native automation method
+        SimulatorSingleResource resourceServer = (SimulatorSingleResource) resource
+                .getSimulatorResource();
+        if (null != resourceServer) {
+            int autoId = -1;
+            try {
+                autoId = resourceServer.startResourceUpdation(autoType,
+                        autoUpdateInterval, automationListener);
+            } catch (SimulatorException e) {
+                Activator
+                        .getDefault()
+                        .getLogManager()
+                        .log(Level.ERROR.ordinal(), new Date(),
+                                Utility.getSimulatorErrorString(e, null));
+                autoId = -1;
             }
-        }
-        return status;
-    }
+            if (-1 != autoId) {
+                // Automation request accepted.
+                changeResourceLevelAutomationStatus(resource, true);
 
-    private LocalResourceAttribute getAttributeWithGivenAutomationId(
-            SimulatorResource resource, int automationId) {
-        LocalResourceAttribute targetAttribute = null;
-        if (null != resource) {
-            Map<String, LocalResourceAttribute> attributeMap = resource
-                    .getResourceAttributesMap();
-            if (null != attributeMap) {
-                Set<String> attNameSet = attributeMap.keySet();
-                Iterator<String> attNameItr = attNameSet.iterator();
-                String attName;
-                LocalResourceAttribute attribute;
-                while (attNameItr.hasNext()) {
-                    attName = attNameItr.next();
-                    if (null != attName) {
-                        attribute = attributeMap.get(attName);
-                        if (null != attribute) {
-                            if (attribute.isAutomationInProgress()
-                                    && (attribute.getAutomationId() == automationId)) {
-                                targetAttribute = attribute;
-                                break;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return targetAttribute;
-    }
+                resource.setAutomationId(autoId);
 
-    public boolean startResourceAutomationUIRequest(final String resourceURI) {
-        if (null == resourceURI) {
-            return false;
-        }
-        boolean status = false;
-        SimulatorResource resource = getSimulatorResourceByURI(resourceURI);
-        if (null != resource) {
-            changeResourceLevelAutomationStatus(resource, true);
-
-            // Invoke the native automation method
-            SimulatorResourceServer resourceServer = resource
-                    .getResourceServer();
-            if (null != resourceServer) {
-                // TODO: Temporarily handling the normal one-time automation for
-                // resources
-                int autoId = -1;
-                try {
-                    autoId = resourceServer.startResourceAutomation(
-                            AutomationType.NORMAL, 500, automationListener);
-                } catch (SimulatorException e) {
-                    Activator
-                            .getDefault()
-                            .getLogManager()
-                            .log(Level.ERROR.ordinal(),
-                                    new Date(),
-                                    "[" + e.getClass().getSimpleName() + "]"
-                                            + e.code().toString() + "-"
-                                            + e.message());
-                    autoId = -1;
-                }
-                if (-1 == autoId) {
-                    // Automation request failed and hence status is being
-                    // rolled back
-                    changeResourceLevelAutomationStatus(resource, false);
-                } else {
-                    // Automation request accepted.
-                    resource.setAutomationId(autoId);
-
-                    // Notify the UI listeners in a different thread.
-                    Thread notifyThread = new Thread() {
-                        public void run() {
-                            resourceAutomationStartedUINotification(resourceURI);
-                        };
+                // Notify the UI listeners in a different thread.
+                Thread notifyThread = new Thread() {
+                    public void run() {
+                        UiListenerHandler.getInstance()
+                                .resourceAutomationStartedUINotification(
+                                        resource);
                     };
-                    notifyThread.setPriority(Thread.MAX_PRIORITY);
-                    notifyThread.start();
+                };
+                notifyThread.setPriority(Thread.MAX_PRIORITY);
+                notifyThread.start();
 
-                    status = true;
-                }
+                status = true;
             }
         }
         return status;
     }
 
-    public boolean stopResourceAutomationUIRequest(final String resourceURI) {
-        SimulatorResource resource = getSimulatorResourceByURI(resourceURI);
+    public boolean stopResourceAutomationUIRequest(final SingleResource resource) {
         if (null == resource) {
             return false;
         }
@@ -1515,129 +1479,309 @@ public class ResourceManager {
         if (-1 == autoId) {
             return false;
         }
-        SimulatorResourceServer resourceServer = resource.getResourceServer();
+        SimulatorSingleResource resourceServer = (SimulatorSingleResource) resource
+                .getSimulatorResource();
         if (null == resourceServer) {
             return false;
         }
         // Call native method
         try {
-            resourceServer.stopAutomation(autoId);
+            resourceServer.stopUpdation(autoId);
         } catch (SimulatorException e) {
             Activator
                     .getDefault()
                     .getLogManager()
-                    .log(Level.ERROR.ordinal(),
-                            new Date(),
-                            "[" + e.getClass().getSimpleName() + "]"
-                                    + e.code().toString() + "-" + e.message());
+                    .log(Level.ERROR.ordinal(), new Date(),
+                            Utility.getSimulatorErrorString(e, null));
             return false;
         }
 
         // Notify the UI Listeners. Invoke the automation complete callback.
         Thread stopThread = new Thread() {
             public void run() {
-                automationListener.onAutomationComplete(resourceURI, autoId);
+                automationListener.onUpdateComplete(resource.getResourceURI(),
+                        autoId);
             }
         };
         stopThread.start();
         return true;
     }
 
+    private boolean isAnyAttributeInAutomation(SingleResource resource) {
+        if (null == resource || null == resource.getResourceRepresentation()) {
+            return false;
+        }
+
+        Map<String, AttributeElement> attributes = resource
+                .getResourceRepresentation().getAttributes();
+        if (null == attributes || 0 == attributes.size())
+            return false;
+
+        for (Map.Entry<String, AttributeElement> entry : attributes.entrySet()) {
+            if (entry.getValue().isAutoUpdateInProgress())
+                return true;
+        }
+
+        return false;
+    }
+
     // Changes the automation state of the resource and its attributes
-    private void changeResourceLevelAutomationStatus(
-            SimulatorResource resource, boolean status) {
-
-        Map<String, LocalResourceAttribute> attributeMap = resource
-                .getResourceAttributesMap();
-        if (null != attributeMap) {
-            Set<String> attrNameSet = attributeMap.keySet();
-            Iterator<String> attrNameItr = attrNameSet.iterator();
-            String attrName;
-            LocalResourceAttribute attribute;
-            while (attrNameItr.hasNext()) {
-                attrName = attrNameItr.next();
-                attribute = attributeMap.get(attrName);
-                if (null != attribute) {
-                    attribute.setAutomationInProgress(status);
-                }
-            }
+    private void changeResourceLevelAutomationStatus(SingleResource resource,
+            boolean status) {
+
+        if (null == resource || null == resource.getResourceRepresentation()) {
+            return;
         }
+
+        Map<String, AttributeElement> attributes = resource
+                .getResourceRepresentation().getAttributes();
+        if (null == attributes || 0 == attributes.size())
+            return;
+
+        for (Map.Entry<String, AttributeElement> entry : attributes.entrySet()) {
+            entry.getValue().setAutoUpdateState(status);
+        }
+
         resource.setResourceAutomationInProgress(status);
     }
 
-    public boolean isResourceAutomationStarted(String resourceURI) {
-        boolean status = false;
-        if (null == resourceURI) {
-            return status;
+    private AttributeElement getAttributeWithGivenAutomationId(
+            SingleResource resource, int automationId) {
+        if (null == resource || null == resource.getResourceRepresentation()) {
+            return null;
         }
 
-        SimulatorResource resource = getSimulatorResourceByURI(resourceURI);
-        if (null != resource) {
-            status = resource.isResourceAutomationInProgress();
+        Map<String, AttributeElement> attributes = resource
+                .getResourceRepresentation().getAttributes();
+        if (null == attributes || 0 == attributes.size())
+            return null;
+
+        for (Map.Entry<String, AttributeElement> entry : attributes.entrySet()) {
+            if (automationId == entry.getValue().getAutoUpdateId())
+                return entry.getValue();
         }
-        return status;
+
+        return null;
     }
 
-    public boolean isAttributeAutomationStarted(String resourceURI) {
+    public boolean isResourceAutomationStarted(SingleResource resource) {
         boolean status = false;
-        if (null == resourceURI) {
-            return status;
-        }
-        SimulatorResource resource = getSimulatorResourceByURI(resourceURI);
         if (null != resource) {
-            status = resource.isAttributeAutomationInProgress();
+            status = resource.isResourceAutomationInProgress();
         }
         return status;
     }
 
-    public LocalResourceAttribute getAttributeByResourceURI(String uri,
-            String attName) {
-        if (null == uri || null == attName) {
-            return null;
-        }
-        SimulatorResource resource = getSimulatorResourceByURI(uri);
+    public boolean isAttributeAutomationStarted(SingleResource resource) {
         if (null == resource) {
-            return null;
-        }
-        Map<String, LocalResourceAttribute> attMap = resource
-                .getResourceAttributesMap();
-        if (null == attMap) {
-            return null;
+            return false;
         }
-        return attMap.get(attName);
+        return resource.isAttributeAutomationInProgress();
     }
 
-    public void notifyObserverRequest(SimulatorResource res, int observerId) {
-        if (null == res) {
+    public void notifyObserverRequest(Resource resource, int observerId) {
+        if (null == resource) {
             return;
         }
-        SimulatorResourceServer server = res.getResourceServer();
-        if (null == server) {
+        SimulatorResource simulatorResource = resource.getSimulatorResource();
+        if (null == simulatorResource) {
             return;
         }
         try {
-            server.notifyObserver(observerId);
+            simulatorResource.notifyObserver(observerId);
         } catch (SimulatorException e) {
             Activator
                     .getDefault()
                     .getLogManager()
-                    .log(Level.ERROR.ordinal(),
-                            new Date(),
-                            "[" + e.getClass().getSimpleName() + "]"
-                                    + e.code().toString() + "-" + e.message());
+                    .log(Level.ERROR.ordinal(), new Date(),
+                            Utility.getSimulatorErrorString(e, null));
         }
     }
 
-    public Image getImage(String resourceURI) {
-        if (null == resourceURI) {
+    public List<String> getAllValuesOfAttribute(SimulatorResourceAttribute att) {
+        if (null == att) {
             return null;
         }
-        SimulatorResource resource = getSimulatorResourceByURI(resourceURI);
-        if (null == resource) {
+
+        AttributeValue value = att.value();
+        if (null == value || null == value.get()) {
             return null;
         }
-        return Activator.getDefault().getImageRegistry()
-                .get(resource.getResourceType());
+
+        TypeInfo type = value.typeInfo();
+
+        if (type.mBaseType == ValueType.RESOURCEMODEL) {
+            return null;
+        }
+
+        List<String> values = new ArrayList<String>();
+
+        AttributeProperty prop = att.property();
+        if (null == prop) {
+            // Adding the current value of the attribute.
+            values.add(new AttributeValueStringConverter(value).toString());
+            return values;
+        }
+
+        if (type.mType == ValueType.ARRAY) {
+            if (type.mDepth == 1) {
+                ArrayProperty arrayProperty = prop.asArray();
+                if (null != arrayProperty) {
+                    AttributeProperty childProp = arrayProperty
+                            .getElementProperty();
+                    switch (childProp.getType()) {
+                        case INTEGER:
+                            IntegerProperty intProperty = childProp.asInteger();
+                            if (null != intProperty) {
+                                values.addAll(getAllValues(att, intProperty,
+                                        Type.INTEGER));
+                            }
+                            break;
+                        case DOUBLE:
+                            DoubleProperty dblProperty = childProp.asDouble();
+                            if (null != dblProperty) {
+                                values.addAll(getAllValues(att, dblProperty,
+                                        Type.DOUBLE));
+                            }
+                            break;
+                        case BOOLEAN:
+                            BooleanProperty boolProperty = childProp
+                                    .asBoolean();
+                            if (null != boolProperty) {
+                                values.addAll(getAllValues(att, boolProperty,
+                                        Type.BOOLEAN));
+                            }
+                            break;
+                        case STRING:
+                            StringProperty stringProperty = childProp
+                                    .asString();
+                            if (null != stringProperty) {
+                                values.addAll(getAllValues(att, stringProperty,
+                                        Type.STRING));
+                            }
+                            break;
+                        default:
+                            break;
+                    }
+                }
+            }
+        } else {
+            switch (prop.getType()) {
+                case INTEGER:
+                    IntegerProperty intProperty = prop.asInteger();
+                    if (null != intProperty) {
+                        values.addAll(getAllValues(att, intProperty,
+                                Type.INTEGER));
+                    }
+                    break;
+                case DOUBLE:
+                    DoubleProperty dblProperty = prop.asDouble();
+                    if (null != dblProperty) {
+                        values.addAll(getAllValues(att, dblProperty,
+                                Type.DOUBLE));
+                    }
+                    break;
+                case BOOLEAN:
+                    BooleanProperty boolProperty = prop.asBoolean();
+                    if (null != boolProperty) {
+                        values.addAll(getAllValues(att, boolProperty,
+                                Type.BOOLEAN));
+                    }
+                    break;
+                case STRING:
+                    StringProperty stringProperty = prop.asString();
+                    if (null != stringProperty) {
+                        values.addAll(getAllValues(att, stringProperty,
+                                Type.STRING));
+                    }
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        return values;
+    }
+
+    public List<String> getAllValues(SimulatorResourceAttribute attribute,
+            IntegerProperty intProperty, AttributeProperty.Type type) {
+        List<String> values = new ArrayList<String>();
+
+        if (intProperty.hasRange()) {
+            int min = (int) intProperty.min();
+            int max = (int) intProperty.max();
+            for (int iVal = min; iVal <= max; iVal++) {
+                values.add(String.valueOf(iVal));
+            }
+        } else if (intProperty.hasValues()) {
+            for (Integer val : intProperty.getValues()) {
+                values.add(String.valueOf(val));
+            }
+        } else {
+            AttributeValue value = attribute.value();
+            if (null != value && null != value.get()) {
+                // Adding the current value of the attribute.
+                values.add(String.valueOf(value.get()));
+            }
+        }
+        return values;
+    }
+
+    public List<String> getAllValues(SimulatorResourceAttribute attribute,
+            DoubleProperty dblProperty, AttributeProperty.Type type) {
+        NumberFormat formatter = NumberFormat.getInstance();
+        List<String> values = new ArrayList<String>();
+
+        if (dblProperty.hasRange()) {
+            double min = (double) dblProperty.min();
+            double max = (double) dblProperty.max();
+            for (double val = min; val <= max; val += 0.1) {
+                formatter.setMaximumFractionDigits(1);
+                formatter.setMinimumFractionDigits(1);
+                values.add(formatter.format(val));
+            }
+        } else if (dblProperty.hasValues()) {
+            for (Double val : dblProperty.getValues()) {
+                values.add(String.valueOf(val));
+            }
+        } else {
+            AttributeValue value = attribute.value();
+            if (null != value && null != value.get()) {
+                // Adding the current value of the attribute.
+                values.add(String.valueOf(value.get()));
+            }
+        }
+        return values;
+    }
+
+    public List<String> getAllValues(SimulatorResourceAttribute attribute,
+            BooleanProperty boolProperty, AttributeProperty.Type type) {
+        List<String> values = new ArrayList<String>();
+        values.add("true");
+        values.add("false");
+        return values;
+    }
+
+    public List<String> getAllValues(SimulatorResourceAttribute attribute,
+            StringProperty stringProperty, AttributeProperty.Type type) {
+        List<String> values = new ArrayList<String>();
+
+        if (stringProperty.hasValues()) {
+            for (String val : stringProperty.getValues()) {
+                values.add(String.valueOf(val));
+            }
+        } else {
+            AttributeValue value = attribute.value();
+            if (null != value && null != value.get()) {
+                // Adding the current value of the attribute.
+                values.add(String.valueOf(value.get()));
+            }
+        }
+        return values;
+    }
+
+    public int getResourceCount() {
+        return data.getResourceCount();
     }
 
     public void shutdown() {