Fix attributes filtering : defines admin service 's resources as observed

Fix/Improve ModelInstanceRegistration filters definition
diff --git a/platform/northbound/attributes-filtering/attributes-filter/src/test/java/org/eclipse/sensinact/gateway/nthbnd/filter/attributes/test/TestAttributesFiltering.java b/platform/northbound/attributes-filtering/attributes-filter/src/test/java/org/eclipse/sensinact/gateway/nthbnd/filter/attributes/test/TestAttributesFiltering.java
index e748ab3..671e78b 100644
--- a/platform/northbound/attributes-filtering/attributes-filter/src/test/java/org/eclipse/sensinact/gateway/nthbnd/filter/attributes/test/TestAttributesFiltering.java
+++ b/platform/northbound/attributes-filtering/attributes-filter/src/test/java/org/eclipse/sensinact/gateway/nthbnd/filter/attributes/test/TestAttributesFiltering.java
@@ -10,11 +10,6 @@
  */
 package org.eclipse.sensinact.gateway.nthbnd.filter.attributes.test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
 import java.util.Map;
 
 import org.eclipse.sensinact.gateway.common.bundle.Mediator;
@@ -123,9 +118,30 @@
         + "[{\"name\":\"position\",\"type\":\"SENSOR\"}]" 
         + "}]" 
         + ",\"location\":\"45.2:5.7\""
-        + ",\"friendlyName\":\"slider\"}]}");
+        + ",\"friendlyName\":null}]}");
         JSONAssert.assertEquals(expected, new JSONObject(response), false);
+        
+        HttpServiceTestClient.newRequest(mediator, HTTP_ROOTURL + "/sensinact/slider/admin/friendlyName/SET",
+        "[{\"name\":\"attributeName\",\"type\":\"string\",\"value\":\"value\"},{\"name\":\"value\",\"type\":\"string\",\"value\":\"mySlider\"}]", "POST");
 
+        Thread.sleep(2000);
+        response = HttpServiceTestClient.newRequest(mediator, HTTP_ROOTURL + "/sensinact?attrs=[friendlyName]", null, "GET");
+        
+        result = new JSONObject(response);
+        expected = new JSONObject(
+        "{\"filters\":[{\"definition\":\"[friendlyName]\",\"type\":\"attrs\"}]," 
+        + "\"providers\":" + "[{\"name\":\"slider\",\"services\":[{\"name\":\"admin\"," 
+        + "\"resources\":" + "[{\"name\":\"friendlyName\",\"type\":\"PROPERTY\"}," 
+        + "{\"name\":\"location\",\"type\":\"PROPERTY\"}," 
+        + "{\"name\":\"bridge\",\"type\":\"PROPERTY\"}," 
+        + "{\"name\":\"icon\",\"type\":\"PROPERTY\"}]}," 
+        + "{\"name\":\"cursor\",\"resources\":" 
+        + "[{\"name\":\"position\",\"type\":\"SENSOR\"}]" 
+        + "}]" 
+        + ",\"location\":\"45.2:5.7\""
+        + ",\"friendlyName\":\"mySlider\"}]}");
+        JSONAssert.assertEquals(expected, new JSONObject(response), false);
+        
         response = HttpServiceTestClient.newRequest(mediator, HTTP_ROOTURL + "/sensinact?attrs={friendlyName,icon}", null, "GET");
         result = new JSONObject(response);
         expected = new JSONObject(
@@ -140,7 +156,7 @@
         + "}]" 
         + ",\"location\":\"45.2:5.7\""
         + ",\"icon\":null"
-        + ",\"friendlyName\":\"slider\"}]}");
+        + ",\"friendlyName\":\"mySlider\"}]}");
         JSONAssert.assertEquals(expected, result, false);
 
         response = HttpServiceTestClient.newRequest(mediator, HTTP_ROOTURL + "/sensinact?attrs=friendlyName,icon,bridge", null, "GET");
