From 8256917551c259df2b7e69e32cd74497e5394786 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Thu, 23 Jan 2014 12:09:30 +0100 Subject: Refactored Resource into a new ResourceLoader interface, which allows CRISTAL processes in other enviroments with complex class loading (e.g. OSGi) to supply their own resource and class loader to the kernel and its modules. Fixes #149 --- src/main/java/com/c2kernel/scripting/Script.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/main/java/com/c2kernel/scripting/Script.java') diff --git a/src/main/java/com/c2kernel/scripting/Script.java b/src/main/java/com/c2kernel/scripting/Script.java index 9166e2e..e3b4478 100644 --- a/src/main/java/com/c2kernel/scripting/Script.java +++ b/src/main/java/com/c2kernel/scripting/Script.java @@ -29,7 +29,6 @@ import com.c2kernel.entity.proxy.ItemProxy; import com.c2kernel.process.Gateway; import com.c2kernel.utils.LocalObjectLoader; import com.c2kernel.utils.Logger; -import com.c2kernel.utils.Resource; /************************************************************************** * @@ -159,7 +158,7 @@ public class Script PrintWriter output = new PrintWriter(out); context.setWriter(output); context.setErrorWriter(output); - HashMap consoleScripts = Resource.getAllTextResources("textFiles/consoleScript."+lang+".txt"); + HashMap consoleScripts = Gateway.getResource().getAllTextResources("textFiles/consoleScript."+lang+".txt"); for (String ns : consoleScripts.keySet()) { try { engine.put(ScriptEngine.FILENAME, ns+" init script"); @@ -305,7 +304,7 @@ public class Script { try { - addInputParam(name, Class.forName(type)); + addInputParam(name, Gateway.getResource().getClassForName(type)); } catch (ClassNotFoundException ex) { @@ -351,7 +350,7 @@ public class Script { try { - addOutput(name, Class.forName(type)); + addOutput(name, Gateway.getResource().getClassForName(type)); } catch (ClassNotFoundException ex) { throw new ParameterException("Output parameter " + name + " specifies class " + type + " which was not found."); -- cgit v1.2.3