diff --git a/configure/etc/conf/plugins.properties b/configure/etc/conf/plugins.properties
index c9a4a912..a6db4469 100644
--- a/configure/etc/conf/plugins.properties
+++ b/configure/etc/conf/plugins.properties
@@ -1 +1,2 @@
-datacap-plugin-mysql=plugin/datacap-plugin-mysql/pom.xml
\ No newline at end of file
+datacap-plugin-mysql=plugin/datacap-plugin-mysql/pom.xml
+datacap-convert-txt=convert/datacap-convert-txt/pom.xml
\ No newline at end of file
diff --git a/convert/datacap-convert-spi/pom.xml b/convert/datacap-convert-spi/pom.xml
index 1798d7c3..89d1374e 100644
--- a/convert/datacap-convert-spi/pom.xml
+++ b/convert/datacap-convert-spi/pom.xml
@@ -30,6 +30,11 @@
io.edurt.datacap
datacap-common
+
+ io.edurt.datacap
+ datacap-plugin
+ ${project.version}
+
diff --git a/convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/ConvertFilter.kt b/convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/ConvertFilter.kt
index 96a53e67..709cb437 100644
--- a/convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/ConvertFilter.kt
+++ b/convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/ConvertFilter.kt
@@ -1,8 +1,6 @@
package io.edurt.datacap.convert
-import com.google.inject.Injector
-import com.google.inject.Key
-import com.google.inject.TypeLiteral
+import io.edurt.datacap.plugin.PluginManager
import java.util.*
object ConvertFilter
@@ -10,17 +8,14 @@ object ConvertFilter
/**
* Finds a file in the injector by name.
*
- * @param injector the injector to search in
+ * @param pluginManager PluginManager
* @param name the name of the file to find
* @return an Optional containing the found File, or an empty Optional if not found
*/
@JvmStatic
- fun filter(injector: Injector, name: String): Optional
+ fun filter(pluginManager: PluginManager, name: String): Optional
{
- return injector.getInstance(Key.get(object : TypeLiteral>()
- {}))
- .stream()
- .filter { it.name() == name }
- .findFirst()
+ return pluginManager.getPlugin(name)
+ .map { it.getService(ConvertService::class.java) }
}
}
diff --git a/convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/ConvertManager.kt b/convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/ConvertManager.kt
deleted file mode 100644
index baaa7f3b..00000000
--- a/convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/ConvertManager.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package io.edurt.datacap.convert
-
-import com.google.inject.AbstractModule
-import io.edurt.datacap.common.utils.DateUtils
-import org.slf4j.Logger
-import org.slf4j.LoggerFactory.getLogger
-import java.util.*
-
-class ConvertManager : AbstractModule()
-{
- private val log: Logger = getLogger(ConvertManager::class.java)
- private var externalModules: Iterable = ServiceLoader.load(ConvertModule::class.java)
-
- override fun configure()
- {
- log.info("========== Loading convert start ==========")
- externalModules.forEach { module ->
- log.info("Installing convert [ {} ] join time [ {} ]", module.name(), DateUtils.formatYMDHMSWithInterval())
- install(module)
- }
- log.info("========== Loading convert end ==========")
- }
-}
diff --git a/convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/ConvertModule.kt b/convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/ConvertModule.kt
deleted file mode 100644
index b2192c09..00000000
--- a/convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/ConvertModule.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package io.edurt.datacap.convert
-
-import com.google.inject.AbstractModule
-
-abstract class ConvertModule : AbstractModule()
-{
- fun name(): String = this.javaClass
- .simpleName
- .removeSuffix("Convert")
- .removeSuffix("Module")
-}
diff --git a/convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/Convert.kt b/convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/ConvertService.kt
similarity index 89%
rename from convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/Convert.kt
rename to convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/ConvertService.kt
index 875acc19..bffae8e7 100644
--- a/convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/Convert.kt
+++ b/convert/datacap-convert-spi/src/main/kotlin/io/edurt/datacap/convert/ConvertService.kt
@@ -2,8 +2,9 @@ package io.edurt.datacap.convert
import io.edurt.datacap.convert.model.ConvertRequest
import io.edurt.datacap.convert.model.ConvertResponse
+import io.edurt.datacap.plugin.Service
-interface Convert
+interface ConvertService : Service
{
fun name(): String
{
diff --git a/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/ConvertFilterTest.kt b/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/ConvertServiceFilterTest.kt
similarity index 91%
rename from convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/ConvertFilterTest.kt
rename to convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/ConvertServiceFilterTest.kt
index 9628a87e..bcf6d4d7 100644
--- a/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/ConvertFilterTest.kt
+++ b/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/ConvertServiceFilterTest.kt
@@ -4,7 +4,7 @@ import com.google.inject.Guice
import org.junit.Assert
import org.junit.Test
-class ConvertFilterTest
+class ConvertServiceFilterTest
{
private val injector = Guice.createInjector(ConvertManager())
diff --git a/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/ConvertModuleTest.kt b/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/ConvertServiceModuleTest.kt
similarity index 91%
rename from convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/ConvertModuleTest.kt
rename to convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/ConvertServiceModuleTest.kt
index a377c672..f3f6fad5 100644
--- a/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/ConvertModuleTest.kt
+++ b/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/ConvertServiceModuleTest.kt
@@ -7,14 +7,14 @@ import com.google.inject.TypeLiteral
import org.junit.Assert
import org.junit.Test
-class ConvertModuleTest
+class ConvertServiceModuleTest
{
private val injector: Injector = Guice.createInjector(ConvertManager())
@Test
fun test()
{
- injector.getInstance(Key.get(object : TypeLiteral>()
+ injector.getInstance(Key.get(object : TypeLiteral>()
{}))
.stream()
.findFirst()
diff --git a/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/TestConvertModule.kt b/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/TestConvertModule.kt
index 934e0530..b74f8259 100644
--- a/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/TestConvertModule.kt
+++ b/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/TestConvertModule.kt
@@ -6,8 +6,8 @@ class TestConvertModule : ConvertModule()
{
override fun configure()
{
- Multibinder.newSetBinder(this.binder(), Convert::class.java)
+ Multibinder.newSetBinder(this.binder(), ConvertService::class.java)
.addBinding()
- .to(TestConvert::class.java)
+ .to(TestConvertService::class.java)
}
}
diff --git a/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/TestConvert.kt b/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/TestConvertService.kt
similarity index 93%
rename from convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/TestConvert.kt
rename to convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/TestConvertService.kt
index 07e8cefe..9a4992cd 100644
--- a/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/TestConvert.kt
+++ b/convert/datacap-convert-spi/src/test/kotlin/io/edurt/datacap/convert/TestConvertService.kt
@@ -3,7 +3,7 @@ package io.edurt.datacap.convert
import io.edurt.datacap.convert.model.ConvertRequest
import io.edurt.datacap.convert.model.ConvertResponse
-class TestConvert : Convert
+class TestConvertService : ConvertService
{
override fun format(request: ConvertRequest): ConvertResponse
{
diff --git a/convert/datacap-convert-txt/src/main/kotlin/io/edurt/datacap/convert/TxtPlugin.kt b/convert/datacap-convert-txt/src/main/kotlin/io/edurt/datacap/convert/TxtPlugin.kt
new file mode 100644
index 00000000..63151320
--- /dev/null
+++ b/convert/datacap-convert-txt/src/main/kotlin/io/edurt/datacap/convert/TxtPlugin.kt
@@ -0,0 +1,5 @@
+package io.edurt.datacap.convert
+
+import io.edurt.datacap.plugin.Plugin
+
+class TxtPlugin : Plugin()
diff --git a/convert/datacap-convert-txt/src/main/kotlin/io/edurt/datacap/convert/txt/TxtConvert.kt b/convert/datacap-convert-txt/src/main/kotlin/io/edurt/datacap/convert/TxtService.kt
similarity index 98%
rename from convert/datacap-convert-txt/src/main/kotlin/io/edurt/datacap/convert/txt/TxtConvert.kt
rename to convert/datacap-convert-txt/src/main/kotlin/io/edurt/datacap/convert/TxtService.kt
index f673d311..5e45fdf2 100644
--- a/convert/datacap-convert-txt/src/main/kotlin/io/edurt/datacap/convert/txt/TxtConvert.kt
+++ b/convert/datacap-convert-txt/src/main/kotlin/io/edurt/datacap/convert/TxtService.kt
@@ -1,10 +1,8 @@
-package io.edurt.datacap.convert.txt
+package io.edurt.datacap.convert
import com.google.common.base.Preconditions.checkArgument
import com.google.common.base.Preconditions.checkState
import io.edurt.datacap.common.utils.DateUtils
-import io.edurt.datacap.convert.Convert
-import io.edurt.datacap.convert.FileConvert
import io.edurt.datacap.convert.model.ConvertRequest
import io.edurt.datacap.convert.model.ConvertResponse
import org.apache.commons.io.FileUtils
@@ -15,7 +13,7 @@ import java.io.IOException
import java.io.InputStreamReader
import java.util.Objects.requireNonNull
-class TxtConvert : Convert
+class TxtService : ConvertService
{
private val log = getLogger(this::class.java)
diff --git a/convert/datacap-convert-txt/src/main/kotlin/io/edurt/datacap/convert/txt/TxtModule.kt b/convert/datacap-convert-txt/src/main/kotlin/io/edurt/datacap/convert/txt/TxtModule.kt
deleted file mode 100644
index 252a35f9..00000000
--- a/convert/datacap-convert-txt/src/main/kotlin/io/edurt/datacap/convert/txt/TxtModule.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package io.edurt.datacap.convert.txt
-
-import com.google.inject.multibindings.Multibinder
-import io.edurt.datacap.convert.Convert
-import io.edurt.datacap.convert.ConvertModule
-
-class TxtModule : ConvertModule()
-{
- override fun configure()
- {
- Multibinder.newSetBinder(this.binder(), Convert::class.java)
- .addBinding()
- .to(TxtConvert::class.java)
- }
-}
diff --git a/convert/datacap-convert-txt/src/main/resources/META-INF/services/io.edurt.datacap.convert.ConvertModule b/convert/datacap-convert-txt/src/main/resources/META-INF/services/io.edurt.datacap.convert.ConvertModule
deleted file mode 100644
index de0ac4df..00000000
--- a/convert/datacap-convert-txt/src/main/resources/META-INF/services/io.edurt.datacap.convert.ConvertModule
+++ /dev/null
@@ -1 +0,0 @@
-io.edurt.datacap.convert.txt.TxtModule
diff --git a/convert/datacap-convert-txt/src/main/resources/META-INF/services/io.edurt.datacap.plugin.Plugin b/convert/datacap-convert-txt/src/main/resources/META-INF/services/io.edurt.datacap.plugin.Plugin
new file mode 100644
index 00000000..b78a5790
--- /dev/null
+++ b/convert/datacap-convert-txt/src/main/resources/META-INF/services/io.edurt.datacap.plugin.Plugin
@@ -0,0 +1 @@
+io.edurt.datacap.convert.TxtPlugin
\ No newline at end of file
diff --git a/convert/datacap-convert-txt/src/main/resources/META-INF/services/io.edurt.datacap.plugin.Service b/convert/datacap-convert-txt/src/main/resources/META-INF/services/io.edurt.datacap.plugin.Service
new file mode 100644
index 00000000..da99f920
--- /dev/null
+++ b/convert/datacap-convert-txt/src/main/resources/META-INF/services/io.edurt.datacap.plugin.Service
@@ -0,0 +1 @@
+io.edurt.datacap.convert.TxtService
\ No newline at end of file
diff --git a/convert/datacap-convert-txt/src/test/kotlin/io/edurt/datacap/convert/txt/TxtConvertTest.kt b/convert/datacap-convert-txt/src/test/kotlin/io/edurt/datacap/convert/TxtConvertTest.kt
similarity index 99%
rename from convert/datacap-convert-txt/src/test/kotlin/io/edurt/datacap/convert/txt/TxtConvertTest.kt
rename to convert/datacap-convert-txt/src/test/kotlin/io/edurt/datacap/convert/TxtConvertTest.kt
index edbf59ad..0a492459 100644
--- a/convert/datacap-convert-txt/src/test/kotlin/io/edurt/datacap/convert/txt/TxtConvertTest.kt
+++ b/convert/datacap-convert-txt/src/test/kotlin/io/edurt/datacap/convert/TxtConvertTest.kt
@@ -1,4 +1,4 @@
-package io.edurt.datacap.convert.txt
+package io.edurt.datacap.convert
import com.google.inject.Guice
import com.google.inject.Injector
diff --git a/convert/datacap-convert-txt/src/test/kotlin/io/edurt/datacap/convert/txt/TxtModuleTest.kt b/convert/datacap-convert-txt/src/test/kotlin/io/edurt/datacap/convert/TxtModuleTest.kt
similarity index 94%
rename from convert/datacap-convert-txt/src/test/kotlin/io/edurt/datacap/convert/txt/TxtModuleTest.kt
rename to convert/datacap-convert-txt/src/test/kotlin/io/edurt/datacap/convert/TxtModuleTest.kt
index b5ae8091..e5c24b97 100644
--- a/convert/datacap-convert-txt/src/test/kotlin/io/edurt/datacap/convert/txt/TxtModuleTest.kt
+++ b/convert/datacap-convert-txt/src/test/kotlin/io/edurt/datacap/convert/TxtModuleTest.kt
@@ -1,4 +1,4 @@
-package io.edurt.datacap.convert.txt
+package io.edurt.datacap.convert
import com.google.inject.Guice
import com.google.inject.Injector
diff --git a/core/datacap-common/pom.xml b/core/datacap-common/pom.xml
index 82da5f2f..a27d5ef6 100644
--- a/core/datacap-common/pom.xml
+++ b/core/datacap-common/pom.xml
@@ -50,16 +50,6 @@
datacap-captcha
${project.version}
-
- io.edurt.datacap
- datacap-fs-spi
- ${project.version}
-
-
- io.edurt.datacap
- datacap-scheduler-spi
- ${project.version}
-
diff --git a/core/datacap-common/src/main/java/io/edurt/datacap/common/utils/SpiUtils.java b/core/datacap-common/src/main/java/io/edurt/datacap/common/utils/SpiUtils.java
deleted file mode 100644
index 956f7ffa..00000000
--- a/core/datacap-common/src/main/java/io/edurt/datacap/common/utils/SpiUtils.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package io.edurt.datacap.common.utils;
-
-import com.google.inject.Injector;
-import com.google.inject.Key;
-import com.google.inject.TypeLiteral;
-import io.edurt.datacap.fs.Fs;
-import io.edurt.datacap.scheduler.Scheduler;
-
-import java.util.Optional;
-import java.util.Set;
-
-public class SpiUtils
-{
- private SpiUtils()
- {
- }
-
- /**
- * Finds a specific Fs object by name.
- *
- * @param injector the injector used for dependency injection
- * @param name the name of the Fs object to find
- * @return an Optional containing the found Fs object, or an empty Optional if not found
- */
- public static Optional findFs(Injector injector, String name)
- {
- Optional optionalFs = injector.getInstance(Key.get(new TypeLiteral>() {}))
- .stream()
- .filter(item -> item.name().equalsIgnoreCase(name))
- .findFirst();
- return optionalFs;
- }
-
- /**
- * Finds a schedule in the injector by name.
- *
- * @param injector the injector to search in
- * @param name the name of the schedule to find
- * @return an Optional containing the found Scheduler, or an empty Optional if not found
- */
- public static Optional findSchedule(Injector injector, String name)
- {
- return injector.getInstance(Key.get(new TypeLiteral>() {}))
- .stream()
- .filter(item -> item.name().equalsIgnoreCase(name))
- .findFirst();
- }
-}
diff --git a/core/datacap-plugin/src/main/java/io/edurt/datacap/plugin/PluginType.java b/core/datacap-plugin/src/main/java/io/edurt/datacap/plugin/PluginType.java
index 5258c0cf..d134e704 100644
--- a/core/datacap-plugin/src/main/java/io/edurt/datacap/plugin/PluginType.java
+++ b/core/datacap-plugin/src/main/java/io/edurt/datacap/plugin/PluginType.java
@@ -2,7 +2,9 @@ package io.edurt.datacap.plugin;
public enum PluginType
{
- CONNECTOR("Connector");
+ CONNECTOR("Connector"),
+ EXECUTOR("Executor"),
+ SCHEDULER("Scheduler");
private String name;
diff --git a/core/datacap-plugin/src/main/java/io/edurt/datacap/plugin/utils/PluginPathUtils.java b/core/datacap-plugin/src/main/java/io/edurt/datacap/plugin/utils/PluginPathUtils.java
index 0503c2a5..cef1e5fb 100644
--- a/core/datacap-plugin/src/main/java/io/edurt/datacap/plugin/utils/PluginPathUtils.java
+++ b/core/datacap-plugin/src/main/java/io/edurt/datacap/plugin/utils/PluginPathUtils.java
@@ -250,4 +250,18 @@ public class PluginPathUtils
return Optional.empty();
}
}
+
+ /**
+ * 安全地将子路径添加到项目根目录
+ * Safely append a sub-path to the project root directory
+ *
+ * @param subPath 要添加的子路径
+ * @return 组合后的路径
+ */
+ public static Path appendPath(String subPath)
+ {
+ Path root = findProjectRoot();
+ String safePath = subPath.startsWith("/") ? subPath.substring(1) : subPath;
+ return root.resolve(safePath);
+ }
}
diff --git a/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/DataSetController.java b/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/DataSetController.java
index 8973a795..7cbaf161 100644
--- a/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/DataSetController.java
+++ b/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/DataSetController.java
@@ -1,6 +1,7 @@
package io.edurt.datacap.server.controller;
import io.edurt.datacap.common.response.CommonResponse;
+import io.edurt.datacap.plugin.PluginMetadata;
import io.edurt.datacap.service.body.FilterBody;
import io.edurt.datacap.service.body.adhoc.Adhoc;
import io.edurt.datacap.service.entity.DataSetColumnEntity;
@@ -78,7 +79,7 @@ public class DataSetController
}
@GetMapping(value = "getActuators")
- public CommonResponse> getActuators()
+ public CommonResponse> getActuators()
{
return service.getActuators();
}
diff --git a/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/PluginController.java b/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/PluginController.java
index d6b19414..ff419428 100644
--- a/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/PluginController.java
+++ b/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/PluginController.java
@@ -5,11 +5,11 @@ import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.TypeLiteral;
import io.edurt.datacap.common.response.CommonResponse;
-import io.edurt.datacap.executor.Executor;
+import io.edurt.datacap.executor.ExecutorService;
import io.edurt.datacap.plugin.PluginManager;
import io.edurt.datacap.plugin.PluginMetadata;
import io.edurt.datacap.plugin.PluginType;
-import io.edurt.datacap.scheduler.Scheduler;
+import io.edurt.datacap.scheduler.SchedulerService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -37,15 +37,15 @@ public class PluginController
public CommonResponse