Package org.jdesktop.wonderland.common.modules

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


         */
        HashMap<String, ModuleRequiredCheck> required = new HashMap();
        Iterator<Map.Entry<String, ModuleInfo>> it = removedModules.entrySet().iterator();
        while (it.hasNext() == true) {
            Map.Entry<String, ModuleInfo> entry = it.next();
            ModuleInfo info = entry.getValue();
            required.put(info.getName(), new ModuleRequiredCheck(info));
        }
       
        /*
         * Fetch a map of installed modules. Loop through each and add as
         * requirements to the modules if they are being asked to be removed.
         */
        Map<String, Module> present = this.getInstalledModules();
        Iterator<Map.Entry<String, Module>> it2 = present.entrySet().iterator();
        while (it2.hasNext() == true) {
            /*
             * Fetch the map of modules that this module requires
             */
            Map.Entry<String, Module> entry = it2.next();
            String moduleName = entry.getKey();
            Module module = entry.getValue();
            ModuleInfo info = module.getInfo();
            ModuleRequires requirements = module.getRequires();
           
            /*
             * Loop through each of the requirements of the module and add it
             * to the ModuleRequiredCheck, if it exists. (If it does exist, it
             * means we are checking to see if the module is still required and
             * we want to flag it with this module).
             */
            for (ModuleInfo infoRequires : requirements.getRequires()) {
                ModuleRequiredCheck check = required.get(infoRequires.getName());
                if (check != null) {
                    check.addRequiresModuleInfo(info);
                }
            }
        }
       
        /*
         * Next we need to loop through and see which modules are no longer
         * required. When a module is no longer required, we should add it to
         * the map of satisfied modules and also remove it from all of the
         * other module requirement checks. We continue checking until we can
         * find no more additional modules that are no longer requires.
         */
        boolean found = true;
        while (found == true) {
            found = false;
            Iterator<Map.Entry<String, ModuleRequiredCheck>> it4 = required.entrySet().iterator();
            while (it4.hasNext() == true) {
                Map.Entry<String, ModuleRequiredCheck> entry = it4.next();
               
                /*
                 * If the module is no longer required, then...
                 */
                if (entry.getValue().isRequired() == false) {
                    /* Add it to the 'satified map' */
                    ModuleInfo moduleInfo = entry.getValue().getCheckedModuleInfo();
                    satisfied.put(moduleInfo.getName(), moduleInfo);
                   
                    /* Remove it from the dependency map using the iterator */
                    it4.remove();
                   
                    /*
 
View Full Code Here


         * dependency as met.
         */
        Map<String, Module> present = this.getInstalledModules();
        Iterator<Map.Entry<String, Module>> it2 = present.entrySet().iterator();
        while (it2.hasNext() == true) {
            ModuleInfo potentialDependency = it2.next().getValue().getInfo();
            Iterator<Map.Entry<Module, ModuleDependencyCheck>> it3 = dependencies.entrySet().iterator();
            while (it3.hasNext() == true) {
                ModuleDependencyCheck check = it3.next().getValue();
                check.checkDependency(potentialDependency);
            }
        }
       
        /*
         * Next we need to loop through and see which modules have had their
         * requirements met. When a module has all of its requirements met, then
         * we should add it to the map of satified modules and also remove it
         * from all of the other module dependency checks. We continue checking
         * until we can find no more additional modules requirements met.
         */
        boolean found = true;
        while (found == true) {
            found = false;
            Iterator<Map.Entry<Module, ModuleDependencyCheck>> it4 = dependencies.entrySet().iterator();
            while (it4.hasNext() == true) {
                Map.Entry<Module, ModuleDependencyCheck> entry = it4.next();
                Module module = entry.getKey();
                String moduleName = module.getName();
                ModuleDependencyCheck mdc = entry.getValue();
               
                /*
                 * If the module has all of its requirements met and it is not
                 * already in the map of modules who have had their requirements
                 * met (meaning, this is the first time we see it has had its
                 * requirements met), then...
                 */
                if (mdc.isDependenciesMet() == true && satisfied.containsKey(moduleName) == false) {
                    /* Add it to the 'satified map' */
                    satisfied.put(moduleName, module);
                   
                    /* Remove it from the dependency map using the iterator */
                    it4.remove();
                   
                    /*
                     * Iterator over the remaining dependency check objects. This
                     * part assumes the following works properly in Java: nested
                     * iterations where we just removed an entry from the original
                     * map using the Iterator.remove() method
                     */
                    ModuleInfo moduleInfo = module.getInfo();
                    Iterator<Map.Entry<Module, ModuleDependencyCheck>> it5 = dependencies.entrySet().iterator();
                    while (it5.hasNext() == true) {
                        Map.Entry<Module, ModuleDependencyCheck> check = it5.next();
                        check.getValue().checkDependency(moduleInfo);
                    }
View Full Code Here

         * remove it
         */
        boolean found = false;
        Iterator<ModuleInfo> it = this.requirements.iterator();
        while (it.hasNext() == true) {
            ModuleInfo requirement = it.next();
            if (this.isSatisfied(potentialDependency, requirement) == true) {
                /*
                 * We remove from the iterator so that it also removes from the
                 * underlying list is an iterator-safe fashion.
                 */
 
View Full Code Here

        this.uninstallModules.remove(moduleName);
        ModuleInfo[] infos = this.uninstallList.getModuleInfos();
        List<ModuleInfo> list = new LinkedList(Arrays.asList(infos));
        Iterator<ModuleInfo> it = list.iterator();
        while (it.hasNext() == true) {
            ModuleInfo info = it.next();
            if (info.getName().equals(moduleName) == true) {
                it.remove();
                break;
            }
        }
        ModuleInfo[] newInfos = list.toArray(new ModuleInfo[] {});
View Full Code Here

        marshaller.setProperty("jaxb.formatted.output", true);
        marshaller.marshal(this, w);
    }
   
    public static void main(String args[]) throws JAXBException, IOException {
        ModuleInfo info1 = new ModuleInfo("mpk20", 1, 0, 0);
        ModuleInfo info2 = new ModuleInfo("default", 5, 2, 0);
        ModuleInfoList list = new ModuleInfoList(new ModuleInfo[] { info1, info2 });
        list.encode(new FileWriter("foo.xml"));
    }
View Full Code Here

        this.manifest = new ArchiveManifest(file);
       
        /*
         * 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

            ResponseBuilder rb = Response.status(Response.Status.BAD_REQUEST);
            return rb.build();
        }
       
        /* Check to see that the module info exists -- it's really bad if it doesn't */
        ModuleInfo moduleInfo = module.getInfo();
        if (moduleInfo == null) {
            /* Log an error and return an error response */
            logger.warning("ModuleManager: unable to locate module info: " + moduleName);
            ResponseBuilder rb = Response.status(Response.Status.BAD_REQUEST);
            return rb.build();
        }
       
        /* Write the XML encoding to a writer and return it */
        StringWriter sw = new StringWriter();
        try {
            moduleInfo.encode(sw);
            ResponseBuilder rb = Response.ok(sw.toString());
            return rb.build();
        } catch (javax.xml.bind.JAXBException excp) {
            /* Log an error and return an error response */
            logger.warning("ModuleManager: unable to encode module info " + moduleName);
View Full Code Here

TOP

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

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.