Examples of itemExists()


Examples of javax.jcr.Session.itemExists()

     */
    public void removeMember(DavResource member) throws DavException {
        Session session = getRepositorySession();
        try {
            String itemPath = member.getLocator().getRepositoryPath();
            if (!exists() || !session.itemExists(itemPath)) {
                throw new DavException(DavServletResponse.SC_NOT_FOUND);
            }
            if (!getResourcePath().equals(Text.getRelativeParent(member.getResourcePath(), 1))) {
                throw new DavException(DavServletResponse.SC_CONFLICT, member.getResourcePath() + "is not member of this resource (" + getResourcePath() + ")");
            }
View Full Code Here

Examples of javax.jcr.Session.itemExists()

        final String path = cleanPath(name);
        this.handleChangeEvent(path);
        Session session = null;
        try {
            session = createSession();
            if (session.itemExists(path)) {
                Item fileItem = session.getItem(path);
                fileItem.remove();
                session.save();
                return true;
            }
View Full Code Here

Examples of javax.jcr.Session.itemExists()

    throws IOException {
        final String path = cleanPath(name) + "/jcr:content/jcr:data";
        Session session = null;
        try {
            session = this.createSession();
            if ( session.itemExists(path) ) {
                final Property prop = (Property)session.getItem(path);
                final InputStream is = prop.getStream();
                final ByteArrayOutputStream baos = new ByteArrayOutputStream();
                int l = 0;
                final byte[] buf = new byte[2048];
View Full Code Here

Examples of javax.jcr.Session.itemExists()

    public long getLastModified(final String name) {
        final String path = cleanPath(name) + "/jcr:content/jcr:lastModified";
        Session session = null;
        try {
            session = this.createSession();
            if ( session.itemExists(path) ) {
                final Property prop = (Property)session.getItem(path);
                return prop.getLong();
            }
        } catch (final RepositoryException se) {
            logger.error("Cannot get last modification time for " + name, se);
View Full Code Here

Examples of javax.jcr.Session.itemExists()

                    }
                }
                Node fileNode = null;
                Node contentNode = null;
                Node parentNode = null;
                if (session.itemExists(fileName)) {
                    final Item item = session.getItem(fileName);
                    if (item.isNode()) {
                        final Node node = item.isNode() ? (Node) item : item.getParent();
                        if ("jcr:content".equals(node.getName())) {
                            // replace the content properties of the jcr:content
View Full Code Here

Examples of javax.jcr.Session.itemExists()

    private boolean findClassLoaderResource(final String path) throws IOException {
        Session session = null;
        boolean res = false;
        try {
            session = this.writer.createSession();
            if ( session.itemExists(path) ) {
                logger.debug("Found resource at {}", path);
                res = true;
            } else {
                logger.debug("No classpath entry contains {}", path);
            }
View Full Code Here

Examples of javax.jcr.Session.itemExists()

    private byte[] findClassLoaderClass(final String path) throws IOException {
        Session session = null;
        byte[] res = null;
        try {
            session = this.writer.createSession();
            if ( session.itemExists(path) ) {
                final Node node = (Node)session.getItem(path);
                logger.debug("Found resource at {}", path);
                res = Util.getBytes(node);
            } else {
                logger.debug("No classpath entry contains {}", path);
View Full Code Here

Examples of javax.jcr.Session.itemExists()

                        }
                    } else {
                        targetSession = defaultSession;
                    }

                    if (targetSession.itemExists(path)) {
                        targetSession.getItem(path).remove();
                    }
                }

                // persist modifications now
View Full Code Here

Examples of javax.jcr.Session.itemExists()

    static boolean hasOverlayResource(ResourceResolver resolver, String path) {
        // check for overlay resource by checking directly in underlying JCR
        final Session session = resolver.adaptTo(Session.class);
        try {
            return (null != session && session.itemExists(path));
        } catch (RepositoryException e) {
            log.error("Error accessing the repository. ", e);
        }
        return false;
    }
View Full Code Here

Examples of javax.jcr.Session.itemExists()

    private String getJcrStringProperty(String pNodePath, String pPropertName) {
        String absolutePropertyPath = pNodePath + "/" + pPropertName;
        Session session = resolver.adaptTo(Session.class);
        try {
            if (!session.itemExists(absolutePropertyPath)) {
                return null;
            }
            return session.getProperty(absolutePropertyPath).getString();
        }
        catch (RepositoryException ex) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.