Connect the TreeResolver¶
Introduction¶
The TreeResolver, which is the seal-operator-treeresolver
service, is used for traversing a directory structure and creating a document list from the found items. From the document list, a task can be created for a PLOSSYS 5, DPF or PLOSSYS 4 system for example and then also be started. Any directory structure is possible that is provided by the Fileupload (scratch
), the PLOSSYS@rchive or the SharePoint connector.
As of TreeResolver version 2.0, the service detects keywords transferred via document metadata that would be invalid as keywords in MongoDB and fixes them.
Configure the Connector¶
Execute the following steps to activate the connector in SEAL Operator and specify the keys for the connection:
-
Open a Command Prompt or PowerShell.
-
Export the complete configuration of SEAL Operator from Consul to a YAML file with the following command. So you're making sure the current configuration settings are being used.
operator config export <filename>.yml --insecure
-
Edit the exported file
<filename>.yml
. -
In the section for the TreeResolver connector, set
cstatus
toon
.operator: connectors: ... treeresolver: cstatus: 'on' serviceName: operator-treeresolver url: 'https://localhost:3018' ...
-
In the
env
section, specify the following optional keys for theseal-operator-treeresolver
service unless the defaults fit:-
ITEM_TYPE
: Type of items to be collected -
SORT_COLLECTIONS_FIRST
: Directories are listed before the other items -
SORT_METADATA
: Metadata keys used for sorting the items -
SORT_OVERALL
: Sorting over all items or in each directory
Literature - keys
For further information about available keys, refer to the Key Reference.
-
-
Save the
<filename>.yml
file. -
Re-import it to Consul.
operator config import <filename>.yml --insecure
Use the TreeResolver¶
The TreeResolver connector can be used via the REST API. The following example shows how to use the TreeResolver connector to create a task for a PLOSSYS 4 system retrieving data from sharepoint connector.
-
Create a JSON object containing the task data.
datasink
: target system; additional metadata besidesdatasink
depend on the target given in datasinkhref
of the list iteminput
: source of the top level document or directory
{ "name":"task1", "metadata": { "datasink": "operator-p4", "Printer": "hpm402" }, "lists": { "input": { "uuid": "<unique id for input list>", "name": "input", "embedded": { "listItems": [ { "index": 0, "href": "/v1/services/operator-sharepoint/repo/<id of basenode>" } ] } } } }
-
Create the task by sending a HTTP POST request to the task creation REST endpoint (e.g.
https://localhost:3008/v1/services/operator-treeresolver/tasks
). The response contains the task ID.Bash example with curl
TASK_RESPONSE=$(curl -k -s -X POST -H "<Authentication>" -H "Content-Type:application/json" -d "<JSON Task>" "https://localhost:3008/v1/services/operator-treeresolver/tasks") TID=$(echo $TASK_RESPONSE | jq -r '.tid')
-
Start the task by sending a HTTP POST request to the task action REST endpoint (e.g.
https://localhost:3008/v1/services/operator-treeresolver/tasks/<tid>/action
).Bash example with curl
curl -k -s -X POST -H "<Authentication>" -H "Content-Type:application/json" -d '{"action": "start"}' "https://localhost:3008/v1/services/operator-treeresolver/tasks/${TID}/action"
Description and usage of the REST API
For more detailed information regarding the REST API and its usage, refer to API Description