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

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


        // the ContentResource that points to the file, otherwise, return null.

        // The model loader may use a different filename, so check the directory exists rather
        // than the existance of the .dep file.
        String fileName = "art/" + file.getName();
        ContentCollection userRoot = getUserRoot();
        try {
            ContentNode node = userRoot.getChild(fileName);
            if (node != null && node instanceof ContentCollection) {
                // Search for the dep file, and return it's url
                List<ContentNode> children = ((ContentCollection)node).getChildren();
                for(ContentNode c : children) {
                    if (c instanceof ContentResource && ((ContentResource)c).getName().endsWith(".dep")) {
View Full Code Here


        // Now copy the temporary files into webdav

        // Create the directory to hold the contents of the model. We place it
        // in a directory named after the kmz file. If the directory already
        // exists, then just use it.
        ContentCollection modelRoot = getUserRoot();

        try {
            // Copy from the art directory
            File artDir = FileUtils.findDir(tmpDir, "art");
            copyFiles(artDir, modelRoot);
View Full Code Here

            }
            else if (!(node instanceof ContentCollection)) {
                node.getParent().removeChild(node.getName());
                node = n.createChild(fName, Type.COLLECTION);
            }
            ContentCollection dir = (ContentCollection)node;

            // Recursively descend the children and copy them over too.
            File[] subdirs = f.listFiles();
            if (subdirs != null) {
                for (File child : subdirs) {
View Full Code Here

        //upload image
        String path = origCursorFilePath;
        ContentRepositoryRegistry registry = ContentRepositoryRegistry.getInstance();
        ContentRepository repo = registry.getRepository(LoginManager.getPrimary());
        try {
            ContentCollection c = repo.getUserRoot();
            ContentResource r = (ContentResource) c.getChild(cursorFile.getName());

            if(r!=null) {

                //file is already exist
                Object[] options = {
                    BUNDLE.getString("Replace"),
                    BUNDLE.getString("Use_Existing"),
                    BUNDLE.getString("Cancel")
                };
                String msg = MessageFormat.format(
                        BUNDLE.getString("Replace_Question"), file.getName());
                String title = BUNDLE.getString("Replace_Title");

                int result = JOptionPane.showOptionDialog(this, msg, title,
                        JOptionPane.YES_NO_CANCEL_OPTION,
                        JOptionPane.QUESTION_MESSAGE, null, options, options[0]);

                // If the user hits Cancel or a "closed" action (e.g. Escape key)
                // then just return
                if ((result == JOptionPane.CANCEL_OPTION)
                        || (result == JOptionPane.CLOSED_OPTION)) {
                    path = origCursorFilePath;
                }

                // If the content exists and we do not want to upload a new version,
                // then simply create it and return.
                if (result == JOptionPane.NO_OPTION) {
                    path = "wlcontent:/"+r.getPath();
                }
                if(result == JOptionPane.YES_OPTION) {
                    try {
                        r.put(temp);
                        path = "wlcontent:/"+r.getPath();
                    } catch (IOException ex) {
                        Logger.getLogger(BasicJPanel.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            } else {
               
                //create a new file
                r = (ContentResource) c.createChild(cursorFile.getName()
                            , ContentNode.Type.RESOURCE);
                try {
                    r.put(temp);
                    path = "wlcontent:/"+r.getPath();
                } catch (IOException ex) {
View Full Code Here

        String uri = "";
        ContentRepositoryRegistry registry = ContentRepositoryRegistry.getInstance();
        ContentRepository repo = registry.getRepository(LoginManager.getPrimary());
        try {
            ContentCollection c = repo.getUserRoot();
            try {
                /*
                 * Remove file if it exists.
                 */
                ContentResource r = (ContentResource) c.removeChild(image.getName());
            } catch (Exception e) {
            }
           
            ContentResource r = (ContentResource) c.createChild(
                image.getName(), ContentNode.Type.RESOURCE);
            try {
                r.put(image);
                uri = "wlcontent:/"+r.getPath();
            } catch (IOException ex) {
View Full Code Here

        records++;
        bytes += length;
    }

    private void copyFileToWebDav() throws FileNotFoundException, ContentRepositoryException, IOException {
        ContentCollection recordingRoot = getSystemRoot(brInitializer.getSessionManager());
        if (recordingRoot == null) {
            logger.severe("Failed to get recording root");
            return;
        }
        logger.info("recording root: " + recordingRoot);
        File audioFile = new File(recorder.getRecordPath());
        if (!audioFile.exists()) {
            throw new FileNotFoundException();
        }
        ContentNode node = recordingRoot.getChild(AUDIO_RECORDINGS_DIRECTORY);
        if (node == null) {
            node = recordingRoot.createChild(AUDIO_RECORDINGS_DIRECTORY, Type.COLLECTION);
        }
        ContentCollection dirNode = (ContentCollection) node;
        logger.info("directory for audio recordings: " + dirNode);
        String recordingName = audioFile.getName();
        logger.info("recording name: " + recordingName);
        node = dirNode.getChild(recordingName);
        if (node != null) {
            logger.info("recording already exists, so removing: " + recordingName);
            dirNode.removeChild(recordingName);
        }
        node = dirNode.createChild(recordingName, Type.RESOURCE);
        ContentResource resource = (ContentResource) node;
        logger.info("created a node for the audio file: " + resource);
        resource.put(audioFile);
    }
View Full Code Here

       
        String uri = "";
        ContentRepositoryRegistry registry = ContentRepositoryRegistry.getInstance();
        ContentRepository repo = registry.getRepository(LoginManager.getPrimary());
        try {
            ContentCollection c = repo.getUserRoot();
            try {
                /*
                 * Remove file if it exists.
                 */
                ContentResource r = (ContentResource) c.removeChild(image.getName());
            } catch (Exception e) {
            }
           
            ContentResource r = (ContentResource) c.createChild(
                image.getName(), ContentNode.Type.RESOURCE);
            try {
               
                r.put(image);
               
View Full Code Here

    public static PlacemarkList getUserPlacemarkList() {
        // First fetch the content collection of user placemarks.
        // Upon error, log an error and return an empty list. Then fetch the
        // items from this collection
        try {
            ContentCollection sysNode = getUserPlacemarksContentCollection();
            if (sysNode == null) {
                return new PlacemarkList();
            }
            return getItemList(sysNode);
        } catch (ContentRepositoryException excp) {
View Full Code Here

        // First fetch the PlacemarkList for the user and add the new Placemark
        // and write the new list out
        PlacemarkList placemarkList = getUserPlacemarkList();
        placemarkList.addPlacemark(placemark);
        ContentCollection c = getUserPlacemarksContentCollection();
        setItemList(c, placemarkList);
    }
View Full Code Here

        // First fetch the PlacemarkList for the user and remove the Placemark
        // and write the new list out
        PlacemarkList placemarkList = getUserPlacemarkList();
        placemarkList.removePlacemark(name);
        ContentCollection c = getUserPlacemarksContentCollection();
        setItemList(c, placemarkList);
    }
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.