Package org.jboss.cache

Examples of org.jboss.cache.DataNode


  
   private void integrateAssociatedState() throws Exception
   {
      if (associated_state != null && cache instanceof PojoCache) {
        
         DataNode refMapNode = cache.get(InternalDelegate.JBOSS_INTERNAL_MAP);

         ByteArrayInputStream in_stream=new ByteArrayInputStream(associated_state);
         MarshalledValueInputStream in=new MarshalledValueInputStream(in_stream);
        
         try {
            Object[] nameValue;
            while ((nameValue = (Object[]) in.readObject()) != null) {
               TreeNode target = refMapNode.getChild(nameValue[0]);
              
               if (target == null) {
                  // Create the node
                  Fqn fqn = new Fqn(InternalDelegate.JBOSS_INTERNAL_MAP, nameValue[0]);
                  target = factory.createDataNode(nodeType,
                                                  nameValue[0],
                                                  fqn,
                                                  refMapNode,
                                                  null,
                                                  true,
                                                  cache);
                  refMapNode.addChild(nameValue[0], target);
               }
              
               target.put(nameValue[0], nameValue[1]);
            }
         }
View Full Code Here


           
            Map attrs = nd.getAttributes();
           
            // We handle this NodeData.  Create a DataNode and
            // integrate its data           
            DataNode target = factory.createDataNode(nodeType,
                                                     name,
                                                     fqn,
                                                     parent,
                                                     attrs,
                                                     true,
View Full Code Here

      if (fqn == null
            || fqn.size() == 0
            || fqn.isChildOf(InternalDelegate.JBOSS_INTERNAL))
         return;

      DataNode refMapNode = cache.get(InternalDelegate.JBOSS_INTERNAL_MAP);
     
      Map children = null;
      if (refMapNode != null && (children = refMapNode.getChildren()) != null) {
        
         String targetFqn = ObjectUtil.getIndirectFqn(fqn.toString());
        
         Map.Entry entry;
         String key;
         DataNode value;
         for (Iterator iter = children.entrySet().iterator(); iter.hasNext();) {
            entry = (Map.Entry) iter.next();
            key = (String) entry.getKey();
            if (key.startsWith(targetFqn)) {
               value = (DataNode) entry.getValue();
               out.writeObject(new Object[] { key, value.get(key) });
            }
         }
      }
     
   }
View Full Code Here

      _sleep(wakeupIntervalMillis + 500);
      System.out.println(cache.toString(true));

      for (int i = 0; i < 10; i++)
      {
         DataNode node = cache.get("/org/jboss/test/data/" + Integer.toString(i));
         System.out.println(node);
         if (i % 2 == 0)
         {
            if (i < 6)
            {
               int numElements = node.numAttributes();
               assertEquals(i + 1, numElements);
            }
            else
            {
               assertNull(node);
            }
         }
         else
         {
            assertEquals(1, node.numAttributes());
         }
      }
   }
View Full Code Here

      for (int i = 0; i < 20; i++)
      {
         String str = rootStr + Integer.toString(i);
         Fqn fqn = Fqn.fromString(str);
         DataNode node = cache.get(fqn);
         System.out.println(i + " " + node);
         if (i > 9)
         {
            assertNull("Testing at " + i, node);
         }
         else
         {
            assertEquals(1 + i, node.numAttributes());
         }
      }

      for (int i = 0; i < 17; i++)
      {
         cache.put("/org/jboss/data/" + Integer.toString(3), new Integer(100 + i), "value");
      }

      DataNode node = cache.get("/org/jboss/data/" + Integer.toString(3));
      assertEquals(21, node.numAttributes());
      _sleep(wakeupIntervalMillis + 500);

      assertNull(cache.get("/org/jboss/data/" + Integer.toString(3)));
   }
View Full Code Here

         cache.put("/a/1", null);
         cache.put("/a/2", null);
         cache.put("/a/3", null);
         System.out.println("cache is " + cache.printLockInfo());

         DataNode n=cache.get("/a");
         assertNotNull(n);

         Set children=cache.getChildrenNames("/a");
         assertNotNull(children);
         assertEquals(3, children.size());
View Full Code Here

      if (fqn == null
            || fqn.size() == 0
            || fqn.isChildOf(InternalDelegate.JBOSS_INTERNAL))
         return;

      DataNode refMapNode = cache.get(InternalDelegate.JBOSS_INTERNAL_MAP);
     
      Map children = null;
      if (refMapNode != null && (children = refMapNode.getChildren()) != null) {
        
         String targetFqn = ObjectUtil.getIndirectFqn(fqn.toString());
        
         Map.Entry entry;
         String key;
         DataNode value;
         for (Iterator iter = children.entrySet().iterator(); iter.hasNext();) {
            entry = (Map.Entry) iter.next();
            key = (String) entry.getKey();
            if (key.startsWith(targetFqn)) {
               value = (DataNode) entry.getValue();
               out.writeObject(new Object[] { key, value.get(key) });
            }
         }
      }
     
   }
View Full Code Here

   }

   boolean isAopNode(Fqn fqn) throws CacheException
   {
      // Use this API so it doesn't go thru the interceptor.
      DataNode node = cache_.peek(fqn);
      if(node == null) return false;

      if( node.get(AOPInstance.KEY) != null )
         return true;
      else
         return false;
   }
View Full Code Here

      // Let's do cache-wide copy then. It won't be fast and atomic but
      // at least it preserves the pojo structure and also do replication
      // TODO Can TreeCache provide a method to do this??

      // First do a recursive copy using the new base fqn
      DataNode node = cache_.get(thisFqn);
      Map value = node.getData();
      cache_.put(newFqn, value);

      Map children = node.getChildren();
      if(children == null || children.size() == 0)
      {
         cache_.remove(thisFqn);
         return; // we are done
      }
View Full Code Here

         else if (fqn != null && cache.exists(fqn) && loader.exists(fqn)) {
            // Remove the node from the cache loader if it exists in memory,
            // its attributes have been initialized, its children have been loaded,
            // AND it was found in the cache loader (nodeLoaded = true).
            // Then notify the listeners that the node has been activated.
            DataNode n = getNode(fqn); // don't load
            // node not null and attributes have been loaded?
            if (n != null && !n.containsKey(TreeCache.UNINITIALIZED)) {
               if (n.hasChildren()) {
                  if (allInitialized(n)) {
                     log.debug("children all initialized");
                     remove(fqn);
                  }
               } else if (loaderNoChildren(fqn)) {
View Full Code Here

TOP

Related Classes of org.jboss.cache.DataNode

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.