[IoTivity Simulator] Handling resource interfaces.
[platform/upstream/iotivity.git] / service / simulator / java / eclipse-plugin / ClientControllerPlugin / src / oic / simulator / clientcontroller / manager / ResourceManager.java
index bcadd4a..e20e18a 100644 (file)
@@ -29,20 +29,9 @@ import java.util.Set;
 import java.util.Vector;
 
 import oic.simulator.clientcontroller.Activator;
-import oic.simulator.clientcontroller.listener.IConfigurationUpload;
-import oic.simulator.clientcontroller.listener.IDevicePlatformInfoUIListener;
-import oic.simulator.clientcontroller.listener.IFindResourceUIListener;
-import oic.simulator.clientcontroller.listener.IGetUIListener;
-import oic.simulator.clientcontroller.listener.IObserveUIListener;
-import oic.simulator.clientcontroller.listener.IPostUIListener;
-import oic.simulator.clientcontroller.listener.IPutUIListener;
-import oic.simulator.clientcontroller.listener.IResourceSelectionChangedUIListener;
-import oic.simulator.clientcontroller.listener.IVerificationUIListener;
+import oic.simulator.clientcontroller.remoteresource.DeviceAndPlatformInfo;
 import oic.simulator.clientcontroller.remoteresource.MetaProperty;
-import oic.simulator.clientcontroller.remoteresource.PutPostAttributeModel;
 import oic.simulator.clientcontroller.remoteresource.RemoteResource;
-import oic.simulator.clientcontroller.remoteresource.RemoteResourceAttribute;
-import oic.simulator.clientcontroller.utils.AttributeValueBuilder;
 import oic.simulator.clientcontroller.utils.Constants;
 import oic.simulator.clientcontroller.utils.Utility;
 
@@ -79,59 +68,40 @@ import org.oic.simulator.client.SimulatorRemoteResource.VerificationType;
  */
 public class ResourceManager {
 
-    private Set<String>                               lastKnownSearchTypes;
+    private Set<String>                        lastKnownSearchTypes;
 
-    private RemoteResource                            currentResourceInSelection;
+    private RemoteResource                     currentResourceInSelection;
 
-    private FindResourceListener                      findResourceListener;
-    private GetResponseListener                       getListener;
-    private PutResponseListener                       putListener;
-    private PostResponseListener                      postListener;
-    private ObserveNotificationListener               observeListener;
-    private VerificationListener                      verifyListener;
-    private DeviceListener                            deviceListener;
-    private PlatformListener                          platformListener;
+    private FindResourceListener               findResourceListener;
+    private GetResponseListener                getListener;
+    private PutResponseListener                putListener;
+    private PostResponseListener               postListener;
+    private ObserveNotificationListener        observeListener;
+    private VerificationListener               verifyListener;
+    private DeviceListener                     deviceListener;
+    private PlatformListener                   platformListener;
 
-    private ResponseSynchronizerThread                synchronizerThread;
+    private ResponseSynchronizerThread         synchronizerThread;
 
-    private Thread                                    threadHandle;
-
-    private List<IFindResourceUIListener>             findResourceUIListeners;
-    private List<IResourceSelectionChangedUIListener> resourceSelectionChangedUIListeners;
-    private List<IGetUIListener>                      getUIListeners;
-    private List<IPutUIListener>                      putUIListeners;
-    private List<IPostUIListener>                     postUIListeners;
-    private List<IObserveUIListener>                  observeUIListeners;
-    private List<IVerificationUIListener>             verificationUIListeners;
-    private List<IConfigurationUpload>                configUploadUIListeners;
-    private List<IDevicePlatformInfoUIListener>       devicePlatformInfoUIListeners;
+    private Thread                             threadHandle;
 
     // Map with Server ID as key and the complete object as the value
-    private Map<String, RemoteResource>               resourceMap;
-    private List<RemoteResource>                      favoriteResources;
+    private Map<String, RemoteResource>        resourceMap;
+    private List<RemoteResource>               favoriteResources;
     // Maintaining a list of resource URIs for favorite resources feature.
-    private List<String>                              favoriteURIList;
+    private List<String>                       favoriteURIList;
 
     // Maintaining a list of observed resource URIs.
-    private List<String>                              observedResourceURIList;
+    private List<String>                       observedResourceURIList;
 
-    private DeviceInfo                                devInfo;
-    private PlatformInfo                              platInfo;
+    private Map<String, DeviceAndPlatformInfo> hostDeviceAndPlatformMap;
 
     public ResourceManager() {
         resourceMap = new HashMap<String, RemoteResource>();
         favoriteResources = new ArrayList<RemoteResource>();
         favoriteURIList = new ArrayList<String>();
         observedResourceURIList = new ArrayList<String>();
-        findResourceUIListeners = new ArrayList<IFindResourceUIListener>();
-        resourceSelectionChangedUIListeners = new ArrayList<IResourceSelectionChangedUIListener>();
-        getUIListeners = new ArrayList<IGetUIListener>();
-        putUIListeners = new ArrayList<IPutUIListener>();
-        postUIListeners = new ArrayList<IPostUIListener>();
-        observeUIListeners = new ArrayList<IObserveUIListener>();
-        verificationUIListeners = new ArrayList<IVerificationUIListener>();
-        configUploadUIListeners = new ArrayList<IConfigurationUpload>();
-        devicePlatformInfoUIListeners = new ArrayList<IDevicePlatformInfoUIListener>();
+        hostDeviceAndPlatformMap = new HashMap<String, DeviceAndPlatformInfo>();
 
         findResourceListener = new FindResourceListener() {
 
@@ -144,6 +114,14 @@ public class ResourceManager {
                             return;
                         }
 
+                        // Ignore the response if the resource is a device or
+                        // platform.
+                        Vector<String> resTypes = resourceN.getResourceTypes();
+                        if (null != resTypes && resTypes.contains("oic.wk.d")
+                                || resTypes.contains("oic.wk.p")) {
+                            return;
+                        }
+
                         // If id is not available, then it cannot be added to
                         // the local map as null value should not be allowed as
                         // key.
@@ -158,9 +136,6 @@ public class ResourceManager {
                             return;
                         }
 
-                        // Fetch the resource data
-                        // RemoteResource resource =
-                        // fetchResourceDetails(resourceN);
                         RemoteResource resource = new RemoteResource();
                         resource.setRemoteResourceRef(resourceN);
 
@@ -189,7 +164,8 @@ public class ResourceManager {
                         addResourceDetails(resource);
 
                         // Notify the UI listener
-                        newResourceFoundNotification(resource);
+                        UiListenerHandler.getInstance()
+                                .newResourceFoundNotification(resource);
 
                         Activator
                                 .getDefault()
@@ -200,9 +176,16 @@ public class ResourceManager {
                                                 + "].");
 
                         // Send an initial GET request to get the resource
-                        // attributes
+                        // attributes on an interface supported by the resource.
                         try {
-                            resourceN.get(null, getListener);
+                            String ifType = null;
+                            Vector<String> resInterfaces = resourceN
+                                    .getResourceInterfaces();
+                            if (null != resInterfaces) {
+                                ifType = resInterfaces.get(0);
+                            }
+                            resourceN.get(formQueryParameters(ifType, null),
+                                    getListener);
                         } catch (SimulatorException e) {
                             Activator
                                     .getDefault()
@@ -213,40 +196,70 @@ public class ResourceManager {
                                                     null));
                         }
 
-                        // Get the device and platform information
-                        try {
-                            SimulatorManager.findDevices(deviceListener);
-                            SimulatorManager
-                                    .getPlatformInformation(platformListener);
-                        } catch (SimulatorException e) {
-                            Activator
-                                    .getDefault()
-                                    .getLogManager()
-                                    .log(Level.ERROR.ordinal(),
-                                            new Date(),
-                                            Utility.getSimulatorErrorString(e,
-                                                    null));
+                        // Get the device information
+                        if (!isDeviceInfoExist(resourceN.getHost())) {
+                            try {
+                                SimulatorManager.findDevices(resource
+                                        .getRemoteResourceRef().getHost(),
+                                        deviceListener);
+                            } catch (SimulatorException e) {
+                                Activator
+                                        .getDefault()
+                                        .getLogManager()
+                                        .log(Level.ERROR.ordinal(),
+                                                new Date(),
+                                                Utility.getSimulatorErrorString(
+                                                        e, null));
+                            }
+                        }
+
+                        // Get the platform information
+                        if (!isPlatformInfoExist(resourceN.getHost())) {
+                            try {
+                                SimulatorManager.getPlatformInformation(
+                                        resource.getRemoteResourceRef()
+                                                .getHost(), platformListener);
+                            } catch (SimulatorException e) {
+                                Activator
+                                        .getDefault()
+                                        .getLogManager()
+                                        .log(Level.ERROR.ordinal(),
+                                                new Date(),
+                                                Utility.getSimulatorErrorString(
+                                                        e, null));
+                            }
                         }
                     }
                 });
             }
         };
 
