Package org.jboss.cache

Examples of org.jboss.cache.Node


      return children;
   }
  
   private void storeSessionIdsForOwner(Node<Object, Object> owner, Fqn<String> webappFqn, Map<String, String> result)
   {
      @SuppressWarnings("unchecked")
      Node webRoot = owner.getChild(webappFqn);
      if (webRoot != null)
      {
         @SuppressWarnings("unchecked")
         Set<String> ids = webRoot.getChildrenNames();
         @SuppressWarnings("unchecked")
         String ownerName = Util.getBuddyOwner(owner.getFqn());
         storeSessionOwners(ids, ownerName, result);
      }
   }
View Full Code Here


      return children;
   }
  
   private void storeSessionIdsForOwner(Node<Object, Object> owner, Fqn<String> webappFqn, Map<String, String> result)
   {
      @SuppressWarnings("unchecked")
      Node webRoot = owner.getChild(webappFqn);
      if (webRoot != null)
      {
         @SuppressWarnings("unchecked")
         Set<String> ids = webRoot.getChildrenNames();
         @SuppressWarnings("unchecked")
         String ownerName = Util.getBuddyOwner(owner.getFqn());
         storeSessionOwners(ids, ownerName, result);
      }
   }
View Full Code Here

   }
  
   private Set<String> getSSOIds() throws Exception
   {
      Fqn<String> ssoRootFqn = Fqn.fromElements(SSO);
      @SuppressWarnings("unchecked")
      Node ssoRoot = cache.getRoot().getChild(ssoRootFqn);
      @SuppressWarnings("unchecked")
      Set<String> result = ssoRoot == null ? new HashSet<String>() : ssoRoot.getChildrenNames();
      return result;
   }
