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

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


    }//GEN-LAST:event_downloadButtonActionPerformed

    private void deleteCollectionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteCollectionButtonActionPerformed

        try {
            ContentCollection parent = tableSelectedNode.getParent();
            parent.removeChild(tableSelectedNode.getName());
            jtable.setContentCollection(parent);
            jtree.refresh();
        } catch (java.lang.Exception excp) {
            String nodeName = tableSelectedNode.getName();
            logger.log(Level.WARNING, "Unable to delete " + nodeName, excp);
View Full Code Here


        // entry in the content repository and upload the file.
        File file = chooser.getSelectedFile();
        String name = file.getName();
        if (file.exists() == true) {
            try {
                ContentCollection c = (ContentCollection) treeSelectedNode;
                ContentResource r = (ContentResource) c.createChild(
                        name, ContentNode.Type.RESOURCE);
                r.put(file);
                jtable.setContentCollection(c);
            } catch (java.lang.Exception excp) {
                logger.log(Level.WARNING, "Unable to upload " + file, excp);
View Full Code Here

        }

        // Go ahead and create the new directory in the content repository
        String name = s.trim();
        try {
            ContentCollection collection = (ContentCollection) treeSelectedNode;
            collection.createChild(name, ContentNode.Type.COLLECTION);
            jtree.refresh();
            jtable.setContentCollection(collection);
        } catch (ContentRepositoryException ex) {
            logger.log(Level.WARNING, "Unable to create directory " + name, ex);
View Full Code Here

        // Munge the asset path to include the system or user root prefix
        String totalPath = root + "/" + assetPath;
        try {
            // Fetch the content node based upon the path from the root and
            // return
            ContentCollection rootCollection = contentrepo.getRoot();
            return rootCollection.getChild(totalPath);
        } catch (ContentRepositoryException excp) {
            // Log an error and return
            logger.log(Level.WARNING, "Unable to find content node " + totalPath, excp);
            return null;
        }
View Full Code Here

        for (ContentNode child : rootCollection.getChildren()) {
            if (child instanceof ContentCollection) {
                // Only add the child if it contains an art/ subdirectory. In
                // order to figure this out, we need to form the wrapper for
                // the module node and see if it has children.
                ContentCollection c = (ContentCollection)child;
                ModuleContentCollection mcc = new ModuleContentCollection(c, this);
                if (mcc.getChildren().isEmpty() == false) {
                    moduleList.add(mcc);
                }
            }
View Full Code Here

    public String isContentExists(File file) {
        String fileName = file.getName();
        ContentRepositoryRegistry registry = ContentRepositoryRegistry.getInstance();
        ContentRepository repo = registry.getRepository(loginInfo);
        try {
            ContentCollection userRoot = repo.getUserRoot();
            if (userRoot.getChild(fileName) != null) {
                return "wlcontent://users/" + loginInfo.getUsername() + "/" + fileName;
            }
            return null;
        } catch (ContentRepositoryException excp) {
            logger.log(Level.WARNING, "Error while try to find " + fileName +
View Full Code Here

    @Override
    public String uploadContent(File file) throws IOException {
        String fileName = file.getName();
        ContentRepositoryRegistry registry = ContentRepositoryRegistry.getInstance();
        ContentRepository repo = registry.getRepository(loginInfo);
        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 while trying to find " + fileName +
                    " in content repository", excp);
View Full Code Here

        }

        // Now find the children of the art/ subdir and return nodes that wrap
        // the children. This makes it so the art/ does not appear in the tree
        // at all.
        ContentCollection artCollection = (ContentCollection)node;
        for (ContentNode child : artCollection.getChildren()) {
            if (child instanceof ContentCollection) {
                childList.add(new ArtContentCollection((ContentCollection)child, this));
            }
            else {
                childList.add(new ArtContentResource((ContentResource)child, this));
View Full Code Here

                ContentRepositoryRegistry registry = ContentRepositoryRegistry.getInstance();
                ContentRepository cr = registry.getRepository(LoginManager.getPrimary());
                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

    }
   
    public static GoToCoverScreenInfo getGoToCoverScreenInfo() {
        try {
            // Find the GoToCoverScreen.xml file and parse as a PlacemarkList object.
           ContentCollection collection = getSystemContentRepository();
           ContentCollection grps = (ContentCollection) collection.getParent().getChild("groups");
            if(grps==null) {
                grps = (ContentCollection) collection.getParent().createChild("groups", ContentNode.Type.COLLECTION);
            }
            ContentCollection grpusrs = (ContentCollection) grps.getChild("users");
            if(grpusrs == null) {
                grpusrs = (ContentCollection) grps.createChild("users", ContentNode.Type.COLLECTION);
            }
            ContentCollection csColl = (ContentCollection) grpusrs.getChild("GoToCoverScreen");
            if(csColl==null) {
                csColl = (ContentCollection) grpusrs.createChild("GoToCoverScreen", ContentNode.Type.COLLECTION);
            }
           ArrayList<ContentNode> resources = (ArrayList<ContentNode>) csColl.getChildren();
           ContentResource resource = null;
           if(resources!=null && !resources.isEmpty()) {
                resource = (ContentResource)csColl.getChildren().get(0);
           }
           if (resource == null) {
               LOGGER.warning("Unable to find GoToCoverScreen.xml in " + collection.getPath());
               return null;
           } else {
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.