Integrated resource model related changes with eclipse plug-ins.
[platform/upstream/iotivity.git] / service / simulator / java / eclipse-plugin / ClientControllerPlugin / src / oic / simulator / clientcontroller / manager / ResourceManager.java
index 63b22c6..0b6b3a3 100644 (file)
@@ -29,29 +29,25 @@ 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.RemoteResource;
+import oic.simulator.clientcontroller.utils.AttributeValueStringConverter;
 import oic.simulator.clientcontroller.utils.Constants;
 import oic.simulator.clientcontroller.utils.Utility;
 
+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.IntegerProperty;
 import org.oic.simulator.PlatformInfo;
 import org.oic.simulator.PlatformListener;
 import org.oic.simulator.SimulatorException;
@@ -59,6 +55,7 @@ import org.oic.simulator.SimulatorManager;
 import org.oic.simulator.SimulatorResourceAttribute;
 import org.oic.simulator.SimulatorResourceModel;
 import org.oic.simulator.SimulatorResult;
+import org.oic.simulator.StringProperty;
 import org.oic.simulator.client.FindResourceListener;
 import org.oic.simulator.client.SimulatorRemoteResource;
 import org.oic.simulator.client.SimulatorRemoteResource.GetResponseListener;
@@ -77,43 +74,33 @@ 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 Map<String, DeviceAndPlatformInfo>        hostDeviceAndPlatformMap;
+    private Map<String, DeviceAndPlatformInfo> hostDeviceAndPlatformMap;
 
     public ResourceManager() {
         resourceMap = new HashMap<String, RemoteResource>();
@@ -122,16 +109,6 @@ public class ResourceManager {
         observedResourceURIList = new ArrayList<String>();
         hostDeviceAndPlatformMap = new HashMap<String, DeviceAndPlatformInfo>();
 
-        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>();
-
         findResourceListener = new FindResourceListener() {
 
             @Override
@@ -143,6 +120,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.
@@ -157,9 +142,6 @@ public class ResourceManager {
                             return;
                         }
 
-                        // Fetch the resource data
-                        // RemoteResource resource =
-                        // fetchResourceDetails(resourceN);
                         RemoteResource resource = new RemoteResource();
                         resource.setRemoteResourceRef(resourceN);
 
@@ -188,7 +170,8 @@ public class ResourceManager {
                         addResourceDetails(resource);
 
                         // Notify the UI listener
-                        newResourceFoundNotification(resource);
+                        UiListenerHandler.getInstance()
+                                .newResourceFoundNotification(resource);
 
                         Activator
                                 .getDefault()
@@ -199,9 +182,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()
@@ -250,7 +240,7 @@ public class ResourceManager {
             }
         };
 
-        // TODO: Listeners for device and platform information.
+        // Listeners for device and platform information.
         deviceListener = new DeviceListener() {
 
             @Override
@@ -274,7 +264,8 @@ public class ResourceManager {
                         }
 
                         // Notify UI listeners
-                        deviceInfoReceivedNotification();
+                        UiListenerHandler.getInstance()
+                                .deviceInfoReceivedNotification();
                     }
                 });
             }
@@ -303,7 +294,8 @@ public class ResourceManager {
                         }
 
                         // Notify UI listeners
-                        platformInfoReceivedNotification();
+                        UiListenerHandler.getInstance()
+                                .platformInfoReceivedNotification();
                     }
                 });
             }
@@ -314,7 +306,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()
@@ -335,7 +326,8 @@ public class ResourceManager {
                                 resourceModelN);
                         if (null != resource) {
                             // Notify the UI listeners
-                            getCompleteNotification(resource);
+                            UiListenerHandler.getInstance()
+                                    .getCompleteNotification(resource);
                         }
                     }
                 });
@@ -368,7 +360,8 @@ public class ResourceManager {
                                 resourceModelN);
                         if (null != resource) {
                             // Notify the UI listeners
-                            putCompleteNotification(resource);
+                            UiListenerHandler.getInstance()
+                                    .putCompleteNotification(resource);
                         }
                     }
                 });
