Package org.jboss.cache.marshall

Examples of org.jboss.cache.marshall.NodeData


   }

   @Deprecated
   private List<NodeData> buildNodeDataLegacy(List<NodeData> list, NodeSPI node, boolean mapSafe)
   {
      NodeData data = new NodeData(buddyFqnTransformer.getActualFqn(node.getFqn()), node.getDataDirect(), mapSafe);
      list.add(data);
      for (Object childNode : node.getChildrenDirect())
      {
         buildNodeData(list, (NodeSPI) childNode, true);
      }
View Full Code Here


      {
         return;
      }

      Map attrs;
      NodeData nd;

      // first handle the current node
      attrs = node.getInternalState(false);

      if (attrs.size() == 0)
      {
         nd = new NodeData(node.getFqn());
      }
      else
      {
         nd = new NodeData(node.getFqn(), attrs, true);
      }

      list.add(nd);

      // then visit the children
View Full Code Here

      {
         return;
      }

      Map attrs;
      NodeData nd;

      // first handle the current node
      attrs = node.getInternalState(false);

      if (attrs.size() == 0)
      {
         nd = new NodeData(node.getFqn());
      }
      else
      {
         nd = new NodeData(node.getFqn(), attrs, true);
      }

      list.add(nd);

      // then visit the children
View Full Code Here

         Iterator<NodeData> nodeDataIterator = list.iterator();

         // Read the first NodeData and integrate into our target
         if (nodeDataIterator.hasNext())
         {
            NodeData nd = nodeDataIterator.next();

            //are there any transient nodes at all?
            if (nd != null && !nd.isMarker())
            {
               // with MVCC these calls should ALWAYS go up the interceptor chain since no other locking
               // takes place elsewhere.
               prepareContextOptions();
               cache.clearData(target);
               prepareContextOptions();
               cache.put(target, nd.getAttributes());

               // Check whether this is an integration into the buddy backup
               // subtree
               Fqn tferFqn = nd.getFqn();
               boolean move = target.isChildOrEquals(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN)
                     && !tferFqn.isChildOrEquals(target);
               // If it is an integration, calculate how many levels of offset
               int offset = move ? target.size() - tferFqn.size() : 0;
View Full Code Here

   {
      int parentLevel = parentFqn.size();
      int targetLevel = parentLevel + 1;
      Fqn fqn;
      int size;
      NodeData nd = nodeDataIterator.hasNext() ? nodeDataIterator.next() : null;
      while (nd != null && !nd.isMarker())
      {
         fqn = nd.getFqn();
         // If we need to integrate into the buddy backup subtree,
         // change the Fqn to fit under it
         if (offset > 0)
         {
            fqn = Fqn.fromRelativeFqn(parentFqn.getAncestor(offset), fqn);
         }
         size = fqn.size();
         if (size <= parentLevel)
         {
            return nd;
         }
         else if (size > targetLevel)
         {
            throw new IllegalStateException("NodeData " + fqn + " is not a direct child of " + parentFqn);
         }

         Map attrs = nd.getAttributes();

         prepareContextOptions();
         cache.clearData(fqn);
         prepareContextOptions();
         cache.put(fqn, attrs);

         // Recursively call, which will walk down the tree
         // and return the next NodeData that's a child of our parent
         nd = integrateStateTransferChildren(fqn, offset, nodeDataIterator);
      }
      if (nd != null && nd.isExceptionMarker())
      {
         NodeDataExceptionMarker ndem = (NodeDataExceptionMarker) nd;
         throw new CacheException("State provider node " + ndem.getCacheNodeIdentity()
               + " threw exception during loadState", ndem.getCause());
      }
View Full Code Here

      nodes.abNode.put("ab", "ab");
      nodes.abcNode.put("abc", "abc");
      List<NodeData> result = new ArrayList<NodeData>();
      container.buildNodeData(result, nodes.abNode, true);
      assert result.size() == 2;
      assert result.contains(new NodeData(nodes.ab, nodes.abNode.getData(), true));
      assert result.contains(new NodeData(nodes.abc, nodes.abcNode.getData(), true));
   }
View Full Code Here

         Iterator<NodeData> nodeDataIterator = list.iterator();

         // Read the first NodeData and integrate into our target
         if (nodeDataIterator.hasNext())
         {
            NodeData nd = nodeDataIterator.next();

            //are there any transient nodes at all?
            if (nd != null && !nd.isMarker())
            {
               Map attributes = nd.getAttributes();
               if (usePut)
               {
                  cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
                  cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
                  target.clearData();
                  cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
                  cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
                  target.putAll(attributes);
               }
               else
               {
                  target.setInternalState(attributes);
               }

               // Check whether this is an integration into the buddy backup
               // subtree
               Fqn tferFqn = nd.getFqn();
               Fqn tgtFqn = target.getFqn();
               boolean move = tgtFqn.isChildOrEquals(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN)
                     && !tferFqn.isChildOrEquals(tgtFqn);
               // If it is an integration, calculate how many levels of offset
               int offset = move ? tgtFqn.size() - tferFqn.size() : 0;
View Full Code Here

   {
      int parent_level = parent.getFqn().size();
      int target_level = parent_level + 1;
      Fqn fqn;
      int size;
      NodeData nd = nodeDataIterator.hasNext() ? nodeDataIterator.next() : null;
      while (nd != null && !nd.isMarker())
      {
         fqn = nd.getFqn();
         // If we need to integrate into the buddy backup subtree,
         // change the Fqn to fit under it
         if (offset > 0)
         {
            fqn = Fqn.fromRelativeFqn(parent.getFqn().getAncestor(offset), fqn);
         }
         size = fqn.size();
         if (size <= parent_level)
         {
            return nd;
         }
         else if (size > target_level)
         {
            throw new IllegalStateException("NodeData " + fqn + " is not a direct child of " + parent.getFqn());
         }

         Map attrs = nd.getAttributes();

         // We handle this NodeData.  Create a TreeNode and
         // integrate its data
         NodeSPI target;
         if (usePut)
         {
            cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
            cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
            cache.clearData(fqn);
            cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
            cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
            cache.put(fqn, attrs);
            target = cache.getNode(fqn);
         }
         else
         {
            target = factory.createNode(fqn, parent, attrs);
            parent.addChild(fqn.getLastElement(), target);
            // JBCACHE-913
            Region region = cache.getRegion(fqn, false);
            if (region != null && region.getEvictionRegionConfig() != null)
            {
               region.registerEvictionEvent(fqn, EvictionEvent.Type.ADD_NODE_EVENT, attrs == null ? 0 : attrs.size(), null, null);
            }
         }

         // Recursively call, which will walk down the tree
         // and return the next NodeData that's a child of our parent
         nd = integrateStateTransferChildren(target, offset, nodeDataIterator);
      }
      if (nd != null && nd.isExceptionMarker())
      {
         NodeDataExceptionMarker ndem = (NodeDataExceptionMarker) nd;
         throw new CacheException("State provider node " + ndem.getCacheNodeIdentity()
               + " threw exception during loadState", ndem.getCause());
      }
View Full Code Here

         autocommitPrev = con.getAutoCommit();
         if (config.isBatchEnabled()) con.setAutoCommit(false);
         ps = prepareAndLogStatement(con, config.getInsertNodeSql());
         for (Object aNodeData : nodeData)
         {
            NodeData nd = (NodeData) aNodeData;
            if (nd.isMarker()) break;
            Fqn fqn;
            if (moveToBuddy)
            {
               fqn = buddyFqnTransformer.getBackupFqn(subtree, nd.getFqn());
            }
            else
            {
               fqn = nd.getFqn();
            }

            Map attributes = nd.getAttributes() == null ? null : new HashMap(nd.getAttributes());
            populatePreparedStatementForInsert(fqn, attributes, ps);
            if (!config.isBatchEnabled())
            {
               if (ps.executeUpdate() != 1)
               {
View Full Code Here

         while (rs.next())
         {
            Map<Object, Object> attributes = readAttributes(rs, 2);
            Fqn path = Fqn.fromString(rs.getString(1));
            NodeData nodeData = (attributes == null || attributes.isEmpty()) ? new NodeData(path) : new NodeData(path, attributes, true);
            list.add(nodeData);
         }
      }
      catch (SQLException e)
      {
View Full Code Here

TOP

Related Classes of org.jboss.cache.marshall.NodeData

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.