From cf676728d3fdedc4856aa8fbfa5f7f6bb94275fb Mon Sep 17 00:00:00 2001 From: Andrew Sills Date: Mon, 21 Oct 2024 15:08:00 -0400 Subject: [PATCH] Initial idea for plug interfaces --- orchestration-interfaces/pom.xml | 2 + .../interfaces/plugin/Plugin.java | 8 +++ plugin-impl/.mvn/jvm.config | 0 plugin-impl/.mvn/maven.config | 0 plugin-impl/pom.xml | 24 +++++++++ .../java/dev/ikm/tinkar/plugin/Plugin.java | 25 +++++++++ .../impl/AbstractConceptDetailWidget.java | 7 +++ .../interaction/ApplicationMenuBar.java | 4 ++ .../tinkar/plugin/interaction/BumpOut.java | 5 ++ .../plugin/interaction/DoubleClick.java | 4 ++ .../plugin/interaction/DragAndDrop.java | 4 ++ .../plugin/interaction/JournalCreateMenu.java | 4 ++ .../plugin/interaction/JournalMenuBar.java | 6 +++ .../tinkar/plugin/interaction/RightClick.java | 4 ++ .../dev/ikm/tinkar/plugin/type/Field.java | 6 +++ .../java/dev/ikm/tinkar/plugin/type/Menu.java | 5 ++ .../dev/ikm/tinkar/plugin/type/Style.java | 5 ++ .../java/dev/ikm/tinkar/plugin/type/Task.java | 5 ++ .../dev/ikm/tinkar/plugin/type/Widget.java | 6 +++ .../dev/ikm/tinkar/plugin/type/Window.java | 6 +++ plugin-impl/src/main/java/module-info.java | 9 ++++ .../ikm/tinkar/plugin/test/SimplePlugin.java | 51 +++++++++++++++++++ plugin-impl/src/test/java/module-info.java | 6 +++ pom.xml | 4 +- 24 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 orchestration-interfaces/src/main/java/dev/ikm/orchestration/interfaces/plugin/Plugin.java create mode 100644 plugin-impl/.mvn/jvm.config create mode 100644 plugin-impl/.mvn/maven.config create mode 100644 plugin-impl/pom.xml create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/Plugin.java create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/impl/AbstractConceptDetailWidget.java create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/ApplicationMenuBar.java create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/BumpOut.java create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/DoubleClick.java create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/DragAndDrop.java create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/JournalCreateMenu.java create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/JournalMenuBar.java create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/RightClick.java create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Field.java create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Menu.java create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Style.java create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Task.java create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Widget.java create mode 100644 plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Window.java create mode 100644 plugin-impl/src/main/java/module-info.java create mode 100644 plugin-impl/src/test/java/dev/ikm/tinkar/plugin/test/SimplePlugin.java create mode 100644 plugin-impl/src/test/java/module-info.java diff --git a/orchestration-interfaces/pom.xml b/orchestration-interfaces/pom.xml index ff83131..bcbe478 100644 --- a/orchestration-interfaces/pom.xml +++ b/orchestration-interfaces/pom.xml @@ -28,6 +28,8 @@ ${komet.version} compile + + \ No newline at end of file diff --git a/orchestration-interfaces/src/main/java/dev/ikm/orchestration/interfaces/plugin/Plugin.java b/orchestration-interfaces/src/main/java/dev/ikm/orchestration/interfaces/plugin/Plugin.java new file mode 100644 index 0000000..b2b2e3e --- /dev/null +++ b/orchestration-interfaces/src/main/java/dev/ikm/orchestration/interfaces/plugin/Plugin.java @@ -0,0 +1,8 @@ +package dev.ikm.orchestration.interfaces.plugin; + +import java.util.UUID; + +public interface Plugin { + + +} diff --git a/plugin-impl/.mvn/jvm.config b/plugin-impl/.mvn/jvm.config new file mode 100644 index 0000000..e69de29 diff --git a/plugin-impl/.mvn/maven.config b/plugin-impl/.mvn/maven.config new file mode 100644 index 0000000..e69de29 diff --git a/plugin-impl/pom.xml b/plugin-impl/pom.xml new file mode 100644 index 0000000..dca8102 --- /dev/null +++ b/plugin-impl/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + + dev.ikm + ikm-framework + 3.0.1-SNAPSHOT + + + plugin-impl + + plugin-impl + + http://www.example.com + + + + dev.ikm.komet + framework + 1.37.0-SNAPSHOT + + + diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/Plugin.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/Plugin.java new file mode 100644 index 0000000..0466ead --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/Plugin.java @@ -0,0 +1,25 @@ +package dev.ikm.tinkar.plugin; + +import dev.ikm.komet.framework.events.EvtBus; +import dev.ikm.komet.framework.events.EvtType; +import dev.ikm.komet.preferences.KometPreferences; + +import java.util.List; +import java.util.UUID; + + +public interface Plugin { + + UUID getId(); + + String getName(); + + void reconstruct(KometPreferences kometPreferences); + + void register(EvtBus evtBus); + + void registerTopics(EvtBus evtBus); + + void unregister(EvtBus evtBus); + +} diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/impl/AbstractConceptDetailWidget.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/impl/AbstractConceptDetailWidget.java new file mode 100644 index 0000000..082067b --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/impl/AbstractConceptDetailWidget.java @@ -0,0 +1,7 @@ +package dev.ikm.tinkar.plugin.impl; + +import dev.ikm.tinkar.plugin.type.Widget; + +@Widget +public class AbstractConceptDetailWidget { +} diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/ApplicationMenuBar.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/ApplicationMenuBar.java new file mode 100644 index 0000000..860e6e7 --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/ApplicationMenuBar.java @@ -0,0 +1,4 @@ +package dev.ikm.tinkar.plugin.interaction; + +public @interface ApplicationMenuBar { +} diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/BumpOut.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/BumpOut.java new file mode 100644 index 0000000..9b710aa --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/BumpOut.java @@ -0,0 +1,5 @@ +package dev.ikm.tinkar.plugin.interaction; + +public @interface BumpOut { + String iconPath() default ""; +} diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/DoubleClick.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/DoubleClick.java new file mode 100644 index 0000000..3dee46d --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/DoubleClick.java @@ -0,0 +1,4 @@ +package dev.ikm.tinkar.plugin.interaction; + +public @interface DoubleClick { +} diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/DragAndDrop.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/DragAndDrop.java new file mode 100644 index 0000000..42ef87a --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/DragAndDrop.java @@ -0,0 +1,4 @@ +package dev.ikm.tinkar.plugin.interaction; + +public @interface DragAndDrop { +} diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/JournalCreateMenu.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/JournalCreateMenu.java new file mode 100644 index 0000000..a37dabf --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/JournalCreateMenu.java @@ -0,0 +1,4 @@ +package dev.ikm.tinkar.plugin.interaction; + +public @interface JournalCreateMenu { +} diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/JournalMenuBar.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/JournalMenuBar.java new file mode 100644 index 0000000..764faba --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/JournalMenuBar.java @@ -0,0 +1,6 @@ +package dev.ikm.tinkar.plugin.interaction; + +public @interface JournalMenuBar { + String iconPath() default ""; + +} diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/RightClick.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/RightClick.java new file mode 100644 index 0000000..3923d88 --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/interaction/RightClick.java @@ -0,0 +1,4 @@ +package dev.ikm.tinkar.plugin.interaction; + +public @interface RightClick { +} diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Field.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Field.java new file mode 100644 index 0000000..117a296 --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Field.java @@ -0,0 +1,6 @@ +package dev.ikm.tinkar.plugin.type; + +public @interface Field { + String fxml() default ""; + +} diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Menu.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Menu.java new file mode 100644 index 0000000..b84b39f --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Menu.java @@ -0,0 +1,5 @@ +package dev.ikm.tinkar.plugin.type; + +public @interface Menu { + +} diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Style.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Style.java new file mode 100644 index 0000000..32cadf6 --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Style.java @@ -0,0 +1,5 @@ +package dev.ikm.tinkar.plugin.type; + +public @interface Style { + +} diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Task.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Task.java new file mode 100644 index 0000000..d6da7c6 --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Task.java @@ -0,0 +1,5 @@ +package dev.ikm.tinkar.plugin.type; + +public @interface Task { + +} diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Widget.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Widget.java new file mode 100644 index 0000000..2c6c5f3 --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Widget.java @@ -0,0 +1,6 @@ +package dev.ikm.tinkar.plugin.type; + +public @interface Widget { + String icon() default ""; + +} diff --git a/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Window.java b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Window.java new file mode 100644 index 0000000..8ce2ea2 --- /dev/null +++ b/plugin-impl/src/main/java/dev/ikm/tinkar/plugin/type/Window.java @@ -0,0 +1,6 @@ +package dev.ikm.tinkar.plugin.type; + +public @interface Window { + String icon() default ""; + +} diff --git a/plugin-impl/src/main/java/module-info.java b/plugin-impl/src/main/java/module-info.java new file mode 100644 index 0000000..192efa3 --- /dev/null +++ b/plugin-impl/src/main/java/module-info.java @@ -0,0 +1,9 @@ +module dev.ikm.tinkar.plugin { + requires dev.ikm.komet.framework; + + exports dev.ikm.tinkar.plugin; + exports dev.ikm.tinkar.plugin.interaction; + exports dev.ikm.tinkar.plugin.impl; + exports dev.ikm.tinkar.plugin.type; + +} \ No newline at end of file diff --git a/plugin-impl/src/test/java/dev/ikm/tinkar/plugin/test/SimplePlugin.java b/plugin-impl/src/test/java/dev/ikm/tinkar/plugin/test/SimplePlugin.java new file mode 100644 index 0000000..7927f3b --- /dev/null +++ b/plugin-impl/src/test/java/dev/ikm/tinkar/plugin/test/SimplePlugin.java @@ -0,0 +1,51 @@ +package dev.ikm.tinkar.plugin.test; + +import dev.ikm.komet.framework.events.EvtBus; +import dev.ikm.komet.framework.events.EvtType; +import dev.ikm.komet.preferences.KometPreferences; +import dev.ikm.tinkar.plugin.Plugin; +import dev.ikm.tinkar.plugin.interaction.ApplicationMenuBar; +import dev.ikm.tinkar.plugin.interaction.BumpOut; +import dev.ikm.tinkar.plugin.type.Widget; + +import java.util.List; +import java.util.UUID; + +@Widget +@BumpOut +@ApplicationMenuBar //TODO - with menu bar are we owning interconnection of plugins (i think no) +public class SimplePlugin implements Plugin { + + private static final String PLUGIN_NAME = "SimplePlugin"; + private static final UUID PLUGIN_ID = UUID.randomUUID(); + + @Override + public UUID getId() { + return PLUGIN_ID; + } + + @Override + public String getName() { + return PLUGIN_NAME; + } + + @Override + public void reconstruct(KometPreferences kometPreferences) { + + } + + @Override + public void register(EvtBus evtBus) { + evtBus.subscribe(null, null, null); + } + + @Override + public void unregister(EvtBus evtBus) { + evtBus.unsubscribe(null, null, null); + } + + @Override + public void registerTopics(EvtBus evtBus) { + + } +} diff --git a/plugin-impl/src/test/java/module-info.java b/plugin-impl/src/test/java/module-info.java new file mode 100644 index 0000000..2fab022 --- /dev/null +++ b/plugin-impl/src/test/java/module-info.java @@ -0,0 +1,6 @@ +module dev.ikm.tinkar.plugin.test { + + requires dev.ikm.tinkar.plugin; + requires dev.ikm.komet.framework; + +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 766539a..1fe8b5f 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,7 @@ 3.0.0-beta2 21 2.0.13 - 1.34.0-SNAPSHOT + 1.37.0-SNAPSHOT 1.65.0 6.10.0.202406032230-r-r5 @@ -37,5 +37,7 @@ to modules that are plugins, but not dependencies (plugins are transparent to the build order) --> komet-orchestrator + plugin-impl + \ No newline at end of file