Examples of WorkspaceNode


Examples of org.jboss.cache.optimistic.WorkspaceNode

    * @param includeInvalidNodes
    * @return a node, if found, or null if not.
    */
   private WorkspaceNode fetchWorkspaceNode(InvocationContext ctx, Fqn fqn, TransactionWorkspace workspace, boolean undeleteIfNecessary, boolean includeInvalidNodes)
   {
      WorkspaceNode workspaceNode = workspace.getNode(fqn);
      // if we do not have the node then we need to add it to the workspace
      if (workspaceNode == null)
      {
         NodeSPI node = dataContainer.peek(fqn, true, includeInvalidNodes);
         if (node == null) return null;
         GlobalTransaction gtx = ctx.getGlobalTransaction();
         workspaceNode = lockAndCreateWorkspaceNode(nodeFactory, node, workspace, gtx, lockAcquisitionTimeout);

         // and add the node to the workspace.
         workspace.addNode(workspaceNode);
      }

      // Check that the workspace node has been marked as deleted.
      if (workspaceNode.isRemoved())
      {
         if (trace) log.trace("Node " + fqn + " has been deleted in the workspace.");
         if (undeleteIfNecessary)
         {
            undeleteWorkspaceNode(workspaceNode, fetchWorkspaceNode(ctx, fqn.getParent(), workspace, undeleteIfNecessary, includeInvalidNodes));
         }
         else if (!includeInvalidNodes)
         {
            // don't return deleted nodes if undeleteIfNecessary is false!
            workspaceNode = null;
         }
      }

      // set implicit node versioning flag.
      if (workspaceNode != null && !(workspaceNode.getVersion() instanceof DefaultDataVersion))
      {
         workspaceNode.setVersioningImplicit(false);
      }

      // now make sure all parents are in the wsp as well
      if (workspaceNode != null && !fqn.isRoot())
         fetchWorkspaceNode(ctx, fqn.getParent(), workspace, false, includeInvalidNodes);
View Full Code Here

Examples of org.jboss.cache.optimistic.WorkspaceNode

   }

   protected DataVersion getNodeVersion(TransactionWorkspace w, Fqn f)
   {
      if (w == null) return null;
      WorkspaceNode wn = w.getNode(f);
      if (wn == null) return null; // JBCACHE-1297
      DataVersion v = wn.getVersion();

      if (wn.isVersioningImplicit())
      {
         // then send back an incremented version
         v = ((DefaultDataVersion) v).increment();
      }
View Full Code Here

Examples of org.jboss.cache.optimistic.WorkspaceNode

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

Examples of org.jboss.cache.optimistic.WorkspaceNode

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

Examples of org.jboss.cache.optimistic.WorkspaceNode

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

Examples of org.jboss.cache.optimistic.WorkspaceNode

   @Override
   public Object visitMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
   {
      TransactionWorkspace workspace = getTransactionWorkspace(ctx);
      WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, true, true);
      if (ctx.isOriginLocal() && ctx.getOptionOverrides() != null && ctx.getOptionOverrides().getDataVersion() != null)
      {
         throw new CacheException("Setting a data version while performing a move() is not supported!!");
      }
      if (workspaceNode != null)
View Full Code Here

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
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.