diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-01-23 12:09:30 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-01-23 12:09:30 +0100 |
| commit | 8256917551c259df2b7e69e32cd74497e5394786 (patch) | |
| tree | 068ec6e5acf41aabeb1538c6731c8e8f70d1ddb1 /src/main/java/com/c2kernel/process/resource/ResourceLoader.java | |
| parent | 428d828ca640d1348979f9982d1c0bc0a489a3b4 (diff) | |
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
Diffstat (limited to 'src/main/java/com/c2kernel/process/resource/ResourceLoader.java')
| -rw-r--r-- | src/main/java/com/c2kernel/process/resource/ResourceLoader.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/main/java/com/c2kernel/process/resource/ResourceLoader.java b/src/main/java/com/c2kernel/process/resource/ResourceLoader.java new file mode 100644 index 0000000..fdf2508 --- /dev/null +++ b/src/main/java/com/c2kernel/process/resource/ResourceLoader.java @@ -0,0 +1,41 @@ +package com.c2kernel.process.resource;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+
+import com.c2kernel.common.InvalidDataException;
+import com.c2kernel.common.ObjectNotFoundException;
+
+public interface ResourceLoader {
+
+ public URL getKernelBaseURL();
+
+ public URL getKernelResourceURL(String resName)
+ throws MalformedURLException;
+
+ public void addModuleBaseURL(String ns, URL newBaseURL);
+
+ public void addModuleBaseURL(String ns, String newBaseURL)
+ throws InvalidDataException;
+
+ public HashMap<String, URL> getModuleBaseURLs();
+
+ public URL getModuleResourceURL(String ns, String resName)
+ throws MalformedURLException;
+
+ /**************************************************************************
+ * Gets any text resource files
+ **************************************************************************/
+
+ public String findTextResource(String resName);
+
+ public HashMap<String, String> getAllTextResources(String resName);
+
+ public String getTextResource(String ns, String resName)
+ throws ObjectNotFoundException;
+
+ public Class<?> getClassForName(String name)
+ throws ClassNotFoundException;
+
+}
\ No newline at end of file |