@@ -400,7 +393,8 @@ public class ResourceManager {
                                 resourceModelN);
                         if (null != resource) {
                             // Notify the UI listeners
-                            postCompleteNotification(resource);
+                            UiListenerHandler.getInstance()
+                                    .postCompleteNotification(resource);
                         }
                     }
                 });
@@ -421,7 +415,8 @@ public class ResourceManager {
                                 resourceModelN);
                         if (null != resource) {
                             // Notify the UI listeners
-                            observeCompleteNotification(resource);
+                            UiListenerHandler.getInstance()
+                                    .observeCompleteNotification(resource);
                         }
                     }
                 });
@@ -445,7 +440,9 @@ public class ResourceManager {
                         int autoType = resource.getAutomationtype(autoId);
 
                         // Notify the listeners.
-                        verificationStartedNotification(resource, autoType);
+                        UiListenerHandler.getInstance()
+                                .verificationStartedNotification(resource,
+                                        autoType);
                     }
                 });
             }
@@ -466,7 +463,9 @@ public class ResourceManager {
                         int autoType = resource.getAutomationtype(autoId);
 
                         // Notify the listeners.
-                        verificationCompletedNotification(resource, autoType);
+                        UiListenerHandler.getInstance()
+                                .verificationCompletedNotification(resource,
+                                        autoType);
                     }
                 });
             }
@@ -486,7 +485,9 @@ public class ResourceManager {
                         int autoType = resource.getAutomationtype(autoId);
 
                         // Notify the listeners.
-                        verificationAbortedNotification(resource, autoType);
+                        UiListenerHandler.getInstance()
+                                .verificationAbortedNotification(resource,
+                                        autoType);
                     }
                 });
             }
@@ -511,15 +512,7 @@ public class ResourceManager {
             return null;
         }
 
-        // if(!resource.isConfigUploaded() || null ==
-        // resource.getResourceModelRef())
-        SimulatorResourceModel resourceModel = resource.getResourceModelRef();
-        if (null == resourceModel) {
-            resource.setResourceModelRef(resourceModelN);
-        } else {
-            resourceModel.update(resourceModelN);
-        }
-
+        resource.setResourceModelRef(resourceModelN);
         resource.setResourceRepresentation(resourceModelN, false);
 
         return resource;
@@ -588,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;
@@ -771,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) {
@@ -808,201 +677,6 @@ public class ResourceManager {
         return resource;
     }
 
-    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;
     }
@@ -1070,7 +744,8 @@ public class ResourceManager {
                     }
                     // Change the current resource in selection
                     setCurrentResourceInSelection(null);
-                    resourceSelectionChangedUINotification(null);
+                    UiListenerHandler.getInstance()
+                            .resourceSelectionChangedUINotification(null);
                 } else {
                     Iterator<String> typeItr = searchTypes.iterator();
                     String resType;
@@ -1105,7 +780,8 @@ public class ResourceManager {
             type = itr.next();
             if (searchTypes.contains(type)) {
                 setCurrentResourceInSelection(null);
-                resourceSelectionChangedUINotification(null);
+                UiListenerHandler.getInstance()
+                        .resourceSelectionChangedUINotification(null);
                 break;
             }
         }
@@ -1158,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();
     }
@@ -1183,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;
                     }
@@ -1255,13 +946,6 @@ public class ResourceManager {
                     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;
     }
 
@@ -1326,23 +1010,6 @@ public class ResourceManager {
             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, ""));
-         */
         return metaProperties;
     }
 
@@ -1409,130 +1076,168 @@ public class ResourceManager {
         }
 
         AttributeValue val = att.value();
-        if (null == val) {
+        if (null == val || null == val.get()) {
             return null;
         }
 
-        List<String> values = new ArrayList<String>();
-
         TypeInfo type = val.typeInfo();
 
+        if (type.mType == ValueType.RESOURCEMODEL
+                || type.mBaseType == ValueType.RESOURCEMODEL) {
+            return null;
+        }
+
+        List<String> values = new ArrayList<String>();
+
         AttributeProperty prop = att.property();
-        if (null == prop || prop.type().ordinal() == Type.UNKNOWN.ordinal()) {
-            values.add(Utility.getAttributeValueAsString(val));
+        if (null == prop) {
+            values.add(new AttributeValueStringConverter(val).toString());
             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);
+        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(intProperty,
+                                        Type.INTEGER));
                             }