-        // TODO: Listeners for device and platform information.
+        // Listeners for device and platform information.
         deviceListener = new DeviceListener() {
 
             @Override
-            public void onDeviceFound(final DeviceInfo deviceInfo) {
-                if (null == deviceInfo) {
+            public void onDeviceFound(final String host,
+                    final DeviceInfo deviceInfo) {
+                if (null == deviceInfo || null == host) {
                     return;
                 }
                 synchronizerThread.addToQueue(new Runnable() {
                     @Override
                     public void run() {
-                        setDeviceInfo(deviceInfo);
+                        synchronized (hostDeviceAndPlatformMap) {
+                            DeviceAndPlatformInfo info = hostDeviceAndPlatformMap
+                                    .get(host);
+                            if (null == info) {
+                                info = new DeviceAndPlatformInfo();
+                                info.setHost(host);
+                                hostDeviceAndPlatformMap.put(host, info);
+                            }
+                            info.setDeviceInfo(deviceInfo);
+                        }
 
                         // Notify UI listeners
-                        deviceInfoReceivedNotification();
+                        UiListenerHandler.getInstance()
+                                .deviceInfoReceivedNotification();
                     }
                 });
             }
@@ -255,17 +268,28 @@ public class ResourceManager {
         platformListener = new PlatformListener() {
 
             @Override
-            public void onPlatformFound(final PlatformInfo platformInfo) {
-                if (null == platformInfo) {
+            public void onPlatformFound(final String host,
+                    final PlatformInfo platformInfo) {
+                if (null == platformInfo || null == host) {
                     return;
                 }
                 synchronizerThread.addToQueue(new Runnable() {
                     @Override
                     public void run() {
-                        setPlatformInfo(platformInfo);
+                        synchronized (hostDeviceAndPlatformMap) {
+                            DeviceAndPlatformInfo info = hostDeviceAndPlatformMap
+                                    .get(host);
+                            if (null == info) {
+                                info = new DeviceAndPlatformInfo();
+                                info.setHost(host);
+                                hostDeviceAndPlatformMap.put(host, info);
+                            }
+                            info.setPlatformInfo(platformInfo);
+                        }
 
                         // Notify UI listeners
-                        platformInfoReceivedNotification();
+                        UiListenerHandler.getInstance()
+                                .platformInfoReceivedNotification();
                     }
                 });
             }
@@ -276,7 +300,6 @@ public class ResourceManager {
             public void onGetResponse(final String uid,
                     final SimulatorResult result,
                     final SimulatorResourceModel resourceModelN) {
-                System.out.println(result);
                 if (result != SimulatorResult.SIMULATOR_OK) {
                     Activator
                             .getDefault()
@@ -297,7 +320,8 @@ public class ResourceManager {
                                 resourceModelN);
                         if (null != resource) {
                             // Notify the UI listeners
-                            getCompleteNotification(resource);
+                            UiListenerHandler.getInstance()
+                                    .getCompleteNotification(resource);
                         }
                     }
                 });
@@ -330,7 +354,8 @@ public class ResourceManager {
                                 resourceModelN);
                         if (null != resource) {
                             // Notify the UI listeners
-                            putCompleteNotification(resource);
+                            UiListenerHandler.getInstance()
+                                    .putCompleteNotification(resource);
                         }
                     }
                 });
@@ -362,7 +387,8 @@ public class ResourceManager {
                                 resourceModelN);
                         if (null != resource) {
                             // Notify the UI listeners
-                            postCompleteNotification(resource);
+                            UiListenerHandler.getInstance()
+                                    .postCompleteNotification(resource);
                         }
                     }
                 });
@@ -383,7 +409,8 @@ public class ResourceManager {
                                 resourceModelN);
                         if (null != resource) {
                             // Notify the UI listeners
-                            observeCompleteNotification(resource);
+                            UiListenerHandler.getInstance()
+                                    .observeCompleteNotification(resource);
                         }
                     }
                 });
@@ -407,7 +434,9 @@ public class ResourceManager {
                         int autoType = resource.getAutomationtype(autoId);
 
                         // Notify the listeners.
-                        verificationStartedNotification(resource, autoType);
+                        UiListenerHandler.getInstance()
+                                .verificationStartedNotification(resource,
+                                        autoType);
                     }
                 });
             }