@@ -156,7 +172,7 @@
         + "[{\"name\":\"position\",\"type\":\"SENSOR\"}]" 
         + "}]" 
         + ",\"location\":\"45.2:5.7\""
-        + ",\"friendlyName\":\"slider\""
+        + ",\"friendlyName\":\"mySlider\""
         + ",\"icon\":null"
         + ",\"bridge\":\"slider\"}]}");
         JSONAssert.assertEquals(expected, result, false);
@@ -180,7 +196,27 @@
         + "[{\"name\":\"position\",\"type\":\"SENSOR\"}]" 
         + "}]" 
         + ",\"location\":\"45.2:5.7\""
-        + ",\"friendlyName\":\"slider\"}]}");
+        + ",\"friendlyName\":null}]}");
+        JSONAssert.assertEquals(expected, result, false);
+
+        this.synchronizedRequest(client, "/sensinact/slider/admin/friendlyName/SET", "[{\"name\":\"attributeName\",\"type\":\"string\",\"value\":\"value\"},{\"name\":\"value\",\"type\":\"string\",\"value\":\"mySlider\"}]");
+
+        Thread.sleep(2000);
+
+        response = this.synchronizedRequest(client, "/sensinact", "[{\"name\":\"attrs\",\"type\":\"string\",\"value\":\"[friendlyName]\"}]");
+        result = new JSONObject(response);
+        expected = new JSONObject(
+        "{\"filters\":[{\"definition\":\"[friendlyName]\",\"type\":\"attrs\"}]," 
+        + "\"providers\":" + "[{\"name\":\"slider\",\"services\":[{\"name\":\"admin\"," 
+        + "\"resources\":" + "[{\"name\":\"friendlyName\",\"type\":\"PROPERTY\"}," 
+        + "{\"name\":\"location\",\"type\":\"PROPERTY\"}," 
+        + "{\"name\":\"bridge\",\"type\":\"PROPERTY\"}," 
+        + "{\"name\":\"icon\",\"type\":\"PROPERTY\"}]}," 
+        + "{\"name\":\"cursor\",\"resources\":" 
+        + "[{\"name\":\"position\",\"type\":\"SENSOR\"}]" 
+        + "}]" 
+        + ",\"location\":\"45.2:5.7\""
+        + ",\"friendlyName\":\"mySlider\"}]}");
         JSONAssert.assertEquals(expected, result, false);
 
         response = this.synchronizedRequest(client, "/sensinact", "[{\"name\":\"attrs\",\"type\":\"string\",\"value\":\"{friendlyName,icon}\"}]");
@@ -197,7 +233,7 @@
         + "}]" 
         + ",\"location\":\"45.2:5.7\""
         + ",\"icon\":null"
-        + ",\"friendlyName\":\"slider\"}]}");
+        + ",\"friendlyName\":\"mySlider\"}]}");
         JSONAssert.assertEquals(expected, result, false);
 
         response = this.synchronizedRequest(client, "/sensinact", "[{\"name\":\"attrs\",\"type\":\"string\",\"value\":\"friendlyName,icon,bridge\"}]");
@@ -213,7 +249,7 @@
         + "[{\"name\":\"position\",\"type\":\"SENSOR\"}]" 
         + "}]" 
         + ",\"location\":\"45.2:5.7\""
-        + ",\"friendlyName\":\"slider\""
+        + ",\"friendlyName\":\"mySlider\""
         + ",\"icon\":null"
         + ",\"bridge\":\"slider\"}]}");
         JSONAssert.assertEquals(expected, result, false);
diff --git a/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/ModelConfiguration.java b/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/ModelConfiguration.java
index d62e462..2b00bb0 100644
--- a/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/ModelConfiguration.java
+++ b/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/ModelConfiguration.java
@@ -244,23 +244,15 @@
 		return this.accessTree;
 	}
 
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration#setDefaultResourceType(java.lang.Class)
-	 */
+	@Override
 	public ModelConfiguration setDefaultResourceType(Class<? extends Resource> defaultResourceType) {
 		if (this.defaultResourceConfigBuilder != null) {
 			this.defaultResourceConfigBuilder.setDefaultResourceType(defaultResourceType);
 		}
 		return this;
 	}
