Refine search
private Node getOrAddNode(Node node, String name) throws RepositoryException { Node node1 = null; try { node1 = node.getNode(name); } catch (PathNotFoundException pnfe) { node1 = node.addNode(name); } catch (RepositoryException e) { String msg = "failed to resolve the path of the given node "; log.debug(msg); throw new RepositoryException(msg, e); } return node1; }
/** * {@inheritDoc} */ public void start() throws RepositoryException { try { // start update operation itemOps.edit(); } catch (IllegalStateException ise) { aborted = true; String msg = "internal error: failed to start update operation"; log.debug(msg); throw new RepositoryException(msg, ise); } }
/** * {@inheritDoc} */ public void start() throws RepositoryException { try { // start update operation itemOps.edit(); } catch (IllegalStateException ise) { aborted = true; String msg = "internal error: failed to start update operation"; log.debug(msg); throw new RepositoryException(msg, ise); } }
/** * End an update operation. This will save all changes made since * the last invocation of {@link #edit()}. If this operation fails, * no item will have been saved. * * @throws RepositoryException if the update operation failed * @throws IllegalStateException if the state manager is not in edit mode */ public void update() throws RepositoryException, IllegalStateException { try { stateMgr.update(); } catch (ItemStateException ise) { String msg = "update operation failed"; log.debug(msg, ise); throw new RepositoryException(msg, ise); } }
/** * Returns a light weight copy of this BLOB file value. * * @return a copy of this value. * @throws RepositoryException if an error occurs while creating the copy or * if this value has been disposed already. */ @Override synchronized BLOBFileValue copy() throws RepositoryException { if (refCount <= 0) { throw new RepositoryException("this BLOBFileValue has been disposed"); } BLOBFileValue bin = new RefCountBinary(); refCount++; log.debug("{}@refCount={}", System.identityHashCode(this), refCount); return bin; }
/** * Returns a light weight copy of this BLOB file value. * * @return a copy of this value. * @throws RepositoryException if an error occurs while creating the copy or * if this value has been disposed already. */ @Override synchronized BLOBFileValue copy() throws RepositoryException { if (refCount <= 0) { throw new RepositoryException("this BLOBFileValue has been disposed"); } BLOBFileValue bin = new RefCountBinary(); refCount++; log.debug("{}@refCount={}", System.identityHashCode(this), refCount); return bin; }
/** * End an update operation. This will save all changes made since * the last invocation of {@link #edit()}. If this operation fails, * no item will have been saved. * * @throws RepositoryException if the update operation failed * @throws IllegalStateException if the state manager is not in edit mode */ public void update() throws RepositoryException, IllegalStateException { try { stateMgr.update(); } catch (ItemStateException ise) { String msg = "update operation failed"; log.debug(msg, ise); throw new RepositoryException(msg, ise); } }
/** * create a transient node for temporarily stash the child nodes * @return the temporary node * @throws RepositoryException if an error occurrs */ private Node getOrCreateTemporaryNode() throws RepositoryException { if (tmpNode != null) { return tmpNode; } for (String rootPath: ROOTS) { try { Node root = session.getNode(rootPath); return tmpNode = root.addNode("tmp" + System.currentTimeMillis(), JcrConstants.NT_UNSTRUCTURED); } catch (RepositoryException e) { log.debug("unable to create temporary stash location below {}.", rootPath); } } throw new RepositoryException("Unable to create temporary root below."); }
private CustomPrivilegeStore(FileSystemResource customPrivilegesResource) throws RepositoryException { this.customPrivilegesResource = customPrivilegesResource; try { // make sure path to resource exists if (!customPrivilegesResource.exists()) { customPrivilegesResource.makeParentDirs(); } } catch (FileSystemException e) { String error = "Internal error: Failed to access/create file system resource for custom privileges at " + customPrivilegesResource.getPath(); log.debug(error); throw new RepositoryException(error, e); } }
public SessionMoveOperation( PathResolver resolver, String srcAbsPath, String destAbsPath) throws RepositoryException { this.srcAbsPath = srcAbsPath; this.srcPath = getAbsolutePath(resolver, srcAbsPath); this.destAbsPath = destAbsPath; this.destPath = getAbsolutePath(resolver, destAbsPath); if (destPath.getIndex() != Path.INDEX_UNDEFINED) { // subscript in name element String msg = destAbsPath + ": invalid destination path (subscript in name element is not allowed)"; log.debug(msg); throw new RepositoryException(msg); } if (srcPath.isAncestorOf(destPath)) { throw new RepositoryException( "Destination path " + destAbsPath + " cannot be descendant of source path " + srcAbsPath + " in a move operation."); } }
private CustomPrivilegeStore(FileSystemResource customPrivilegesResource) throws RepositoryException { this.customPrivilegesResource = customPrivilegesResource; try { // make sure path to resource exists if (!customPrivilegesResource.exists()) { customPrivilegesResource.makeParentDirs(); } } catch (FileSystemException e) { String error = "Internal error: Failed to access/create file system resource for custom privileges at " + customPrivilegesResource.getPath(); log.debug(error); throw new RepositoryException(error, e); } }
public SessionMoveOperation( PathResolver resolver, String srcAbsPath, String destAbsPath) throws RepositoryException { this.srcAbsPath = srcAbsPath; this.srcPath = getAbsolutePath(resolver, srcAbsPath); this.destAbsPath = destAbsPath; this.destPath = getAbsolutePath(resolver, destAbsPath); if (destPath.getIndex() != Path.INDEX_UNDEFINED) { // subscript in name element String msg = destAbsPath + ": invalid destination path (subscript in name element is not allowed)"; log.debug(msg); throw new RepositoryException(msg); } if (srcPath.isAncestorOf(destPath)) { throw new RepositoryException( "Destination path " + destAbsPath + " cannot be descendant of source path " + srcAbsPath + " in a move operation."); } }
/** * {@inheritDoc} */ public final ItemId resolvePath(Path path) throws RepositoryException { // shortcut if (path.denotesRoot()) { return rootNodeId; } if (!path.isCanonical()) { String msg = "path is not canonical"; log.debug(msg); throw new RepositoryException(msg); } return resolvePath(path, RETURN_ANY); }
/** * {@inheritDoc} */ public final ItemId resolvePath(Path path) throws RepositoryException { // shortcut if (path.denotesRoot()) { return rootNodeId; } if (!path.isCanonical()) { String msg = "path is not canonical"; log.debug(msg); throw new RepositoryException(msg); } return resolvePath(path, RETURN_ANY); }
/** * @param relativeJcrPath * @return Path object for the specified relative JCR path string. * @throws RepositoryException */ private Path getPath(String relativeJcrPath) throws RepositoryException { try { Path p = session.getPathResolver().getQPath(relativeJcrPath); return getPath(p); } catch (NameException e) { String msg = "Invalid relative path: " + relativeJcrPath; log.debug(msg); throw new RepositoryException(msg, e); } }
/** * @param relativeJcrPath * @return Path object for the specified relative JCR path string. * @throws RepositoryException */ private Path getPath(String relativeJcrPath) throws RepositoryException { try { Path p = session.getPathResolver().getQPath(relativeJcrPath); return getPath(p); } catch (NameException e) { String msg = "Invalid relative path: " + relativeJcrPath; log.debug(msg); throw new RepositoryException(msg, e); } }
private QueryResult doQuery(String queryString, long limit, long offset) throws RepositoryException { try { final Session jcrSession = MgnlContext.getJCRSession(repository); final QueryManager jcrQueryManager = jcrSession.getWorkspace().getQueryManager(); final Query query = jcrQueryManager.createQuery(queryString, Query.JCR_SQL2); query.setLimit(limit); query.setOffset(offset); log.debug("Executing query against workspace [{}] with statement [{}] and limit {} and offset {}...", repository, queryString, limit, offset); long start = System.currentTimeMillis(); QueryResult qr = query.execute(); log.debug("Query execution took {} ms", System.currentTimeMillis() - start); return qr; } catch (RepositoryException e) { log.error("An error occurred while performing a query against workspace [{}] with statement [{}] and limit {} and offset {}.", repository, queryString, limit, offset); throw new RepositoryException(e); } } }
/** * @see Node#getProperties() */ public PropertyIterator getProperties() throws RepositoryException { checkStatus(); try { return getItemManager().getChildProperties(getNodeEntry()); } catch (ItemNotFoundException infe) { String msg = "Failed to list the child properties of " + getPath(); log.debug(msg); throw new RepositoryException(msg, infe); } catch (AccessDeniedException ade) { String msg = "Failed to list the child properties of " + getPath(); log.debug(msg); throw new RepositoryException(msg, ade); } }
/** * @see Node#getProperties() */ public PropertyIterator getProperties() throws RepositoryException { checkStatus(); try { return getItemManager().getChildProperties(getNodeEntry()); } catch (ItemNotFoundException infe) { String msg = "Failed to list the child properties of " + getPath(); log.debug(msg); throw new RepositoryException(msg, infe); } catch (AccessDeniedException ade) { String msg = "Failed to list the child properties of " + getPath(); log.debug(msg); throw new RepositoryException(msg, ade); } }
/** * * @param relativePath * @return * @throws RepositoryException */ private Path getReorderPath(String relativePath) throws RepositoryException { try { Path p = session.getPathResolver().getQPath(relativePath); if (p.isAbsolute() || p.getLength() != 1 || p.getDepth() != 1) { throw new RepositoryException("Invalid relative path: " + relativePath); } return p; } catch (NameException e) { String msg = "Invalid relative path: " + relativePath; log.debug(msg); throw new RepositoryException(msg, e); } }