@@ -428,7 +457,9 @@ public class ResourceManager {
                         int autoType = resource.getAutomationtype(autoId);
 
                         // Notify the listeners.
-                        verificationCompletedNotification(resource, autoType);
+                        UiListenerHandler.getInstance()
+                                .verificationCompletedNotification(resource,
+                                        autoType);
                     }
                 });
             }
@@ -448,7 +479,9 @@ public class ResourceManager {
                         int autoType = resource.getAutomationtype(autoId);
 
                         // Notify the listeners.
-                        verificationAbortedNotification(resource, autoType);
+                        UiListenerHandler.getInstance()
+                                .verificationAbortedNotification(resource,
+                                        autoType);
                     }
                 });
             }
@@ -473,73 +506,38 @@ public class ResourceManager {
             return null;
         }
 
-        resource.setResourceModelRef(resourceModelN);
-        Map<String, RemoteResourceAttribute> attributeMap = fetchResourceAttributesFromModel(resourceModelN);
-        if (resource.isConfigUploaded()) {
-            updateResourceAttributesFromResponse(resource, attributeMap);
+        SimulatorResourceModel resourceModel = resource.getResourceModelRef();
+        if (null == resourceModel) {
+            resource.setResourceModelRef(resourceModelN);
         } else {
-            resource.setResourceAttributesMap(attributeMap);
-        }
-        // TODO: Printing the values for debugging
-        if (null != attributeMap) {
-            RemoteResourceAttribute.printAttributes(attributeMap);
+            resourceModel.update(resourceModelN);
         }
+
+        resource.setResourceRepresentation(resourceModelN, false);
+
         return resource;
     }
 