-
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration# setDefaultDataType(java.lang.Class)
-	 */
+	
+	@Override
 	public ModelConfiguration setDefaultDataType(Class<?> defaultDataType) {
 		if (this.defaultResourceConfigBuilder != null) {
 			this.defaultResourceConfigBuilder.setDefaultDataType(defaultDataType);
@@ -268,11 +260,7 @@
 		return this;
 	}
 
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration# setDefaultModifiable(Modifiable)
-	 */
+	@Override
 	public ModelConfiguration setDefaultModifiable(Modifiable defaultModifiable) {
 		if (this.defaultResourceConfigBuilder != null) {
 			this.defaultResourceConfigBuilder.setDefaultModifiable(defaultModifiable);
@@ -280,12 +268,7 @@
 		return this;
 	}
 
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration#
-	 *      setDefaultUpdatePolicy(Resource.UpdatePolicy)
-	 */
+	@Override
 	public ModelConfiguration setDefaultUpdatePolicy(Resource.UpdatePolicy defaultUpdatePolicy) {
 		if (this.defaultResourceConfigBuilder != null) {
 			this.defaultResourceConfigBuilder.setDefaultUpdatePolicy(defaultUpdatePolicy);
@@ -293,23 +276,12 @@
 		return this;
 	}
 
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration#
-	 *      setProviderImplementationType(java.lang.Class)
-	 */
 	@Override
 	public ModelConfiguration setProviderImplementationType(Class<? extends ServiceProviderImpl> serviceProviderType) {
 		this.serviceProviderType = serviceProviderType;
 		return this;
 	}
 
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration# getProviderImplementationType()
-	 */
 	@Override
 	public Class<? extends ServiceProviderImpl> getProviderImplementationType() {
 		if (this.serviceProviderType == null) {
@@ -318,23 +290,12 @@
 		return this.serviceProviderType;
 	}
 
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration#
-	 *      setServiceImplmentationType(java.lang.Class)
-	 */
 	@Override
 	public ModelConfiguration setServiceImplmentationType(Class<? extends ServiceImpl> serviceType) {
 		this.serviceType = serviceType;
 		return this;
 	}
 
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration# getServiceImplementationType()
-	 */
 	@Override
 	public Class<? extends ServiceImpl> getServiceImplementationType() {
 		if (this.serviceType == null) {
@@ -343,23 +304,12 @@
 		return this.serviceType;
 	}
 
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration#
-	 *      setResourceImplementationType(java.lang.Class)
-	 */
 	@Override
 	public ModelConfiguration setResourceImplementationType(Class<? extends ResourceImpl> resourceType) {
 		this.resourceType = resourceType;
 		return this;
 	}
 
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration# getResourceImplementationType()
-	 */
 	@Override
 	public Class<? extends ResourceImpl> getResourceImplementationType() {
 		if (this.resourceType == null) {
@@ -557,55 +507,28 @@
 		}
 	}
 
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration#
-	 *      setResourceBuildPolicy(SensiNactResourceModelConfiguration.BuildPolicy)
-	 */
 	@Override
 	public ModelConfiguration setResourceBuildPolicy(byte buildPolicy) {
 		this.resourceBuildPolicy = buildPolicy;
 		return this;
 	}
 
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration# getResourceBuildPolicy()
-	 */
 	@Override
 	public byte getResourceBuildPolicy() {
 		return this.resourceBuildPolicy;
 	}
 
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration#
-	 *      setServiceBuildPolicy(SensiNactResourceModelConfiguration.BuildPolicy)
-	 */
 	@Override
 	public ModelConfiguration setServiceBuildPolicy(byte buildPolicy) {
 		this.serviceBuildPolicy = buildPolicy;
 		return this;
 	}
 
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration# getServiceBuildPolicy()
-	 */
 	@Override
 	public byte getServiceBuildPolicy() {
 		return this.serviceBuildPolicy;
 	}
 
-	/**
-	 * @inheritDoc
-	 *
-	 * @see SensiNactResourceModelConfiguration# getStartAtInitializationTime()
-	 */
 	@Override
 	public boolean getStartAtInitializationTime() {
 		return this.startAtInitializationTime;
diff --git a/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/ModelInstance.java b/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/ModelInstance.java
index 2935903..e88ed72 100644
--- a/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/ModelInstance.java
+++ b/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/ModelInstance.java
@@ -12,6 +12,8 @@
 

 import java.security.AccessController;

 import java.security.PrivilegedAction;

+import java.util.ArrayList;

+import java.util.Arrays;

 import java.util.Collection;

 import java.util.Dictionary;

 import java.util.Hashtable;

@@ -43,6 +45,11 @@
  */

 public class ModelInstance<C extends ModelConfiguration> implements SensiNactResourceModel<C>, LifecycleStatusListener {

 

+	public static final String LOCATION_PROPERTY = "admin.".concat(LocationResource.LOCATION);

+	public static final String ICON_PROPERTY = "admin.".concat(ServiceProvider.ICON);

+	public static final String BRIDGE_PROPERTY = "admin.".concat(ServiceProvider.BRIDGE);

+	public static final String FRIENDLY_NAME_PROPERTY = "admin.".concat(ServiceProvider.FRIENDLY_NAME);

+	

 	/**

 	 * Returns the initial location of the sensiNact gateway and so of the service

 	 * providers for which it is not specified. This method should be called once at

@@ -123,13 +130,10 @@
 	/**

 	 * Constructor

 	 * 

-	 * @param mediator

-	 *            the {@link Mediator} allowing to interact with the OSGi host

-	 *            environment

-	 * @param configuration

-	 *            the extended {@link ModelConfiguration} gathering the

-	 *            configuration properties applying on the ModelInstance to be

-	 *            created

+	 * @param mediator the {@link Mediator} allowing to interact with the OSGi 

+	 * host  environment

+	 * @param configuration the extended {@link ModelConfiguration} gathering 

+	 * the configuration properties applying on the ModelInstance to be created

 	 * 

 	 * @throws InvalidServiceProviderException

 	 */

@@ -390,11 +394,24 @@
 			this.registration = new ModelInstanceRegistration(uri, observed, instanceRegistration, this.configuration);

 			this.messageRouter = new SnaMessageListener(mediator, this.configuration());

 			

-			boolean pattern = false;

-

-			StringBuilder observedBuilder = new StringBuilder().append(uri);

+			StringBuilder observedBuilder  = Arrays.asList(

+				LOCATION_PROPERTY, ICON_PROPERTY, FRIENDLY_NAME_PROPERTY, BRIDGE_PROPERTY

+			    ).stream().<StringBuilder>collect(

+						() -> {return new StringBuilder();},

+						(sb,p) -> {							    

+							    if(sb.length()==0) {

+							    	sb.append(uri.replace("/","\\/"));

+							    	sb.append("(");

+							    }else

+									sb.append("|");

+						    	sb.append("(");

+								sb.append("\\/");

+								sb.append(p.concat("(.value)?").replace(".","\\/"));

+						    	sb.append(")");

+					},

+					(sb1,sb2)->{sb1.append(sb2.toString());});

+			

 			if (observed != null && !observed.isEmpty()) {

-				observedBuilder.append("(/admin/location/value");

 				Iterator<String> it = observed.iterator();

 				while (it.hasNext()) {

 					String obs = null;

@@ -404,28 +421,26 @@
 					case 1:

 						continue;

 					case 2:

-						obs = UriUtils.getUri(uriElements).concat("/value");

+						obs = UriUtils.getUri(uriElements).concat("(/value)?");

 						break;

 					case 3:

-						obs = UriUtils.getUri(uriElements);

+						obs = UriUtils.getUri(uriElements).replace("/value","(/value)?");

 						break;

 					default:

 						continue;

 					}

-					observedBuilder.append("|");

-					observedBuilder.append(obs);

+					observedBuilder.append("|(");

+					observedBuilder.append(obs.replace("/","\\/"));

+					observedBuilder.append(")");

 				}

-				observedBuilder.append(")");

-				pattern = true;

-			} else {

-				observedBuilder.append("/admin/location/value");

 			}

-			SnaFilter filter = new SnaFilter(mediator, observedBuilder.toString(), pattern, false);

+			observedBuilder.append(")");

 

+			SnaFilter filter = new SnaFilter(mediator, observedBuilder.toString(), true, false);

 			filter.addHandledType(SnaMessage.Type.UPDATE);

 			this.messageRouter.addCallback(filter, registration);

-

-			filter = new SnaFilter(mediator, "(/[^/]+)+", true, false);

+			

+			filter = new SnaFilter(mediator, uri.replace("/","\\/").concat("(\\/[^\\/]+)*"), true, false);

 			filter.addHandledType(SnaMessage.Type.LIFECYCLE);

 			this.messageRouter.addCallback(filter, registration);

 

@@ -544,14 +559,12 @@
 	 * {@link AccessMethod.Type}s for the {@link AccessLevelOption} passed as

 	 * parameter and

 	 * 

-	 * @param modelElement

-	 *            the {@link ModelElement} for which to retrieve the set of

-	 *            accessible {@link AccessMethod.Type}s

-	 * @param accessLevelOption

-	 *            the requirer {@link AccessLevelOption}

+	 * @param modelElement  the {@link ModelElement} for which to retrieve the 

+	 * set of accessible {@link AccessMethod.Type}s

+	 * @param accessLevelOption the requirer {@link AccessLevelOption}

 	 * 

 	 * @return the set of accessible {@link AccessMethod.Type} of the specified

-	 *         {@link ModelElement} for the specified {@link AccessLevelOption}

+	 *  {@link ModelElement} for the specified {@link AccessLevelOption}

 	 */

 	public <I extends ModelInstance<?>, M extends ModelElementProxy, P extends ProcessableData, E extends Nameable, R extends Nameable> List<MethodAccessibility> getAuthorizations(

 			ModelElement<I, M, P, E, R> modelElement, AccessLevelOption accessLevelOption) {

diff --git a/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/ModelInstanceRegistration.java b/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/ModelInstanceRegistration.java
index 4271054..90baf5b 100644
--- a/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/ModelInstanceRegistration.java
+++ b/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/ModelInstanceRegistration.java
@@ -45,10 +45,6 @@
  * @author <a href="mailto:christophe.munilla@cea.fr">Christophe Munilla</a>
  */
 public class ModelInstanceRegistration extends AbstractMidCallback {
-	public static final String LOCATION_PROPERTY = "admin.".concat(LocationResource.LOCATION);
-	public static final String ICON_PROPERTY = "admin.".concat(ServiceProvider.ICON);
-	public static final String BRIDGE_PROPERTY = "admin.".concat(ServiceProvider.BRIDGE);
-	public static final String FRIENDLY_NAME_PROPERTY = "admin.".concat(ServiceProvider.FRIENDLY_NAME);
 
 	private boolean registered;
 	private ServiceRegistration<?> instanceRegistration;
@@ -63,8 +59,7 @@
 	 * @param observed
 	 *            the list of observed String paths
 	 * @param registration
-	 *            the {@link ServiceRegistration} of the
-	 *            {@link SensiNactResourceModel}
+	 *            the {@link ServiceRegistration} of the {@link SensiNactResourceModel}
 	 * @param configuration
 	 *            the {@link ModelConfiguration} of the {@link ModelInstance} whose
 	 *            registration will be wrapped by the ModelInstanceRegistration to
@@ -105,9 +100,12 @@
 				if (!list.contains(attribute)) 
 					list.add(attribute);
 			}
-		}
-		
-		Arrays.asList(LOCATION_PROPERTY, ICON_PROPERTY, FRIENDLY_NAME_PROPERTY, BRIDGE_PROPERTY).stream().forEach(
+		}		
+		Arrays.asList(ModelInstance.LOCATION_PROPERTY, 
+				ModelInstance.ICON_PROPERTY, 
+				ModelInstance.FRIENDLY_NAME_PROPERTY, 
+				ModelInstance.BRIDGE_PROPERTY
+				).stream().forEach(
 				p -> {
 						List<String> list = ModelInstanceRegistration.this.observed.get(p);
 						if (list == null) {
@@ -118,7 +116,7 @@
 							list.add(DataResource.VALUE);
 				}
 		);
-
+		
 		this.instanceRegistration = registration;
 		this.configuration = configuration;
 		this.registered = true;
@@ -136,9 +134,8 @@
 	}
 
 	void update(final Dictionary<String, Object> properties) {
-		if (!registered || properties == null || properties.size() == 0 || this.instanceRegistration == null) {
+		if (!registered || properties == null || properties.size() == 0 || this.instanceRegistration == null) 
 			return;
-		}
 		synchronized (this.instanceRegistration) {
 			AccessController.<Void>doPrivileged(new PrivilegedAction<Void>() {
 				@Override
@@ -207,7 +204,7 @@
 		Dictionary<String, Object> properties = properties();
 		properties.remove(observed);
 
-		if (observed.startsWith(LOCATION_PROPERTY)) {
+		if (observed.startsWith(ModelInstance.LOCATION_PROPERTY)) {
 			properties.remove("latitude");
 			properties.remove("longitude");
 
@@ -247,11 +244,11 @@
 		if (service == null) {
 			return;
 		}
-		MutableAccessNode node = null;
 		MutableAccessNode root = this.configuration.getAccessTree().getRoot();
-		if ((node = (MutableAccessNode) root.get(uri)) == null) {
+		MutableAccessNode node = (MutableAccessNode) root.get(uri);
+		if (node == null) 
 			node = root;
-		}
+		
 		String resource = (length > 2) ? uriElements[2] : null;
 		boolean added = !lifecycle.equals(Lifecycle.RESOURCE_DISAPPEARING)
 				&& !lifecycle.equals(Lifecycle.SERVICE_DISAPPEARING);
@@ -298,7 +295,7 @@
 				if (attribute.equals(name) || (attribute.equals(DataResource.VALUE) && resource.equals(name))) 
 					value = initial.opt(DataResource.VALUE);
 				
-				if (LOCATION_PROPERTY.equals(resourceKey)) {
+				if (ModelInstance.LOCATION_PROPERTY.equals(resourceKey)) {
 					double latitude = 0d;
 					double longitude = 0d;
 
@@ -399,7 +396,6 @@
 
 	@Override
 	public synchronized void doCallback(SnaMessage<?> message) {
-
 		String uri = message.getPath();
 		String[] uriElements = UriUtils.getUriElements(uri);
 		switch (((SnaMessageSubType) message.getType()).getSnaMessageType()) {
@@ -408,7 +404,7 @@
 			JSONObject notification = m.getNotification();
 			String key = new StringBuilder().append(uriElements[1]).append(".").append(uriElements[2]).toString();
 			switch(m.getType()) {
-				case ATTRIBUTE_VALUE_UPDATED:					
+				case ATTRIBUTE_VALUE_UPDATED:
 					List<String> obs = this.observed.get(key);
 					if (obs != null && !obs.isEmpty() && obs.contains(uriElements[3])) {
 						Object value = notification.opt(DataResource.VALUE);
diff --git a/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/RegistryEndpoint.java b/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/RegistryEndpoint.java
index 4cfa8f8..ddff4e1 100644
--- a/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/RegistryEndpoint.java
+++ b/platform/sensinact-core/src/main/java/org/eclipse/sensinact/gateway/core/RegistryEndpoint.java
@@ -246,13 +246,13 @@
             String provider = new StringBuilder().append(prefix).append(name).toString();
 
             String location = null;
-            Object obj = reference.getProperty(ModelInstanceRegistration.LOCATION_PROPERTY.concat(".value"));
+            Object obj = reference.getProperty(ModelInstance.LOCATION_PROPERTY.concat(".value"));
             if (obj == null || "null".equals(String.valueOf(obj)))           
             	location = defaultLocation;
             else	
                 location = String.valueOf(obj).replace('"', '\'');  
 
-            Integer locationGetLevel = (Integer) reference.getProperty(ModelInstanceRegistration.LOCATION_PROPERTY.concat(".GET"));
+            Integer locationGetLevel = (Integer) reference.getProperty(ModelInstance.LOCATION_PROPERTY.concat(".GET"));
             if (locationGetLevel == null)
             	locationGetLevel = Integer.valueOf(AccessLevelOption.OWNER.getAccessLevel().getLevel());
 
@@ -262,14 +262,14 @@
                 node = tree.getRoot();            
             int locationAccessLevel = node.getAccessLevelOption(get).getAccessLevel().getLevel();
             
-            String friendlyName = null;
-            obj = reference.getProperty(ModelInstanceRegistration.FRIENDLY_NAME_PROPERTY.concat(".value"));
+            String friendlyName;
+            obj = reference.getProperty(ModelInstance.FRIENDLY_NAME_PROPERTY.concat(".value"));
             if (obj == null || "null".equals(String.valueOf(obj))) 
-            	friendlyName = name;
+            	friendlyName = null;
             else
             	friendlyName = String.valueOf(obj).replace('"', '\'');
 
-            Integer friendlyNameGetLevel = (Integer) reference.getProperty(ModelInstanceRegistration.FRIENDLY_NAME_PROPERTY.concat(".GET"));
+            Integer friendlyNameGetLevel = (Integer) reference.getProperty(ModelInstance.FRIENDLY_NAME_PROPERTY.concat(".GET"));
             if (friendlyNameGetLevel == null)
             	friendlyNameGetLevel = Integer.valueOf(AccessLevelOption.OWNER.getAccessLevel().getLevel());
 
@@ -280,13 +280,13 @@
             int friendlyNameAccessLevel = node.getAccessLevelOption(get).getAccessLevel().getLevel();
             
             String bridge;
-            obj = reference.getProperty(ModelInstanceRegistration.BRIDGE_PROPERTY.concat(".value"));
+            obj = reference.getProperty(ModelInstance.BRIDGE_PROPERTY.concat(".value"));
             if (obj == null || "null".equals(String.valueOf(obj)))  
             	bridge = null;
             else
             	bridge = String.valueOf(obj).replace('"', '\'');
 
-            Integer bridgeGetLevel = (Integer) reference.getProperty(ModelInstanceRegistration.BRIDGE_PROPERTY.concat(".GET"));
+            Integer bridgeGetLevel = (Integer) reference.getProperty(ModelInstance.BRIDGE_PROPERTY.concat(".GET"));
             if (bridgeGetLevel == null)
             	bridgeGetLevel = Integer.valueOf(AccessLevelOption.OWNER.getAccessLevel().getLevel());
 
@@ -297,13 +297,13 @@
              int bridgeAccessLevel = node.getAccessLevelOption(get).getAccessLevel().getLevel();
             
             String icon;
-            obj = reference.getProperty(ModelInstanceRegistration.ICON_PROPERTY.concat(".value"));
+            obj = reference.getProperty(ModelInstance.ICON_PROPERTY.concat(".value"));
             if (obj == null || "null".equals(String.valueOf(obj)))  
             	icon = null;
             else
             	icon = String.valueOf(obj).replace('"', '\'');
 
-            Integer iconGetLevel = (Integer) reference.getProperty(ModelInstanceRegistration.ICON_PROPERTY.concat(".GET"));
+            Integer iconGetLevel = (Integer) reference.getProperty(ModelInstance.ICON_PROPERTY.concat(".GET"));
             if (iconGetLevel == null)
             	iconGetLevel = Integer.valueOf(AccessLevelOption.OWNER.getAccessLevel().getLevel());