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

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


     */
    public static ViewProperties loadViewProperties()
            throws ContentRepositoryException, JAXBException {

        // Find the viewproperites.xml file and parse as a ViewProperties object.
        ContentCollection c = getUserContentRepository();
        ContentResource resource = (ContentResource)c.getChild(PROPS_FILE);
        if (resource == null) {
            logger.warning("Unable to find " + PROPS_FILE + " in " + c.getPath());
            return new ViewProperties();
        }
       
        Reader r = new InputStreamReader(resource.getInputStream());
        return ViewProperties.decode(r);
View Full Code Here


     */
    public static void saveViewProperties(ViewProperties viewProperties)
            throws ContentRepositoryException, JAXBException {

        // Find the viewproperites.xml file, creating it if necessary.
        ContentCollection c = getUserContentRepository();
        ContentResource resource = (ContentResource)c.getChild(PROPS_FILE);
        if (resource == null) {
            resource = (ContentResource)c.createChild(PROPS_FILE, Type.RESOURCE);
        }

        // Write the new list to the resource
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        Writer w = new OutputStreamWriter(os);
View Full Code Here

                ContentRepositoryRegistry registry = ContentRepositoryRegistry.getInstance();
                ContentRepository cr = registry.getRepository(serverSessionManager);
                String[] urls = imageURL.toString().split("/");
                String fname = urls[urls.length-1];
                String userName = urls[3];
                ContentCollection user = cr.getUserRoot(userName);
               
                ContentResource res = (ContentResource) user.getChild(fname);
               
                BufferedImage bimg = ImageIO.read(res.getInputStream());
                if(bimg.getWidth()>width || bimg.getHeight()>height) {
                    if(bimg.getWidth()>width && bimg.getHeight()>height) {
                        if(bimg.getWidth()-width>bimg.getHeight()-height) {
View Full Code Here

        ContentRepositoryRegistry registry = ContentRepositoryRegistry.getInstance();

        ContentRepository repo = registry.getRepository(LoginManager.getPrimary());
 
        ContentCollection audioCollection = null;

        try {
      ContentCollection c = repo.getUserRoot();

      audioCollection = (ContentCollection) c.getChild("audio");

      if (audioCollection == null) {
    audioCollection = (ContentCollection) c.createChild("audio", Type.COLLECTION);
        }
        } catch (ContentRepositoryException e) {
      throw new AudioCacheHandlerException("Content repository exception: "
    + e.getMessage());
        }
View Full Code Here

     */
    private ImiAvatarConfigManager() {
        // Fetch the IMI base content collection for configuration, which is
        // the imi/ directory beneath the avatar base.
        AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
        ContentCollection bc = registry.getAvatarCollection();
        try {
            imiCollection = (ContentCollection) bc.getChild("imi");
            if (imiCollection == null) {
                imiCollection = (ContentCollection) bc.createChild("imi", Type.COLLECTION);
            }
            logger.info("Using local IMI avatar collection " +
                    imiCollection.getPath());
        } catch (ContentRepositoryException excp) {
            logger.log(Level.WARNING, "Unable to fetch imi/ collection", excp);
View Full Code Here

        // Delete the existing avatar locally if there is one. We need to do
        // this before touching the 'avatar' object because they may be one
        // in the same.
        if (existingAvatar != null) {
            ContentResource resource = existingAvatar.getResource();
            ContentCollection parent = resource.getParent();
            try {
                parent.removeChild(resource.getName());
            } catch (ContentRepositoryException excp) {
                logger.log(Level.WARNING, "Unable to remove local avatar " +
                        resource.getPath(), excp);
            }
        }
View Full Code Here

         */
        private ContentCollection getBaseServerCollection(ServerSessionManager session)
                throws ContentRepositoryException {

            // Fetch the avatars/imi directory, creating each if necessary
            ContentCollection dir = AvatarSessionLoader.getBaseServerCollection(session);
            ContentCollection imiDir = (ContentCollection) dir.getChild("imi");
            if (imiDir == null) {
                imiDir = (ContentCollection) dir.createChild("imi", Type.COLLECTION);
            }
            return imiDir;
        }
View Full Code Here

            // server. If so, then remove it from the server and the map.
            String avatarName = avatar.getName();
            ImiServerAvatar serverAvatar = serverAvatars.get(avatarName);
            if (serverAvatar != null) {
                ContentResource resource = serverAvatar.resource;
                ContentCollection parent = resource.getParent();
                try {
                    parent.removeChild(resource.getName());
                } catch (ContentRepositoryException excp) {
                    logger.log(Level.WARNING, "Unable to delete avatar from" +
                            " server " + avatar, excp);
                }
                serverAvatars.remove(avatarName);
View Full Code Here

            return;
        }

        // Fetch the content node for the "x-apps" directory under "system". If
        // "x-apps" isn't there, then create it.
        ContentCollection xAppsCollection = null;
        try {
            ContentCollection sysRoot = wcr.getSystemRoot();
            ContentNode xappsNode = sysRoot.getChild("x-apps");
            if (xappsNode == null) {
                xappsNode = sysRoot.createChild("x-apps", Type.COLLECTION);
            }
            xAppsCollection = (ContentCollection)xappsNode;
        } catch (ContentRepositoryException excp) {
            logger.log(Level.WARNING, "Unable to get x-apps collection", excp);
            error(request, response, "No x-apps collection found. <br>" +
View Full Code Here

   
    private String uploadFile(File file) {
        String fileName = file.getName();
        ContentRepositoryRegistry registry = ContentRepositoryRegistry.getInstance();
        ContentRepository repo = registry.getRepository(LoginManager.getPrimary());
        ContentCollection userRoot;

        // First try to find the resource, if it exists, then simply upload the
        // new bits. Otherwise create the resource and upload the new bits
        try {
            userRoot = repo.getUserRoot();
            ContentNode node = (ContentNode)userRoot.getChild(fileName);
            if (node == null) {
                node = (ContentNode)userRoot.createChild(fileName, Type.RESOURCE);
            }
            ((ContentResource)node).put(file);
        } catch (ContentRepositoryException excp) {
            LOGGER.log(Level.WARNING, "Error uploading", excp);
        } catch(IOException ie) {
View Full Code Here

TOP

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

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.