Skip to content

Commit 679060c

Browse files
hoe-jocastler
authored andcommitted
[plantuml] enable packacke in seooc and component definition
1 parent 42be427 commit 679060c

13 files changed

Lines changed: 287 additions & 7 deletions

File tree

bazel/rules/rules_score/docs/user_guide/architectural_design.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,48 @@ package "MySeooc" as MySeooc <<SEooC>> {
7171
@enduml
7272
```
7373

74+
#### Valid PlantUML Definitions
75+
76+
The validator identifies elements by their **stereotype**, not by the PlantUML keyword used. Both `package` and `component` keywords are accepted at each level.
77+
78+
| Stereotype | Valid PlantUML keywords | Meaning | Bazel rule |
79+
|---|---|---|---|
80+
| `<<SEooC>>` | `package`, `component` | Safety Element out of Context boundary | `dependable_element` |
81+
| `<<component>>` | `component`, `package` | Architectural component | `component` |
82+
| `<<unit>>` | `component`, `package` | Leaf implementation unit | `unit` |
83+
84+
#### Ports and Interface Bindings
85+
86+
Elements with stereotype `<<SEooC>>` or `<<component>>` may declare ports and bind them to interfaces. This documents which external interfaces the element requires or provides.
87+
88+
```text
89+
@startuml MySeooc_StaticDesign
90+
91+
package "MySeooc" as MySeooc <<SEooC>> {
92+
component "KvsComponent" as KvsComponent <<component>> {
93+
component "KeyValueStore" as KeyValueStore <<unit>>
94+
}
95+
96+
portin " " as p_storage ' required interface port
97+
portout " " as p_api ' provided interface port
98+
}
99+
100+
interface "score::storage" as storage
101+
interface "kvsapi" as kvsapi
102+
103+
p_storage -( storage : requires
104+
p_api )- kvsapi : provides
105+
106+
@enduml
107+
```
108+
109+
**Rules:**
110+
111+
- `portin` / `portout` are declared inside the `<<SEooC>>` or `<<component>>` element.
112+
- `-(` binds a required (incoming) interface; `)-` binds a provided (outgoing) interface.
113+
- The `--()` lollipop syntax (e.g. `port --() Interface`) is treated as a plain association and does **not** carry interface-binding semantics.
114+
- Plain `package` without a stereotype cannot carry interface bindings.
115+
74116
### Bazel
75117

76118
The PlantUML diagrams capture *intended* structure; the Bazel rules model the *actual* implementation. Using the same example as the diagram above — SEooC `MySeooc` containing component `KvsComponent` with units `KeyValueStore` and `StorageBackend` — the three rules work together like this:

plantuml/parser/integration_test/component_diagram/invalid_interface_binding_non_component/output.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ invalid_interface_binding_non_component.puml:
1616
fields:
1717
from: "ActorA"
1818
to: "IService"
19-
reason: "Decorator binding only allows Component on the left and Interface on the right"
19+
reason: "Decorator binding requires a Component or component-stereotyped element on the left and Interface on the right"

plantuml/parser/integration_test/component_diagram/invalid_interface_left_decorator/output.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ invalid_interface_left_decorator.puml:
1616
fields:
1717
from: "IProvided"
1818
to: "A"
19-
reason: "Decorator binding only allows Component on the left and Interface on the right"
19+
reason: "Decorator binding requires a Component or component-stereotyped element on the left and Interface on the right"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
' *******************************************************************************
2+
' Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
'
4+
' See the NOTICE file(s) distributed with this work for additional
5+
' information regarding copyright ownership.
6+
'
7+
' This program and the accompanying materials are made available under the
8+
' terms of the Apache License Version 2.0 which is available at
9+
' https://www.apache.org/licenses/LICENSE-2.0
10+
'
11+
' SPDX-License-Identifier: Apache-2.0
12+
' *******************************************************************************
13+
@startuml
14+
15+
package "Pkg" as Pkg {
16+
interface "IService" as IService
17+
}
18+
19+
Pkg )- IService : invalid
20+
21+
@enduml
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
invalid_package_no_stereotype_binding.puml:
14+
error:
15+
type: "InvalidRelationship"
16+
fields:
17+
from: "Pkg"
18+
to: "IService"
19+
reason: "Decorator binding requires a Component or component-stereotyped element on the left and Interface on the right"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"package_component_interface_binding.puml": {
3+
"MyComponent": {
4+
"id": "MyComponent",
5+
"name": "MyComponent",
6+
"alias": "MyComponent",
7+
"parent_id": null,
8+
"comp_type": "Package",
9+
"stereotype": "component",
10+
"relations": [
11+
{
12+
"target": "IRequired",
13+
"annotation": "requires",
14+
"relation_type": "InterfaceBinding",
15+
"source_role": "Required"
16+
},
17+
{
18+
"target": "IProvided",
19+
"annotation": "provides",
20+
"relation_type": "InterfaceBinding",
21+
"source_role": "Provided"
22+
}
23+
]
24+
},
25+
"IRequired": {
26+
"id": "IRequired",
27+
"name": "IRequired",
28+
"alias": "IRequired",
29+
"parent_id": null,
30+
"comp_type": "Interface",
31+
"stereotype": null,
32+
"relations": []
33+
},
34+
"IProvided": {
35+
"id": "IProvided",
36+
"name": "IProvided",
37+
"alias": "IProvided",
38+
"parent_id": null,
39+
"comp_type": "Interface",
40+
"stereotype": null,
41+
"relations": []
42+
}
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
' *******************************************************************************
2+
' Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
'
4+
' See the NOTICE file(s) distributed with this work for additional
5+
' information regarding copyright ownership.
6+
'
7+
' This program and the accompanying materials are made available under the
8+
' terms of the Apache License Version 2.0 which is available at
9+
' https://www.apache.org/licenses/LICENSE-2.0
10+
'
11+
' SPDX-License-Identifier: Apache-2.0
12+
' *******************************************************************************
13+
@startuml
14+
15+
package "MyComponent" as MyComponent <<component>> {
16+
portin " " as p_in
17+
portout " " as p_out
18+
}
19+
20+
interface "IRequired" as IRequired
21+
interface "IProvided" as IProvided
22+
23+
p_in -( IRequired : requires
24+
p_out )- IProvided : provides
25+
26+
@enduml
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"package_seooc_interface_binding.puml": {
3+
"MySeooc": {
4+
"id": "MySeooc",
5+
"name": "MySeooc",
6+
"alias": "MySeooc",
7+
"parent_id": null,
8+
"comp_type": "Package",
9+
"stereotype": "SEooC",
10+
"relations": [
11+
{
12+
"target": "IRequired",
13+
"annotation": "requires",
14+
"relation_type": "InterfaceBinding",
15+
"source_role": "Required"
16+
},
17+
{
18+
"target": "IProvided",
19+
"annotation": "provides",
20+
"relation_type": "InterfaceBinding",
21+
"source_role": "Provided"
22+
}
23+
]
24+
},
25+
"IRequired": {
26+
"id": "IRequired",
27+
"name": "IRequired",
28+
"alias": "IRequired",
29+
"parent_id": null,
30+
"comp_type": "Interface",
31+
"stereotype": null,
32+
"relations": []
33+
},
34+
"IProvided": {
35+
"id": "IProvided",
36+
"name": "IProvided",
37+
"alias": "IProvided",
38+
"parent_id": null,
39+
"comp_type": "Interface",
40+
"stereotype": null,
41+
"relations": []
42+
}
43+
}
44+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
' *******************************************************************************
2+
' Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
'
4+
' See the NOTICE file(s) distributed with this work for additional
5+
' information regarding copyright ownership.
6+
'
7+
' This program and the accompanying materials are made available under the
8+
' terms of the Apache License Version 2.0 which is available at
9+
' https://www.apache.org/licenses/LICENSE-2.0
10+
'
11+
' SPDX-License-Identifier: Apache-2.0
12+
' *******************************************************************************
13+
@startuml
14+
15+
package "MySeooc" as MySeooc <<SEooC>> {
16+
portin " " as p_in
17+
portout " " as p_out
18+
}
19+
20+
interface "IRequired" as IRequired
21+
interface "IProvided" as IProvided
22+
23+
p_in -( IRequired : requires
24+
p_out )- IProvided : provides
25+
26+
@enduml

plantuml/parser/puml_resolver/src/component_diagram/src/component_relations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,5 @@ When interface bindings are used:
5353
- Exactly one endpoint must be an interface.
5454
- Interface-to-interface bindings are not allowed.
5555
- Interface-left decorator forms are rejected.
56+
- Only a `component` element or a `package` with stereotype `<<SEooC>>` or `<<component>>` is accepted on the left side.
5657
- Port role (`portin`/`portout`) must be consistent with decorator role.

0 commit comments

Comments
 (0)