Examples of WorkspaceNode


Examples of org.jboss.cache.optimistic.WorkspaceNode

   @Override
   public Object visitRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command) throws Throwable
   {
      TransactionWorkspace workspace = getTransactionWorkspace(ctx);
      WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, true, true);

      if (workspaceNode != null)
      {
         setVersioning(ctx, workspace, workspaceNode);
      }
View Full Code Here

Examples of org.jboss.cache.optimistic.WorkspaceNode

   @Override
   public Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command) throws Throwable
   {
      TransactionWorkspace workspace = getTransactionWorkspace(ctx);
      WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, true, true);
      if (workspaceNode != null)
      {
         setVersioning(ctx, workspace, workspaceNode);
      }
      removeDataAndNotify(workspace, workspaceNode, ctx);
View Full Code Here

Examples of org.jboss.cache.optimistic.WorkspaceNode

   @Override
   public Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable
   {
      TransactionWorkspace workspace = getTransactionWorkspace(ctx);
      Object result;
      WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, false, false);

      if (workspaceNode == null)
      {
         if (trace) log.debug("Unable to find node " + command.getFqn() + " in workspace.");
         result = null;
      }
      else
      {
         //add this node into the wrokspace
         notifier.notifyNodeVisited(command.getFqn(), true, ctx);
         Object val = workspaceNode.get(command.getKey());
         workspace.addNode(workspaceNode);
         notifier.notifyNodeVisited(command.getFqn(), false, ctx);
         result = val;
      }
      return result;
View Full Code Here

Examples of org.jboss.cache.optimistic.WorkspaceNode

   public Object visitGetKeysCommand(InvocationContext ctx, GetKeysCommand command) throws Throwable
   {
      TransactionWorkspace workspace = getTransactionWorkspace(ctx);
      Object result;
      Fqn fqn = command.getFqn();
      WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, fqn, workspace, false, false);
      if (workspaceNode == null)
      {
         if (trace) log.trace("unable to find node " + fqn + " in workspace.");
         result = null;
      }
      else
      {
         notifier.notifyNodeVisited(fqn, true, ctx);
         Object keySet = workspaceNode.getKeys();
         workspace.addNode(workspaceNode);
         notifier.notifyNodeVisited(fqn, false, ctx);
         result = keySet;
      }
      return result;
View Full Code Here

Examples of org.jboss.cache.optimistic.WorkspaceNode

   @Override
   public Object visitGetDataMapCommand(InvocationContext ctx, GetDataMapCommand command) throws Throwable
   {
      TransactionWorkspace workspace = getTransactionWorkspace(ctx);
      Object result;
      WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, false, false);
      if (workspaceNode == null)
      {
         if (trace) log.trace("unable to find node " + command.getFqn() + " in workspace.");
         result = null;
      }
      else
      {
         notifier.notifyNodeVisited(command.getFqn(), true, ctx);
         Object data = workspaceNode.getData();
         workspace.addNode(workspaceNode);
         notifier.notifyNodeVisited(command.getFqn(), false, ctx);
         result = data;
      }
      return result;
View Full Code Here

Examples of org.jboss.cache.optimistic.WorkspaceNode

   @Override
   public Object visitGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand command) throws Throwable
   {
      TransactionWorkspace workspace = getTransactionWorkspace(ctx);
      Object result;
      WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, false, false);
      if (workspaceNode == null)
      {
         if (trace) log.trace("Unable to find node " + command.getFqn() + " in workspace.");
         result = null;
      }
      else
      {
         notifier.notifyNodeVisited(command.getFqn(), true, ctx);
         Object nameSet = workspaceNode.getChildrenNames();
         workspace.addNode(workspaceNode);
         notifier.notifyNodeVisited(command.getFqn(), false, ctx);
         result = nameSet;
      }
      return result;
View Full Code Here

