Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Protocol discovery import UI implemented

Rich Turnerbbaa9375b026
diff --git a/agent/src/main/java/org/openremote/agent/protocol/knx/KNXProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/knx/KNXProtocol.java
index 107bb5bc2..f536bee3a 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/knx/KNXProtocol.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/knx/KNXProtocol.java
@@ -11,11 +11,14 @@ import java.util.logging.Logger;
import org.openremote.agent.protocol.AbstractProtocol;
import org.openremote.agent.protocol.ConnectionStatus;
+import org.openremote.agent.protocol.ProtocolLinkedAttributeImport;
import org.openremote.model.AbstractValueHolder;
import org.openremote.model.ValidationFailure;
import org.openremote.model.ValueHolder;
+import org.openremote.model.asset.Asset;
import org.openremote.model.asset.AssetAttribute;
import org.openremote.model.attribute.*;
+import org.openremote.model.file.FileInfo;
import org.openremote.model.util.Pair;
import org.openremote.model.value.Value;
@@ -28,9 +31,9 @@ import tuwien.auto.calimero.datapoint.Datapoint;
import tuwien.auto.calimero.datapoint.StateDP;
/**
- * This protocol is used to connecto to a KNX bus via an IP interface.
+ * This protocol is used to connect to a KNX bus via an IP interface.
*/
-public class KNXProtocol extends AbstractProtocol {
+public class KNXProtocol extends AbstractProtocol implements ProtocolLinkedAttributeImport {
private static final Logger LOG = Logger.getLogger(KNXProtocol.class.getName());
@@ -413,4 +416,10 @@ public class KNXProtocol extends AbstractProtocol {
return clientStillUsed;
}
+
+ @Override
+ public Asset[] discoverLinkedAssetAttributes(AssetAttribute protocolConfiguration, FileInfo fileInfo) throws IllegalStateException {
+ // TODO: implement discovery using provided file info
+ return new Asset[0];
+ }
}
diff --git a/container/src/main/java/org/openremote/container/util/Util.java b/container/src/main/java/org/openremote/container/util/Util.java
index 324d1ba5a..937e548ad 100644
--- a/container/src/main/java/org/openremote/container/util/Util.java
+++ b/container/src/main/java/org/openremote/container/util/Util.java
@@ -1,5 +1,7 @@
package org.openremote.container.util;
+import org.apache.commons.codec.binary.Base64;
+
import java.lang.reflect.Array;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -133,4 +135,24 @@ public class Util {
d = d + shift;
return (String.format("%.1f", d) + suffix);
}
+
+ public static byte[] decodeBase64(String base64String) {
+ if (base64String == null) {
+ return null;
+ }
+
+ if (base64String.length() == 0) {
+ return new byte[0];
+ }
+
+ // Could be data URL encoded so look for comma in first 50 chars
+ int searchLength = Math.min(50, base64String.length());
+ String str = base64String.substring(0, searchLength-1);
+ int commaIndex = str.indexOf(',');
+ if (commaIndex >=0) {
+ base64String = base64String.substring(commaIndex+1);
+ }
+
+ return Base64.decodeBase64(base64String);
+ }
}
diff --git a/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetEditActivity.java b/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetEditActivity.java
index bead8b63a..62eea8343 100644
--- a/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetEditActivity.java
+++ b/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetEditActivity.java
@@ -31,6 +31,7 @@ import org.openremote.manager.client.assets.browser.BrowserTreeNode;
import org.openremote.manager.client.assets.browser.TenantTreeNode;
import org.openremote.manager.client.event.ShowFailureEvent;
import org.openremote.manager.client.event.ShowSuccessEvent;
+import org.openremote.manager.client.interop.jackson.FileInfoMapper;
import org.openremote.manager.client.interop.value.ObjectValueMapper;
import org.openremote.manager.client.widget.FormButton;
import org.openremote.manager.client.widget.ValueEditors;
@@ -75,6 +76,7 @@ public class AssetEditActivity
protected final AssetQueryMapper assetQueryMapper;
protected final ProtocolDescriptorArrayMapper protocolDescriptorArrayMapper;
protected final ProtocolDescriptorMapMapper protocolDescriptorMapMapper;
+ protected final FileInfoMapper fileInfoMapper;
protected final AttributeValidationResultMapper attributeValidationResultMapper;
protected final AssetAttributeMapper assetAttributeMapper;
protected final Consumer<ConstraintViolation[]> validationErrorHandler;
@@ -102,6 +104,7 @@ public class AssetEditActivity
ProtocolDescriptorMapMapper protocolDescriptorMapMapper,
AttributeValidationResultMapper attributeValidationResultMapper,
AssetAttributeMapper assetAttributeMapper,
+ FileInfoMapper fileInfoMapper,
MapResource mapResource,
ObjectValueMapper objectValueMapper) {
super(environment, currentTenant, assetBrowserPresenter, jsonEditorProvider, objectValueMapper, mapResource, true);
@@ -117,6 +120,7 @@ public class AssetEditActivity
this.protocolDescriptorMapMapper = protocolDescriptorMapMapper;
this.attributeValidationResultMapper = attributeValidationResultMapper;
this.assetAttributeMapper = assetAttributeMapper;
+ this.fileInfoMapper = fileInfoMapper;
validationErrorHandler = violations -> {
for (ConstraintViolation violation : violations) {
@@ -663,6 +667,41 @@ public class AssetEditActivity
}
protected void doProtocolDiscovery(ProtocolDiscoveryView.DiscoveryRequest request, Runnable callback) {
-
+ showInfo(environment.getMessages().protocolLinkDiscoveryStarted());
+
+ environment.getRequestService().execute(
+ assetArrayMapper,
+ fileInfoMapper,
+ requestParams -> {
+ if (request.getFileInfo() != null) {
+ agentResource.importLinkedAttributes(
+ requestParams, assetId,
+ request.getProtocolConfigurationName(),
+ request.getParentId(),
+ request.getRealmId(),
+ request.getFileInfo()
+ );
+ } else {
+ agentResource.searchForLinkedAttributes(
+ requestParams, assetId,
+ request.getProtocolConfigurationName(),
+ request.getParentId(),
+ request.getRealmId()
+ );
+ }
+ },
+ Collections.singletonList(200),
+ discoveredAssets -> {
+ updateMetaItemDescriptors();
+ view.setFormBusy(false);
+ view.setAvailableAttributeTypes(attributeTypesToList());
+ showSuccess(environment.getMessages().protocolLinkDiscoverySuccess(discoveredAssets.length));
+ callback.run();
+ },
+ ex -> {
+ handleRequestException(ex, environment.getEventBus(), environment.getMessages(), validationErrorHandler);
+ callback.run();
+ }
+ );
}
}
diff --git a/manager/client/src/main/java/org/openremote/manager/client/assets/attributes/ProtocolDiscoveryView.java b/manager/client/src/main/java/org/openremote/manager/client/assets/attributes/ProtocolDiscoveryView.java
index 303f15901..38e75c401 100644
--- a/manager/client/src/main/java/org/openremote/manager/client/assets/attributes/ProtocolDiscoveryView.java
+++ b/manager/client/src/main/java/org/openremote/manager/client/assets/attributes/ProtocolDiscoveryView.java
@@ -31,10 +31,7 @@ import org.openremote.manager.client.assets.browser.AssetSelector;
import org.openremote.manager.client.assets.browser.AssetTreeNode;
import org.openremote.manager.client.assets.browser.TenantTreeNode;
import org.openremote.manager.client.interop.BiConsumer;
-import org.openremote.manager.client.widget.FormGroup;
-import org.openremote.manager.client.widget.FormGroupActions;
-import org.openremote.manager.client.widget.FormInlineLabel;
-import org.openremote.manager.client.widget.FormLabel;
+import org.openremote.manager.client.widget.*;
import org.openremote.model.asset.AssetAttribute;
import org.openremote.model.asset.agent.ProtocolDescriptor;
import org.openremote.model.attribute.AttributeValidationResult;
@@ -77,6 +74,8 @@ public class ProtocolDiscoveryView extends AbstractAttributeViewExtension {
protected final BiConsumer<DiscoveryRequest, Runnable> discoveryRequestConsumer;
protected String importRealmId;
protected String importParentId;
+ protected FileUploadLabelled fileUpload;
+ protected FormGroup importGroup;
public ProtocolDiscoveryView(
Environment environment,
@@ -112,53 +111,46 @@ public class ProtocolDiscoveryView extends AbstractAttributeViewExtension {
) {
@Override
public void beginSelection() {
- ProtocolDiscoveryView.this.setDisabled(true);
+ importGroup.setDisabled(true);
super.beginSelection();
}
@Override
public void endSelection() {
super.endSelection();
- ProtocolDiscoveryView.this.setDisabled(false);
+ importGroup.setDisabled(false);
}
};
add(assetSelector);
if (protocolDescriptor.isDeviceImport()) {
- FormGroup importGroup = new FormGroup();
+ importGroup = new FormGroup();
importGroup.setFormLabel(new FormLabel(environment.getMessages().importProtocolLinks()));
FormGroupActions actions = new FormGroupActions();
- FileUpload fileUpload = new FileUpload();
- fileUpload.setVisible(false);
-
- fileUpload.addChangeHandler(event -> {
- JsArray files = (JsArray) fileUpload.getElement().getPropertyJSO("files");
+ fileUpload = new FileUploadLabelled();
+ fileUpload.setIcon("upload");
+ fileUpload.getElement().addClassName(environment.getWidgetStyle().FormControl());
+ fileUpload.getElement().addClassName(environment.getWidgetStyle().FormFileUploadLabel());
+ fileUpload.setText(environment.getMessages().uploadProtocolFile());
+
+ fileUpload.getFileUpload().addChangeHandler(event -> {
+ JsArray files = (JsArray) fileUpload.getFileUpload().getElement().getPropertyJSO("files");
if (files.length() != 1) {
return;
}
- // Base64 encode non-text files
Blob file = (Blob) files.get(0);
final FileReader reader = Browser.getWindow().newFileReader();
if (file.getType().matches("text.*")) {
- reader.setOnloadend(evt -> doDiscoveryImport(reader.getResult().toString(), false));
+ reader.setOnloadend(evt -> doDiscoveryImport(fileUpload.getFileUpload().getFilename(), reader.getResult().toString(), false));
reader.readAsText(file, "UTF-8");
} else {
- reader.setOnloadend(evt -> doDiscoveryImport(reader.getResult().toString(), true));
+ reader.setOnloadend(evt -> doDiscoveryImport(fileUpload.getFileUpload().getFilename(), reader.getResult().toString(), true));
reader.readAsDataURL(file);
}
});
- FormInlineLabel label = new FormInlineLabel(environment.getMessages().uploadProtocolFile());
- label.setIcon("upload");
- FlowPanel fileUploadWrapper = new FlowPanel();
- fileUploadWrapper.getElement().getStyle().setDisplay(com.google.gwt.dom.client.Style.Display.INLINE);
- fileUploadWrapper.addStyleName(environment.getWidgetStyle().FormControl());
- fileUploadWrapper.addStyleName(environment.getWidgetStyle().FormFileUploadLabel());
- fileUploadWrapper.add(fileUpload);
- fileUploadWrapper.add(label);
-
- actions.add(fileUploadWrapper);
+ actions.add(fileUpload);
importGroup.setFromGroupActions(actions);
add(importGroup);
}
@@ -179,7 +171,18 @@ public class ProtocolDiscoveryView extends AbstractAttributeViewExtension {
}
- protected void doDiscoveryImport(String data, boolean binary) {
-
+ protected void doDiscoveryImport(String name, String data, boolean binary) {
+ fileUpload.clearInput();
+ setDisabled(true);
+ fileUpload.setText(environment.getMessages().importInProgress());
+
+ FileInfo fileInfo = new FileInfo(name, data, binary);
+ DiscoveryRequest discoveryRequest = new DiscoveryRequest(attribute.getName().orElse(""), importParentId, importRealmId, fileInfo);
+ if (discoveryRequestConsumer != null) {
+ discoveryRequestConsumer.accept(discoveryRequest, () -> {
+ fileUpload.setText(environment.getMessages().uploadProtocolFile());
+ setDisabled(false);
+ });
+ }
}
}
diff --git a/manager/client/src/main/java/org/openremote/manager/client/i18n/ManagerMessages.java b/manager/client/src/main/java/org/openremote/manager/client/i18n/ManagerMessages.java
index 2949857b1..0f12b29b4 100644
--- a/manager/client/src/main/java/org/openremote/manager/client/i18n/ManagerMessages.java
+++ b/manager/client/src/main/java/org/openremote/manager/client/i18n/ManagerMessages.java
@@ -231,6 +231,8 @@ public interface ManagerMessages extends Messages {
String uploadProtocolFile();
+ String importInProgress();
+
String or();
String and();
@@ -420,4 +422,10 @@ public interface ManagerMessages extends Messages {
String selectAttribute();
String selectProtocolConfiguration();
+
+ String protocolLinkDiscoveryStarted();
+
+ String protocolLinkDiscoverySuccess(@PluralCount int assetCount);
+
+ String protocolLinkDiscoveryFailure(int failureCode);
}
diff --git a/manager/client/src/main/java/org/openremote/manager/client/interop/jackson/FileInfoMapper.java b/manager/client/src/main/java/org/openremote/manager/client/interop/jackson/FileInfoMapper.java
new file mode 100644
index 000000000..dadab1909
--- /dev/null
+++ b/manager/client/src/main/java/org/openremote/manager/client/interop/jackson/FileInfoMapper.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2016, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.openremote.manager.client.interop.jackson;
+
+import com.github.nmorel.gwtjackson.client.ObjectMapper;
+import com.github.nmorel.gwtjackson.client.annotation.JsonMixIns;
+import org.openremote.manager.shared.http.EntityReader;
+import org.openremote.manager.shared.http.EntityWriter;
+import org.openremote.model.asset.AssetQuery;
+import org.openremote.model.file.FileInfo;
+
+@JsonMixIns({@JsonMixIns.JsonMixIn(target = FileInfo.class, mixIn = DefaultJsonMixin.class)})
+public interface FileInfoMapper
+ extends ObjectMapper<FileInfo>,
+ EntityWriter<FileInfo> {
+}
diff --git a/manager/client/src/main/java/org/openremote/manager/client/rules/RulesEditorImpl.java b/manager/client/src/main/java/org/openremote/manager/client/rules/RulesEditorImpl.java
index d92e2c223..ec83bfc2c 100644
--- a/manager/client/src/main/java/org/openremote/manager/client/rules/RulesEditorImpl.java
+++ b/manager/client/src/main/java/org/openremote/manager/client/rules/RulesEditorImpl.java
@@ -139,7 +139,7 @@ public class RulesEditorImpl extends FormViewImpl implements RulesEditor {
rulesFileUpload.getFileUpload().addChangeHandler(event -> {
rulesFileUpload.getElement().removeClassName("error");
- JsArray files = (JsArray) rulesFileUpload.getElement().getPropertyJSO("files");
+ JsArray files = (JsArray) rulesFileUpload.getFileUpload().getElement().getPropertyJSO("files");
if (files.length() != 1)
return;
Blob file = (Blob) files.get(0);
diff --git a/manager/client/src/main/java/org/openremote/manager/client/widget/FileUploadLabelled.java b/manager/client/src/main/java/org/openremote/manager/client/widget/FileUploadLabelled.java
index dfaa16c9e..6153901b0 100644
--- a/manager/client/src/main/java/org/openremote/manager/client/widget/FileUploadLabelled.java
+++ b/manager/client/src/main/java/org/openremote/manager/client/widget/FileUploadLabelled.java
@@ -21,9 +21,11 @@ package org.openremote.manager.client.widget;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.FormElement;
import com.google.gwt.dom.client.LabelElement;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.FileUpload;
+import com.google.gwt.user.client.ui.FormPanel;
/**
* This creates a customisable File upload widget (need to use a label wrapper otherwise the invisible
@@ -35,6 +37,7 @@ public class FileUploadLabelled extends ComplexPanel {
protected FileUpload fileUpload;
protected FormInlineLabel label;
Element wrapper;
+ FormElement parentForm;
public FileUploadLabelled() {
wrapper = Document.get().createElement(LabelElement.TAG);
@@ -45,6 +48,21 @@ public class FileUploadLabelled extends ComplexPanel {
add(label, wrapper);
}
+ @Override
+ protected void onAttach() {
+ super.onAttach();
+
+ parentForm = getParentForm();
+ if (parentForm == null) {
+ // wrap the input in a form to allow resetting the input
+ FormPanel form = new FormPanel();
+ add(form, wrapper);
+ parentForm = form.getElement().cast();
+ fileUpload.removeFromParent();
+ form.add(fileUpload);
+ }
+ }
+
public FileUpload getFileUpload() {
return fileUpload;
}
@@ -64,4 +82,21 @@ public class FileUploadLabelled extends ComplexPanel {
public void setClass(String clss) {
wrapper.setClassName(clss);
}
+
+ public void clearInput() {
+ if (parentForm != null) {
+ parentForm.reset();
+ } else {
+ // This probably won't work due to browser protection but is a backup option
+ fileUpload.getElement().setAttribute("value", "");
+ }
+ }
+
+ protected FormElement getParentForm() {
+ Element parent = wrapper.getParentElement();
+ while (parent != null && !parent.hasTagName("form")) {
+ parent = parent.getParentElement();
+ }
+ return (FormElement)parent;
+ }
}
diff --git a/manager/client/src/main/java/org/openremote/manager/client/widget/FormSection.java b/manager/client/src/main/java/org/openremote/manager/client/widget/FormSection.java
index 1548d0b7e..a9ff55d59 100644
--- a/manager/client/src/main/java/org/openremote/manager/client/widget/FormSection.java
+++ b/manager/client/src/main/java/org/openremote/manager/client/widget/FormSection.java
@@ -29,6 +29,7 @@ public class FormSection extends FlowPanel {
protected FormSectionLabel label = new FormSectionLabel();
public FormSection(String label) {
+ setStyleName("or-FormSection");
addLabel(label);
}
diff --git a/manager/client/src/main/resources/org/openremote/manager/client/i18n/ManagerMessages.properties b/manager/client/src/main/resources/org/openremote/manager/client/i18n/ManagerMessages.properties
index ea186f880..4f67361db 100644
--- a/manager/client/src/main/resources/org/openremote/manager/client/i18n/ManagerMessages.properties
+++ b/manager/client/src/main/resources/org/openremote/manager/client/i18n/ManagerMessages.properties
@@ -123,6 +123,12 @@ protocolLinkDiscovery=Protocol link discovery
importProtocolLinks=Import links from file
searchProtocolLinks=Search for links
uploadProtocolFile=Upload file
+importInProgress=Import in progress
+protocolLinkDiscoveryStarted=Protocol link discovery has started
+protocolLinkDiscoverySuccess=Protocol link discovery has finished {0,number} assets were found and added
+protocolLinkDiscoverySuccess[none]=Protocol link discovery has finished no assets were found
+protocolLinkDiscoverySuccess[one]=Protocol link discovery has finished 1 asset was found and added
+protocolLinkDiscoveryFailure=Protocol link discovery failed: server response: {0}
or=or
and=and
customItem=Custom item
diff --git a/manager/client/src/main/webapp/css/style.html b/manager/client/src/main/webapp/css/style.html
index 508e5f531..7ed2629dc 100644
--- a/manager/client/src/main/webapp/css/style.html
+++ b/manager/client/src/main/webapp/css/style.html
@@ -282,6 +282,8 @@
padding: 0.4em;
}
+ .or-FormSection.opaque .or-FormLabel,
+ .or-FormSection.opaque .or-FormOutputText
.or-FormGroup.opaque .or-FormLabel,
.or-FormGroup.opaque .or-FormOutputText {
opacity: 0.44;
@@ -364,6 +366,7 @@
}
.or-FormControl[disabled],
+ .or-FormSection.opaque .or-FormControl,
.or-FormGroup.opaque .or-FormControl {
cursor: not-allowed;
pointer-events: none;
@@ -374,6 +377,7 @@
opacity: 1;
}
+ .or-FormSection.opaque .or-FormCheckBox,
.or-FormGroup.opaque .or-FormCheckBox {
opacity: 0.44;
}
diff --git a/manager/server/src/main/java/org/openremote/manager/server/agent/AgentResourceImpl.java b/manager/server/src/main/java/org/openremote/manager/server/agent/AgentResourceImpl.java
index ffe7f60f8..93522a987 100644
--- a/manager/server/src/main/java/org/openremote/manager/server/agent/AgentResourceImpl.java
+++ b/manager/server/src/main/java/org/openremote/manager/server/agent/AgentResourceImpl.java
@@ -48,7 +48,7 @@ import static org.openremote.model.util.TextUtil.isNullOrEmpty;
public class AgentResourceImpl extends ManagerWebResource implements AgentResource {
- private static final Logger LOG = Logger.getLogger(AssetResourceImpl.class.getName());
+ private static final Logger LOG = Logger.getLogger(AgentResourceImpl.class.getName());
protected final AgentService agentService;
protected final AssetStorageService assetStorageService;
@@ -120,7 +120,7 @@ public class AgentResourceImpl extends ManagerWebResource implements AgentResour
}
@Override
- public Asset[] getDiscoveredLinkedAttributes(RequestParams requestParams, String agentId, String protocolConfigurationName, String parentId, String realmId) {
+ public Asset[] searchForLinkedAttributes(RequestParams requestParams, String agentId, String protocolConfigurationName, String parentId, String realmId) {
AttributeRef protocolConfigRef = new AttributeRef(agentId, protocolConfigurationName);
AgentConnector agentConnector = findAgent(agentId)
.flatMap(agentService::getAgentConnector)
@@ -145,7 +145,7 @@ public class AgentResourceImpl extends ManagerWebResource implements AgentResour
}
@Override
- public Asset[] getDiscoveredLinkedAttributes(RequestParams requestParams, String agentId, String protocolConfigurationName, String parentId, String realmId, FileInfo fileInfo) {
+ public Asset[] importLinkedAttributes(RequestParams requestParams, String agentId, String protocolConfigurationName, String parentId, String realmId, FileInfo fileInfo) {
AttributeRef protocolConfigRef = new AttributeRef(agentId, protocolConfigurationName);
AgentConnector agentConnector = findAgent(agentId)
.flatMap(agentService::getAgentConnector)
diff --git a/manager/shared/src/main/java/org/openremote/manager/shared/agent/AgentResource.java b/manager/shared/src/main/java/org/openremote/manager/shared/agent/AgentResource.java
index 420db1c69..7c76d7617 100644
--- a/manager/shared/src/main/java/org/openremote/manager/shared/agent/AgentResource.java
+++ b/manager/shared/src/main/java/org/openremote/manager/shared/agent/AgentResource.java
@@ -107,11 +107,11 @@ public interface AgentResource {
* inserted.
*/
@GET
- @Path("discover/{agentId}/{protocolConfigurationName}")
+ @Path("search/{agentId}/{protocolConfigurationName}")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@SuccessStatusCode(200)
- Asset[] getDiscoveredLinkedAttributes(
+ Asset[] searchForLinkedAttributes(
@BeanParam RequestParams requestParams,
@PathParam("agentId") String agentId,
@PathParam("protocolConfigurationName") String protocolConfigurationName,
@@ -129,12 +129,12 @@ public interface AgentResource {
* <b>NOTE:</b> The {@link FileInfo} should be a file that the protocol understands.
*/
@POST
- @Path("discover/{agentId}/{protocolConfigurationName}")
+ @Path("import/{agentId}/{protocolConfigurationName}")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@SuccessStatusCode(200)
// TODO: File upload should use standard multipart mechanism
- Asset[] getDiscoveredLinkedAttributes(
+ Asset[] importLinkedAttributes(
@BeanParam RequestParams requestParams,
@PathParam("agentId") String agentId,
@PathParam("protocolConfigurationName") String protocolConfigurationName,
diff --git a/manager/shared/src/main/java/org/openremote/manager/shared/http/RequestParams.java b/manager/shared/src/main/java/org/openremote/manager/shared/http/RequestParams.java
index 0b28a8246..ce9137bb0 100644
--- a/manager/shared/src/main/java/org/openremote/manager/shared/http/RequestParams.java
+++ b/manager/shared/src/main/java/org/openremote/manager/shared/http/RequestParams.java
@@ -60,7 +60,7 @@ public class RequestParams<OUT> {
public Request.InternalCallback callback;
@JsProperty(name = "$async")
- public boolean async;
+ public boolean async = true; // Default to async request
@JsIgnore
public RequestParams() {