DSD-DBS / capella-addons

A collection of Capella addons
0 stars 0 forks source link

Create plugin that shares the collab mgr session id and metadata about selected element(s) in a Capella model #1

Open jamilraichouni opened 6 months ago

jamilraichouni commented 6 months ago

The idea is to create an addon (deployable .jar that can be put into the dropins folder of a Capella installation).

Requirements:

R1 The plugin shall automatically be activated when Capella starts

R2 When the plugin has been activated, it shall identify the Capella Collaboration Manager session id once.

Comment: The Capella Collaboration Manager session id will be provided as environment variable CAPELLACOLLAB_SESSION_ID as documented here.

R3 The plugin shall run a timer with a frequency of 500 ms

R4 When the timer runs a loop, the plugin shall determine the (list of) selected element(s) and information about the corresponding Capella model (project)

R5 When the timer runs a loop and the selection of elements differs from the previous loop, the plugin shall send (HTTP POST request) the following data:

[
    {
        "element_uuid": "...",
        "element_name": "...",
        "model_uuid": "...",
        "model_path": "..."
    }
]

R6 The plugin shall send the data to a network host that will be specified in the environment variable SELECTED_ELEMENTS_SERVICE_TARGET_URL. The endpoint will accept a parameter named capellacollab_session_id.

Comment: The HTTP POST request will be sent to https://host/endpoint?capellacollab_session_id=(...)

Implementation status:

jamilraichouni commented 6 months ago

This issue is related to: https://github.com/DSD-DBS/capella-collab-manager/issues/1016

jamilraichouni commented 6 months ago

Hi @MoritzWeber0,

I think a better structure for the JSON data is an array of selected elements:

[
    {
        "uuid": "{uuid_of_element}",
        "name": "{name_of_selected_element}",
        "model_uuid": "{uuid_of_model}",
        "model_path": "{path_to_model_relative_to_workspace}"
    }
]

That is simple and clear (also in the needed Java code)

MoritzWeber0 commented 6 months ago

Hi @MoritzWeber0,

I think a better structure for the JSON data is an array of selected elements:

[
    {
        "uuid": "{uuid_of_element}",
        "name": "{name_of_selected_element}",
        "model_uuid": "{uuid_of_model}",
        "model_path": "{path_to_model_relative_to_workspace}"
    }
]

That is simple and clear (also in the needed Java code)

This structure of also fine for me.

jamilraichouni commented 6 months ago

Ah, well. Now I forgot about the collab manager session id :-) Sorry. Another proposal:

{
    "collab_manager_session_id": "...",
    "selected_model_elements": [
        {
            "uuid": "...",
            "name": "...",
            "model_uuid": "...",
            "model_path": "..."
        }
    ]
}

The model meta data will be provided per selected element, because it is possible to select multiple elements across multiple models:

image
MoritzWeber0 commented 6 months ago

Ah, well. Now I forgot about the collab manager session id :-) Sorry. Another proposal:

{
    "collab_manager_session_id": "...",
    "selected_model_elements": [
        {
            "uuid": "...",
            "name": "...",
            "model_uuid": "...",
            "model_path": "..."
        }
    ]
}

The model meta data will be provided per selected element, because it is possible to select multiple elements across multiple models:

image

We don't need the session id in the request body. It's a path parameter in the request URL.

jamilraichouni commented 6 months ago

Alright. Can we introduce another environment variable named SELECTED_ELEMENTS_SHARE_SERVICE_TARGET_URL?

MoritzWeber0 commented 6 months ago

SELECTED_ELEMENTS_SHARE_SERVICE_TARGET_URL

What would be a possible value of it? The full URL to the Collaboration Manager API endpoint where you have to send the payload to? This would be possible.

jamilraichouni commented 6 months ago

Yes, full URL with a path parameter or anything that expects the collab mgr session id which I read from the containers env var and set before sending the HTTP request.

jamilraichouni commented 5 months ago

SELECTED_ELEMENTS_SHARE_SERVICE_TARGET_URL

Want to rename this to SELECTED_ELEMENTS_SERVICE_TARGET_URL