Search in sources :

Example 36 with ItemPath

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");
}
Also used : StringTokenizer(java.util.StringTokenizer) ObjectNotFoundException(org.cristalise.kernel.common.ObjectNotFoundException) InvalidDataException(org.cristalise.kernel.common.InvalidDataException) InvalidDataException(org.cristalise.kernel.common.InvalidDataException) PersistencyException(org.cristalise.kernel.common.PersistencyException) InvalidItemPathException(org.cristalise.kernel.lookup.InvalidItemPathException) ObjectNotFoundException(org.cristalise.kernel.common.ObjectNotFoundException) ItemPath(org.cristalise.kernel.lookup.ItemPath)

Aggregations

ItemPath (org.cristalise.kernel.lookup.ItemPath)36 DomainPath (org.cristalise.kernel.lookup.DomainPath)16 ObjectNotFoundException (org.cristalise.kernel.common.ObjectNotFoundException)14 InvalidDataException (org.cristalise.kernel.common.InvalidDataException)10 PersistencyException (org.cristalise.kernel.common.PersistencyException)10 InvalidItemPathException (org.cristalise.kernel.lookup.InvalidItemPathException)10 ObjectAlreadyExistsException (org.cristalise.kernel.common.ObjectAlreadyExistsException)6 C2KLocalObject (org.cristalise.kernel.entity.C2KLocalObject)5 CannotManageException (org.cristalise.kernel.common.CannotManageException)4 AgentPath (org.cristalise.kernel.lookup.AgentPath)4 Test (org.junit.Test)4 Aggregation (org.cristalise.kernel.collection.Aggregation)3 TraceableEntity (org.cristalise.kernel.entity.TraceableEntity)3 Path (org.cristalise.kernel.lookup.Path)3 Property (org.cristalise.kernel.property.Property)3 PropertyDescription (org.cristalise.kernel.property.PropertyDescription)3 PropertyDescriptionList (org.cristalise.kernel.property.PropertyDescriptionList)3 ConcurrentModificationException (java.util.ConcurrentModificationException)2 StringTokenizer (java.util.StringTokenizer)2 Dependency (org.cristalise.kernel.collection.Dependency)2