Package org.jdesktop.wonderland.common.modules

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


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

    this.handleQCInformation();

    this.ncFile.addAttribute( null, qcFlagsAtt );

    // Add some general metadata in global attributes.
    this.ncFile.addAttribute( null, new Attribute( "title",
                                                   new StringBuffer("NGDC archived ")
                                                   .append( datasetIdAtt.getStringValue())
                                                   .append( " data with start time ")
                                                   .append( startDateAtt.getStringValue())
                                                   .toString()));
    this.ncFile.addAttribute( null, new Attribute( "Convention", _Coordinate.Convention));

    // Add some THREDDS specific metadata in global attributes.
    this.ncFile.addAttribute( null, new Attribute( "thredds_creator", "DOD/USAF/SMC > Space and Missile Systems Center (SMC), U.S. Air Force, U.S. Department of Defense"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_contributor", "DOC/NOAA/NESDIS/NGDC > National Geophysical Data Center, NESDIS, NOAA, U.S. Department of Commerce"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_contributor_role", "archive"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_publisher", "DOC/NOAA/NESDIS/NGDC > National Geophysical Data Center, NESDIS, NOAA, U.S. Department of Commerce"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_publisher_url", "http://dmsp.ngdc.noaa.gov/"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_publisher_email", "ngdc.dmsp@noaa.gov"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_summary",
                                                   new StringBuffer("This dataset contains data from the DMSP ").append( spacecraftIdAtt.getStringValue())
                                                   .append( " satellite OLS instrument and includes both visible smooth and thermal smooth imagery with 2.7km resolution.")
                                                   .append( " The start time for this data is ").append( startDateAtt.getStringValue())
                                                   .append( " and the northerly equatorial crossing longitude is ").append( startLongitudeAtt.getNumericValue())
                                                   .append( ".  The DMSP satellite is a polar-orbiting satellite crossing the equator, depending on the satellite, at either dawn/dusk or noon/midnight.")
                                                   .append( " This data is in the NOAA/NGDC DMSP archive format.")
                                                   .toString()));
    this.ncFile.addAttribute( null, new Attribute( "thredds_history", ""));
    this.ncFile.addAttribute( null, new Attribute( "thredds_timeCoverage_start", startDateAtt.getStringValue()));
    this.ncFile.addAttribute( null, new Attribute( "thredds_timeCoverage_end", endDateAtt.getStringValue()));
    this.ncFile.addAttribute( null, new Attribute( "thredds_geospatialCoverage",
                                                   new StringBuffer("Polar orbit with northerly equatorial crossing at longitude ")
                                                   .append( ascendingNodeAtt.getNumericValue()).append( ".")
                                                   .toString()));

View Full Code Here

   * @throws IOException if any problems reading the file (or validating the file).
   */
  private void handleFileInformation()
          throws IOException
  {
    fileIdAtt = new Attribute( this.fileIdAttName,
                               (String) headerInfo.get( HeaderInfoTitle.FILE_ID.toString() ) );
    datasetIdAtt = new Attribute( this.datasetIdAttName,
                                  (String) headerInfo.get( HeaderInfoTitle.DATA_SET_ID.toString() ) );
    recordSizeInBytes = Integer.parseInt( (String) headerInfo.get( HeaderInfoTitle.RECORD_BYTES.toString() ) );
    numRecords = Integer.parseInt( (String) headerInfo.get( HeaderInfoTitle.NUM_RECORDS.toString() ) );
    numHeaderRecords = Integer.parseInt( (String) headerInfo.get( HeaderInfoTitle.NUM_HEADER_RECORDS.toString() ) );
    numDataRecords = Integer.parseInt( (String) headerInfo.get( HeaderInfoTitle.NUM_DATA_RECORDS.toString() ) );
View Full Code Here

   * @throws IOException if any problems reading the file (or validating the file).
   */
  private void handleProcessingInformation()
          throws IOException
  {
    suborbitHistoryAtt = new Attribute( this.suborbitHistoryAttName,
                                        (String) headerInfo.get( HeaderInfoTitle.SUBORBIT_HISTORY.toString() ) );
    processingSystemAtt = new Attribute( this.processingSystemAttName,
                                         (String) headerInfo.get( HeaderInfoTitle.PROCESSING_SYSTEM.toString() ) );
    String processingDateString = (String) headerInfo.get( HeaderInfoTitle.PROCESSING_DATE.toString() );
    try
    {
      processingDate = DateFormatHandler.ALT_DATE_TIME.getDateFromDateTimeString( processingDateString );
    }
    catch ( ParseException e )
    {
      throw new IOException( "Invalid DMSP file: processing date string <" + processingDateString + "> not parseable: " + e.getMessage() );
    }
    processingDateAtt = new Attribute(
            this.processingDateAttName,
            DateFormatHandler.ISO_DATE_TIME.getDateTimeStringFromDate( processingDate ) );
  }
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.