Package org.jboss.cache

Examples of org.jboss.cache.TreeNode


   {
      return CachedType.hasAnnotation(clazz, advisor, type);
   }

   private void createNode(Fqn fqn, GlobalTransaction tx) {
      TreeNode n, child_node;
      Object child_name;
      Fqn tmp_fqn=Fqn.ROOT;

      if(fqn == null) return;
         int treeNodeSize=fqn.size();
         n=cache_.getRoot();
         for(int i=0; i < treeNodeSize; i++) {
            child_name=fqn.get(i);
            tmp_fqn=new Fqn(tmp_fqn, child_name);
            child_node=n.getChild(child_name);
            if(child_node == null) {
               child_node=n.createChild(child_name, tmp_fqn, n);
               if(tx != null) {
                  MethodCall undo_op=MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal,
                                                    new Object[]{tx, tmp_fqn, Boolean.FALSE});
                  cache_.addUndoOperation(tx, undo_op);
               }
View Full Code Here


   private Map getNodeAttributes(Fqn fqn) throws NodeNotLoadedException
   {
      if (fqn == null)
         throw new NodeNotLoadedException();
     
      TreeNode n = cache.getRoot();
      int size = fqn.size();
      for(int i=0; i < size && n != null; i++) {
         n = n.getChild(fqn.get(i));
      }
      if (n != null)
         return n.getData();
      else
         throw new NodeNotLoadedException();
   }
View Full Code Here

         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]);
            }
         }
         catch (EOFException eof) {
            // all done
         }
View Full Code Here

         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]);
            }
         }
         catch (EOFException eof) {
            // all done
         }
View Full Code Here

         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]);
            }
         }
         catch (EOFException eof) {
            // all done
         }
View Full Code Here

            if (children != null)
            {
               for (Iterator iter = children.entrySet().iterator(); iter.hasNext();)
               {
                  Map.Entry entry = (Map.Entry) iter.next();
                  TreeNode child = (TreeNode) entry.getValue();
                  target.addChild(entry.getKey(), child);
               }
            }
           
            target.setRecursiveTreeCacheInstance(cache)// need to set this at root and set it recursively
View Full Code Here

    */
   protected DataNode getNode(Fqn fqn)
   {
      int treeNodeSize = fqn.size();

      TreeNode n = cache.getRoot();
      TreeNode child_node;
      Object child_name;
      for (int i = 0; i < treeNodeSize && n != null; i++)
      {
         child_name = fqn.get(i);
         child_node = n.getChild(child_name);
View Full Code Here

   {
      Fqn tmp_fqn = Fqn.ROOT;

      int size = fqn.size();

      TreeNode n = cache.getRoot();
      for (int i = 0; i < size; i++)
      {
         Object child_name = fqn.get(i);
         tmp_fqn = new Fqn(tmp_fqn, child_name);
         TreeNode child_node = n.getChild(child_name);
         boolean last = (i == size - 1);

         if (child_node == null)
         {
            if (last)
View Full Code Here

                // current workspace node canot be null.
                // try and get the child of current node

                if (log.isTraceEnabled()) log.trace(" Entering synchronized nodewrapper access  for gtx " + gtx);
                TreeNode tempChildNode = workspaceNode.getChild(childName);

//                if (log.isDebugEnabled()) log.debug(" Entered synchronized workspaceNode " + workspaceNode + " access  for gtx " + gtx);

                // no child exists with this name
                if (tempChildNode == null)
                {
                    if (log.isTraceEnabled()) log.trace("Child node "+childName+" doesn't exist.  Creating new node.");
                    // we put the parent node into the workspace as we are changing it's children
                    WorkspaceNode tempCheckWrapper = workspace.getNode(workspaceNode.getFqn());
                    if (tempCheckWrapper == null || tempCheckWrapper.isDeleted())
                    {
                        //add a new one or overwrite an existing one that has been deleted
                        if (log.isTraceEnabled()) log.trace("Parent node "+workspaceNode.getFqn()+" doesn't exist in workspace or has been deleted.  Adding to workspace in gtx " + gtx);
                        workspace.addNode(workspaceNode);
                    }
                    else
                    {
                        if (log.isTraceEnabled()) log.trace(" Parent node " + workspaceNode.getFqn() + " exists in workspace " + gtx);
                    }
                    copy = (Fqn) tmpFqn.clone();
                    // this does not add it into the real child nodes - but in its
                    // local child map for the transaction

                    // get the version passed in, if we need to use explicit versioning.
                    DataVersion versionToPassIn = null;
                    if (isTargetFqn && !workspace.isVersioningImplicit()) versionToPassIn = version;

                    DataNode tempNode = (DataNode) workspaceNode.createChild(childName, copy, workspaceNode.getNode(), cache, versionToPassIn);

                    childWorkspaceNode = NodeFactory.getInstance().createWorkspaceNode(tempNode, workspace);
                   childWorkspaceNode.setVersioningImplicit(versionToPassIn == null || !isTargetFqn);
                   if (log.isTraceEnabled()) log.trace("setting versioning of " + childWorkspaceNode.getFqn() + " to be " + (childWorkspaceNode.isVersioningImplicit() ? "implicit" : "explicit"));

                    // now add the wrapped child node into the transaction space
                    workspace.addNode(childWorkspaceNode);
                    childWorkspaceNode.markAsCreated();
                    // save in list so we can broadcast our created nodes outside
                    // the synch block
                    nodesCreated.add(tmpFqn);

                }
                else
                {
                    // node does exist but might not be in the workspace
                    childWorkspaceNode = workspace.getNode(tempChildNode.getFqn());
                    // wrap it up so we can put it in later if we need to
                    if (childWorkspaceNode == null || childWorkspaceNode.isDeleted())
                    {
                        if (log.isDebugEnabled()) log.debug("Child node "+tempChildNode.getFqn()+" doesn't exist in workspace or has been deleted.  Adding to workspace in gtx " + gtx);
                        childWorkspaceNode = NodeFactory.getInstance().createWorkspaceNode(tempChildNode, workspace);
                        if (isTargetFqn && !workspace.isVersioningImplicit())
                        {
                           childWorkspaceNode.setVersion(version);
                           childWorkspaceNode.setVersioningImplicit(false);
                        }
                       else
                        {
                           childWorkspaceNode.setVersioningImplicit(true);
                        }
                       if (log.isTraceEnabled()) log.trace("setting versioning of " + childWorkspaceNode.getFqn() + " to be " + (childWorkspaceNode.isVersioningImplicit() ? "implicit" : "explicit"));
                      
                    }
                    else
                    {
                        if (log.isDebugEnabled()) log.debug(" Already found " + tempChildNode.getFqn() + " node in workspace " + gtx);

                    }
                }
                workspaceNode = childWorkspaceNode;
            }
View Full Code Here

        {
            return null;
        }

        //see if we already have it
        TreeNode child = (TreeNode) optimisticChildNodeMap.get(child_name);

        // if not we need to create it
        if (child == null)
        {
            child = NodeFactory.getInstance().createNodeOfType(parent, child_name, fqn, parent, null, cache, version);
View Full Code Here

TOP

Related Classes of org.jboss.cache.TreeNode

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.