Package java.util

Examples of java.util.TreeMap$AscendingSubMap


  }

  // -----------------------------------------------------------------

  public void ejbCreate() throws CreateException {
     oBTree = Collections.synchronizedSortedMap(new TreeMap());
  }
View Full Code Here


    int f, s, e;
    StringBuffer oReport = new StringBuffer(4096);
    String sLine, sOpCode = null, sEntity = null;

    TreeMap oOpen  = new TreeMap();
    Integer oCount;

    LineNumberReader lnr;

    FileReader oReader = new FileReader(sFile);
    BufferedReader oBuffer = new BufferedReader(oReader);
    LineNumberReader oLines = new LineNumberReader(oBuffer);

    while ((sLine = oLines.readLine())!=null) {
      f = 0;
      s = -1;
      while ((s=sLine.indexOf(';',s+1))!=-1) {
        f++;
        switch (f) {
          case 2:
            sOpCode = sLine.substring(s, sLine.indexOf(';', s+1));
            break;
          case 4:
            sEntity = sLine.substring(s, sLine.indexOf(';', s+1));

            if (sOpCode.equals("ODBC") || sOpCode.equals("OJSP")) {
              oCount = (Integer) oOpen.get(sEntity);
              if (oCount==null) {
                oCount = new Integer(1);
                oOpen.put(sEntity, oCount);
              }
              else {
                oCount = new Integer(oCount.intValue()+1);
                oOpen.remove(sEntity);
                oOpen.put(sEntity, oCount);
              }
            } // fi (sOpCode==ODBC)
            else if (sOpCode.equals("CDBC") || sOpCode.equals("CJSP")) {
              oCount = (Integer) oOpen.get(sEntity);
              if (oCount==null) {
                oCount = new Integer(-1);
                oOpen.put(sEntity, oCount);
              }
              else {
                oCount = new Integer(oCount.intValue()-1);
                oOpen.remove(sEntity);
                oOpen.put(sEntity, oCount);
              }
            }
            break;
        } // switch(f)
      } // wend
      if (f%10==0) System.out.print('.');
    } // wend

    System.out.print("\n");

    oReader.close();
    oLines.close();
    oBuffer.close();

    Iterator oKeys = oOpen.keySet().iterator();

    while (oKeys.hasNext()) {
      sEntity = (String) oKeys.next();
      oCount = (Integer) oOpen.get(sEntity);

      if (oCount.intValue()!=0) {
        oReport.append(sEntity + " open/close mismatch " + oCount.toString() + "\n");
      }
    } // wend
