Author: manik.surtani(a)jboss.com
Date: 2008-07-31 14:08:14 -0400 (Thu, 31 Jul 2008)
New Revision: 6476
Removed:
core/trunk/src/main/java/org/jboss/cache/commands/write/CreateNodeCommand.java
Log:
Removed CreateNodeCommand frm MVCC codepaths
Deleted: core/trunk/src/main/java/org/jboss/cache/commands/write/CreateNodeCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/CreateNodeCommand.java 2008-07-31
18:07:54 UTC (rev 6475)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/CreateNodeCommand.java 2008-07-31
18:08:14 UTC (rev 6476)
@@ -1,85 +0,0 @@
-package org.jboss.cache.commands.write;
-
-import org.jboss.cache.Fqn;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.commands.WriteCommand;
-import org.jboss.cache.commands.read.AbstractDataCommand;
-import org.jboss.cache.invocation.InvocationContext;
-import org.jboss.cache.transaction.GlobalTransaction;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Command that creates a node. Primarily to be used as an undo command for removing
nodes.
- *
- * @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
- * @since 2.2.0
- */
-public class CreateNodeCommand extends AbstractDataCommand implements WriteCommand
-{
- public static final int METHOD_ID = 48;
- protected final List<Fqn> newlyCreated = new LinkedList<Fqn>();
-
- public CreateNodeCommand(Fqn fqn)
- {
- this.fqn = fqn;
- newlyCreated.add(fqn);
- }
-
- public CreateNodeCommand()
- {
- }
-
- public int getCommandId()
- {
- return METHOD_ID;
- }
-
- public void setGlobalTransaction(GlobalTransaction gtx)
- {
- // no op
- }
-
- public GlobalTransaction getGlobalTransaction()
- {
- return null;
- }
-
- /**
- * Creates a node in the cache, specified by the given Fqn.
- */
- public Object perform(InvocationContext ctx)
- {
- Object[] results = dataContainer.createNodes(fqn);
- List<NodeSPI> created = (List<NodeSPI>) results[0];
-
- boolean foundFqn = false;
- if (!created.isEmpty())
- {
- for (NodeSPI n : created)
- {
- if (fqn.equals(n.getFqn())) foundFqn = true;
- newlyCreated.add(n.getFqn());
- }
- }
- if (newlyCreated != null && !foundFqn) newlyCreated.remove(fqn);
-
- return results[1];
- }
-
- public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
- {
- return visitor.visitCreateNodeCommand(ctx, this);
- }
-
- @Override
- public String toString()
- {
- return "CreateNodeCommand{" +
- "fqn=" + fqn +
- ", newlyCreated=" + newlyCreated +
- '}';
- }
-}
Show replies by date