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 Output Engine, 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.
-
Export the complete configuration of SEAL Operator from Consul to a YAML file. This ensures that you edit the current configuration.
operator config export <filename>.yml --insecure -
Edit the exported file
<filename>.yml. -
In the section for the TreeResolver connector, set
cstatustoon.operator: connectors: ... treeresolver: cstatus: 'on' serviceName: operator-treeresolver url: 'https://localhost:3018' ... -
In the
envsection, specify the following optional keys for theseal-operator-treeresolverservice in theoperator-treeresolversection unless the defaults fit:-
ITEM_TYPE: optional, type of items to be collected -
SORT_COLLECTIONS_FIRST: optional, listing of directories before the other items -
SORT_METADATA: optional, metadata keys used for sorting the items -
SORT_OVERALL: optional, sorting over all items or in each directory
Literature - keys
For further information about available keys, refer to the Key Reference.
-
-
Save the
<filename>.ymlfile. -
Re-import the file to Consul.
operator config import <filename>.yml --insecure -
Check the imported value of a key you have set, for example
ITEM_TYPE:operator config get ITEM_TYPE --service operator-treeresolver --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 the SharePoint connector.
-
Create a JSON object containing the task data.
datasink: target system. Additional metadata besidesdatasinkdepend on the target given indatasink.hrefof 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 an HTTP POST request to the task creation REST endpoint, for example
https://localhost:3008/v1/services/operator-treeresolver/tasks. The response contains the task ID.Example - 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 an HTTP POST request to the task action REST endpoint, for example
https://localhost:3008/v1/services/operator-treeresolver/tasks/<tid>/action.Example - 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"
Literature - Description and usage of the REST API
For more detailed information regarding the REST API and its usage, refer to API Description.