View Full Code Here

    String sPaddedID;
    Node oBlksNode = null;
    NodeList oNodeList = null;
    int iNodeListLen = 0;
    Vector<Block> oLinkVctr = null;
    SortedMap oSortedMap = new TreeMap();

    if (DebugFile.trace) {
      if (null==oNode.getFirstChild())
        DebugFile.writeln("Node.getFirstChild() returned null");
    }

    for (oBlksNode=oNode.getFirstChild(); oBlksNode!=null; oBlksNode=oBlksNode.getNextSibling())
      if (Node.ELEMENT_NODE==oBlksNode.getNodeType())
        if (oBlksNode.getNodeName().equals("blocks")) break;

    if (DebugFile.trace)
      if (null==oBlksNode)
        DebugFile.writeln("ERROR: blocks node not found");

    if (null==oBlksNode)
      throw new DOMException(DOMException.NOT_FOUND_ERR, "<blocks> node not found");

    oNodeList = ((Element) oBlksNode).getElementsByTagName("block");
    iNodeListLen = oNodeList.getLength();

    if (DebugFile.trace)
      DebugFile.writeln(String.valueOf(iNodeListLen) + " blocks found.");

    oLinkVctr = new Vector<Block>(iNodeListLen);

    for (int i=0; i<iNodeListLen; i++) {

      if (DebugFile.trace) {
        if (null==oNodeList.item(i).getAttributes().getNamedItem("id"))
          DebugFile.writeln("ERROR: Block " + String.valueOf(i) + " does not have the required id attribute.");
        else
          if (null==oNodeList.item(i).getAttributes().getNamedItem("id").getNodeValue())
            DebugFile.writeln("ERROR: Block " + String.valueOf(i) + " id attribute is null.");
          else if (oNodeList.item(i).getAttributes().getNamedItem("id").getNodeValue().length()==0)
            DebugFile.writeln("ERROR: Block " + String.valueOf(i) + " id attribute is empty.");
      }

      sPaddedID = "-" + Gadgets.leftPad(oNodeList.item(i).getAttributes().getNamedItem("id").getNodeValue(), '0', 3);

      if (DebugFile.trace)
        DebugFile.writeln("padded id = " + sPaddedID);

      if (DebugFile.trace) {
        if (((Element)oNodeList.item(i)).getElementsByTagName("metablock").getLength()==0)
          DebugFile.writeln("ERROR: No MetaBlocks found");
        else
          if (null==((Element)oNodeList.item(i)).getElementsByTagName("metablock").item(0).getFirstChild())
            DebugFile.writeln("ERROR: MetaBlock for Block " + String.valueOf(i) + " does not have the requiered id attribute");
          else
            if (((Element)oNodeList.item(i)).getElementsByTagName("metablock").item(0).getFirstChild().getNodeValue().length()==0)
              DebugFile.writeln("ERROR: MetaBlock for Block " + String.valueOf(i) + " id attribute is empty.");
            else
              DebugFile.writeln("SortedMap.put(" + ((Element)oNodeList.item(i)).getElementsByTagName("metablock").item(0).getFirstChild().getNodeValue() + sPaddedID + ", " + oNodeList.item(i).toString()+")");
      }

      oSortedMap.put(((Element)oNodeList.item(i)).getElementsByTagName("metablock").item(0).getFirstChild().getNodeValue() + sPaddedID, oNodeList.item(i));
    } // next (i)

    Iterator oIterator = oSortedMap.keySet().iterator();
    while (oIterator.hasNext()) {
      Node oAux = (Node) oSortedMap.get(oIterator.next());
      oLinkVctr.add(new Block(oAux));
      if (DebugFile.trace)
        DebugFile.writeln("Inserted " + ((Element)oAux).getElementsByTagName("metablock").item(0).getFirstChild().getNodeValue() + (new Integer(oAux.getAttributes().getNamedItem("id").getNodeValue())).intValue());
    } // wend
View Full Code Here

    public Tokenizer(String str, String delimiters[], boolean returnDelimiters, boolean returnEmptyStrings, char commentStartCharacter, char commentEndCharacter)
    {
        _currentIndex = 0;
        StringBuffer buf = new StringBuffer(str);
        TreeMap indexToDelimiterMap = new TreeMap();
        for (int i = 0; i < delimiters.length; i++)
            getDelimiterIndizes(buf, delimiters[i], commentStartCharacter, commentEndCharacter, indexToDelimiterMap);

        TreeMap indexToTokenMap = new TreeMap();
        getTokenIndizes(buf, indexToDelimiterMap, indexToTokenMap, returnEmptyStrings);
        if (returnDelimiters)
            indexToTokenMap.putAll(indexToDelimiterMap);
        _indexToTokenEntries = new Vector();
        _indexToTokenEntries.addAll(indexToTokenMap.entrySet());
    }