-                        } else if (valuesType.ordinal() == Type.VALUESET
-                                .ordinal()) {
-                            List<String> list = getAllowedValuesForPrimitiveNonArrayAttributes(
-                                    childProp.valueSet(), type.mBaseType);
-                            if (null != list) {
-                                values.addAll(list);
+                            break;
+                        case DOUBLE:
+                            DoubleProperty dblProperty = childProp.asDouble();
+                            if (null != dblProperty) {
+                                values.addAll(getAllValues(dblProperty,
+                                        Type.DOUBLE));
                             }
-                        }
+                            break;
+                        case BOOLEAN:
+                            BooleanProperty boolProperty = childProp
+                                    .asBoolean();
+                            if (null != boolProperty) {
+                                values.addAll(getAllValues(boolProperty,
+                                        Type.BOOLEAN));
+                            }
+                            break;
+                        case STRING:
+                            StringProperty stringProperty = childProp
+                                    .asString();
+                            if (null != stringProperty) {
+                                values.addAll(getAllValues(stringProperty,
+                                        Type.STRING));
+                            }
+                            break;
+                        default:
+                            break;
                     }
                 }
-            } else {
-                if (valuesType.ordinal() == Type.RANGE.ordinal()) {
-                    List<String> list = getRangeForPrimitiveNonArrayAttributes(
-                            prop, type.mType);
-                    if (null != list) {
-                        values.addAll(list);
+            }
+        } else {
+            switch (prop.getType()) {
+                case INTEGER:
+                    IntegerProperty intProperty = prop.asInteger();
+                    if (null != intProperty) {
+                        values.addAll(getAllValues(intProperty, Type.INTEGER));
                     }
-                } else if (valuesType.ordinal() == Type.VALUESET.ordinal()) {
-                    List<String> list = getAllowedValuesForPrimitiveNonArrayAttributes(
-                            prop.valueSet(), type.mType);
-                    if (null != list) {
-                        values.addAll(list);
+                    break;
+                case DOUBLE:
+                    DoubleProperty dblProperty = prop.asDouble();
+                    if (null != dblProperty) {
+                        values.addAll(getAllValues(dblProperty, Type.DOUBLE));
                     }
-                }
+                    break;
+                case BOOLEAN:
+                    BooleanProperty boolProperty = prop.asBoolean();
+                    if (null != boolProperty) {
+                        values.addAll(getAllValues(boolProperty, Type.BOOLEAN));
+                    }
+                    break;
+                case STRING:
+                    StringProperty stringProperty = prop.asString();
+                    if (null != stringProperty) {
+                        values.addAll(getAllValues(stringProperty, Type.STRING));
+                    }
+                    break;
+                default:
+                    break;
             }
         }
 
-        if (values.isEmpty()) {
-            values.add(Utility.getAttributeValueAsString(val));
-        }
-
         return values;
     }
 
