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

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


            ContentCollection csColl = (ContentCollection) grpusrs.getChild("LoginCoverScreen");
            if(csColl==null) {
                csColl = (ContentCollection) grpusrs.createChild("LoginCoverScreen", 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 LoginCoverScreen.xml in " + grpusrs.getPath());
               return null;
           } else {
               logger.warning("find LoginCoverScreen.xml in " + grpusrs.getPath());
           }
          
           Reader r = new InputStreamReader(resource.getURL().openStream());
           LoginCoverScreenInfo out = LoginCoverScreenInfo.decode(r);
           return out;
        } catch (ContentRepositoryException ex) {
            Logger.getLogger(PlacemarkUtils.class.getName()).log(Level.SEVERE, null, ex);
        } catch (JAXBException ex) {
View Full Code Here


            }
            ArrayList<ContentNode> resources = (ArrayList<ContentNode>)csColl.getChildren();
            if (resources != null && resources.size()!=0) {
                csColl.removeChild(resources.get(0).getName());
            }
            ContentResource resource = (ContentResource)csColl.createChild("GoToCoverScreen"+new Date().getTime()+".xml", Type.RESOURCE);
          
            // Write the new list to the resource
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            Writer w = new OutputStreamWriter(os);
            goToCoverScreenInfo.encode(w);
            resource.put(os.toByteArray());
        } catch (ContentRepositoryException ex) {
            Logger.getLogger(PlacemarkUtils.class.getName()).log(Level.SEVERE, null, ex);
        } catch (JAXBException ex) {
            Logger.getLogger(PlacemarkUtils.class.getName()).log(Level.SEVERE, null, ex);
        }
View Full Code Here

            ContentCollection csColl = (ContentCollection) grpusrs.getChild("GoToCoverScreen");
            if(csColl==null) {
                csColl = (ContentCollection) grpusrs.createChild("GoToCoverScreen", 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 {
               logger.warning("find GoToCoverScreen.xml in " + collection.getPath());
           }
          
           Reader r = new InputStreamReader(resource.getURL().openStream());
           GoToCoverScreenInfo out = GoToCoverScreenInfo.decode(r);
           return out;
        } catch (ContentRepositoryException ex) {
            Logger.getLogger(PlacemarkUtils.class.getName()).log(Level.SEVERE, null, ex);
        } catch (JAXBException ex) {
View Full Code Here

            ContentCollection csColl = (ContentCollection) grpusrs.getChild("GoToCoverScreen");
            if(csColl==null) {
                csColl = (ContentCollection) grpusrs.createChild("GoToCoverScreen", 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 {
               logger.warning("find GoToCoverScreen.xml in " + collection.getPath());
           }
          
           Reader r = new InputStreamReader(resource.getURL().openStream());
           GoToCoverScreenInfo out = GoToCoverScreenInfo.decode(r);
           return out;
        } catch (ContentRepositoryException ex) {
            Logger.getLogger(PlacemarkUtils.class.getName()).log(Level.SEVERE, null, ex);
        } catch (JAXBException ex) {
View Full Code Here

            ContentCollection csColl = (ContentCollection) grpusrs.getChild("GoToCoverScreen");
            if(csColl==null) {
                csColl = (ContentCollection) grpusrs.createChild("GoToCoverScreen", 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 " + grpusrs.getPath());
               return null;
           } else {
               logger.warning("find GoToCoverScreen.xml in " + grpusrs.getPath());
           }
          
           Reader r = new InputStreamReader(resource.getURL().openStream());
           GoToCoverScreenInfo out = GoToCoverScreenInfo.decode(r);
           return out;
        } catch (ContentRepositoryException ex) {
            Logger.getLogger(PlacemarkUtils.class.getName()).log(Level.SEVERE, null, ex);
        } catch (JAXBException ex) {
View Full Code Here

            throws JAXBException, ContentRepositoryException
    {
        Marshaller marshaller = getContext().createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
       
        ContentResource resource = (ContentResource) dir.getChild(report.getId());
        if (resource == null) {
            resource = (ContentResource) dir.createChild(report.getId(),
                                                         ContentNode.Type.RESOURCE);
        }
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        marshaller.marshal(report, baos);
        resource.put(baos.toByteArray());
    }
View Full Code Here

    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);
        viewProperties.encode(w);
        resource.put(os.toByteArray());
    }
View Full Code Here

                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) {
                            float nw = width;
                            float nh = (width*bimg.getHeight())/bimg.getWidth();
 
View Full Code Here

        try {
      /*
       * Remove file if it exists.
       */
            ContentResource r = (ContentResource) audioCollection.removeChild(file.getName());
  } catch (Exception e) {
  }

        try {
            ContentResource r = (ContentResource) audioCollection.createChild(
                file.getName(), ContentNode.Type.RESOURCE);

            r.put(file);
        } catch (Exception e) {
      throw new AudioCacheHandlerException("Failed to upload file:  " + e.getMessage());
  }

  return file;
View Full Code Here

TOP

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

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.