use of org.apache.jackrabbit.core.state.NoSuchItemStateException in project jackrabbit by apache.
the class InMemPersistenceManager method loadReferencesTo.
/**
* {@inheritDoc}
*/
public synchronized NodeReferences loadReferencesTo(NodeId id) throws NoSuchItemStateException, ItemStateException {
if (!initialized) {
throw new IllegalStateException("not initialized");
}
byte[] data = refsStore.get(id);
if (data == null) {
throw new NoSuchItemStateException(id.toString());
}
ByteArrayInputStream in = new ByteArrayInputStream(data);
try {
NodeReferences refs = new NodeReferences(id);
Serializer.deserialize(refs, in);
return refs;
} catch (Exception e) {
String msg = "failed to load references: " + id;
log.debug(msg);
throw new ItemStateException(msg, e);
}
}
use of org.apache.jackrabbit.core.state.NoSuchItemStateException in project jackrabbit by apache.
the class InMemPersistenceManager method load.
/**
* {@inheritDoc}
*/
public synchronized NodeState load(NodeId id) throws NoSuchItemStateException, ItemStateException {
if (!initialized) {
throw new IllegalStateException("not initialized");
}
byte[] data = stateStore.get(id);
if (data == null) {
throw new NoSuchItemStateException(id.toString());
}
ByteArrayInputStream in = new ByteArrayInputStream(data);
try {
NodeState state = createNew(id);
Serializer.deserialize(state, in);
return state;
} catch (Exception e) {
String msg = "failed to read node state: " + id;
log.debug(msg);
throw new ItemStateException(msg, e);
}
}
use of org.apache.jackrabbit.core.state.NoSuchItemStateException in project jackrabbit by apache.
the class ObjectPersistenceManager method loadReferencesTo.
/**
* {@inheritDoc}
*/
public synchronized NodeReferences loadReferencesTo(NodeId id) throws NoSuchItemStateException, ItemStateException {
if (!initialized) {
throw new IllegalStateException("not initialized");
}
String refsFilePath = buildNodeReferencesFilePath(id);
try {
if (!itemStateFS.isFile(refsFilePath)) {
throw new NoSuchItemStateException(id.toString());
}
} catch (FileSystemException fse) {
String msg = "failed to load references: " + id;
log.debug(msg);
throw new ItemStateException(msg, fse);
}
try {
BufferedInputStream in = new BufferedInputStream(itemStateFS.getInputStream(refsFilePath));
try {
NodeReferences refs = new NodeReferences(id);
Serializer.deserialize(refs, in);
return refs;
} finally {
in.close();
}
} catch (Exception e) {
String msg = "failed to load references: " + id;
log.debug(msg);
throw new ItemStateException(msg, e);
}
}
use of org.apache.jackrabbit.core.state.NoSuchItemStateException in project jackrabbit by apache.
the class HierarchyManagerImpl method getName.
/**
* {@inheritDoc}
*/
public Name getName(NodeId id, NodeId parentId) throws ItemNotFoundException, RepositoryException {
NodeState parentState;
try {
parentState = (NodeState) getItemState(parentId);
} catch (NoSuchItemStateException nsis) {
String msg = "failed to resolve name of " + id;
log.debug(msg);
throw new ItemNotFoundException(id.toString());
} catch (ItemStateException ise) {
String msg = "failed to resolve name of " + id;
log.debug(msg);
throw new RepositoryException(msg, ise);
}
ChildNodeEntry entry = getChildNodeEntry(parentState, id);
if (entry == null) {
String msg = "failed to resolve name of " + id;
log.debug(msg);
throw new ItemNotFoundException(msg);
}
return entry.getName();
}
use of org.apache.jackrabbit.core.state.NoSuchItemStateException in project jackrabbit by apache.
the class HierarchyManagerImpl method getName.
/**
* {@inheritDoc}
*/
public Name getName(ItemId itemId) throws ItemNotFoundException, RepositoryException {
if (itemId.denotesNode()) {
NodeId nodeId = (NodeId) itemId;
try {
NodeState nodeState = (NodeState) getItemState(nodeId);
NodeId parentId = getParentId(nodeState);
if (parentId == null) {
// FIXME
return EMPTY_NAME;
}
return getName(nodeId, parentId);
} catch (NoSuchItemStateException nsis) {
String msg = "failed to resolve name of " + nodeId;
log.debug(msg);
throw new ItemNotFoundException(nodeId.toString());
} catch (ItemStateException ise) {
String msg = "failed to resolve name of " + nodeId;
log.debug(msg);
throw new RepositoryException(msg, ise);
}
} else {
return ((PropertyId) itemId).getName();
}
}
Aggregations