Package org.jdesktop.wonderland.modules.contentrepo.client

Examples of org.jdesktop.wonderland.modules.contentrepo.client.ContentRepository


    }
   
    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);
View Full Code Here


            Logger.getLogger(PlacemarkComponentProperties.class.getName()).log(Level.SEVERE, null, ex);
        }
       
        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());
View Full Code Here

     */
    public static synchronized ContentCollection getBaseServerCollection(ServerSessionManager manager)
            throws 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");
        }

View Full Code Here

        // Add roots in the JTree for the System area and Users area in the
        // default content repository.
        ContentRepositoryRegistry registry =
                ContentRepositoryRegistry.getInstance();
        ContentRepository repo = registry.getRepository(session);
        try {
            ContentCollection sysCollection = repo.getSystemRoot();
            ContentCollection userCollection =
                    (ContentCollection) repo.getRoot().getChild("users");
            jtree.addTreeRoot(BUNDLE.getString("System"), sysCollection);
            jtree.addTreeRoot(BUNDLE.getString("Users"), userCollection);
            factoryMap.put(sysCollection, new ContentRepoNodeURIFactory());
            factoryMap.put(userCollection, new ContentRepoNodeURIFactory());
        } catch (ContentRepositoryException excp) {
            logger.log(Level.WARNING, "Unable to create roots", excp);
        }

        // Formulate the "home" path as /Users/<login name>
        try {
            homePath = "/Users/" + repo.getUserRoot().getName();
        } catch (ContentRepositoryException excp) {
            logger.log(Level.WARNING, "Unable to find user's home", excp);
        }

        // Add the Module tree root, using a wrapper for the content repo to
View Full Code Here

            session = LoginManager.getPrimary();
        }

        // Fetch the content repository for the server session
        ContentRepositoryRegistry registry = ContentRepositoryRegistry.getInstance();
        ContentRepository contentrepo = registry.getRepository(session);

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

     */
    @Override
    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) {
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);
View Full Code Here

        private Image scaleImage(URL imageURL,int width, int height) {
            try {
                Image scaledBimg = null;
                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) {
View Full Code Here

     */
    private static ContentCollection getSystemContentRepository()
            throws ContentRepositoryException {

        ContentRepositoryRegistry registry = ContentRepositoryRegistry.getInstance();
        ContentRepository cr = registry.getRepository(LoginManager.getPrimary());
        return cr.getSystemRoot();
    }
View Full Code Here

    }
    private static ContentCollection getSystemContentRepository(ServerSessionManager serverSessionManager)
            throws ContentRepositoryException {

        ContentRepositoryRegistry registry = ContentRepositoryRegistry.getInstance();
        ContentRepository cr = registry.getRepository(serverSessionManager);
        return cr.getSystemRoot();
    }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.contentrepo.client.ContentRepository

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.