Constraint query parameters order in northbound shell
diff --git a/platform/sensinact-shell/src/main/java/org/eclipse/sensinact/gateway/commands/gogo/internal/shell/ShellAccess.java b/platform/sensinact-shell/src/main/java/org/eclipse/sensinact/gateway/commands/gogo/internal/shell/ShellAccess.java
index 2ac2cc2..cd8946e 100644
--- a/platform/sensinact-shell/src/main/java/org/eclipse/sensinact/gateway/commands/gogo/internal/shell/ShellAccess.java
+++ b/platform/sensinact-shell/src/main/java/org/eclipse/sensinact/gateway/commands/gogo/internal/shell/ShellAccess.java
@@ -19,11 +19,14 @@
import org.eclipse.sensinact.gateway.nthbnd.endpoint.NorthboundMediator;
import org.eclipse.sensinact.gateway.nthbnd.endpoint.NorthboundRequest;
import org.eclipse.sensinact.gateway.nthbnd.endpoint.NorthboundRequestBuilder;
+import org.eclipse.sensinact.gateway.nthbnd.endpoint.NorthboundRequestWrapper.QueryKey;
import org.eclipse.sensinact.gateway.nthbnd.endpoint.format.JSONResponseFormat;
import org.json.JSONObject;
import java.io.IOException;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
/**
* Extended {@link NorthboundAccess} dedicated to shell access request
@@ -71,8 +74,17 @@
}
AccessMethodResponse<?> cap = this.endpoint.execute(nthbndRequest);
String resultStr = null;
- List<String> rawList = super.request.getQueryMap().get("rawDescribe");
-
+ List<String> rawList = null;
+
+ Map<QueryKey, List<String>> queryMap = super.request.getQueryMap();
+ Iterator<QueryKey> iterator = queryMap.keySet().iterator();
+ while(iterator.hasNext()) {
+ QueryKey queryKey = iterator.next();
+ if("rawDescribe".equals(queryKey.name)) {
+ rawList = queryMap.get(queryKey);
+ break;
+ }
+ }
if (rawList != null && (rawList.contains("true") || rawList.contains("True") || rawList.contains("yes") || rawList.contains("Yes")) && DescribeResponse.class.isAssignableFrom(cap.getClass())) {
resultStr = ((DescribeResponse<?>) cap).getJSON(true);
} else {
diff --git a/platform/sensinact-shell/src/main/java/org/eclipse/sensinact/gateway/commands/gogo/internal/shell/ShellAccessRequest.java b/platform/sensinact-shell/src/main/java/org/eclipse/sensinact/gateway/commands/gogo/internal/shell/ShellAccessRequest.java
index ba8d6c6..4dee1b2 100644
--- a/platform/sensinact-shell/src/main/java/org/eclipse/sensinact/gateway/commands/gogo/internal/shell/ShellAccessRequest.java
+++ b/platform/sensinact-shell/src/main/java/org/eclipse/sensinact/gateway/commands/gogo/internal/shell/ShellAccessRequest.java
@@ -70,7 +70,7 @@
* @see org.eclipse.sensinact.gateway.nthbnd.endpoint.NorthboundRequestWrapper#getQueryMap()
*/
@Override
- public Map<String, List<String>> getQueryMap() {
+ public Map<QueryKey, List<String>> getQueryMap() {
String uri = request.optString("uri");
String[] uriElements = uri.split("\\?");
if (uriElements.length == 2) {
@@ -80,7 +80,7 @@
this.mediator.error(e);
}
}
- return Collections.<String, List<String>>emptyMap();
+ return Collections.<QueryKey, List<String>>emptyMap();
}
/**