private NodeType getNodetype() throws RepositoryException { NodeType ntType = null; if (resource.getDescription() != null) { ntType = registrySession.getWorkspace().getNodeTypeManager(). getNodeType(resource.getDescription()); } else { try { String parPath = ""; // if(resource.getParentPath().equals(registrySession.getWorkspaceRootPath())) { // Map registry root node path to "/" // parPath = "/"; // } else { parPath = resource.getParentPath(); // } String ntName = registrySession.getUserRegistry().get(parPath).getDescription(); ntType = registrySession.getWorkspace().getNodeTypeManager(). getNodeType(ntName); } catch (RegistryException e) { log.error("Error occurred while getting node type"); } } return ntType; }
public Node getNode(String s) throws PathNotFoundException, RepositoryException { //s-rel path String abs = ""; if (!(nodePath.endsWith("/")) && (!(s.startsWith("/")))) { abs = nodePath + "/" + s; } else { abs = nodePath + s; } RegistryNode subNode = null; try { if (registrySession.getUserRegistry().resourceExists(abs)) { subNode = new RegistryNode(abs, registrySession); subNode.resource = (CollectionImpl) registrySession.getUserRegistry().get(abs); subNode.nodeType = (RegistryNodeType) (registrySession.getWorkspace().getNodeTypeManager().getNodeType(subNode.resource.getDescription())); } else { throw new PathNotFoundException("failed to resolve the path of the given node"); } } catch (RegistryException e) { String msg = "failed to resolve the path of the given node or violation of repository syntax " + this; log.debug(msg); throw new RepositoryException(msg, e); } return subNode; }
public Node getNode(String s) throws PathNotFoundException, RepositoryException { RegistryNode subNode = null; try { if (getUserRegistry().resourceExists(s)) { subNode = new RegistryNode(s, this); subNode.setCollection(s); subNode.nodeType = (RegistryNodeType) getWorkspace().getNodeTypeManager().getNodeType(subNode.resource.getDescription()); } else { throw new PathNotFoundException("failed to resolve the path of the given node"); } } catch (RegistryException e) { String msg = "failed to resolve the path of the given node or violation of repository syntax " + this; log.debug(msg); throw new RepositoryException(msg, e); } return subNode; }