-    public List<String> getRangeForPrimitiveNonArrayAttributes(
-            AttributeProperty prop, ValueType type) {
-        if (null == prop) {
-            return null;
-        }
+    public List<String> getAllValues(IntegerProperty intProperty,
+            AttributeProperty.Type type) {
+        List<String> values = new ArrayList<String>();
 
-        if (type == ValueType.ARRAY || type == ValueType.RESOURCEMODEL) {
-            return null;
+        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 {
+            // Adding the default value.
+            values.add(String.valueOf(intProperty.getDefaultValue()));
         }
+        return values;
+    }
 
+    public List<String> getAllValues(DoubleProperty dblProperty,
+            AttributeProperty.Type type) {
         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:
+
+        if (dblProperty.hasRange()) {
+            double min = (double) dblProperty.min();
+            double max = (double) dblProperty.max();
+            for (double iVal = min; iVal <= max; iVal = iVal + 1) {
+                values.add(String.valueOf(iVal));
+            }
+        } else if (dblProperty.hasValues()) {
+            for (Double val : dblProperty.getValues()) {
+                values.add(String.valueOf(val));
+            }
+        } else {
+            // Adding the default value.
+            values.add(String.valueOf(dblProperty.getDefaultValue()));
         }
         return values;
     }
 
-    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;
-        }
+    public List<String> getAllValues(BooleanProperty boolProperty,
+            AttributeProperty.Type type) {
+        List<String> values = new ArrayList<String>();
+        values.add("true");
+        values.add("false");
+        return values;
+    }
 
-        Object obj;
+    public List<String> getAllValues(StringProperty stringProperty,
+            AttributeProperty.Type type) {
         List<String> values = new ArrayList<String>();
-        for (AttributeValue val : attValues) {
-            if (null == val) {
-                continue;
-            }
-            obj = val.get();
-            if (null == obj) {
-                continue;
+
+        if (stringProperty.hasValues()) {
+            for (String val : stringProperty.getValues()) {
+                values.add(String.valueOf(val));
             }
-            values.add(String.valueOf(obj));
+        } else {
+            // Adding the default value.
+            values.add(String.valueOf(stringProperty.getDefaultValue()));
         }
         return values;
     }
 
-    /*
-     * public String getAttributeValue(RemoteResource res, String attName) { if
-     * (null == res || null == attName) { return null; } return
-     * res.getAttributeValue(attName); }
-     */
-    public void sendGetRequest(RemoteResource resource) {
+    public void sendGetRequest(String ifType, String query,
+            RemoteResource resource) {
         if (null == resource) {
             return;
         }
@@ -1540,8 +1245,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()
@@ -1551,7 +1258,7 @@ public class ResourceManager {
         }
     }
 
-    public void sendPutRequest(RemoteResource resource,
+    public void sendPutRequest(String ifType, RemoteResource resource,
             SimulatorResourceModel model) {
         if (null == resource || null == model) {
             return;
@@ -1560,8 +1267,9 @@ public class ResourceManager {
         if (null == resourceN) {
             return;
         }
+        Map<String, String> queryParams = formQueryParameters(ifType, null);
         try {
-            resourceN.put(null, model, putListener);
+            resourceN.put(queryParams, model, putListener);
         } catch (Exception e) {
             String addlInfo;
             addlInfo = "Invalid Attribute Value. Cannot send PUT request.";
@@ -1573,7 +1281,7 @@ public class ResourceManager {
         }
     }
 
-    public void sendPostRequest(RemoteResource resource,
+    public void sendPostRequest(String ifType, RemoteResource resource,
             SimulatorResourceModel model) {
         if (null == resource || null == model) {
             return;
@@ -1582,8 +1290,9 @@ public class ResourceManager {
         if (null == resourceN) {
             return;
         }
+        Map<String, String> queryParams = formQueryParameters(ifType, null);
         try {
-            resourceN.post(null, model, postListener);
+            resourceN.post(queryParams, model, postListener);
         } catch (Exception e) {
             String addlInfo;
             addlInfo = "Invalid Attribute Value. Cannot send POST request.";
@@ -1604,7 +1313,7 @@ public class ResourceManager {
             return false;
         }
         try {
-            resourceN.startObserve(null, observeListener);
+            resourceN.observe(observeListener);
             resource.setObserved(true);
             // Add observed resource URI to show the proper status after every
             // find/refresh operations.
@@ -1620,6 +1329,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()) {
@@ -1665,16 +1403,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()
@@ -1700,7 +1443,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();
         }
@@ -1732,12 +1475,12 @@ public class ResourceManager {
             }
 
             // Store the resource model in the local cache
-            SimulatorResourceModel resourceModel = resource
-                    .getResourceModelRef();
-            if (null != resourceModel) {
-                configuredResourceModel.update(resourceModel);
-            }
-            resource.setResourceModelRef(configuredResourceModel);
+            /*
+             * SimulatorResourceModel resourceModel = resource
+             * .getResourceModelRef(); if (null != resourceModel) {
+             * configuredResourceModel.update(resourceModel); }
+             * resource.setResourceModelRef(configuredResourceModel);
+             */
         } catch (SimulatorException e) {
             Activator
                     .getDefault()
@@ -1750,7 +1493,7 @@ public class ResourceManager {
         resource.setConfigUploaded(true);
 
         // Notify the UI listeners
-        configUploadedNotification(resource);
+        UiListenerHandler.getInstance().configUploadedNotification(resource);
 
         return true;
     }