Package java.util

Examples of java.util.TreeSet


   * @return the names of all running HTTPReceivers
   * @throws XException
   *             if something goes wrong
   */
  protected Set getRunningHTTPReceivers() throws XException {
    TreeSet returnSet = new TreeSet();

    for (Iterator it = getAllHTTPReceivers().iterator(); it.hasNext();) {
      Object stoppedHTTPReceiver = it.next();
      if (!mStoppedHTTPReceivers.contains(stoppedHTTPReceiver)) {
        returnSet.add(stoppedHTTPReceiver);
      }
    }

    return returnSet;
  }
View Full Code Here


   * (ReceiverThreads and HTTPReceivers).
   *
   * @return the names of all stopped background receivers
   */
  public Set getStoppedSystems() {
    TreeSet returnSet = new TreeSet();

    returnSet.addAll(mStoppedThreads);
    returnSet.addAll(mStoppedHTTPReceivers);

    return returnSet;
  }
View Full Code Here

    return retList;
  }

  public void writeCSVFile(List entries, String filename)
  {
    TreeSet set = new TreeSet(entries);

    StringBuffer strBuffer = new StringBuffer(
        "Class;Method;Chapter;Section;Key;Type;Optional")
        .append(Constants.LINE_SEPERATOR);
    Entry entry = null;
    for (Iterator it = set.iterator(); it.hasNext();)
    {
      entry = (Entry) it.next();
      strBuffer.append(entry.file).append(";").append(entry.method)
          .append(";").append(entry.chapter).append(";").append(
              entry.section).append(";").append(entry.key)
View Full Code Here

      if (!dir.exists())
         throw new Exception("InitialUpdater.getSupportedVersions invoked but the directory '" + this.initialCmdPath + "' does not exist");
      if (!dir.isDirectory())
         throw new Exception("InitialUpdater.getSupportedVersions invoked but '" + this.initialCmdPath + "' is not a directory");
      File[] childs = dir.listFiles();
      TreeSet set = new TreeSet();
      for (int i=0; i < childs.length; i++) {
         if (childs[i].isDirectory())
            continue;
         if (!childs[i].canRead())
            continue;
         String filename = childs[i].getName();
         String prefix = VersionTransformerCache.stripReplicationPrefix(filename).trim();
         String version = VersionTransformerCache.stripReplicationVersion(filename);
         if (version != null && prefix.equals(this.replPrefix)) {
            log.info("added version='" + version + "' for prefix='" + prefix + "' when encountering file='" + filename + "'");
            set.add(prefix + VERSION_TOKEN + version.trim());
         }
      }
      if (currentReplVersion != null) {
         String txt = this.replPrefix + VERSION_TOKEN + currentReplVersion;
         set.add(txt);
         log.info("added default version '" + txt + "'");
      }
      return InfoHelper.getIteratorAsString(set.iterator());
   }
View Full Code Here

        }

        Element rootNode = requestDoc.createElement(mSource.getName());
        requestDoc.appendChild(rootNode);

        SortedSet paramSet = new TreeSet(parameters.keySet());
        String key = null;
        Node tmpNode = null;
        String[] values = null;
        for (Iterator it = paramSet.iterator(); it.hasNext();)
        {
          key = (String) it.next();
          values = (String[]) parameters.get(key);
          if ((XBUSSystem.FILENAME_WILDCARD.equals(key))
              || (XBUSSystem.FILENAME_WILDCARD_XML.equals(key)))
View Full Code Here

      }
     
      String[] files = subDir.list();
      log.info("retreiving '" + files.length + "' manual transferred data files from directory '" + subDir.getAbsolutePath() + "'");
      // alphabetical order guarantees correct sequence.
      TreeSet set = new TreeSet();
      for (int i=0; i < files.length; i++)
         set.add(files[i]);
      files = (String[])set.toArray(new String[set.size()]);
     
      for (int i=0; i < files.length; i++) {
         File file = new File(subDir, files[i]);
         if (!file.exists())
            throw new Exception("The entry nr. '" + i + "': file '" + file.getAbsolutePath() + "' does not exist");
View Full Code Here

      // Search all other cluster nodes to find the masters of this message ...
      // NOTE: If no filters are used, the masterSet=f(msgUnit) could be cached for performance gain
      //       Cache implementation is currently missing

      Set masterSet = new TreeSet(); // Contains the NodeMasterInfo objects which match this message
                                     // Sorted by stratum (0 is the first entry) -> see NodeMasterInfo.compareTo
      int numRulesFound = 0;                             // For nicer logging of warnings

      QosData publishQos = msgUnit.getQosData();
      if (publishQos.count(glob.getNodeId()) > 1) { // Checked in RequestBroker as well with warning
         log.warning("Warning, message '" + msgUnit.getLogId() +
            "' passed my node id='" + glob.getId() + "' before, we have a circular routing problem, keeping message locally");
         return null;
      }

      ClusterNode[] clusterNodes = getClusterNodes();
      for (int ic=0; ic<clusterNodes.length; ic++) {
         ClusterNode clusterNode = clusterNodes[ic];
         NodeMasterInfo[] nodeMasterInfos = clusterNode.getNodeMasterInfos();

         if (nodeMasterInfos.length < 1)
            continue;
         if (clusterNode.isAllowed() == false) {
            if (log.isLoggable(Level.FINE)) log.fine("Ignoring master node id='" + clusterNode.getId() + "' because it is not available");
            continue;
         }
         if (!clusterNode.isLocalNode() && publishQos.count(clusterNode.getNodeId()) > 0) {
            if (log.isLoggable(Level.FINE)) log.fine("Ignoring node id='" + clusterNode.getId() + "' for routing, message '" +
                            msgUnit.getLogId() + "' has been there already");
            continue;
         }
         if (log.isLoggable(Level.FINE)) log.fine("Testing " + nodeMasterInfos.length + " domains rules of node " +
                                  clusterNode.getId() + " for " + msgUnit.getLogId());
         numRulesFound += clusterNode.getNodeMasterInfos().length;
         // for each domain mapping rule ...
         for (int i=0; i<nodeMasterInfos.length; i++) {
            NodeMasterInfo nodeMasterInfo = (NodeMasterInfo)nodeMasterInfos[i];
            I_MapMsgToMasterId domainMapper = this.mapMsgToMasterPluginManager.getMapMsgToMasterId(
                                 nodeMasterInfo.getType(), nodeMasterInfo.getVersion(), // "DomainToMaster", "1.0"
                                 msgUnit.getContentMime(), msgUnit.getContentMimeExtended());
            if (domainMapper == null) {
               log.warning("No domain mapping plugin type='" + nodeMasterInfo.getType() + "' version='" + nodeMasterInfo.getVersion() +
                              "' found for message mime='" + msgUnit.getContentMime() + "' and '" + msgUnit.getContentMimeExtended() +
                              "' ignoring rules " + nodeMasterInfo.toXml());
               continue;
            }

            // Now invoke the plugin to find out who is the master ...
            nodeMasterInfo = domainMapper.getMasterId(nodeMasterInfo, msgUnit);
            if (nodeMasterInfo != null) {
               masterSet.add(nodeMasterInfo);
               break; // found one
            }
         }
      }

      if (masterSet.size() < 1) {
         if (numRulesFound == 0) {
            if (log.isLoggable(Level.FINE)) log.fine("Using local node for message, no master mapping rules are known.");
         }
         else {
            if (destination == null) {
               log.info("No master found for " + msgUnit.getMethodName() + " message '" + msgUnit.getLogId() + "' mime='" +
                         msgUnit.getContentMime() + "' domain='" + msgUnit.getDomain() + "', using local node.");
            }
            else {
               if (log.isLoggable(Level.FINE)) log.fine("No master found for PtP message '" + msgUnit.getLogId() + "' mime='" +
                         msgUnit.getContentMime() + "' domain='" + msgUnit.getDomain() + "', using local node.");
           
            }
         }
         return null;
      }
      if (masterSet.size() > 1) {
         if (log.isLoggable(Level.FINE)) log.fine(masterSet.size() + " masters found for message '" + msgUnit.getLogId() +
                                      "' domain='" + msgUnit.getDomain() + "'");
      }

      NodeMasterInfo nodeMasterInfo = loadBalancer.getClusterNode(masterSet); // Invoke for masterSet.size()==1 as well, the balancer may choose to ignore it
View Full Code Here

      try {
         return this.storage.getKeys();
      }
      catch (Exception ex) {
         log.warning("An exception occured when retreiving the keys: " + ex.getMessage());
         return new TreeSet();
      }
   }