Examples of org.jboss.cache.optimistic.WorkspaceNode

   @Override
   public Object visitGetNodeCommand(InvocationContext ctx, GetNodeCommand command) throws Throwable
   {
      TransactionWorkspace workspace = getTransactionWorkspace(ctx);
      Object result;
      WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, false, false);
      if (workspaceNode == null)
      {
         if (trace) log.trace("Unable to find node " + command.getFqn() + " in workspace.");
         result = null;
      }
      else if (workspaceNode.isRemoved())
      {
         if (trace) log.trace("Attempted to retrieve node " + command.getFqn() + " but it has been deleted!");
         result = null;
      }
      else
      {
         notifier.notifyNodeVisited(command.getFqn(), true, ctx);
         workspace.addNode(workspaceNode);
         notifier.notifyNodeVisited(command.getFqn(), false, ctx);
         result = workspaceNode.getNode();
      }
      return result;
   }
View Full Code Here

Examples of org.jboss.cache.optimistic.WorkspaceNode

      {
         log.warn("Attempting to move the root node.  Not taking any action, treating this as a no-op.");
         return;
      }

      WorkspaceNode oldParent = fetchWorkspaceNode(ctx, nodeFqn.getParent(), ws, false, true);
      if (oldParent == null) throw new NodeNotExistsException("Node " + nodeFqn.getParent() + " does not exist!");

      if (parentFqn.equals(oldParent.getFqn()))
      {
         log.warn("Attempting to move a node in same place.  Not taking any action, treating this as a no-op.");
         return;
      }
      // retrieve parent
      WorkspaceNode parent = fetchWorkspaceNode(ctx, parentFqn, ws, false, true);
      if (parent == null) throw new NodeNotExistsException("Node " + parentFqn + " does not exist!");

      Object nodeName = nodeFqn.getLastElement();

      // now that we have the parent and target nodes:
      // first correct the pointers at the pruning point
      oldParent.removeChild(nodeName);

      // parent pointer is calculated on the fly using Fqns.
      // now adjust Fqns of node and all children.
      Fqn nodeNewFqn = Fqn.fromRelativeElements(parent.getFqn(), nodeFqn.getLastElement());

      // pre-notify
      notifier.notifyNodeMoved(nodeFqn, nodeNewFqn, true, ctx);
      recursiveMoveNode(ctx, node, parent.getFqn(), ws);

      // remove old nodes. this may mark some nodes which have already been moved as deleted
      removeNode(ws, node, false, ctx);

      // post-notify
View Full Code Here

Examples of org.jboss.cache.optimistic.WorkspaceNode

    * @param ws      transaction workspace
    */
   private void recursiveMoveNode(InvocationContext ctx, WorkspaceNode node, Fqn newBase, TransactionWorkspace ws)
   {
      Fqn newFqn = Fqn.fromRelativeElements(newBase, node.getFqn().getLastElement());
      WorkspaceNode movedNode = fetchWorkspaceNode(ctx, newFqn, ws, true, true);
      movedNode.putAll(node.getData());

      // invoke children
      for (Object n : node.getChildrenNames())
      {
         WorkspaceNode child = fetchWorkspaceNode(ctx, Fqn.fromRelativeElements(node.getFqn(), n), ws, false, true);
         if (child != null) recursiveMoveNode(ctx, child, newFqn, ws);
      }
   }
View Full Code Here

Examples of org.jboss.cache.optimistic.WorkspaceNode

   {
      // it is already removed - we can ignore it
      if (workspaceNode == null) return false;

      Fqn parentFqn = workspaceNode.getFqn().getParent();
      WorkspaceNode parentNode = fetchWorkspaceNode(ctx, parentFqn, workspace, false, true);
      if (parentNode == null) throw new NodeNotExistsException("Unable to find parent node with fqn " + parentFqn);

      // pre-notify
      if (notify) notifier.notifyNodeRemoved(workspaceNode.getFqn(), true, workspaceNode.getData(), ctx);

      Fqn nodeFqn = workspaceNode.getFqn();
      parentNode.removeChild(nodeFqn.getLastElement());

      SortedMap<Fqn, WorkspaceNode> tailMap = workspace.getNodesAfter(workspaceNode.getFqn());

      for (WorkspaceNode toDelete : tailMap.values())
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.