Updated Plugin-API version as it has recived updates since 0.1.0, but yet dine to be in 1.0 release
build / build (push) Has been cancelled

Updeaded the RPCP loader to use JarFile instead of a virtual FS

Signed-off-by: zacharias <alienfromdia@proton.me>
This commit is contained in:
2026-06-16 17:58:33 +02:00
parent b74c5e9e97
commit fcbb405a2e
3 changed files with 11 additions and 6 deletions
@@ -849,7 +849,7 @@ public class Core {
pluginJsonData.append(tmp);
}
JSONObject pluginJson = new JSONObject(pluginJsonData.toString());
LoadedPlugin plugin = loader.loadPlugin(pluginJson, file.toPath(), data);
LoadedPlugin plugin = loader.loadPlugin(pluginJson, jar, file.toPath(), data);
data.addPlugin(plugin);
@@ -28,6 +28,8 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import static me.neurodock.plugin.Plugin.UNKNOWN_PLUGIN;
@@ -79,7 +81,9 @@ public class Loader {
@Override
public String toString() {
// Replaces the toString which is used thru out the Core and OllamaObject to get the JSON representation of a Function Tool
// Replaces the toString which is used throughout the Core and OllamaObject to get the JSON representation of a Function Tool
// Ideally the toString method SHULD NOT be used like this, while yes a JSON representation is better than a Java Hash representation
// the toString should not be utilized or overwritten in this manner
return tool.getToolJSON();
}
});
@@ -89,13 +93,13 @@ public class Loader {
}
public LoadedPlugin loadPlugin(JSONObject pluginJson, Path pluginJar, Data data) {
public LoadedPlugin loadPlugin(JSONObject pluginJson, JarFile jar, Path pluginJar, Data data) {
if(!pluginJson.has("name") || !(pluginJson.get("name") instanceof String pluginName))
throw new PluginLoadingException("Malformed plugin json", UNKNOWN_PLUGIN);
if(!pluginJson.has("entryPoint") || !(pluginJson.get("entryPoint") instanceof String pluginEntryPoint))
throw new PluginLoadingException("Malformed plugin json", pluginName);
Path pluginEntryPointFile = fs.getPath("/"+pluginEntryPoint.replaceAll("\\.", "/")+".class");
if(!Files.exists(pluginEntryPointFile)) throw new PluginLoadingException("Missing plugin entrypoint", pluginName);
JarEntry entry = jar.getJarEntry(pluginEntryPoint.replaceAll("\\.", "/"));
if(entry == null) throw new PluginLoadingException("Missing plugin entrypoint", pluginName);
Plugin plugin = null;
URLClassLoader classLoader;
+2 -1
View File
@@ -2,7 +2,7 @@ plugins {
id 'java-library'
}
version = '0.1.0'
version = '0.1.2'
repositories {
mavenCentral()
@@ -12,6 +12,7 @@ dependencies {
implementation 'io.github.classgraph:classgraph:4.8.184'
api "org.json:json:20250107"
api "org.jetbrains:annotations:23.1.0"
testImplementation platform('org.junit:junit-bom:6.0.0')