Package org.jdesktop.wonderland.common.modules

Examples of org.jdesktop.wonderland.common.modules.ModuleInfo$Attribute


        mf.write(jos);
    }
   
    public static void main(String[] args) throws IOException, JAXBException {
        ModuleJarWriter mjw = new ModuleJarWriter();
        ModuleInfo info = new ModuleInfo("Fubar", 1, 0, 0, "Fubar module");
        mjw.setModuleInfo(info);
        mjw.addArtFile("models/castle.tiff", new File("/Users/jordanslott/Desktop/yuval.tiff"));
        mjw.addArtFile("models/castle/mystuff.tiff", new File("/Users/jordanslott/Desktop/yuval.tiff"));
        mjw.writeToJar(new File("mymodule.jar"));
    }
View Full Code Here


    public CachedModule getModule(String moduleName) {
        // Look for the cached module. If we can't find it, see if it exists
        // on the server nevertheless.
        CachedModule cm = this.cachedModules.get(moduleName);
        if (cm == null) {
            ModuleInfo info = ModuleUtils.fetchModuleInfo(this.serverURL, moduleName);
            if (info == null) {
                logger.info("[MODULES] No module information found for " + moduleName);
                return null;
            }
            cm = new CachedModule(serverURL, info);
View Full Code Here

        this.setFile(root);
       
        /*
         * Fetch the module info, this is pretty bad if module.xml doesn't exist
         */
        ModuleInfo info = this.fetchModuleInfo();
        if (info == null) {
            info = new ModuleInfo();
        }
        this.setInfo(info);
       
        /*
         * Fetch the module dependencies, this isn't terrible if it doesn't exist
View Full Code Here

        // TODO calculate checksums?       
        super.execute();
    }
   
    private void writeModuleInfo() throws IOException, JAXBException {
        ModuleInfo mi = new ModuleInfo(name, majorVersion, minorVersion,
                miniVersion, moduleDescription);
       
        File moduleInfoFile;
        if (buildDir == null) {
            moduleInfoFile = File.createTempFile("moduleInfo", "xml");
            moduleInfoFile.deleteOnExit();
        } else {
            moduleInfoFile = new File(buildDir, "moduleInfo.xml");
        }
       
        if (overwrite || !compareModuleInfo(mi, moduleInfoFile)) {
            log("Rewriting moduleInfo file", Project.MSG_VERBOSE);
            FileWriter writer = new FileWriter(moduleInfoFile);
            mi.encode(writer);
            writer.close();
        }
       
        ZipFileSet zfs = new ZipFileSet();
        zfs.setFile(moduleInfoFile);
View Full Code Here

        }

        FileReader reader = null;
        try {
            reader = new FileReader(oldMIFile);
            ModuleInfo oldMI = ModuleInfo.decode(reader);
           
            log("New desc:|" + newMI.getDescription() + "|Old desc:|" + oldMI.getDescription() + "|", Project.MSG_VERBOSE);
           
            // ModuleInfo.equals() doesn't check the description field,
            // but we want to re-write the file if the description has
            // changed.
            boolean descChanged = (newMI.getDescription() == null) ?
                (oldMI.getDescription() != null) :
                (!newMI.getDescription().equals(oldMI.getDescription()));
           
            log("ModuleInfo: descChanged: " + descChanged + " " +
                "equals: " + newMI.equals(oldMI), Project.MSG_VERBOSE);
           
            return (!descChanged && newMI.equals(oldMI));
View Full Code Here

    }
   
    private void writeRequires() throws IOException, JAXBException {
        Set<ModuleInfo> mis = new HashSet<ModuleInfo>();
        for (Requires r : requires) {
            mis.add(new ModuleInfo(r.name, r.majorVersion, r.minorVersion,
                    r.miniVersion));
        }
       
        ModuleRequires mr = new ModuleRequires(mis.toArray(new ModuleInfo[0]));
       
View Full Code Here

                    if (f.isDirectory()) {
                        mjw.addDirectory(f);
                    }
                }
            }
            ModuleInfo mi =
                    new ModuleInfo(moduleName, 1, 0, 0, descriptionTF.getText());
            mjw.setModuleInfo(mi);
            try {
                if (targetDir == null) {
                    targetDir = tmpDir.getParentFile();
                }
View Full Code Here

                continue;
            }
           
            /* See if we want to set attributes on the module and add if so */
            if (attributes != null) {
                ModuleInfo info = module.getInfo();
                info.putAttibutes(attributes);
                File infoFile = module.getFile(Module.MODULE_INFO);
                try {
                    FileWriter writer = new FileWriter(infoFile);
                    info.encode(writer);
                    writer.close();
                } catch (Exception ex) {
                    logger.log(Level.WARNING, "[MODULES] INSTALL Failed to update module.xml", ex);
                }
            }
View Full Code Here

    private Map<String, String[]> getChecksums(Map<String, Module> modules) {
        Map<String, String[]> out = new HashMap<String, String[]>();

        for (Iterator<Module> i = modules.values().iterator(); i.hasNext();) {
            ModuleInfo info = i.next().getInfo();
            String filename = info.getAttribute(ModuleAttributes.FILENAME);
            String checksum = info.getAttribute(ModuleAttributes.CHECKSUM);

            if (filename != null) {
                // add both the checksum and the module name
                String[] desc = new String[2];
                desc[0] = checksum;
                desc[1] = info.getName();

                // add to the list of files with checksums
                out.put(filename, desc);

                // remove from the installed list
View Full Code Here

         * violate the dependencies of other modules.
         */
        Iterator<Map.Entry<String, Module>> it1 = passed.entrySet().iterator();
        while (it1.hasNext() == true) {
            Map.Entry<String, Module> entry = it1.next();
            ModuleInfo info = entry.getValue().getInfo();
           
            OverwriteQueryResult res = ModuleOverwriteUtils.canOverwrite(info);
            if (res.getResult() == false) {
                StringBuffer message = new StringBuffer("[MODULES] Unable to replace module " +
                                                        info.getName() + ":\n");
                for (String reason : res.getReasons()) {
                    message.append(reason + "\n");
                }
                logger.warning(message.toString());

View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.common.modules.ModuleInfo$Attribute

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.