-    private void updateResourceAttributesFromResponse(RemoteResource res,
-            Map<String, RemoteResourceAttribute> newAttributeMap) {
-        if (null == res || null == newAttributeMap) {
-            return;
-        }
-        Map<String, RemoteResourceAttribute> oldAttributeMap = res
-                .getResourceAttributesMap();
-        if (null == oldAttributeMap) {
-            return;
-        }
-        Iterator<String> itr = oldAttributeMap.keySet().iterator();
-        String attName;
-        RemoteResourceAttribute newAtt;
-        RemoteResourceAttribute oldAtt;
-        while (itr.hasNext()) {
-            attName = itr.next();
-            newAtt = newAttributeMap.get(attName);
-            if (null == newAtt) {
-                // Attribute does not exist in the received model. Hence
-                // removing it from local model.
-                itr.remove();
-            } else {
-                oldAtt = oldAttributeMap.get(attName);
-                if (null != oldAtt) {
-                    oldAtt.setAttributeValue(newAtt.getAttributeValue());
-                } else {
-                    itr.remove();
-                }
-                newAttributeMap.remove(attName);
-            }
+    public synchronized boolean isDeviceInfoExist(String host) {
+        DeviceAndPlatformInfo info = hostDeviceAndPlatformMap.get(host);
+        if (null == info) {
+            return false;
         }
-        // Adding new attributes in the received model.
-        itr = newAttributeMap.keySet().iterator();
-        while (itr.hasNext()) {
-            attName = itr.next();
-            oldAttributeMap.put(attName, newAttributeMap.get(attName));
+        if (null == info.getDeviceInfo()) {
+            return false;
         }
+        return true;
     }
 
-    public synchronized DeviceInfo getDeviceInfo() {
-        return devInfo;
-    }
-
-    public synchronized void setDeviceInfo(DeviceInfo devInfo) {
-        this.devInfo = devInfo;
-    }
-
-    public synchronized PlatformInfo getPlatformInfo() {
-        return platInfo;
-    }
-
-    public synchronized void setPlatformInfo(PlatformInfo platInfo) {
-        this.platInfo = platInfo;
+    public synchronized boolean isPlatformInfoExist(String host) {
+        DeviceAndPlatformInfo info = hostDeviceAndPlatformMap.get(host);
+        if (null == info) {
+            return false;
+        }
+        if (null == info.getPlatformInfo()) {
+            return false;
+        }
+        return true;
     }
 
     private static class ResponseSynchronizerThread implements Runnable {
@@ -583,112 +581,6 @@ public class ResourceManager {
         }
     }
 
-    public void addResourceSelectionChangedUIListener(
-            IResourceSelectionChangedUIListener resourceSelectionChangedUIListener) {
-        synchronized (resourceSelectionChangedUIListeners) {
-            resourceSelectionChangedUIListeners
-                    .add(resourceSelectionChangedUIListener);
-        }
-    }
-
-    public void addGetUIListener(IGetUIListener getUIListener) {
-        synchronized (getUIListeners) {
-            getUIListeners.add(getUIListener);
-        }
-    }
-
-    public void addPutUIListener(IPutUIListener putUIListener) {
-        synchronized (putUIListeners) {
-            putUIListeners.add(putUIListener);
-        }
-    }
-
-    public void addPostUIListener(IPostUIListener postUIListener) {
-        synchronized (postUIListeners) {
-            postUIListeners.add(postUIListener);
-        }
-    }
-
-    public void addObserveUIListener(IObserveUIListener observeUIListener) {
-        synchronized (observeUIListeners) {
-            observeUIListeners.add(observeUIListener);
-        }
-    }
-
-    public void addVerificationUIListener(
-            IVerificationUIListener verificationUIListener) {
-        synchronized (verificationUIListeners) {
-            verificationUIListeners.add(verificationUIListener);
-        }
-    }
-
-    public void addConfigUploadUIListener(IConfigurationUpload configListener) {
-        synchronized (configUploadUIListeners) {
-            configUploadUIListeners.add(configListener);
-        }
-    }
-
-    public void addDevicePlatformInfoUIListener(
-            IDevicePlatformInfoUIListener deviceUIListener) {
-        synchronized (devicePlatformInfoUIListeners) {
-            devicePlatformInfoUIListeners.add(deviceUIListener);
-        }
-    }
-
-    public void removeDevicePlatformInfoUIListener(
-            IDevicePlatformInfoUIListener platformUIListener) {
-        synchronized (devicePlatformInfoUIListeners) {
-            devicePlatformInfoUIListeners.remove(platformUIListener);
-        }
-    }
-
-    public void removeResourceSelectionChangedUIListener(
-            IResourceSelectionChangedUIListener listener) {
-        synchronized (resourceSelectionChangedUIListeners) {
-            if (null != listener
-                    && resourceSelectionChangedUIListeners.size() > 0) {
-                resourceSelectionChangedUIListeners.remove(listener);
-            }
-        }
-    }
-
-    public void removeGetUIListener(IGetUIListener getUIListener) {
-        synchronized (getUIListeners) {
-            getUIListeners.remove(getUIListener);
-        }
-    }
-
-    public void removePutUIListener(IPutUIListener putUIListener) {
-        synchronized (putUIListeners) {
-            putUIListeners.remove(putUIListener);
-        }
-    }
-
-    public void removePostUIListener(IPostUIListener postUIListener) {
-        synchronized (postUIListeners) {
-            postUIListeners.remove(postUIListener);
-        }
-    }
-
-    public void removeObserveUIListener(IObserveUIListener observeUIListener) {
-        synchronized (observeUIListeners) {
-            observeUIListeners.remove(observeUIListener);
-        }
-    }
-
-    public void removeVerificationUIListener(
-            IVerificationUIListener verificationUIListener) {
-        synchronized (verificationUIListeners) {
-            verificationUIListeners.remove(verificationUIListener);
-        }
-    }
-
-    public void removeConfigUploadUIListener(IConfigurationUpload configListener) {
-        synchronized (configUploadUIListeners) {
-            configUploadUIListeners.remove(configListener);
-        }
-    }
-
     public void addResourcetoFavorites(RemoteResource resource) {
         if (null == resource) {
             return;
@@ -729,7 +621,8 @@ public class ResourceManager {
 
     public void addObservedResourceURI(String resourceURI) {
         synchronized (observedResourceURIList) {
-            observedResourceURIList.add(resourceURI);
+            if (!observedResourceURIList.contains(resourceURI))
+                observedResourceURIList.add(resourceURI);
         }
     }
 
@@ -765,24 +658,6 @@ public class ResourceManager {
         }
     }
 
-    public void addFindresourceUIListener(IFindResourceUIListener listener) {
-        if (null == listener) {
-            return;
-        }
-        synchronized (findResourceUIListeners) {
-            findResourceUIListeners.add(listener);
-        }
-    }
-
-    public void removeFindresourceUIListener(IFindResourceUIListener listener) {
-        if (null == listener) {
-            return;
-        }
-        synchronized (findResourceUIListeners) {
-            findResourceUIListeners.remove(listener);
-        }
-    }
-
     private boolean isUidExist(String uid) {
         boolean exist;
         synchronized (resourceMap) {
@@ -802,270 +677,6 @@ public class ResourceManager {
         return resource;
     }
 
-    private Map<String, RemoteResourceAttribute> fetchResourceAttributesFromModel(
-            SimulatorResourceModel resourceModelN) {
-        Map<String, RemoteResourceAttribute> resourceAttributeMap = null;
-        if (null != resourceModelN) {
-            Map<String, SimulatorResourceAttribute> attributeMapN;
-            attributeMapN = resourceModelN.getAttributes();
-            if (null != attributeMapN) {
-                resourceAttributeMap = new HashMap<String, RemoteResourceAttribute>();
-
-                Set<String> attNameSet = attributeMapN.keySet();
-                String attName;
-                Object attValueObj;
-                AttributeValue attValueN;
-                AttributeProperty attPropN;
-                TypeInfo typeInfo;
-                Type valuesType;
-                SimulatorResourceAttribute attributeN;
-                RemoteResourceAttribute attribute;
-                Iterator<String> attNameItr = attNameSet.iterator();
-                while (attNameItr.hasNext()) {
-                    attName = attNameItr.next();
-                    attributeN = attributeMapN.get(attName);
-                    if (null != attributeN) {
-                        attribute = new RemoteResourceAttribute();
-                        attribute.setResourceAttributeRef(attributeN);
-                        attribute.setAttributeName(attName);
-
-                        attValueN = attributeN.value();
-                        if (null != attValueN) {
-                            attValueObj = attValueN.get();
-                            if (null != attValueObj) {
-                                attribute.setAttributeValue(attValueObj);
-                            }
-
-                            // Set the attribute type
-                            typeInfo = attValueN.typeInfo();
-                            if (null != typeInfo) {
-                                attribute.setAttValBaseType(typeInfo.mBaseType);
-                                attribute.setAttValType(typeInfo.mType);
-                                attribute.setDepth(typeInfo.mDepth);
-                            }
-
-                        }
-
-                        // Set the range and allowed values
-                        attPropN = attributeN.property();
-                        valuesType = attPropN.type();
-                        attribute.setValuesType(valuesType);
-                        if (valuesType == Type.RANGE) {
-                            attribute.setMinValue(attPropN.min());
-                            attribute.setMaxValue(attPropN.max());
-                        } else if (valuesType == Type.VALUESET) {
-                            Object[] values = attPropN.valueSet();
-                            if (null != values && values.length > 0) {
-                                List<Object> valueList = new ArrayList<Object>();
-                                for (Object obj : values) {
-                                    valueList.add(((AttributeValue) obj).get());
-                                }
-                                attribute.setAllowedValues(valueList);
-                            }
-                        }
-                        resourceAttributeMap.put(attName, attribute);
-                    }
-                }
-            }
-        }
-        return resourceAttributeMap;
-    }
-
-    private void newResourceFoundNotification(RemoteResource resource) {
-        synchronized (findResourceUIListeners) {
-            if (findResourceUIListeners.size() > 0) {
-                IFindResourceUIListener listener;
-                Iterator<IFindResourceUIListener> listenerItr = findResourceUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onNewResourceFound(resource);
-                    }
-                }
-            }
-        }
-    }
-
-    private void resourceSelectionChangedUINotification(RemoteResource resource) {
-        synchronized (resourceSelectionChangedUIListeners) {
-            if (resourceSelectionChangedUIListeners.size() > 0) {
-                IResourceSelectionChangedUIListener listener;
-                Iterator<IResourceSelectionChangedUIListener> listenerItr = resourceSelectionChangedUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onResourceSelectionChange(resource);
-                    }
-                }
-            }
-        }
-    }
-
-    private void getCompleteNotification(RemoteResource resource) {
-        synchronized (getUIListeners) {
-            if (getUIListeners.size() > 0) {
-                IGetUIListener listener;
-                Iterator<IGetUIListener> listenerItr = getUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onGetCompleted(resource);
-                    }
-                }
-            }
-        }
-    }
-
-    private void putCompleteNotification(RemoteResource resource) {
-        synchronized (putUIListeners) {
-            if (putUIListeners.size() > 0) {
-                IPutUIListener listener;
-                Iterator<IPutUIListener> listenerItr = putUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onPutCompleted(resource);
-                    }
-                }
-            }
-        }
-    }
-
-    private void postCompleteNotification(RemoteResource resource) {
-        synchronized (postUIListeners) {
-            if (postUIListeners.size() > 0) {
-                IPostUIListener listener;
-                Iterator<IPostUIListener> listenerItr = postUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onPostCompleted(resource);
-                    }
-                }
-            }
-        }
-    }
-
-    private void observeCompleteNotification(RemoteResource resource) {
-        synchronized (observeUIListeners) {
-            if (observeUIListeners.size() > 0) {
-                IObserveUIListener listener;
-                Iterator<IObserveUIListener> listenerItr = observeUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onObserveCompleted(resource);
-                    }
-                }
-            }
-        }
-    }
-
-    private void verificationStartedNotification(RemoteResource resource,
-            int autoType) {
-        synchronized (verificationUIListeners) {
-            if (verificationUIListeners.size() > 0) {
-                IVerificationUIListener listener;
-                Iterator<IVerificationUIListener> listenerItr = verificationUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onVerificationStarted(resource, autoType);
-                    }
-                }
-            }
-        }
-    }
-
-    private void verificationAbortedNotification(RemoteResource resource,
-            int autoType) {
-        synchronized (verificationUIListeners) {
-            if (verificationUIListeners.size() > 0) {
-                IVerificationUIListener listener;
-                Iterator<IVerificationUIListener> listenerItr = verificationUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onVerificationAborted(resource, autoType);
-                    }
-                }
-            }
-        }
-    }
-
-    private void verificationCompletedNotification(RemoteResource resource,
-            int autoType) {
-        synchronized (verificationUIListeners) {
-            if (verificationUIListeners.size() > 0) {
-                IVerificationUIListener listener;
-                Iterator<IVerificationUIListener> listenerItr = verificationUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onVerificationCompleted(resource, autoType);
-                    }
-                }
-            }
-        }
-    }
-
-    private void configUploadedNotification(RemoteResource resource) {
-        synchronized (configUploadUIListeners) {
-            if (configUploadUIListeners.size() > 0) {
-                IConfigurationUpload listener;
-                Iterator<IConfigurationUpload> listenerItr = configUploadUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onConfigurationUploaded(resource);
-                    }
-                }
-            }
-        }
-    }
-
-    private void deviceInfoReceivedNotification() {
-        synchronized (devicePlatformInfoUIListeners) {
-            if (devicePlatformInfoUIListeners.size() > 0) {
-                IDevicePlatformInfoUIListener listener;
-                Iterator<IDevicePlatformInfoUIListener> listenerItr = devicePlatformInfoUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onDeviceInfoFound();
-                    }
-                }
-            }
-        }
-    }
-
-    private void platformInfoReceivedNotification() {
-        synchronized (devicePlatformInfoUIListeners) {
-            if (devicePlatformInfoUIListeners.size() > 0) {
-                IDevicePlatformInfoUIListener listener;
-                Iterator<IDevicePlatformInfoUIListener> listenerItr = devicePlatformInfoUIListeners
-                        .iterator();
-                while (listenerItr.hasNext()) {
-                    listener = listenerItr.next();
-                    if (null != listener) {
-                        listener.onPlatformInfoFound();
-                    }
-                }
-            }
-        }
-    }
-
     public synchronized Set<String> getLastKnownSearchTypes() {
         return lastKnownSearchTypes;
     }
