Package java.util

Examples of java.util.TreeSet


      long maxEntries = property.getMaxEntries();
      if (maxEntries > Integer.MAX_VALUE)
         throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME, "initialize: The maximum number of messages is too big");
      this.comparator = new MsgComparator();
      this.storage = new TreeSet(this.comparator);
      this.numOfPersistentEntries = 0L;
      this.persistentSizeInBytes = 0L;
      this.isShutdown = false;
   }
View Full Code Here


            if (event.startsWith(ContextNode.LOGGING_MARKER_TAG+"/severe/")
                  || event.startsWith("logging/error/")) {
               // We want to be notified if a log.error() is called, this will
               // notify our LogableDevice.log() method
               XbNotifyHandler.instance().register(Level.SEVERE.intValue(), this);
               if (this.loggingSet == null) this.loggingSet = new TreeSet();
               this.loggingSet.add(event);
            }
            // "logging/warning/*"
            else if (event.startsWith(ContextNode.LOGGING_MARKER_TAG+"/warning/")
                  || event.startsWith("logging/warn/")) {
               XbNotifyHandler.instance().register(Level.WARNING.intValue(), this);
               if (this.loggingSet == null) this.loggingSet = new TreeSet();
               this.loggingSet.add(event);
            }
            // "service/RunlevelManager/event/startupRunlevel8", "service/RunlevelManager/event/shutdownRunlevel7"
            else if (event.startsWith(this.engineGlob.getRunlevelManager().getContextNode().getRelativeName()+"/event/")) {
               log.fine("Register event = " + event);
               this.engineGlob.getRunlevelManager().addRunlevelListener(this);
               if (this.runlevelSet == null) this.runlevelSet = new TreeSet();
               this.runlevelSet.add(event);
            }
            else if (isConnectionStateEvent(event)) {
               // client/[subjectId]/session/[publicSessionId]/event/connectionState
               ClusterManager clusterManager = requestBroker.getServerScope().getClusterManager();
               if (clusterManager == null) {
                  log.warning("Configuration of '" + event + "' is ignored, no cluster manager available");
                  continue;
               }
               if (!clusterManager.isReady()) {
                  log.warning("Configuration of '" + event + "' is ignored, cluster manager is not ready");
                  continue;
               }
               int index = event.lastIndexOf("/event/");
               if (index == -1) {
                  log.warning("Configuration of '" + event + "' is ignored, wrong syntax");
                  continue;
               }
               // strip "event/connectionState"
               String name = event.substring(0, index);
               ClusterNode[] nodes = clusterManager.getClusterNodes();
               for (int ic=0; ic<nodes.length; ic++) {
                  ClusterNode node = nodes[ic];
                  SessionName destination = node.getSessionName();
                  if (destination != null && destination.matchRelativeName(name)) {
                     node.registerConnectionListener(this);
                  }
               }
            }
            else if (isCallbackStateEvent(event)) {
            //else if (event.endsWith("/event/callbackState") || event.endsWith("/event/callbackAlive") || event.endsWith("/event/callbackPolling") || event.endsWith("/event/callbackDead")) {
               // OK: "client/joe/session/1/event/callbackState"
               // Not yet supported: "client/joe/session/1/event/callbackAlive", "client/joe/session/1/event/callbackPolling"
               int index = event.lastIndexOf("/event/");
               if (index == -1) {
                  log.warning("Configuration of '" + event + "' is ignored, wrong syntax");
                  continue;
               }
               String name = event.substring(0, index);
               SessionName sessionName = new SessionName(this.engineGlob, name);
               this.requestBroker.getAuthenticate().addClientListener(this);
               if (this.callbackSessionStateSet == null) this.callbackSessionStateSet = new TreeSet();
               if (event.startsWith(ContextNode.SUBJECT_MARKER_TAG+ContextNode.SEP+"*"+ContextNode.SEP) ||
                   event.endsWith(ContextNode.SESSION_MARKER_TAG+ContextNode.SEP+"*"+"/event/callbackState")) {
                  // "client/*/session/1/event/callbackState" or "client/joe/session/*/event/callbackState"
                  if (this.pendingCallbackSessionInfoSet == null) this.pendingCallbackSessionInfoSet = new TreeSet();
                  this.pendingCallbackSessionInfoSet.add(name);
                  this.callbackSessionStateSet.add(name);
                  SubjectInfo[] subs = null;
                  log.fine("Register existing wildcard callback session state event = " + event);
                  if (event.startsWith(ContextNode.SUBJECT_MARKER_TAG+ContextNode.SEP+"*"+ContextNode.SEP) &&
                      !event.endsWith(ContextNode.SESSION_MARKER_TAG+ContextNode.SEP+"*"+"/event/callbackState")) {
                    subs = this.requestBroker.getAuthenticate().getSubjectInfoArr();
                    for (int sj=0; sj<subs.length; sj++) {
                      SubjectInfo subjectInfo = subs[sj];
                      if (!wildcardMatch(sessionName.getLoginName(), subjectInfo.getLoginName()))
                        continue;
                      SessionInfo[] ses = subjectInfo.getSessions();
                      for (int se=0; se<ses.length; se++) {
                        if (!wildcardMatch(sessionName.getPublicSessionId(), ses[se].getPublicSessionId()))
                          continue;
                        DispatchManager mgr = ses[se].getDispatchManager();
                            if (mgr != null) {
                                mgr.addConnectionStatusListener(this);
                             }
                      }
                    }
                  }
               }
               else {
                  log.fine("Register callback session state event = " + event);
                  SessionInfo sessionInfo = this.requestBroker.getAuthenticate().getSessionInfo(sessionName);
                  DispatchManager mgr = null;
                  if (sessionInfo != null)
                     mgr = sessionInfo.getDispatchManager();
                  if (mgr != null) {
                     mgr.addConnectionStatusListener(this);
                  }
                  else {
                     if (this.pendingCallbackSessionInfoSet == null) this.pendingCallbackSessionInfoSet = new TreeSet();
                     this.pendingCallbackSessionInfoSet.add(sessionName.getAbsoluteName());
                  }
                  this.callbackSessionStateSet.add(sessionName.getRelativeName());
               }
            }
            else if (isConnectionQueueEvent(event)) {
               // client/[subjectId]/session/[publicSessionId]/queue/connection/event/threshold.90%
               // TODO: register in xmlBlasterAccess of each ClusterNode client
               log.severe("Event " + event + " is not implemented");
            }
            else if (isQueueEvent(event)) {
               if (queueEventHandler == null) {
                  queueEventHandler = new QueueEventHandler(serverScope, this);
               }
               queueEventHandler.registerEventType(this, event);
            }
            else if (isPersistenceEvent(event)) {
               if (mapEventHandler == null) {
                  mapEventHandler = new MapEventHandler(serverScope, this);
               }
               mapEventHandler.registerEventType(this, event);
            }
            else if (event.startsWith(ContextNode.SUBJECT_MARKER_TAG+ContextNode.SEP)) {
               // REGEX: "client/.*/session/.*/event/.*"
               // "client/joe/session/1/event/connect", "client/*/session/*/event/disconnect"
               // "client/joe/session/1/event/subscribe"
               log.fine("Register login/logout event = " + event);
               if (event.endsWith("/event/subscribe") || event.endsWith("/event/unSubscribe"))
                  this.requestBroker.addSubscriptionListener(this);
               else if (event.endsWith("/event/remoteProperties"))
                  this.requestBroker.addRemotePropertiesListener(this); // I_RemotePropertiesListener
               else
                  this.requestBroker.getAuthenticate().addClientListener(this);
               if (this.clientSet == null) this.clientSet = new TreeSet();
               this.clientSet.add(event);
            }
            else if (event.startsWith(ContextNode.TOPIC_MARKER_TAG+ContextNode.SEP)) {
               // "topic/hello/event/alive", "topic/hello/event/subscribe" ...
               log.fine("Register topic event = " + event);
               if (event.endsWith("/event/subscribe") || event.endsWith("/event/unSubscribe"))
                  this.requestBroker.addSubscriptionListener(this);
               else
                  this.engineGlob.getTopicAccessor().addTopicListener(this);
               if (this.topicSet == null) this.topicSet = new TreeSet();
               this.topicSet.add(event);
            }
            else if (event.startsWith("heartbeat")) {
               // "heartbeat.360000
               log.fine("Register heartbeat event = " + event);
View Full Code Here

        + " bytes");
    retBuffer.append("\nAvailable processors:            "
        + runtime.availableProcessors());

    retBuffer.append("\n\nEnvironment:\n");
    TreeSet envKeys = new TreeSet(System.getProperties().keySet());
    String key = null;
    for (Iterator it = envKeys.iterator(); it.hasNext();)
    {
      key = (String) it.next();
      retBuffer.append("\n" + key + "=" + System.getProperty(key));
    }