View Full Code Here

            {
                children = EMPTY_FTP_FILE_MAP;
            }
            else
            {
                children = new TreeMap();

                // Remove '.' and '..' elements
                for (int i = 0; i < tmpChildren.length; i++)
                {
                    final FTPFile child = tmpChildren[i];
View Full Code Here

   * @since 4.0
   */

  public static TreeMap mapCmdLine(String sSource)
    throws StringIndexOutOfBoundsException {
  TreeMap oCommands = new TreeMap(String.CASE_INSENSITIVE_ORDER);
  String[] aTokens = tokenizeCmdLine(sSource);
  if (null!=aTokens) {
    for (int t=0; t<aTokens.length; t++) {
      String sToken = aTokens[t];
      int iEq = sToken.indexOf('=');
      if (0==iEq) {
      throw new StringIndexOutOfBoundsException("Parameter "+String.valueOf(t+1)+" begins with equal sign but expected a parameter name");       
      } else if (iEq==sToken.length()-1) {
      throw new StringIndexOutOfBoundsException("Parameter "+String.valueOf(t+1)+" ends with equal sign but expected a value for it");
      } else if (iEq>0) {
        String[] aPair = Gadgets.split2(sToken,'=');
        oCommands.put(aPair[0],aPair[1]);
      }
    } // next
  } // fi
  return oCommands;
  } // mapCmdLine
View Full Code Here

         if (obj instanceof String) {
            httpResponse = new HttpResponse((String)obj, "text/plain"); // CORBA IOR
         }
         else {
            I_HttpRequest httpRequest = (I_HttpRequest)obj;             // Registered plugins
            httpResponse = httpRequest.service(resource, new TreeMap());
         }

         // java.net.HttpURLConnection.HTTP_OK:
         errorResponse(oStream, "HTTP/1.1 200 OK", null, false, null);
         String length = "Content-Length: " + httpResponse.getContent().length;
View Full Code Here

               }

               //since JDK 1.5 or with including jmxremote.jar for JDK 1.3/1.4
               final String storedUser = glob.getProperty().get("xmlBlaster/jmx/rmi/user", (String)null);
               final String storedPassword = glob.getProperty().get("xmlBlaster/jmx/rmi/password", (String)null);
               Map props = new TreeMap();
               if (storedUser != null) {
                  javax.management.remote.JMXAuthenticator auth = new javax.management.remote.JMXAuthenticator() {
                     public javax.security.auth.Subject authenticate(Object credentials) {
                        if (log.isLoggable(Level.FINER)) log.finer("Calling authenticate(" + ((credentials==null)?"null":credentials.toString()) + ")");
                        if (!(credentials instanceof String[])) throw new SecurityException("xmlBlaster responds: Bad credentials, please pass user name and password");
                        String[] creds = (String[])credentials;
                        if (creds.length != 2) throw new SecurityException("xmlBlaster responds: Bad credentials, please pass user name and password");

                        String user = creds[0];
                        String password = creds[1];
                        if (log.isLoggable(Level.FINE)) log.fine("Calling authenticate(user=" + user + ", password=" + password + ")");

                        if (password == null) throw new SecurityException("xmlBlaster responds: Missing password");
                        if (!storedUser.equals(user)) throw new SecurityException("xmlBlaster responds: Unknown user " + user + ",  please try with user '" + storedUser + "'");
                        if (!storedPassword.equals(password)) throw new SecurityException("xmlBlaster responds: Bad password, please try again");

                        Set principals = new HashSet();
                        principals.add(new javax.management.remote.JMXPrincipal(user));
                        return new Subject(true, principals, Collections.EMPTY_SET, Collections.EMPTY_SET);
                     }
                  };
                  props.put("jmx.remote.authenticator", auth); // JMXConnectorServer.AUTHENTICATOR
               }
               else {
                  log.warning("You should switch on authentication with '-xmlBlaster/jmx/rmi/user' and '-xmlBlaster/jmx/rmi/password'");
               }
View Full Code Here

   }

   private ConnectorFactory(Global global) {
      this.global = global;

      this.childGlobals = new TreeMap();
      this.servers = new TreeMap();
   }
View Full Code Here

    * Returns key/values where the key is the threadId and the value is the ThreadUtility object. Never returns null.
    * @param reader
    * @return
    */
   public static Map getThreads(Reader reader) throws IOException {
      Map map = new TreeMap();
      BufferedReader br = new BufferedReader(reader);
      String line = null;
      ThreadUtility thread = null;
      List stack = new ArrayList();
      while ( (line=br.readLine()) != null) {
         if (isHead(line)) {
            if (thread != null) {
               thread.setStack((String[])stack.toArray(new String[stack.size()]));
               map.put(thread.getThreadId(), thread);
            }
            thread = new ThreadUtility();
            thread.setHead(line);
            stack.clear();
         }
View Full Code Here

TOP

Related Classes of java.util.TreeMap$AscendingSubMap

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.