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/process/Bootstrap.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/c2kernel/process/Bootstrap.java') diff --git a/src/main/java/com/c2kernel/process/Bootstrap.java b/src/main/java/com/c2kernel/process/Bootstrap.java index 51b98b0..5f23261 100644 --- a/src/main/java/com/c2kernel/process/Bootstrap.java +++ b/src/main/java/com/c2kernel/process/Bootstrap.java @@ -34,7 +34,6 @@ import com.c2kernel.property.PropertyDescriptionList; import com.c2kernel.utils.FileStringUtility; import com.c2kernel.utils.LocalObjectLoader; import com.c2kernel.utils.Logger; -import com.c2kernel.utils.Resource; /** * @version $Revision: 1.25 $ $Date: 2006/01/10 09:48:32 $ @@ -86,7 +85,7 @@ public class Bootstrap public static void verifyBootDataItems() throws Exception { String bootItems; Logger.msg(1, "Verifying kernel boot items"); - bootItems = FileStringUtility.url2String(Resource.getKernelResourceURL("boot/allbootitems.txt")); + bootItems = FileStringUtility.url2String(Gateway.getResource().getKernelResourceURL("boot/allbootitems.txt")); verifyBootDataItems(bootItems, null, true); Logger.msg(1, "Boot data items complete"); } @@ -99,7 +98,7 @@ public class Bootstrap String itemType = thisItem.substring(0,delim); String itemName = thisItem.substring(delim+1); try { - String data = Resource.getTextResource(ns, "boot/"+thisItem+(itemType.equals("OD")?".xsd":".xml")); + String data = Gateway.getResource().getTextResource(ns, "boot/"+thisItem+(itemType.equals("OD")?".xsd":".xml")); if (data == null) Logger.die("No data found for "+getDataType(itemType)+" "+itemName); verifyResource(ns, itemName, 0, itemType, data, reset); @@ -169,7 +168,7 @@ public class Bootstrap */ private static ItemProxy createResourceItem(String itemType, String itemName, String ns) throws Exception { // create props - PropertyDescriptionList pdList = (PropertyDescriptionList)Gateway.getMarshaller().unmarshall(Resource.getTextResource(null, "boot/property/"+itemType+"Prop.xml")); + PropertyDescriptionList pdList = (PropertyDescriptionList)Gateway.getMarshaller().unmarshall(Gateway.getResource().getTextResource(null, "boot/property/"+itemType+"Prop.xml")); PropertyArrayList props = new PropertyArrayList(); for (int i = 0; i < pdList.list.size(); i++) { PropertyDescription pd = pdList.list.get(i); @@ -300,7 +299,7 @@ public class Bootstrap } Gateway.getStorage().put(serverEntity.getSysKey(), new Property("Name", serverName, false), null); Gateway.getStorage().put(serverEntity.getSysKey(), new Property("Type", "Server", false), null); - Gateway.getStorage().put(serverEntity.getSysKey(), new Property("KernelVersion", Resource.getKernelVersion(), true), null); + Gateway.getStorage().put(serverEntity.getSysKey(), new Property("KernelVersion", Gateway.getKernelVersion(), true), null); if (Gateway.getProperty("ItemServer.Proxy.port") != null) Gateway.getStorage().put(serverEntity.getSysKey(), new Property("ProxyPort", Gateway.getProperty("ItemServer.Proxy.port"), true), null); -- cgit v1.2.3