View Full Code Here

   * @return List with chapters
   * @exception XException if any error occurs
   */
  public List getChapters()
  {
    TreeSet chapters = new TreeSet(mCache.keySet());
    return new Vector(chapters);
  } // getChapters()
View Full Code Here

    if (sections == null)
    {
      return null;
    } // if (sections == null)

    TreeSet sectionSet = new TreeSet(sections.keySet());
    return new Vector(sectionSet);
  } // getSections(String chapter)
View Full Code Here

        for (final Iterator iterator = this.getAllowedOperations().iterator(); iterator.hasNext();)
        {
            parameterTypes.addAll(((OperationFacade)iterator.next()).getParameters());
        }

        final Set types = new TreeSet(new TypeComparator());
        final Collection nonArrayTypes = new TreeSet(new TypeComparator());

        // clear out the cache of checkedTypes, otherwise
        // they'll be ignored the second time this method is
        // called (if the instance is reused)
        this.checkedTypes.clear();
View Full Code Here

   public InclusiveNamespaces(Document doc, Set prefixes) {

      super(doc);

      StringBuffer sb = new StringBuffer();
      SortedSet prefixList = new TreeSet(prefixes);


      Iterator it = prefixList.iterator();

      while (it.hasNext()) {
         String prefix = (String) it.next();

         if (prefix.equals("xmlns")) {
View Full Code Here

    * @param inclusiveNamespaces
    * @return A set to string
    */
   public static SortedSet prefixStr2Set(String inclusiveNamespaces) {

      SortedSet prefixes = new TreeSet();

      if ((inclusiveNamespaces == null)
              || (inclusiveNamespaces.length() == 0)) {
         return prefixes;
      }

      StringTokenizer st = new StringTokenizer(inclusiveNamespaces, " \t\r\n");

      while (st.hasMoreTokens()) {
         String prefix = st.nextToken();

         if (prefix.equals("#default")) {
            prefixes.add("xmlns" );
         } else {
            prefixes.add( prefix);
         }
      }

      return prefixes;
   }
View Full Code Here

  /**
   * Returns the font family names available through extensions, in alphabetical order.
   */
  public static Collection getFontFamilyNames()
  {
    TreeSet familyNames = new TreeSet();//FIXMEFONT use collator for order?
    //FIXMEFONT do some cache
    List families = ExtensionsEnvironment.getExtensionsRegistry().getExtensions(FontFamily.class);
    for (Iterator itf = families.iterator(); itf.hasNext();)
    {
      FontFamily family = (FontFamily)itf.next();
      familyNames.add(family.getName());
    }
    return familyNames;
  }
View Full Code Here

      backcolor = plot.getOwnBackcolor();
      orientation = plot.getOrientation();
      backgroundAlphaFloat = plot.getBackgroundAlphaFloat();
      foregroundAlphaFloat = plot.getForegroundAlphaFloat();
      labelRotationDouble = plot.getLabelRotationDouble();
      seriesColors = new TreeSet(plot.getSeriesColors());
    }
    else
    {
      seriesColors = new TreeSet();
    }
  }
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.