Package jdbm.helper

Examples of jdbm.helper.Tuple


    * Dumps the tree past the key to debug.
    */
   public void dump(Object key) throws IOException
   {
      TupleBrowser browser = tree.browse(key);
      Tuple t = new Tuple();
      log.debug("contents: " + key);
      while (browser.getNext(t))
      {
         log.debug(t.getKey() + "\t" + t.getValue());
      }
      log.debug("");
   }
View Full Code Here


         }
      }

      // Browse the expiry and remove accordingly
      TupleBrowser browse = expiryTree.browse();
      Tuple tuple = new Tuple();
      List<Long> times = new ArrayList<Long>();
      List<Object> keys = new ArrayList<Object>();
      while (browse.getNext(tuple)) {
         Long time = (Long) tuple.getKey();
         if (time > System.currentTimeMillis())
            break;
         times.add(time);
         Object key = tuple.getValue();
         if (key instanceof List)
            keys.addAll((List) key);
         else
            keys.add(key);
      }
View Full Code Here

   }

   private Set<String> getChildrenNames0(Fqn name) throws IOException
   {
      TupleBrowser browser = tree.browse(name);
      Tuple t = new Tuple();

      if (browser.getNext(t))
      {
         if (!t.getValue().equals(NODE))
         {
            log.trace(" not a node");
            return null;
         }
      }
      else
      {
         log.trace(" no nodes");
         return null;
      }

      Set<String> set = new HashSet<String>();

      // Want only /a/b/c/X nodes
      int depth = name.size() + 1;
      while (browser.getNext(t))
      {
         Fqn fqn = (Fqn) t.getKey();
         int size = fqn.size();
         if (size < depth)
         {
            break;
         }
         if (size == depth && t.getValue().equals(NODE))
         {
            set.add((String) fqn.getLastElement());
         }
      }
View Full Code Here

         }
         return null;
      }

      Fqn keys = keys(name);
      Tuple t = new Tuple();
      Map map = new HashMap();

      synchronized (tree)
      {
         TupleBrowser browser = tree.browse(keys);
         while (browser.getNext(t))
         {
            Fqn fqn = (Fqn) t.getKey();
            if (!fqn.isChildOf(keys))
            {
               break;
            }
            Object k = fqn.getLastElement();
            Object v = t.getValue();
            map.put(nullUnmask(k), nullUnmask(v));
         }
      }

      if (trace)
View Full Code Here

         log.trace("erase " + name + " self=" + self);
      }
      synchronized (tree)
      {
         TupleBrowser browser = tree.browse(name);
         Tuple t = new Tuple();
         if (browser.getNext(t) && self)
         {
            tree.remove(t.getKey());
         }

         while (browser.getNext(t))
         {
            Fqn fqn = (Fqn) t.getKey();
            if (!fqn.isChildOf(name))
            {
               break;
            }
            tree.remove(fqn);
View Full Code Here

    * Dumps the tree past the key to debug.
    */
   public void dump(Object key) throws IOException
   {
      TupleBrowser browser = tree.browse(key);
      Tuple t = new Tuple();
      log.debug("contents: " + key);
      while (browser.getNext(t))
      {
         log.debug(t.getKey() + "\t" + t.getValue());
      }
      log.debug("");
   }
View Full Code Here

            logReader.close();
        }

        // Now walk the cache and update EPersons
        TupleBrowser walker = stampDb.browse();
        Tuple stamp = new Tuple();
        Context ctx = new Context();
        ctx.turnOffAuthorisationSystem();

        while(walker.getNext(stamp))
        {
            // Update an EPerson's last login
            String name = (String) stamp.getKey();
            Date date = (Date) stamp.getValue();
            EPerson ePerson;
            ePerson = EPerson.findByEmail(ctx, name);
            if (null == ePerson)
                ePerson = EPerson.findByNetid(ctx, name);
            if (null == ePerson)
View Full Code Here

    // we must synchronize on the BTree while browsing
      Lock readLock = btree.getLock().readLock();
      try {
        readLock.lock();
          TupleBrowser browser = btree.browse();
          Tuple tuple = new Tuple();
          while(browser.getNext(tuple)) {
            if(tuple.getValue().equals(value))
              return(true);
          }
      } finally {
        readLock.unlock();
      }
View Full Code Here

        BTree tree = BTree.createInstance( recman);

        BPage page = new BPage( tree, test, test );

        TupleBrowser browser;
        Tuple tuple = new Tuple();

        // test insertion
        page.insert( 1, test2, test2, false );
        page.insert( 1, test3, test3, false );
        page.insert( 1, test1, test1, false );

        // test binary search
        browser = page.find( 1, test2 );
        if ( browser.getNext( tuple ) == false ) {
            throw new IllegalStateException( "Browser didn't have 'test2'" );
        }
        if ( ! tuple.getKey().equals( test2 ) ) {
            throw new IllegalStateException( "Tuple key is not 'test2'" );
        }
        if ( ! tuple.getValue().equals( test2 ) ) {
            throw new IllegalStateException( "Tuple value is not 'test2'" );
        }

        recman.close();
        recman = null;
View Full Code Here

        }
    }

    public synchronized void recover(QueueMessageContainer container) throws JMSException {
        try {
            Tuple tuple = new Tuple();
            TupleBrowser iter = getOrderedIndex().browse();
            while (iter.getNext(tuple)) {
                Long key = (Long) tuple.getKey();
                MessageIdentity messageIdentity = null;
                if (key != null) {
                    String messageID = (String) tuple.getValue();
                    if (messageID != null) {
                        messageIdentity = new MessageIdentity(messageID, key);
                    }
                }
                if (messageIdentity != null) {
View Full Code Here

TOP

Related Classes of jdbm.helper.Tuple

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.