@@ -1127,10 +738,14 @@ public class ResourceManager {
                         // Delete all cached details of resources
                         resourceMap.clear();
                         favoriteResources.clear();
+
+                        // Clearing the device and platform information
+                        hostDeviceAndPlatformMap.clear();
                     }
                     // Change the current resource in selection
                     setCurrentResourceInSelection(null);
-                    resourceSelectionChangedUINotification(null);
+                    UiListenerHandler.getInstance()
+                            .resourceSelectionChangedUINotification(null);
                 } else {
                     Iterator<String> typeItr = searchTypes.iterator();
                     String resType;
@@ -1165,7 +780,8 @@ public class ResourceManager {
             type = itr.next();
             if (searchTypes.contains(type)) {
                 setCurrentResourceInSelection(null);
-                resourceSelectionChangedUINotification(null);
+                UiListenerHandler.getInstance()
+                        .resourceSelectionChangedUINotification(null);
                 break;
             }
         }
@@ -1201,6 +817,11 @@ public class ResourceManager {
                         removeResourceFromFavorites(resource);
                         // Remove the resource
                         keyItr.remove();
+                        // Remove the device and platform information
+                        synchronized (hostDeviceAndPlatformMap) {
+                            hostDeviceAndPlatformMap.remove(resource
+                                    .getRemoteResourceRef().getHost());
+                        }
                     }
                 }
             }
@@ -1213,7 +834,8 @@ public class ResourceManager {
             public void run() {
                 setCurrentResourceInSelection(resource);
                 // Notify all observers for resource selection change event
-                resourceSelectionChangedUINotification(resource);
+                UiListenerHandler.getInstance()
+                        .resourceSelectionChangedUINotification(resource);
             }
         }.start();
     }
