Examples of ContentRepositoryException


Examples of ch.entwine.weblounge.common.repository.ContentRepositoryException

      IndicesAdminClient indexAdmin = nodeClient.admin().indices();
      CreateIndexRequestBuilder siteIdxRequest = indexAdmin.prepareCreate(site.getIdentifier());
      logger.debug("Trying to create site index for '{}'", site.getIdentifier());
      CreateIndexResponse siteidxResponse = siteIdxRequest.execute().actionGet();
      if (!siteidxResponse.acknowledged()) {
        throw new ContentRepositoryException("Unable to create site index for '" + site.getIdentifier() + "'");
      }
    } catch (IndexAlreadyExistsException e) {
      logger.info("Detected existing index '{}'", site.getIdentifier());
    }

    // Store the correct mapping
    // TODO: Use resource serializers
    for (String type : new String[] {
        "version",
        "page",
        "file",
        "image",
        "movie" }) {
      PutMappingRequest siteMappingRequest = new PutMappingRequest(site.getIdentifier());
      siteMappingRequest.source(loadMapping(type));
      siteMappingRequest.type(type);
      PutMappingResponse siteMappingResponse = nodeClient.admin().indices().putMapping(siteMappingRequest).actionGet();
      if (!siteMappingResponse.acknowledged()) {
        throw new ContentRepositoryException("Unable to install '" + type + "' mapping for index '" + site.getIdentifier() + "'");
      }
    }

    // See if the index version exists and check if it matches. The request will
    // fail if there is no version index
View Full Code Here

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

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

    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

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

    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

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

    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

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

    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

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

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

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

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

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

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

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

        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
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.