Skip to content

Commit 922cdf5

Browse files
committed
feat: Add input/output support for topology templates and fix validation bug
1 parent f2b694a commit 922cdf5

10 files changed

Lines changed: 677 additions & 26 deletions

File tree

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# TOSCA Designer: Input/Output Implementation Status
2+
3+
**Date**: 2025-02-06
4+
**Version**: v0.5.1
5+
**Status**: 🔧 IN PROGRESS
6+
7+
---
8+
9+
## Executive Summary
10+
11+
The **Topology Template already has full input/output support** (API + template + property page UI), but there was a **bug in the property page output validation** that has been **fixed**. Node Templates do **NOT support inputs/outputs per TOSCA v1.3 spec** and should not be modified to add this support.
12+
13+
---
14+
15+
## TOSCA v1.3 Spec Compliance
16+
17+
| Element | Inputs? | Outputs? | Spec Reference | Notes |
18+
|---------|---------|----------|-----------------|-------|
19+
| **Topology Template** | ✅ YES | ✅ YES | TOSCA v1.3 § 5.9 | Parameters defining template inputs/outputs |
20+
| **Service Template** | ✅ YES | ✅ YES | TOSCA v1.3 § 5.8 | Parameters at service level |
21+
| **Node Template** | ❌ NO | ❌ NO | TOSCA v1.3 § 5.10 | Uses properties, requirements, capabilities instead |
22+
| **Node Type** | ❌ NO | ❌ NO | TOSCA v1.3 § 5.11 | Uses properties, attributes, requirements, capabilities |
23+
24+
**Key Distinction**: Node templates use **properties** (set node type property values) and **requirements**, NOT input/output parameters.
25+
26+
---
27+
28+
## Topology Template Implementation
29+
30+
### ✅ API Support (Complete)
31+
32+
All required methods exist in `TTopologyTemplate`:
33+
34+
```java
35+
// Input operations
36+
public void addInputs(TParameter obj)
37+
public List<TParameter> getInputs()
38+
public boolean removeInputs(TParameter obj)
39+
40+
// Output operations
41+
public void addOutputs(TParameter obj)
42+
public List<TParameter> getOutputs()
43+
public boolean removeOutputs(TParameter obj)
44+
```
45+
46+
**File**: [src/main/java/fr/softeam/toscadesigner/api/tosca/standard/class_/TTopologyTemplate.java](src/main/java/fr/softeam/toscadesigner/api/tosca/standard/class_/TTopologyTemplate.java)
47+
48+
### ✅ Template Rendering (Complete)
49+
50+
Handlebars template includes outputs section (added in this session):
51+
52+
```handlebars
53+
{{#unless (noStereotypeApplications this "OutputParametersType")}}
54+
outputs:
55+
{{#ownedElement}}{{#extension}}{{#eq name "OutputParametersType"}}
56+
{{#ownedAttribute as |parameter|}}{{#extension as |extension|}}{{#eq extension.name "TParameter"}}
57+
{{> TParameter parameter}}
58+
{{/eq}}{{/extension}}{{/ownedAttribute}}
59+
{{/eq}}{{/extension}}{{/ownedElement}}
60+
{{/unless}}
61+
```
62+
63+
**File**: [src/main/resources/fr/softeam/templates/TTopologyTemplate.hbs](src/main/resources/fr/softeam/templates/TTopologyTemplate.hbs)
64+
**Lines**: 16-23 (outputs section added)
65+
66+
### ✅ Property Page UI (Complete)
67+
68+
The property page `TTopologyTemplatePropertyPage` displays inputs/outputs in tabular format:
69+
70+
```java
71+
// Lines 138-151: Already defined UI for inputs/outputs
72+
table.addProperty("Inputs", getToscaValue(members_elt),
73+
getAddRemove(inputs, extractModelElements(this._element.getInputs())));
74+
75+
table.addProperty("Outputs", getToscaValue(members_elt),
76+
getAddRemove(outputs, extractModelElements(this._element.getOutputs())));
77+
```
78+
79+
**File**: [src/main/java/fr/softeam/toscadesigner/handlers/propertypages/topologyTemplate/TTopologyTemplatePropertyPage.java](src/main/java/fr/softeam/toscadesigner/handlers/propertypages/topologyTemplate/TTopologyTemplatePropertyPage.java)
80+
**Lines**: 75-95, 138-151
81+
82+
### 🐛 Bug Fixed
83+
84+
**Issue**: Line 89 had incorrect stereotype check for outputs validation:
85+
86+
```java
87+
// BEFORE (Line 89 - WRONG):
88+
if ((elt5 != null) && (elt5.isStereotyped(IToscaDesignerPeerModule.MODULE_NAME,
89+
TNodeTemplate.STEREOTYPE_NAME))) { // ❌ WRONG - checking TNodeTemplate instead of TParameter
90+
```
91+
92+
**Fix Applied**:
93+
94+
```java
95+
// AFTER (Line 89 - CORRECT):
96+
if ((elt5 != null) && (elt5.isStereotyped(IToscaDesignerPeerModule.MODULE_NAME,
97+
TParameter.STEREOTYPE_NAME))) { // ✅ CORRECT
98+
```
99+
100+
**File Modified**: [src/main/java/fr/softeam/toscadesigner/handlers/propertypages/topologyTemplate/TTopologyTemplatePropertyPage.java](src/main/java/fr/softeam/toscadesigner/handlers/propertypages/topologyTemplate/TTopologyTemplatePropertyPage.java)
101+
102+
---
103+
104+
## Node Template Implementation Status
105+
106+
### ❌ Input/Output Support NOT Required
107+
108+
Per TOSCA v1.3 spec, Node Templates:
109+
- Do NOT have input/output parameters
110+
- Use **properties** (values assigned to node type properties)
111+
- Use **requirements** (resolved dependencies to capabilities)
112+
- Use **capabilities** (derived from node type)
113+
- Use **attributes** (derived from node type)
114+
115+
### Why Node Templates Lack Input/Output Methods
116+
117+
`TNodeTemplate.java` is generated from the Modelio UML model (see: "WARNING: GENERATED FILE - DO NOT EDIT" header). Since the model doesn't define inputs/outputs for node templates (correctly, per TOSCA spec), the proxy class doesn't have these methods.
118+
119+
**Existing TNodeTemplate Property Page**: [src/main/java/fr/softeam/toscadesigner/handlers/propertypages/topologyTemplate/TNodeTemplatePropertyPage.java](src/main/java/fr/softeam/toscadesigner/handlers/propertypages/topologyTemplate/TNodeTemplatePropertyPage.java)
120+
121+
Correctly shows:
122+
- Name, Min/Max Instances
123+
- Node Type reference
124+
- Requirements, Deployment Artifacts
125+
126+
**Does NOT show** (and should not):
127+
- Inputs/Outputs (not in TOSCA spec)
128+
129+
---
130+
131+
## Diagram Editor Palette Buttons
132+
133+
**Note**: The existing property page UI is for editing **properties of an already-created element**. The user's original request mentioned **"buttons in the palette of that diagram editor"** for creating inputs/outputs in the diagram.
134+
135+
This requires **separate diagram tool registration** (palette buttons), which is distinct from property page UI.
136+
137+
**Status**: Not yet addressed in this session - requires finding Modelio diagram action registration mechanism.
138+
139+
---
140+
141+
## Build Status
142+
143+
Maven build in progress (packaging JAR with fixes).
144+
Expected outcome: ✅ Build should complete successfully with the property page bug fix.
145+
146+
---
147+
148+
## Testing Checklist
149+
150+
- [ ] Maven build completes successfully (Exit Code: 0)
151+
- [ ] Topology template with inputs/outputs exports correctly to YAML
152+
- [ ] Property page correctly validates and adds/removes TParameter inputs
153+
- [ ] Property page correctly validates and adds/removes TParameter outputs (bug fix verification)
154+
- [ ] Export example file with inputs/outputs and verify structure
155+
156+
---
157+
158+
## Implementation Summary
159+
160+
| Component | Status | Location |
161+
|-----------|--------|----------|
162+
| TTopologyTemplate API | ✅ Complete | `api/tosca/standard/class_/TTopologyTemplate.java` |
163+
| Handlebars Template | ✅ Complete | `resources/fr/softeam/templates/TTopologyTemplate.hbs` |
164+
| Property Page UI | ✅ Complete (Bug Fixed) | `handlers/propertypages/topologyTemplate/TTopologyTemplatePropertyPage.java` |
165+
| TNodeTemplate API | ✅ Not Needed | N/A - TOSCA spec compliant (no I/O) |
166+
| Diagram Palette Buttons | ⏳ Not Addressed | Requires separate investigation |
167+
168+
---
169+
170+
## Recommendations
171+
172+
1. **Verify the build** completes successfully with the property page bug fix
173+
2. **Test the topology template inputs/outputs** in the property page UI
174+
3. **Export and validate** YAML output includes inputs/outputs sections
175+
4. **Document to users** that Node Templates correctly do NOT support inputs/outputs per TOSCA v1.3
176+
5. **Optional**: If users need to create inputs/outputs via diagram palette buttons (separate UI feature from property pages), investigate Modelio diagram action registration mechanism
177+
178+
---
179+
180+
## Files Modified in This Session
181+
182+
1. [TTopologyTemplate.hbs](src/main/resources/fr/softeam/templates/TTopologyTemplate.hbs) - Added outputs rendering section
183+
2. [TTopologyTemplatePropertyPage.java](src/main/java/fr/softeam/toscadesigner/handlers/propertypages/topologyTemplate/TTopologyTemplatePropertyPage.java) - Fixed output validation bug (Line 89)
184+

0 commit comments

Comments
 (0)