Package org.jdesktop.wonderland.modules.contentrepo.common

Examples of org.jdesktop.wonderland.modules.contentrepo.common.ContentRepositoryException


                out.add(getContentNode(child));
            }

            return out;
        } catch (IOException ioe) {
            throw new ContentRepositoryException(ioe);
        }
    }
View Full Code Here


    protected WebdavContentNode getChildNode(String name)
            throws ContentRepositoryException
    {
        // make sure this isn't a path
        if (name.contains("/")) {
            throw new ContentRepositoryException("Paths not allowed: " + name);
        }

        try {
            HttpURL url = getChildURL(getResource().getHttpURL(), name);
           
            logger.fine("[WebdavContentCollection] Get child " + name +
                        " returns " + url + " from " + this);

            AuthenticatedWebdavResource resource =
                    new AuthenticatedWebdavResource(getResource(), url);
            if (resource.getExistence()) {
                return getContentNode(resource);
            }

            return null;
        } catch (IOException ioe) {
            throw new ContentRepositoryException(ioe);
        }
    }
View Full Code Here

    public WebdavContentNode createChild(String name, Type type)
            throws ContentRepositoryException
    {
        // make sure this isn't a path
        if (name.contains("/")) {
            throw new ContentRepositoryException("Paths not allowed: " + name);
        }

        try {
            HttpURL newURL = getChildURL(getResource().getHttpURL(), name);

            logger.fine("[WebdavContentCollection] Create child " + name +
                        " returns " + newURL + " from " + this);

            AuthenticatedWebdavResource newResource =
                    new AuthenticatedWebdavResource(getResource(), newURL);
            if (newResource.exists()) {
                throw new ContentRepositoryException("Path " + newURL +
                                                     " already exists.");
            }
            switch (type) {
                case COLLECTION:
                    newResource.mkcolMethod();
                    break;
                case RESOURCE:
                    break;
            }

            return getContentNode(newResource);
        } catch (IOException ioe) {
            throw new ContentRepositoryException(ioe);
        }
    }
View Full Code Here

    public WebdavContentNode removeChild(String name)
            throws ContentRepositoryException
    {
        // make sure this isn't a path
        if (name.contains("/")) {
            throw new ContentRepositoryException("Paths not allowed: " + name);
        }

        try {
            HttpURL removeURL = getChildURL(getResource().getHttpURL(), name);
            AuthenticatedWebdavResource removeResource =
                    new AuthenticatedWebdavResource(getResource(), removeURL);
            if (removeResource.exists()) {
                removeResource.deleteMethod();
            }
           
            return getContentNode(removeResource);
        } catch (IOException ioe) {
            throw new ContentRepositoryException(ioe);
        }
    }
View Full Code Here

    public FileContentNode createChild(String name, Type type)
            throws ContentRepositoryException
    {
        File childFile = getChildFile(name);
        if (childFile.exists()) {
            throw new ContentRepositoryException("Path " + childFile.getPath() +
                                                 " already exists.");
        }

        if (type == ContentNode.Type.COLLECTION) {
            childFile.mkdir();
View Full Code Here

    public InputStream getInputStream() throws ContentRepositoryException {
        try {
            return getResource().getMethodData();
        } catch (IOException ioe) {
            throw new ContentRepositoryException(ioe);
        }
    }
View Full Code Here

    public URL getURL() throws ContentRepositoryException {
        try {
            return new URL(getResource().getHttpURL().toString());
        } catch (IOException ioe) {
            throw new ContentRepositoryException(ioe);
        }
    }
View Full Code Here

    public void put(byte[] data) throws ContentRepositoryException {
        try {
            getResource().putMethod(data);
        } catch (IOException ioe) {
            throw new ContentRepositoryException(ioe);
        }
    }
View Full Code Here

        ContentRepositoryRegistry reg = ContentRepositoryRegistry.getInstance();
        ContentRepository repository = reg.getRepository(manager);
        ContentCollection userDir = repository.getUserRoot(true);
        if (userDir == null) {
            logger.warning("Unable to find user content directory");
            throw new ContentRepositoryException("Unable to find user dir");
        }

        // Fetch the avatars/imi directory, creating each if necessary
        ContentCollection dir = (ContentCollection) userDir.getChild("avatars");
        if (dir == null) {
View Full Code Here

    /**
     * @inheritDoc()
     */
    public ContentNode createChild(String name, Type type) throws ContentRepositoryException {
        throw new ContentRepositoryException("Removing child not supported");
    }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.contentrepo.common.ContentRepositoryException

Copyright © 2018 www.massapicom. 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.