use of org.cristalise.kernel.lookup.ItemPath in project kernel by cristal-ise.
the class DescriptionObjectCache method loadObjectFromBootstrap.
public D loadObjectFromBootstrap(String name) throws InvalidDataException, ObjectNotFoundException {
Logger.msg(3, "DescriptionObjectCache.loadObjectFromBootstrap() - name:" + name);
try {
String bootItems = FileStringUtility.url2String(Gateway.getResource().getKernelResourceURL("boot/allbootitems.txt"));
StringTokenizer str = new StringTokenizer(bootItems, "\n\r");
while (str.hasMoreTokens()) {
String resLine = str.nextToken();
String[] resElem = resLine.split(",");
if (resElem[0].equals(name) || isBootResource(resElem[1], name)) {
Logger.msg(3, "DescriptionObjectCache.loadObjectFromBootstrap() - Shimming " + getTypeCode() + " " + name + " from bootstrap");
String resData = Gateway.getResource().getTextResource(null, "boot/" + resElem[1] + (resElem[1].startsWith("OD") ? ".xsd" : ".xml"));
return buildObject(name, 0, new ItemPath(resElem[0]), resData);
}
}
} catch (Exception e) {
Logger.error(e);
throw new InvalidDataException("Error finding bootstrap resources");
}
throw new ObjectNotFoundException("Resource " + getSchemaName() + " " + name + " not found in bootstrap resources");
}
Aggregations