authorityPath = authorityPath.getParent();
}
if (authority == null) {
throw new StoreException(StoreException.KEY_NOTFOUND, "No root namespace found in store.");
}
// now iterate through the remaining subsegments to resolve the final authority.
// from now on, we require that all subsegments are present in the store.
// if we have no remaining subsegments at this point, we were given a root namespace in the first place; which is also ok
for (String subSegmentName : subSegmentNames) {
// using the parent authority and subsegment name, find the next authority
DbSubSegment subSegment;
subSegment = DbSubSegment.ByParentAndName(session, authority, subSegmentName);
if (subSegment == null) {
throw new StoreException(StoreException.KEY_NOTFOUND, "Subsegment " + subSegmentName + " not found in store.");
}
authority = subSegment.getAuthority();
}
Hibernate.initialize(authority);
session.getTransaction().commit();
} catch (StoreException ex) {
session.getTransaction().rollback();
log.error(ex);
throw(ex);
} catch (Exception ex) {
session.getTransaction().rollback();
log.error(ex);
throw new StoreException(ex, StoreException.KEY_DBERR, "Cannot access database.");
}
// done
log.trace("Done.");