@@ -1238,18 +860,32 @@ public class ResourceManager {
                     propValue = Utility.getObservableInString(resource
                             .getRemoteResourceRef().isObservable());
                 } else if (propName.equals(Constants.RESOURCE_TYPES)) {
-                    Vector<String> types = resource.getRemoteResourceRef()
+                    Vector<String> resTypes = resource.getRemoteResourceRef()
                             .getResourceTypes();
-                    if (null != types) {
-                        propValue = types.toString();
+                    if (null != resTypes && !resTypes.isEmpty()) {
+                        propValue = "";
+                        Iterator<String> itr = resTypes.iterator();
+                        while (itr.hasNext()) {
+                            propValue += itr.next();
+                            if (itr.hasNext()) {
+                                propValue += ", ";
+                            }
+                        }
                     } else {
                         propValue = Constants.NOT_AVAILABLE;
                     }
                 } else if (propName.equals(Constants.RESOURCE_INTERFACES)) {
                     Vector<String> interfaces = resource.getRemoteResourceRef()
                             .getResourceInterfaces();
-                    if (null != interfaces) {
-                        propValue = interfaces.toString();
+                    if (null != interfaces && !interfaces.isEmpty()) {
+                        propValue = "";
+                        Iterator<String> itr = interfaces.iterator();
+                        while (itr.hasNext()) {
+                            propValue += itr.next();
+                            if (itr.hasNext()) {
+                                propValue += ", ";
+                            }
+                        }
                     } else {
                         propValue = Constants.NOT_AVAILABLE;
                     }
@@ -1267,80 +903,113 @@ public class ResourceManager {
     }
 
     public List<MetaProperty> getDeviceProperties() {
-        if (null == devInfo) {
+        if (null == currentResourceInSelection) {
+            return null;
+        }
+
+        SimulatorRemoteResource remoteResource = currentResourceInSelection
+                .getRemoteResourceRef();
+        if (null == remoteResource) {
+            return null;
+        }
+
+        String host = remoteResource.getHost();
+        if (null == host) {
+            return null;
+        }
+
+        if (!isDeviceInfoExist(host)) {
+            // Device Information
+            try {
+                SimulatorManager.findDevices(host, deviceListener);
+            } catch (SimulatorException e) {
+                Activator
+                        .getDefault()
+                        .getLogManager()
+                        .log(Level.ERROR.ordinal(), new Date(),
+                                Utility.getSimulatorErrorString(e, null));
+            }
             return null;
         }
 
         List<MetaProperty> metaProperties = new ArrayList<MetaProperty>();
+        synchronized (hostDeviceAndPlatformMap) {
+            DeviceInfo devInfo = hostDeviceAndPlatformMap.get(host)
+                    .getDeviceInfo();
+            metaProperties.add(new MetaProperty(Constants.DEVICE_ID, devInfo
+                    .getID()));
+            metaProperties.add(new MetaProperty(Constants.DEVICE_NAME, devInfo
+                    .getName()));
+            metaProperties.add(new MetaProperty(Constants.DEVICE_SPEC_VERSION,
+                    devInfo.getSpecVersion()));
+            metaProperties.add(new MetaProperty(Constants.DEVICE_DMV_VERSION,
+                    devInfo.getDataModelVersion()));
+        }
 
-        metaProperties.add(new MetaProperty(Constants.DEVICE_ID, devInfo
-                .getID()));
-        metaProperties.add(new MetaProperty(Constants.DEVICE_NAME, devInfo
-                .getName()));
-        metaProperties.add(new MetaProperty(Constants.DEVICE_SPEC_VERSION,
-                devInfo.getSpecVersion()));
-        metaProperties.add(new MetaProperty(Constants.DEVICE_DMV_VERSION,
-                devInfo.getDataModelVersion()));
-
-        /*
-         * metaProperties.add(new MetaProperty(Constants.DEVICE_ID, ""));
-         * metaProperties.add(new MetaProperty(Constants.DEVICE_NAME, ""));
-         * metaProperties.add(new MetaProperty(Constants.DEVICE_SPEC_VERSION,
-         * "")); metaProperties.add(new
-         * MetaProperty(Constants.DEVICE_DMV_VERSION, ""));
-         */
         return metaProperties;
     }
 
     public List<MetaProperty> getPlatformProperties() {
-        if (null == platInfo) {
+        if (null == currentResourceInSelection) {
             return null;
         }
 
-        List<MetaProperty> metaProperties = new ArrayList<MetaProperty>();
+        SimulatorRemoteResource remoteResource = currentResourceInSelection
+                .getRemoteResourceRef();
+        if (null == remoteResource) {
+            return null;
+        }
+
+        String host = remoteResource.getHost();
+        if (null == host) {
+            return null;
+        }
+
+        if (!isPlatformInfoExist(host)) {
+            // Platform Information
+            try {
+                SimulatorManager.getPlatformInformation(host, platformListener);
+            } catch (SimulatorException e) {
+                Activator
+                        .getDefault()
+                        .getLogManager()
+                        .log(Level.ERROR.ordinal(), new Date(),
+                                Utility.getSimulatorErrorString(e, null));
+            }
+            return null;
+        }
 
-        metaProperties.add(new MetaProperty(Constants.PLATFORM_ID, platInfo
-                .getPlatformID()));
-        metaProperties.add(new MetaProperty(Constants.PLATFORM_MANUFAC_NAME,
-                platInfo.getManufacturerName()));
-        metaProperties.add(new MetaProperty(Constants.PLATFORM_MANUFAC_URL,
-                platInfo.getManufacturerUrl()));
-        metaProperties.add(new MetaProperty(Constants.PLATFORM_MODEL_NO,
-                platInfo.getModelNumber()));
-        metaProperties.add(new MetaProperty(Constants.PLATFORM_DATE_OF_MANUFAC,
-                platInfo.getDateOfManufacture()));
-        metaProperties.add(new MetaProperty(Constants.PLATFORM_VERSION,
-                platInfo.getPlatformVersion()));
-        metaProperties.add(new MetaProperty(Constants.PLATFORM_OS_VERSION,
-                platInfo.getOperationSystemVersion()));
-        metaProperties.add(new MetaProperty(
-                Constants.PLATFORM_HARDWARE_VERSION, platInfo
-                        .getHardwareVersion()));
-        metaProperties.add(new MetaProperty(
-                Constants.PLATFORM_FIRMWARE_VERSION, platInfo
-                        .getFirmwareVersion()));
-        metaProperties.add(new MetaProperty(Constants.PLATFORM_SUPPORT_URL,
-                platInfo.getSupportUrl()));
-        metaProperties.add(new MetaProperty(Constants.PLATFORM_SYSTEM_TIME,
-                platInfo.getSystemTime()));
-
-        /*
-         * metaProperties.add(new MetaProperty(Constants.PLATFORM_ID, ""));
-         * metaProperties .add(new MetaProperty(Constants.PLATFORM_MANUFAC_NAME,
-         * "")); metaProperties .add(new
-         * MetaProperty(Constants.PLATFORM_MANUFAC_URL, ""));
-         * metaProperties.add(new MetaProperty(Constants.PLATFORM_MODEL_NO,
-         * "")); metaProperties.add(new
-         * MetaProperty(Constants.PLATFORM_DATE_OF_MANUFAC, ""));
-         * metaProperties.add(new MetaProperty(Constants.PLATFORM_VERSION, ""));
-         * metaProperties.add(new MetaProperty(Constants.PLATFORM_OS_VERSION,
-         * "")); metaProperties.add(new MetaProperty(
-         * Constants.PLATFORM_HARDWARE_VERSION, "")); metaProperties.add(new
-         * MetaProperty( Constants.PLATFORM_FIRMWARE_VERSION, ""));
-         * metaProperties .add(new MetaProperty(Constants.PLATFORM_SUPPORT_URL,
-         * "")); metaProperties .add(new
-         * MetaProperty(Constants.PLATFORM_SYSTEM_TIME, ""));
-         */
+        List<MetaProperty> metaProperties = new ArrayList<MetaProperty>();
+        synchronized (hostDeviceAndPlatformMap) {
+            PlatformInfo platInfo = hostDeviceAndPlatformMap.get(host)
+                    .getPlatformInfo();
+            metaProperties.add(new MetaProperty(Constants.PLATFORM_ID, platInfo
+                    .getPlatformID()));
+            metaProperties.add(new MetaProperty(
+                    Constants.PLATFORM_MANUFAC_NAME, platInfo
+                            .getManufacturerName()));
+            metaProperties.add(new MetaProperty(Constants.PLATFORM_MANUFAC_URL,
+                    platInfo.getManufacturerUrl()));
+            metaProperties.add(new MetaProperty(Constants.PLATFORM_MODEL_NO,
+                    platInfo.getModelNumber()));
+            metaProperties.add(new MetaProperty(
+                    Constants.PLATFORM_DATE_OF_MANUFAC, platInfo
+                            .getDateOfManufacture()));
+            metaProperties.add(new MetaProperty(Constants.PLATFORM_VERSION,
+                    platInfo.getPlatformVersion()));
+            metaProperties.add(new MetaProperty(Constants.PLATFORM_OS_VERSION,
+                    platInfo.getOperationSystemVersion()));
+            metaProperties.add(new MetaProperty(
+                    Constants.PLATFORM_HARDWARE_VERSION, platInfo
+                            .getHardwareVersion()));
+            metaProperties.add(new MetaProperty(
+                    Constants.PLATFORM_FIRMWARE_VERSION, platInfo
+                            .getFirmwareVersion()));
+            metaProperties.add(new MetaProperty(Constants.PLATFORM_SUPPORT_URL,
+                    platInfo.getSupportUrl()));
+            metaProperties.add(new MetaProperty(Constants.PLATFORM_SYSTEM_TIME,
+                    platInfo.getSystemTime()));
+        }
         return metaProperties;
     }
 
@@ -1401,14 +1070,132 @@ public class ResourceManager {
         return resourceList;
     }
 
-    public String getAttributeValue(RemoteResource res, String attName) {
-        if (null == res || null == attName) {
+    public List<String> getAllValuesOfAttribute(SimulatorResourceAttribute att) {
+        if (null == att) {
+            return null;
+        }
+
+        AttributeValue val = att.value();
+        if (null == val) {
+            return null;
+        }
+
+        List<String> values = new ArrayList<String>();
+
+        TypeInfo type = val.typeInfo();
+
+        AttributeProperty prop = att.property();
+        if (null == prop || prop.type().ordinal() == Type.UNKNOWN.ordinal()) {
+            values.add(Utility.getAttributeValueAsString(val));
+            return values;
+        }
+
+        Type valuesType = prop.type();
+
+        if (type.mType != ValueType.RESOURCEMODEL) {
+            if (type.mType == ValueType.ARRAY) {
+                if (type.mDepth == 1) {
+                    AttributeProperty childProp = prop.getChildProperty();
+                    if (null != childProp) {
+                        valuesType = childProp.type();
+                        if (valuesType.ordinal() == Type.RANGE.ordinal()) {
+                            List<String> list = getRangeForPrimitiveNonArrayAttributes(
+                                    childProp, type.mBaseType);
+                            if (null != list) {
+                                values.addAll(list);
+                            }
+                        } else if (valuesType.ordinal() == Type.VALUESET
+                                .ordinal()) {
+                            List<String> list = getAllowedValuesForPrimitiveNonArrayAttributes(
+                                    childProp.valueSet(), type.mBaseType);
+                            if (null != list) {
+                                values.addAll(list);
+                            }
+                        }
+                    }
+                }
+            } else {
+                if (valuesType.ordinal() == Type.RANGE.ordinal()) {
+                    List<String> list = getRangeForPrimitiveNonArrayAttributes(
+                            prop, type.mType);
+                    if (null != list) {
+                        values.addAll(list);
+                    }
+                } else if (valuesType.ordinal() == Type.VALUESET.ordinal()) {
+                    List<String> list = getAllowedValuesForPrimitiveNonArrayAttributes(
+                            prop.valueSet(), type.mType);
+                    if (null != list) {
+                        values.addAll(list);
+                    }
+                }
+            }
+        }
+
+        if (values.isEmpty()) {
+            values.add(Utility.getAttributeValueAsString(val));
+        }
+
+        return values;
+    }
+
+    public List<String> getRangeForPrimitiveNonArrayAttributes(
+            AttributeProperty prop, ValueType type) {
+        if (null == prop) {
+            return null;
+        }
+
+        if (type == ValueType.ARRAY || type == ValueType.RESOURCEMODEL) {
             return null;
         }
-        return res.getAttributeValue(attName);
+
+        List<String> values = new ArrayList<String>();
+        switch (type) {
+            case INTEGER:
+                int min = (int) prop.min();
+                int max = (int) prop.max();
+                for (int iVal = min; iVal <= max; iVal++) {
+                    values.add(String.valueOf(iVal));
+                }
+                break;
+            case DOUBLE:
+                double minD = (double) prop.min();
+                double maxD = (double) prop.max();
+                for (double iVal = minD; iVal <= maxD; iVal = iVal + 1.0) {
+                    values.add(String.valueOf(iVal));
+                }
+                break;
+            default:
+        }
+        return values;
     }
 
-    public void sendGetRequest(RemoteResource resource) {
+    public List<String> getAllowedValuesForPrimitiveNonArrayAttributes(
+            AttributeValue[] attValues, ValueType type) {
+        if (null == attValues || attValues.length < 1) {
+            return null;
+        }
+
+        if (type == ValueType.ARRAY || type == ValueType.RESOURCEMODEL) {
+            return null;
+        }
+
+        Object obj;
+        List<String> values = new ArrayList<String>();
+        for (AttributeValue val : attValues) {
+            if (null == val) {
+                continue;
+            }
+            obj = val.get();
+            if (null == obj) {
+                continue;
+            }
+            values.add(String.valueOf(obj));
+        }
+        return values;
+    }
+
+    public void sendGetRequest(String ifType, String query,
+            RemoteResource resource) {
         if (null == resource) {
             return;
         }
@@ -1416,8 +1203,10 @@ public class ResourceManager {
         if (null == resourceN) {
             return;
         }
+
+        Map<String, String> queryParams = formQueryParameters(ifType, query);
         try {
-            resourceN.get(null, getListener);
+            resourceN.get(queryParams, getListener);
         } catch (SimulatorException e) {
             Activator
                     .getDefault()
@@ -1427,24 +1216,18 @@ public class ResourceManager {
         }
     }
 
-    public void sendPutRequest(RemoteResource resource,
-            List<PutPostAttributeModel> putPostModelList) {
-        if (null == resource) {
+    public void sendPutRequest(String ifType, RemoteResource resource,
+            SimulatorResourceModel model) {
+        if (null == resource || null == model) {
             return;
         }
         SimulatorRemoteResource resourceN = resource.getRemoteResourceRef();
         if (null == resourceN) {
             return;
         }
-        Map<String, RemoteResourceAttribute> attMap = resource
-                .getResourceAttributesMap();
-        if (null == attMap || attMap.size() < 1) {
-            return;
-        }
+        Map<String, String> queryParams = formQueryParameters(ifType, null);
         try {
-            SimulatorResourceModel resourceModel = getUpdatedResourceModel(
-                    attMap, putPostModelList);
-            resourceN.put(null, resourceModel, putListener);
+            resourceN.put(queryParams, model, putListener);
         } catch (Exception e) {
             String addlInfo;
             addlInfo = "Invalid Attribute Value. Cannot send PUT request.";
@@ -1456,33 +1239,18 @@ public class ResourceManager {
         }
     }
 
-    public void sendPostRequest(RemoteResource resource,
-            List<PutPostAttributeModel> putPostModelList) {
-        if (null == resource) {
+    public void sendPostRequest(String ifType, RemoteResource resource,
+            SimulatorResourceModel model) {
+        if (null == resource || null == model) {
             return;
         }
         SimulatorRemoteResource resourceN = resource.getRemoteResourceRef();
         if (null == resourceN) {
             return;
         }
-        Map<String, RemoteResourceAttribute> attMap = resource
-                .getResourceAttributesMap();
-        if (null == attMap || attMap.size() < 1) {
-            return;
-        }
-        // Filter out the attributes whose modification status is true.
-        Iterator<PutPostAttributeModel> itr = putPostModelList.iterator();
-        PutPostAttributeModel model;
-        while (itr.hasNext()) {
-            model = itr.next();
-            if (!model.isModified()) {
-                itr.remove();
-            }
-        }
+        Map<String, String> queryParams = formQueryParameters(ifType, null);
         try {
-            SimulatorResourceModel resourceModel = getUpdatedResourceModel(
-                    attMap, putPostModelList);
-            resourceN.post(null, resourceModel, postListener);
+            resourceN.post(queryParams, model, postListener);
         } catch (Exception e) {
             String addlInfo;
             addlInfo = "Invalid Attribute Value. Cannot send POST request.";
@@ -1494,22 +1262,6 @@ public class ResourceManager {
         }
     }
 
-    private SimulatorResourceModel getUpdatedResourceModel(
-            Map<String, RemoteResourceAttribute> attMap,
-            List<PutPostAttributeModel> putPostModelList) throws Exception {
-        SimulatorResourceModel resourceModel = new SimulatorResourceModel();
-        for (PutPostAttributeModel putPostAttribute : putPostModelList)
-        {
-            String attributeName = putPostAttribute.getAttName();
-            RemoteResourceAttribute resourceAttribute = attMap.get(attributeName);
-            AttributeValue attributeValue = AttributeValueBuilder.build(
-                    putPostAttribute.getAttValue(), resourceAttribute.getAttValBaseType());
-            resourceModel.addAttribute(attributeName, attributeValue);
-        }
-
-        return resourceModel;
-    }
-
     public boolean sendObserveRequest(RemoteResource resource) {
         if (null == resource) {
             return false;
@@ -1535,6 +1287,35 @@ public class ResourceManager {
         return true;
     }
 
+    private Map<String, String> formQueryParameters(String ifType, String query) {
+        Map<String, String> queryParams = new HashMap<String, String>();
+
+        // Including the interface type, if given,
+        if (null != ifType) {
+            ifType = ifType.trim();
+            if (ifType.length() > 0)
+                queryParams.put("if", ifType);
+        }
+
+        // Including other queries, if given.
+        if (null != query) {
+            query = query.trim();
+            if (query.length() > 0) {
+                // Parse the query parameters and fill the map.
+                String queries[] = query.split(";");
+                if (queries.length > 0) {
+                    for (String pair : queries) {
+                        String tok[] = pair.split("=");
+                        if (null != tok && tok.length == 2) {
+                            queryParams.put(tok[0].trim(), tok[1].trim());
+                        }
+                    }
+                }
+            }
+        }
+        return queryParams;
+    }
+
     public boolean sendCancelObserveRequest(RemoteResource resource,
             boolean removeEntry) {
         if (null == resource || !resource.isObserved()) {
@@ -1580,16 +1361,21 @@ public class ResourceManager {
             autoId = resourceN.startVerification(reqType, verifyListener);
             if (autoId != -1) {
                 if (reqType == VerificationType.GET) {
-                    // resource.setGetAutomtnInProgress(true);
                     resource.setGetAutomtnId(autoId);
                 } else if (reqType == VerificationType.PUT) {
-                    // resource.setPutAutomtnInProgress(true);
                     resource.setPutAutomtnId(autoId);
-                } else {// if(reqType == Constants.POST_AUTOMATION_INDEX) {
-                    // resource.setPostAutomtnInProgress(true);
+                } else {
                     resource.setPostAutomtnId(autoId);
                 }
             }
+            Activator
+                    .getDefault()
+                    .getLogManager()
+                    .log(Level.INFO.ordinal(),
+                            new Date(),
+                            "[" + reqType.toString()
+                                    + "] Verification Started for \""
+                                    + resourceN.getURI() + "\".");
         } catch (SimulatorException e) {
             Activator
                     .getDefault()
@@ -1615,7 +1401,7 @@ public class ResourceManager {
         } else if (reqType == VerificationType.PUT) {
             resource.setPutAutomtnInProgress(false);
             autoId = resource.getPutAutomtnId();
-        } else {// if(reqType == Constants.POST_AUTOMATION_INDEX) {
+        } else {
             resource.setPostAutomtnInProgress(false);
             autoId = resource.getPostAutomtnId();
         }
@@ -1640,21 +1426,19 @@ public class ResourceManager {
             return false;
         }
         try {
-            SimulatorResourceModel resourceModel;
-            resourceModel = resourceN.setConfigInfo(configFilePath);
-            if (null == resourceModel) {
+            SimulatorResourceModel configuredResourceModel;
+            configuredResourceModel = resourceN.setConfigInfo(configFilePath);
+            if (null == configuredResourceModel) {
                 return false;
             }
+
             // Store the resource model in the local cache
-            resource.setResourceModelRef(resourceModel);
-
-            // Fetching the allowed values and range for all the attributes
-            Map<String, RemoteResourceAttribute> attributeMap = fetchResourceAttributesFromModel(resourceModel);
-            resource.setResourceAttributesMap(attributeMap);
-            // TODO: Printing the values for debugging
-            if (null != attributeMap) {
-                RemoteResourceAttribute.printAttributes(attributeMap);
+            SimulatorResourceModel resourceModel = resource
+                    .getResourceModelRef();
+            if (null != resourceModel) {
+                configuredResourceModel.update(resourceModel);
             }
+            resource.setResourceModelRef(configuredResourceModel);
         } catch (SimulatorException e) {
             Activator
                     .getDefault()
@@ -1667,7 +1451,7 @@ public class ResourceManager {
         resource.setConfigUploaded(true);
 
         // Notify the UI listeners
-        configUploadedNotification(resource);
+        UiListenerHandler.getInstance().configUploadedNotification(resource);
 
         return true;
     }