View Full Code Here

   public Collection<String> getAllCategories()
   {
      try
      {
         @SuppressWarnings("unchecked")
         Node base = this.cache.getRoot().getChild(ROOTFQN);
         @SuppressWarnings("unchecked")
         Collection<String> keys = (base == null ? null : base.getChildrenNames());
         if (keys != null && keys.size() > 0)
         {
            keys = Collections.unmodifiableCollection(keys);
         }
         return keys;
View Full Code Here

      Fqn targetFqn = target.getFqn();
      for (Fqn internalFqn : internalFqns)
      {
         if (internalFqn.isChildOf(targetFqn))
         {
            Node internalNode = getInternalNode(target, internalFqn);
            if (internalNode != null)
            {
               result.add(internalNode);
            }
         }
View Full Code Here

   private Node getInternalNode(Node parent, Fqn internalFqn)
   {
      Object name = internalFqn.get(parent.getFqn().size());
      cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
      Node result = parent.getChild(name);
      if (result != null && internalFqn.size() < result.getFqn().size())
      {
         // need to recursively walk down the tree
         result = getInternalNode(result, internalFqn);
      }
View Full Code Here

               output.reset();
               switch (op)
               {
                  case TcpCacheOperations.GET_CHILDREN_NAMES:
                     fqn = (Fqn) input.readObject();
                     Node node = c.getRoot().getChild(fqn);
                     Set<Object> children = node == null ? Collections.emptySet() : node.getChildrenNames();
                     output.writeObject(children);
                     break;
                  case TcpCacheOperations.GET_KEY:
                     fqn = (Fqn) input.readObject();
                     key = input.readObject();
                     retval = c.get(fqn, key);
                     output.writeObject(retval);
                     break;
                  case TcpCacheOperations.GET:
                     fqn = (Fqn) input.readObject();
                     n = c.getNode(fqn);
                     if (n == null)
                     {
                        // node doesn't exist - return null
                        output.writeObject(null);
                        break;
                     }
                     Map map = n.getData();
                     if (map == null) map = new HashMap();
                     output.writeObject(map);
                     break;
                  case TcpCacheOperations.EXISTS:
                     fqn = (Fqn) input.readObject();
                     flag = c.getRoot().hasChild(fqn);
                     output.writeObject(flag);
                     break;
                  case TcpCacheOperations.PUT_KEY_VAL:
                     fqn = (Fqn) input.readObject();
                     key = input.readObject();
                     val = input.readObject();
                     retval = c.put(fqn, key, val);
                     output.writeObject(retval);
                     break;
                  case TcpCacheOperations.PUT:
                     fqn = (Fqn) input.readObject();
                     map = (Map) input.readObject();
                     c.put(fqn, map);
                     output.writeObject(Boolean.TRUE);
                     break;

                  case TcpCacheOperations.PUT_LIST:
                     int length = input.readInt();
                     retval = Boolean.TRUE;
                     if (length > 0)
                     {
                        Modification mod;
                        List<Modification> mods = new ArrayList<Modification>(length);
                        for (int i = 0; i < length; i++)
                        {
                           mod = new Modification();
                           mod.readExternal(input);
                           mods.add(mod);
                        }
                        try
                        {
                           handleModifications(mods);
                        }
                        catch (Exception ex)
                        {
                           retval = ex;
                        }
                     }
                     output.writeObject(retval);
                     break;
                  case TcpCacheOperations.REMOVE_KEY:
                     fqn = (Fqn) input.readObject();
                     key = input.readObject();
                     retval = c.remove(fqn, key);
                     output.writeObject(retval);
                     break;
                  case TcpCacheOperations.REMOVE:
                     fqn = (Fqn) input.readObject();
                     c.removeNode(fqn);
                     output.writeObject(Boolean.TRUE);
                     break;
                  case TcpCacheOperations.REMOVE_DATA:
                     fqn = (Fqn) input.readObject();
                     node = c.getRoot().getChild(fqn);
                     if (node != null)
                     {
                        node.clearData();
                        output.writeObject(true);
                     }
                     else
                     {
                        output.writeObject(false);
View Full Code Here

                  break;
               case PUT_KEY_VALUE:
                  c.put(m.getFqn(), m.getKey(), m.getValue());
                  break;
               case REMOVE_DATA:
                  Node n = c.getRoot().getChild(m.getFqn());
                  if (n != null) n.clearData();
                  break;
               case REMOVE_KEY_VALUE:
                  c.remove(m.getFqn(), m.getKey());
                  break;
               case REMOVE_NODE:
View Full Code Here

            DataTreeRefresher.FqnTreeNode node = (DataTreeRefresher.FqnTreeNode) path.getLastPathComponent();
            Fqn f = node.getFqn();
            if (!f.equals(nodeDataTableModel.getCurrentFqn()))
            {
               nodeDataTableModel.setCurrentFqn(f);
               Node n = cache.getNode(f);
               if (n != null) nodeDataTableModel.setData(n.getData());
            }
         }
      });
      randomGeneratorButton.addActionListener(new ActionListener()
      {
View Full Code Here

         ctx.setOriginLocal(false);
         // use a get() call into the cache to make sure cache loading takes place.
         // no need to cache the original skipDataGravitation setting here - it will always be false of we got here!!
         //todo 2.2  use dataContainer for peek and load the data in the CLInterceptor rather than using the SPI for than!!!
         ctx.getOptionOverrides().setSkipDataGravitation(true);
         Node actualNode = spi.getNode(fqn);
         ctx.getOptionOverrides().setSkipDataGravitation(false);

         if (trace) log.trace("In local tree, this is " + actualNode);

         Fqn backupNodeFqn = null;
         if (actualNode == null && searchSubtrees)
         {
            log.trace("Looking at backup trees.");

            // need to loop through backupSubtree's children
            Set allGroupNames = getBackupRoots();
            if (allGroupNames != null)
            {
               for (Object groupName : allGroupNames)
               {
                  // groupName is the name of a buddy group since all child names in this
                  // collection are direct children of BUDDY_BACKUP_SUBTREE_FQN
                  Fqn backupRoot = Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, (String) groupName);
                  if (buddyFqnTransformer.isDeadBackupRoot(backupRoot))
                  {
                     Set<Integer> deadChildNames = new TreeSet<Integer>(spi.getChildrenNames(backupRoot));
                     Integer[] elems = deadChildNames.toArray(new Integer[deadChildNames.size()]);

                     // these are integers.  we need to start with the highest/most recent.
                     for (int i = elems.length - 1; i > -1; i--)
                     {
                        Integer versionOfDefunctData = elems[i];
                        backupNodeFqn = Fqn.fromRelativeFqn(Fqn.fromRelativeElements(backupRoot, versionOfDefunctData), fqn);

                        // use a get() call into the cache to make sure cache loading takes place.
                        ctx.getOptionOverrides().setSkipDataGravitation(true);
                        actualNode = spi.peek(backupNodeFqn, false);
                        ctx.getOptionOverrides().setSkipDataGravitation(false);

                        // break out of the inner loop searching through the dead node's various backups
                        if (actualNode != null) break;
                     }
                  }
                  else
                  {
                     backupNodeFqn = Fqn.fromRelativeFqn(backupRoot, fqn);
                     // use a get() call into the cache to make sure cache loading takes place.
                     ctx.getOptionOverrides().setSkipDataGravitation(true);
                     actualNode = spi.getNode(backupNodeFqn);
                     ctx.getOptionOverrides().setSkipDataGravitation(false);
                  }

                  if (trace)
                     log.trace("Looking for " + backupNodeFqn + ". Search result: " + actualNode);

                  // break out of outer loop searching through all available backups.
                  if (actualNode != null) break;
               }
            }

         }

         if (actualNode == null)
         {
            return GravitateResult.noDataFound();
         }
         else
         {
            // make sure we LOAD data for this node!!
            actualNode.getData();
         }

         if (backupNodeFqn == null && searchSubtrees)
         {
            backupNodeFqn = buddyFqnTransformer.getBackupFqn(buddyFqnTransformer.getGroupNameFromAddress(localAddress), fqn);
View Full Code Here

TOP

Related Classes of org.jboss.cache.Node

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.