-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSysMLv2Plugin.java
More file actions
65 lines (55 loc) · 1.86 KB
/
SysMLv2Plugin.java
File metadata and controls
65 lines (55 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package org.openmbee.flexo.sysmlv2.plugin;
import org.openmbee.flexo.cli.plugin.FlexoPlugin;
import org.openmbee.flexo.cli.plugin.PluginContext;
import org.openmbee.flexo.sysmlv2.plugin.commands.SysMLCommand;
import picocli.CommandLine.Model.CommandSpec;
/**
* SysML v2 Plugin for Flexo CLI
*
* Provides commands for interacting with SysML v2 API services:
* - Project management
* - Element operations
* - Branch/commit operations
* - Query execution
* - Tag management
* - Relationship navigation
*/
public class SysMLv2Plugin implements FlexoPlugin {
private PluginContext context;
@Override
public String getName() {
return "sysml";
}
@Override
public String getDescription() {
return "SysML v2 API operations";
}
@Override
public String getVersion() {
return "1.0.0";
}
@Override
public void initialize(PluginContext context) {
this.context = context;
}
@Override
public CommandSpec getCommand() {
SysMLCommand cmd = new SysMLCommand();
cmd.setContext(context);
CommandSpec spec = CommandSpec.forAnnotatedObject(cmd);
// Propagate context to all subcommands
propagateContextToSubcommands(spec);
return spec;
}
private void propagateContextToSubcommands(CommandSpec spec) {
for (picocli.CommandLine subcommandLine : spec.subcommands().values()) {
CommandSpec subcommand = subcommandLine.getCommandSpec();
Object userObject = subcommand.userObject();
if (userObject instanceof org.openmbee.flexo.cli.plugin.PluginCommand) {
((org.openmbee.flexo.cli.plugin.PluginCommand) userObject).setContext(context);
}
// Recursively propagate to nested subcommands
propagateContextToSubcommands(subcommand);
}
}
}