View Full Code Here

  
   private TreeSet prepareEntries(Map existingFiles) {
      if (log.isLoggable(Level.FINER))
         log.finer(ME+": prepareEntries");
     
      TreeSet chronologicalSet = new TreeSet(new FileComparator());
      if (existingFiles == null || existingFiles.size() < 1) {
         if (log.isLoggable(Level.FINEST)) {
            log.finest(ME+": prepareEntries: nothing to do");
         }
      }
      Iterator iter = existingFiles.values().iterator();
      long currentTime = System.currentTimeMillis();
      while (iter.hasNext()) {
         FileInfo info = (FileInfo)iter.next();
        
         if (isReady(info, currentTime)) {
            chronologicalSet.add(info);
         }
      }
      return chronologicalSet;
   }
View Full Code Here

      this.glob = this.property.getGlobal();
     
      if (property.getMaxEntries() > Integer.MAX_VALUE) throw new XmlBlasterException(this.glob, ErrorCode.RESOURCE_CONFIGURATION_PLUGINFAILED, ME + ".initialize: The maximum number of messages is too big");
     
      this.storage = new TreeMap();
      this.lruSet = new TreeSet(new LruComparator());

      this.isShutdown = false;
   }
View Full Code Here

TOP

Related Classes of java.util.TreeSet

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.