Author: mircea.markus
Date: 2008-04-30 11:51:35 -0400 (Wed, 30 Apr 2008)
New Revision: 5774
Removed:
core/trunk/src/main/java/org/jboss/cache/commands/remote/AbstractReplicableCommand.java
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/AbstractVisitor.java
core/trunk/src/main/java/org/jboss/cache/commands/Visitor.java
core/trunk/src/main/java/org/jboss/cache/commands/read/AbstractDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/tx/CommitCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/tx/RollbackCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/CreateNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java
core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/AbstractVersionAwareMarshallerTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java
Log:
refactored the way commands are being build (efficiency)
Modified: core/trunk/src/main/java/org/jboss/cache/commands/AbstractVisitor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/AbstractVisitor.java 2008-04-30
15:16:01 UTC (rev 5773)
+++ core/trunk/src/main/java/org/jboss/cache/commands/AbstractVisitor.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -1,26 +1,12 @@
package org.jboss.cache.commands;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.read.ExistsCommand;
-import org.jboss.cache.commands.read.GetChildrenNamesCommand;
-import org.jboss.cache.commands.read.GetDataMapCommand;
-import org.jboss.cache.commands.read.GetKeyValueCommand;
-import org.jboss.cache.commands.read.GetKeysCommand;
-import org.jboss.cache.commands.read.GetNodeCommand;
-import org.jboss.cache.commands.read.GravitateDataCommand;
+import org.jboss.cache.commands.read.*;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.CreateNodeCommand;
-import org.jboss.cache.commands.write.EvictCommand;
-import org.jboss.cache.commands.write.InvalidateCommand;
-import org.jboss.cache.commands.write.MoveCommand;
-import org.jboss.cache.commands.write.PutDataMapCommand;
-import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.RemoveDataCommand;
-import org.jboss.cache.commands.write.RemoveKeyCommand;
-import org.jboss.cache.commands.write.RemoveNodeCommand;
+import org.jboss.cache.commands.write.*;
import java.util.Collection;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/Visitor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/Visitor.java 2008-04-30 15:16:01 UTC
(rev 5773)
+++ core/trunk/src/main/java/org/jboss/cache/commands/Visitor.java 2008-04-30 15:51:35 UTC
(rev 5774)
@@ -1,26 +1,12 @@
package org.jboss.cache.commands;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.read.ExistsCommand;
-import org.jboss.cache.commands.read.GetChildrenNamesCommand;
-import org.jboss.cache.commands.read.GetDataMapCommand;
-import org.jboss.cache.commands.read.GetKeyValueCommand;
-import org.jboss.cache.commands.read.GetKeysCommand;
-import org.jboss.cache.commands.read.GetNodeCommand;
-import org.jboss.cache.commands.read.GravitateDataCommand;
+import org.jboss.cache.commands.read.*;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.CreateNodeCommand;
-import org.jboss.cache.commands.write.EvictCommand;
-import org.jboss.cache.commands.write.InvalidateCommand;
-import org.jboss.cache.commands.write.MoveCommand;
-import org.jboss.cache.commands.write.PutDataMapCommand;
-import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.RemoveDataCommand;
-import org.jboss.cache.commands.write.RemoveKeyCommand;
-import org.jboss.cache.commands.write.RemoveNodeCommand;
+import org.jboss.cache.commands.write.*;
/**
* This interface is the core of JBoss Cache, where each {@link VisitableCommand} can be
visited by a Visitor implementation.
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/AbstractDataCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/read/AbstractDataCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/read/AbstractDataCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -3,8 +3,6 @@
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.commands.DataCommand;
-import org.jboss.cache.factories.annotations.CacheInjectionMethods;
-import org.jboss.cache.factories.annotations.Inject;
/**
* An abstract class providing basic functionality of all {@link DataCommand}s.
@@ -12,13 +10,11 @@
* @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
* @since 2.2.0
*/
-@CacheInjectionMethods
public abstract class AbstractDataCommand implements DataCommand
{
protected Fqn fqn;
protected DataContainer dataContainer;
- @Inject
public void initialize(DataContainer dataContainer)
{
this.dataContainer = dataContainer;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -24,13 +24,13 @@
{
public static final int METHOD_ID = 16;
- public ExistsCommand()
+ public ExistsCommand(Fqn fqn)
{
+ this.fqn = fqn;
}
- public ExistsCommand(Fqn fqn)
+ public ExistsCommand()
{
- this.fqn = fqn;
}
/**
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -5,11 +5,7 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
/**
* This command retrieves the names of children for a specific Fqn, as defined by {@link
org.jboss.cache.Node#getChildrenNames()}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -20,13 +20,13 @@
{
public static final int METHOD_ID = 24;
- public GetDataMapCommand()
+ public GetDataMapCommand(Fqn fqn)
{
+ this.fqn = fqn;
}
- public GetDataMapCommand(Fqn fqn)
+ public GetDataMapCommand()
{
- this.fqn = fqn;
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -5,8 +5,8 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.notifications.Notifier;
/**
@@ -28,10 +28,6 @@
private Object key;
boolean sendNodeEvent;
- public GetKeyValueCommand()
- {
- }
-
public GetKeyValueCommand(Fqn<?> fqn, Object key, boolean sendNodeEvent)
{
this.fqn = fqn;
@@ -39,9 +35,13 @@
this.sendNodeEvent = sendNodeEvent;
}
- @Inject
- public void injectDependencies(Notifier notifier)
+ public GetKeyValueCommand()
{
+ }
+
+ public void initialize(DataContainer dataContainer, Notifier notifier)
+ {
+ this.dataContainer = dataContainer;
this.notifier = notifier;
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -21,13 +21,13 @@
{
public static final int METHOD_ID = 25;
- public GetKeysCommand()
+ public GetKeysCommand(Fqn fqn)
{
+ this.fqn = fqn;
}
- public GetKeysCommand(Fqn fqn)
+ public GetKeysCommand()
{
- this.fqn = fqn;
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -17,13 +17,13 @@
{
public static final int METHOD_ID = 31;
- public GetNodeCommand()
+ public GetNodeCommand(Fqn fqn)
{
+ this.fqn = fqn;
}
- public GetNodeCommand(Fqn fqn)
+ public GetNodeCommand()
{
- this.fqn = fqn;
}
/**
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -2,17 +2,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Node;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.RPCManager;
+import org.jboss.cache.*;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.buddyreplication.GravitateResult;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.marshall.NodeData;
import java.util.LinkedList;
@@ -43,19 +37,19 @@
private static final Log log = LogFactory.getLog(GravitateDataCommand.class);
private static boolean trace = log.isTraceEnabled();
- public GravitateDataCommand()
- {
- }
-
public GravitateDataCommand(Fqn fqn, boolean searchSubtrees)
{
this.fqn = fqn;
this.searchSubtrees = searchSubtrees;
}
- @Inject
- public void initialize(RPCManager manager, CacheSPI spi)
+ public GravitateDataCommand()
{
+ }
+
+ public void initialize(DataContainer dataContainer, RPCManager manager, CacheSPI spi)
+ {
+ this.dataContainer = dataContainer;
this.rpcManager = manager;
this.spi = spi;
}
Deleted:
core/trunk/src/main/java/org/jboss/cache/commands/remote/AbstractReplicableCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/AbstractReplicableCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/AbstractReplicableCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -1,16 +0,0 @@
-package org.jboss.cache.commands.remote;
-
-import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.factories.annotations.CacheInjectionMethods;
-
-/**
- * An empty abstract class to provide the {@link
org.jboss.cache.factories.annotations.CacheInjectionMethods} annotation
- * for all subclasses.
- *
- * @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
- * @since 2.2.0
- */
-@CacheInjectionMethods
-public abstract class AbstractReplicableCommand implements ReplicableCommand
-{
-}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -4,7 +4,7 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.commands.ReplicableCommand;
import org.jgroups.Address;
/**
@@ -15,7 +15,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2.0
*/
-public class AnnounceBuddyPoolNameCommand extends AbstractReplicableCommand
+public class AnnounceBuddyPoolNameCommand implements ReplicableCommand
{
public static final int METHOD_ID = 28;
private static final Log log = LogFactory.getLog(AnnounceBuddyPoolNameCommand.class);
@@ -37,7 +37,6 @@
this.buddyPoolName = buddyPoolName;
}
- @Inject
public void initialize(BuddyManager buddyManager)
{
this.buddyManager = buddyManager;
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -4,7 +4,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.buddyreplication.BuddyGroup;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.commands.ReplicableCommand;
import java.util.Arrays;
import java.util.Map;
@@ -17,27 +17,27 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2.0
*/
-public class AssignToBuddyGroupCommand extends AbstractReplicableCommand
+public class AssignToBuddyGroupCommand implements ReplicableCommand
{
public static final int METHOD_ID = 29;
+ /* dependencies */
private BuddyManager buddyManager;
-
+ /* parameters */
private BuddyGroup group;
private Map<Fqn, byte[]> state;
- public AssignToBuddyGroupCommand()
- {
- }
-
public AssignToBuddyGroupCommand(BuddyGroup group, Map<Fqn, byte[]> state)
{
this.group = group;
this.state = state;
}
- @Inject
+ public AssignToBuddyGroupCommand()
+ {
+ }
+
public void initialize(BuddyManager manager)
{
this.buddyManager = manager;
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -5,10 +5,10 @@
import org.jboss.cache.DataContainer;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.DataCommand;
+import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.read.ExistsCommand;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.InterceptorChain;
import java.util.ArrayList;
@@ -24,7 +24,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2.0
*/
-public class ClusteredGetCommand extends AbstractReplicableCommand
+public class ClusteredGetCommand implements ReplicableCommand
{
public static final int METHOD_ID = 22;
@@ -36,17 +36,16 @@
private static final Log log = LogFactory.getLog(ClusteredGetCommand.class);
private static boolean trace = log.isTraceEnabled();
- public ClusteredGetCommand()
- {
- }
-
public ClusteredGetCommand(Boolean searchBackupSubtrees, DataCommand dataCommand)
{
this.searchBackupSubtrees = searchBackupSubtrees;
this.dataCommand = dataCommand;
}
- @Inject
+ public ClusteredGetCommand()
+ {
+ }
+
public void initialize(DataContainer dataContainer, InterceptorChain
interceptorChain)
{
this.dataContainer = dataContainer;
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -8,10 +8,10 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
+import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.factories.CommandsFactory;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.InterceptorChain;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
@@ -27,9 +27,11 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class DataGravitationCleanupCommand extends AbstractReplicableCommand
+public class DataGravitationCleanupCommand implements ReplicableCommand
{
public static final int METHOD_ID = 34;
+ private static final Log log =
LogFactory.getLog(DataGravitationCleanupCommand.class);
+ private static boolean trace = log.isTraceEnabled();
/* dependencies */
private BuddyManager buddyManager;
@@ -38,26 +40,22 @@
private CommandsFactory commandsFactory;
private DataContainer dataContainer;
- private static final Log log =
LogFactory.getLog(DataGravitationCleanupCommand.class);
- private static boolean trace = log.isTraceEnabled();
-
/* parameters */
private GlobalTransaction globalTransaction;
private Fqn fqn;
private Fqn backup;
- public DataGravitationCleanupCommand()
- {
- }
-
public DataGravitationCleanupCommand(Fqn primary, Fqn backup)
{
this.fqn = primary;
this.backup = backup;
}
- @Inject
+ public DataGravitationCleanupCommand()
+ {
+ }
+
public void initialize(BuddyManager buddyManager, InterceptorChain invoker,
TransactionTable transactionTable,
CommandsFactory commandsFactory, DataContainer dataContainer)
{
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -2,7 +2,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.commands.ReplicableCommand;
/**
* Removes a buddy from a group. This is not a {@link
org.jboss.cache.commands.VisitableCommand} and hence
@@ -12,7 +12,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class RemoveFromBuddyGroupCommand extends AbstractReplicableCommand
+public class RemoveFromBuddyGroupCommand implements ReplicableCommand
{
public static final int METHOD_ID = 30;
@@ -20,16 +20,15 @@
private String groupName;
- public RemoveFromBuddyGroupCommand()
+ public RemoveFromBuddyGroupCommand(String groupName)
{
+ this.groupName = groupName;
}
- public RemoveFromBuddyGroupCommand(String groupName)
+ public RemoveFromBuddyGroupCommand()
{
- this.groupName = groupName;
}
- @Inject
public void initialize(BuddyManager buddyManager)
{
this.buddyManager = buddyManager;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -7,7 +7,6 @@
import org.jboss.cache.commands.VisitableCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.InterceptorChain;
import java.util.List;
@@ -23,7 +22,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class ReplicateCommand extends AbstractReplicableCommand
+public class ReplicateCommand implements ReplicableCommand
{
public static final int SINGLE_METHOD_ID = 13;
public static final int MULTIPLE_METHOD_ID = 14;
@@ -40,10 +39,6 @@
private ReplicableCommand singleModification;
private List<ReplicableCommand> modifications;
- public ReplicateCommand()
- {
- }
-
public ReplicateCommand(List<ReplicableCommand> modifications)
{
if (modifications != null && modifications.size() == 1)
@@ -58,11 +53,13 @@
public ReplicateCommand(ReplicableCommand command)
{
- this();
this.singleModification = command;
}
- @Inject
+ public ReplicateCommand()
+ {
+ }
+
public void initialize(InterceptorChain interceptorChain)
{
this.invoker = interceptorChain;
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -2,7 +2,6 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.factories.annotations.CacheInjectionMethods;
import org.jboss.cache.transaction.GlobalTransaction;
/**
@@ -11,7 +10,6 @@
* @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
* @since 2.2.0
*/
-@CacheInjectionMethods
public abstract class AbstractTransactionCommand implements VisitableCommand
{
protected GlobalTransaction globalTransaction;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/tx/CommitCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/tx/CommitCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++ core/trunk/src/main/java/org/jboss/cache/commands/tx/CommitCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -14,13 +14,13 @@
{
public static final int METHOD_ID = 11;
- public CommitCommand()
+ public CommitCommand(GlobalTransaction globalTransaction)
{
+ this.globalTransaction = globalTransaction;
}
- public CommitCommand(GlobalTransaction globalTransaction)
+ public CommitCommand()
{
- this.globalTransaction = globalTransaction;
}
public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -20,16 +20,16 @@
public static final int METHOD_ID = 18;
private Map data;
- public OptimisticPrepareCommand()
- {
- }
-
public OptimisticPrepareCommand(GlobalTransaction gtx, List<ReversibleCommand>
modifications, Map data, Address address, boolean onePhaseCommit)
{
super(gtx, modifications, address, onePhaseCommit);
this.data = data;
}
+ public OptimisticPrepareCommand()
+ {
+ }
+
@Override
public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
{
Modified: core/trunk/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++ core/trunk/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -22,10 +22,6 @@
protected Address localAddress;
protected boolean onePhaseCommit;
- public PrepareCommand()
- {
- }
-
public PrepareCommand(GlobalTransaction gtx, List<ReversibleCommand>
modifications, Address localAddress, boolean onePhaseCommit)
{
this.globalTransaction = gtx;
@@ -34,6 +30,10 @@
this.onePhaseCommit = onePhaseCommit;
}
+ public PrepareCommand()
+ {
+ }
+
public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
{
return visitor.visitPrepareCommand(ctx, this);
Modified: core/trunk/src/main/java/org/jboss/cache/commands/tx/RollbackCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/tx/RollbackCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++ core/trunk/src/main/java/org/jboss/cache/commands/tx/RollbackCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -14,13 +14,13 @@
{
public static final int METHOD_ID = 12;
- public RollbackCommand()
+ public RollbackCommand(GlobalTransaction globalTransaction)
{
+ this.globalTransaction = globalTransaction;
}
- public RollbackCommand(GlobalTransaction globalTransaction)
+ public RollbackCommand()
{
- this.globalTransaction = globalTransaction;
}
public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -1,10 +1,9 @@
package org.jboss.cache.commands.write;
import org.jboss.cache.Fqn;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.commands.VersionedDataCommand;
import org.jboss.cache.commands.read.AbstractDataCommand;
-import org.jboss.cache.factories.annotations.CacheInjectionMethods;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
@@ -15,17 +14,17 @@
* @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
* @since 2.2.0
*/
-@CacheInjectionMethods
public abstract class AbstractVersionedDataCommand extends AbstractDataCommand implements
VersionedDataCommand
{
- protected DataVersion dataVersion;
protected Notifier notifier;
+
+ protected DataVersion dataVersion;
protected GlobalTransaction globalTransaction;
- @Inject
- public void injectNotifier(Notifier notifier)
+ public void initialize(Notifier notifier, DataContainer dataContainer)
{
this.notifier = notifier;
+ this.dataContainer = dataContainer;
}
public DataVersion getDataVersion()
Modified: 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-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/CreateNodeCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -22,16 +22,16 @@
public static final int METHOD_ID = 48;
private final List<Fqn> newlyCreated = new LinkedList<Fqn>();
- public CreateNodeCommand()
- {
- }
-
public CreateNodeCommand(Fqn fqn)
{
this.fqn = fqn;
newlyCreated.add(fqn);
}
+ public CreateNodeCommand()
+ {
+ }
+
public int getCommandId()
{
return METHOD_ID;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -25,6 +25,10 @@
this.fqn = fqn;
}
+ public EvictCommand()
+ {
+ }
+
/**
* Evicts a node.
* <p/>
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -2,16 +2,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Node;
-import org.jboss.cache.NodeSPI;
+import org.jboss.cache.*;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Option;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.optimistic.DataVersion;
import javax.transaction.Transaction;
@@ -43,22 +37,20 @@
private TransactionManager transactionManager;
private CacheSPI spi;
- public InvalidateCommand()
+ public InvalidateCommand(Fqn fqn)
{
- super(null);
+ super(fqn);
}
- public InvalidateCommand(Fqn fqn)
+ public InvalidateCommand()
{
- super(fqn);
}
- @Inject
- public void initialize(TransactionManager txManager, Configuration configuration,
CacheSPI spi)
+ public void initialize(TransactionManager txManager, CacheSPI cacheSpi, boolean
optimistic)
{
this.transactionManager = txManager;
- this.spi = spi;
- this.isOptimisticLocking = configuration.isNodeLockingOptimistic();
+ this.spi = cacheSpi;
+ this.isOptimisticLocking = optimistic;
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -2,14 +2,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.NodeNotExistsException;
-import org.jboss.cache.NodeSPI;
+import org.jboss.cache.*;
import org.jboss.cache.commands.ReversibleCommand;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.commands.read.AbstractDataCommand;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.transaction.GlobalTransaction;
@@ -25,20 +21,22 @@
public static final int METHOD_ID = 36;
private static final Log log = LogFactory.getLog(MoveCommand.class);
private static boolean trace = log.isTraceEnabled();
-
+
+ /* dependencies */
+ private Notifier notifier;
+
/* params */
private Fqn to;
- private Notifier notifier;
private GlobalTransaction globalTransaction;
- @Inject
- public void injectNotifier(Notifier notifier)
+ public MoveCommand()
{
- this.notifier = notifier;
}
- public MoveCommand()
+ public void initialize(Notifier notifier, DataContainer dataContainer)
{
+ this.notifier = notifier;
+ this.dataContainer = dataContainer;
}
public MoveCommand(Fqn from, Fqn to)
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -35,13 +35,8 @@
private boolean eraseContents;
private Map oldData;
- public PutDataMapCommand()
- {
- }
-
public PutDataMapCommand(GlobalTransaction globalTransaction, Fqn fqn, Map data,
boolean createUndoOps, boolean eraseContents)
{
- this();
this.globalTransaction = globalTransaction;
this.fqn = fqn;
this.data = data;
@@ -49,6 +44,10 @@
this.eraseContents = eraseContents;
}
+ public PutDataMapCommand()
+ {
+ }
+
/**
* Adds the provided data map to the data map in the node referenced by the specified
Fqn, optionally erasing the node's
* data first (if {@link #isEraseContents()} is <tt>true</tt>).
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -38,10 +38,6 @@
private boolean putForExternalRead;
private Object oldValue;
- public PutKeyValueCommand()
- {
- }
-
public PutKeyValueCommand(GlobalTransaction gtx, Fqn fqn, Object key, Object value,
boolean createUndoOps, boolean putForExternalRead)
{
this.globalTransaction = gtx;
@@ -52,6 +48,10 @@
this.putForExternalRead = putForExternalRead;
}
+ public PutKeyValueCommand()
+ {
+ }
+
/**
* Puts the specified key and value into the data map in the node referenced by the
specified Fqn.
*
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -33,10 +33,6 @@
private boolean eviction;
private HashMap originalData;
- public RemoveDataCommand()
- {
- }
-
public RemoveDataCommand(GlobalTransaction gtx, Fqn fqn, boolean createUndoops,
boolean sendNodeEvent, boolean eviction)
{
this.globalTransaction = gtx;
@@ -46,6 +42,10 @@
this.eviction = eviction;
}
+ public RemoveDataCommand()
+ {
+ }
+
/**
* Clears the data map in the node referenced by the specified Fqn.
*
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -32,19 +32,18 @@
private boolean createUndoOps;
private Object oldValue;
- public RemoveKeyCommand()
- {
- }
-
public RemoveKeyCommand(GlobalTransaction gtx, Fqn fqn, Object key, boolean
createUndoOps)
{
- this();
this.globalTransaction = gtx;
this.fqn = fqn;
this.key = key;
this.createUndoOps = createUndoOps;
}
+ public RemoveKeyCommand()
+ {
+ }
+
/**
* Removes the specified key from the data map in the node referenced by the specified
Fqn.
*
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -33,13 +33,8 @@
private NodeSPI targetNode;
private Map originalData;
- public RemoveNodeCommand()
- {
- }
-
public RemoveNodeCommand(GlobalTransaction globalTransaction, Fqn fqn, boolean
createUndoOps, boolean skipSendingNodeEvents, boolean eviction)
{
- this();
this.globalTransaction = globalTransaction;
this.fqn = fqn;
this.createUndoOps = createUndoOps;
@@ -47,6 +42,10 @@
this.eviction = eviction;
}
+ public RemoveNodeCommand()
+ {
+ }
+
/**
* Removes the node referenced by the specified Fqn.
*
Modified: core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java 2008-04-30
15:16:01 UTC (rev 5773)
+++ core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -1,42 +1,27 @@
package org.jboss.cache.factories;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.RPCManager;
+import org.jboss.cache.*;
import org.jboss.cache.buddyreplication.BuddyGroup;
+import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.commands.DataCommand;
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.ReversibleCommand;
-import org.jboss.cache.commands.read.ExistsCommand;
-import org.jboss.cache.commands.read.GetChildrenNamesCommand;
-import org.jboss.cache.commands.read.GetDataMapCommand;
-import org.jboss.cache.commands.read.GetKeyValueCommand;
-import org.jboss.cache.commands.read.GetKeysCommand;
-import org.jboss.cache.commands.read.GetNodeCommand;
-import org.jboss.cache.commands.read.GravitateDataCommand;
-import org.jboss.cache.commands.remote.AnnounceBuddyPoolNameCommand;
-import org.jboss.cache.commands.remote.AssignToBuddyGroupCommand;
-import org.jboss.cache.commands.remote.ClusteredGetCommand;
-import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
-import org.jboss.cache.commands.remote.RemoveFromBuddyGroupCommand;
-import org.jboss.cache.commands.remote.ReplicateCommand;
+import org.jboss.cache.commands.read.*;
+import org.jboss.cache.commands.remote.*;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.CreateNodeCommand;
-import org.jboss.cache.commands.write.EvictCommand;
-import org.jboss.cache.commands.write.InvalidateCommand;
-import org.jboss.cache.commands.write.MoveCommand;
-import org.jboss.cache.commands.write.PutDataMapCommand;
-import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.RemoveDataCommand;
-import org.jboss.cache.commands.write.RemoveKeyCommand;
-import org.jboss.cache.commands.write.RemoveNodeCommand;
+import org.jboss.cache.commands.write.*;
+import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.interceptors.InterceptorChain;
+import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.transaction.TransactionTable;
import org.jgroups.Address;
+import javax.transaction.TransactionManager;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -56,50 +41,60 @@
public class CommandsFactory
{
private RPCManager rpcManager;
- private ComponentRegistry registry;
+ private DataContainer dataContainer;
+ private Notifier notifier;
+ private InterceptorChain invoker;
+ private BuddyManager buddyManager;
+ private TransactionTable transactionTable;
+ private CacheSPI cacheSpi;
+ private Configuration configuration;
+ private TransactionManager txManager;
public CommandsFactory()
{
}
- public CommandsFactory(RPCManager rpcManager, ComponentRegistry registry)
- {
- this.rpcManager = rpcManager;
- this.registry = registry;
- }
-
@Inject
- public void initialize(RPCManager rpc, ComponentRegistry registry)
+ public void initialize(RPCManager rpc, DataContainer dataContainer, Notifier notifier,
BuddyManager buddyManager,
+ InterceptorChain invoker, TransactionTable transactionTable,
CacheSPI cacheSpi,
+ Configuration configuration, TransactionManager txManager)
{
this.rpcManager = rpc;
- this.registry = registry;
+ this.dataContainer = dataContainer;
+ this.notifier = notifier;
+ this.buddyManager = buddyManager;
+ this.invoker = invoker;
+ this.transactionTable = transactionTable;
+ this.cacheSpi = cacheSpi;
+ this.configuration = configuration;
+ this.txManager = txManager;
}
public PutDataMapCommand buildPutDataMapCommand(GlobalTransaction gtx, Fqn fqn, Map
data, boolean createUndoOps, boolean eraseContents)
{
PutDataMapCommand cmd = new PutDataMapCommand(gtx, fqn, data, createUndoOps,
eraseContents);
- registry.wireDependencies(cmd);
+ cmd.initialize(notifier, dataContainer);
return cmd;
}
public PutKeyValueCommand buildPutKeyValueCommand(GlobalTransaction gtx, Fqn fqn,
Object key, Object value, boolean createUndoOps, boolean putForExternalRead)
{
PutKeyValueCommand command = new PutKeyValueCommand(gtx, fqn, key, value,
createUndoOps, putForExternalRead);
- registry.wireDependencies(command);
+ command.initialize(notifier, dataContainer);
return command;
}
public ReplicateCommand buildReplicateCommand(ReplicableCommand command)
{
ReplicateCommand cmd = new ReplicateCommand(command);
- registry.wireDependencies(cmd);
+ cmd.initialize(invoker);
return cmd;
}
public ReplicateCommand buildReplicateCommand(List<ReplicableCommand>
modifications)
{
ReplicateCommand cmd = new ReplicateCommand(modifications);
- registry.wireDependencies(cmd);
+ cmd.initialize(invoker);
return cmd;
}
@@ -110,135 +105,128 @@
public PrepareCommand buildPrepareCommand(GlobalTransaction gtx,
List<ReversibleCommand> modifications, Address address, boolean onePhaseCommit)
{
- PrepareCommand cmd = new PrepareCommand(gtx, modifications, address,
onePhaseCommit);
- registry.wireDependencies(cmd);
- return cmd;
+ return new PrepareCommand(gtx, modifications, address, onePhaseCommit);
}
public CommitCommand buildCommitCommand(GlobalTransaction gtx)
{
- CommitCommand cmd = new CommitCommand(gtx);
- registry.wireDependencies(cmd);
- return cmd;
+ return new CommitCommand(gtx);
}
public DataGravitationCleanupCommand buildDataGravitationCleanupCommand(Fqn
primaryFqn, Fqn backupFqn)
{
DataGravitationCleanupCommand command = new
DataGravitationCleanupCommand(primaryFqn, backupFqn);
- registry.wireDependencies(command);
+ command.initialize(buddyManager, invoker, transactionTable, this, dataContainer);
return command;
}
public GravitateDataCommand buildGravitateDataCommand(Fqn fqn, Boolean
searchSubtrees)
{
GravitateDataCommand command = new GravitateDataCommand(fqn, searchSubtrees);
- registry.wireDependencies(command);
+ command.initialize(dataContainer, rpcManager, cacheSpi);
return command;
}
public RemoveNodeCommand buildRemoveNodeCommand(GlobalTransaction gtx, Fqn fqn,
boolean eviction, boolean skipSendingNodeEvents, boolean createUndoOps)
{
RemoveNodeCommand command = new RemoveNodeCommand(gtx, fqn, createUndoOps,
skipSendingNodeEvents, eviction);
- registry.wireDependencies(command);
+ command.initialize(notifier, dataContainer);
return command;
}
public RemoveDataCommand buildRemoveDataCommand(GlobalTransaction gtx, Fqn fqn,
boolean createUndoops, boolean sendNodeEvent, boolean eviction)
{
RemoveDataCommand command = new RemoveDataCommand(gtx, fqn, createUndoops,
sendNodeEvent, eviction);
- registry.wireDependencies(command);
+ command.initialize(notifier, dataContainer);
return command;
}
public EvictCommand buildEvictFqnCommand(Fqn fqn)
{
EvictCommand command = new EvictCommand(fqn);
- registry.wireDependencies(command);
+ command.initialize(notifier, dataContainer);
return command;
}
public InvalidateCommand buildInvalidateCommand(Fqn fqn)
{
InvalidateCommand command = new InvalidateCommand(fqn);
- registry.wireDependencies(command);
+ command.initialize(notifier, dataContainer);
+ command.initialize(txManager, cacheSpi, configuration.isNodeLockingOptimistic());
return command;
}
public RemoveKeyCommand buildRemoveKeyCommand(GlobalTransaction tx, Fqn<?> fqn,
Object key, boolean b)
{
RemoveKeyCommand command = new RemoveKeyCommand(tx, fqn, key, b);
- registry.wireDependencies(command);
+ command.initialize(notifier, dataContainer);
return command;
}
public GetDataMapCommand buildGetDataMapCommand(Fqn fqn)
{
GetDataMapCommand command = new GetDataMapCommand(fqn);
- registry.wireDependencies(command);
+ command.initialize(dataContainer);
return command;
}
public ExistsCommand buildExistsNodeCommand(Fqn fqn)
{
ExistsCommand command = new ExistsCommand(fqn);
- registry.wireDependencies(command);
+ command.initialize(dataContainer);
return command;
}
public GetKeyValueCommand buildGetKeyValueCommand(Fqn<?> fqn, Object key,
boolean sendNodeEvent)
{
GetKeyValueCommand command = new GetKeyValueCommand(fqn, key, sendNodeEvent);
- registry.wireDependencies(command);
+ command.initialize(dataContainer, notifier);
return command;
}
public GetNodeCommand buildGetNodeCommand(Fqn fqn)
{
GetNodeCommand command = new GetNodeCommand(fqn);
- registry.wireDependencies(command);
+ command.initialize(dataContainer);
return command;
}
public GetKeysCommand buildGetKeysCommand(Fqn fqn)
{
GetKeysCommand command = new GetKeysCommand(fqn);
- registry.wireDependencies(command);
+ command.initialize(dataContainer);
return command;
}
public GetChildrenNamesCommand buildGetChildrenNamesCommand(Fqn fqn)
{
GetChildrenNamesCommand command = new GetChildrenNamesCommand(fqn);
- registry.wireDependencies(command);
+ command.initialize(dataContainer);
return command;
}
public MoveCommand buildMoveCommand(Fqn from, Fqn to)
{
MoveCommand command = new MoveCommand(from, to);
- registry.wireDependencies(command);
+ command.initialize(notifier, dataContainer);
return command;
}
public GravitateDataCommand buildGravitateDataCacheCommand(Fqn fqn, boolean
searchSubtrees)
{
GravitateDataCommand command = new GravitateDataCommand(fqn, searchSubtrees);
- registry.wireDependencies(command);
+ command.initialize(dataContainer, rpcManager, cacheSpi);
return command;
}
public RollbackCommand buildRollbackCommand(GlobalTransaction gtx)
{
- RollbackCommand cmd = new RollbackCommand(gtx);
- registry.wireDependencies(cmd);
- return cmd;
+ return new RollbackCommand(gtx);
}
public OptimisticPrepareCommand buildOptimisticPrepareCommand(GlobalTransaction gtx,
List<ReversibleCommand> modifications, Map data, Address address, boolean
onePhaseCommit)
{
- OptimisticPrepareCommand cmd = new OptimisticPrepareCommand(gtx, modifications,
data, address, onePhaseCommit);
- registry.wireDependencies(cmd);
- return cmd;
+ return new OptimisticPrepareCommand(gtx, modifications, data, address,
onePhaseCommit);
}
@@ -251,36 +239,36 @@
public AnnounceBuddyPoolNameCommand buildAnnounceBuddyPoolNameCommand(Address address,
String buddyPoolName)
{
AnnounceBuddyPoolNameCommand command = new AnnounceBuddyPoolNameCommand(address,
buddyPoolName);
- registry.wireDependencies(command);
+ command.initialize(buddyManager);
return command;
}
public RemoveFromBuddyGroupCommand buildRemoveFromBuddyGroupCommand(String groupName)
{
RemoveFromBuddyGroupCommand command = new RemoveFromBuddyGroupCommand(groupName);
- registry.wireDependencies(command);
+ command.initialize(buddyManager);
return command;
}
public AssignToBuddyGroupCommand buildAssignToBuddyGroupCommand(BuddyGroup group,
Map<Fqn, byte[]> state)
{
AssignToBuddyGroupCommand command = new AssignToBuddyGroupCommand(group, state);
- registry.wireDependencies(command);
+ command.initialize(buddyManager);
return command;
}
public ClusteredGetCommand buildClusteredGetCommand(Boolean searchBackupSubtrees,
DataCommand dataCommand)
{
ClusteredGetCommand command = new ClusteredGetCommand(searchBackupSubtrees,
dataCommand);
- registry.wireDependencies(command);
+ command.initialize(dataContainer, invoker);
return command;
}
public CreateNodeCommand buildCreateNodeCommand(Fqn fqn)
{
- CreateNodeCommand cmd = new CreateNodeCommand(fqn);
- registry.wireDependencies(cmd);
- return cmd;
+ CreateNodeCommand command = new CreateNodeCommand(fqn);
+ command.initialize(dataContainer);
+ return command;
}
/**
@@ -292,126 +280,203 @@
*/
public ReplicableCommand fromStream(int id, Object[] parameters)
{
- ReplicableCommand returnValue;
switch (id)
{
case ExistsCommand.METHOD_ID:
- returnValue = new ExistsCommand();
- break;
-
+ {
+ ExistsCommand result = new ExistsCommand();
+ result.initialize(dataContainer);
+ result.setParameters(id, parameters);
+ return result;
+ }
case GetChildrenNamesCommand.METHOD_ID:
- returnValue = new GetChildrenNamesCommand();
- break;
-
+ {
+ GetChildrenNamesCommand returnValue = new GetChildrenNamesCommand();
+ returnValue.initialize(dataContainer);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case GetDataMapCommand.METHOD_ID:
- returnValue = new GetDataMapCommand();
- break;
-
+ {
+ GetDataMapCommand returnValue = new GetDataMapCommand();
+ returnValue.initialize(dataContainer);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case GetKeysCommand.METHOD_ID:
- returnValue = new GetKeysCommand();
- break;
-
+ {
+ GetKeysCommand returnValue = new GetKeysCommand();
+ returnValue.initialize(dataContainer);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case GetKeyValueCommand.METHOD_ID:
- returnValue = new GetKeyValueCommand();
- break;
-
+ {
+ GetKeyValueCommand returnValue = new GetKeyValueCommand();
+ returnValue.initialize(dataContainer, notifier);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case GetNodeCommand.METHOD_ID:
- returnValue = new GetNodeCommand();
- break;
-
+ {
+ GetNodeCommand returnValue = new GetNodeCommand();
+ returnValue.initialize(dataContainer);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case MoveCommand.METHOD_ID:
- returnValue = new MoveCommand();
- break;
-
+ {
+ MoveCommand returnValue = new MoveCommand();
+ returnValue.initialize(notifier, dataContainer);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case PutDataMapCommand.METHOD_ID:
case PutDataMapCommand.ERASE_METHOD_ID:
case PutDataMapCommand.ERASE_VERSIONED_METHOD_ID:
case PutDataMapCommand.VERSIONED_METHOD_ID:
- returnValue = new PutDataMapCommand();
- break;
-
+ {
+ PutDataMapCommand returnValue = new PutDataMapCommand();
+ returnValue.initialize(notifier,dataContainer);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case PutKeyValueCommand.METHOD_ID:
case PutKeyValueCommand.VERSIONED_METHOD_ID:
case PutKeyValueCommand.PUT_FOR_EXT_READ_METHOD_ID:
case PutKeyValueCommand.PUT_FOR_EXT_READ_VERSIONED_METHOD_ID:
- returnValue = new PutKeyValueCommand();
- break;
-
+ {
+ PutKeyValueCommand returnValue = new PutKeyValueCommand();
+ returnValue.initialize(notifier, dataContainer);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case RemoveDataCommand.METHOD_ID:
case RemoveDataCommand.VERSIONED_METHOD_ID:
- returnValue = new RemoveDataCommand();
- break;
-
+ {
+ RemoveDataCommand returnValue = new RemoveDataCommand();
+ returnValue.initialize(notifier, dataContainer);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case RemoveKeyCommand.METHOD_ID:
case RemoveKeyCommand.VERSIONED_METHOD_ID:
- returnValue = new RemoveKeyCommand();
- break;
+ {
+ RemoveKeyCommand returnValue = new RemoveKeyCommand();
+ returnValue.initialize(notifier, dataContainer);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case RemoveNodeCommand.METHOD_ID:
case RemoveNodeCommand.VERSIONED_METHOD_ID:
- returnValue = new RemoveNodeCommand();
- break;
-
+ {
+ RemoveNodeCommand returnValue = new RemoveNodeCommand();
+ returnValue.initialize(notifier, dataContainer);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case CreateNodeCommand.METHOD_ID:
- returnValue = new CreateNodeCommand();
- break;
+ {
+ CreateNodeCommand returnValue = new CreateNodeCommand();
+ returnValue.initialize(dataContainer);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
+ // --- transactional method calls
- // --- transactional method calls
-
case PrepareCommand.METHOD_ID:
- returnValue = new PrepareCommand();
- break;
+ {
+ PrepareCommand returnValue = new PrepareCommand();
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case OptimisticPrepareCommand.METHOD_ID:
- returnValue = new OptimisticPrepareCommand();
- break;
+ {
+ OptimisticPrepareCommand returnValue = new OptimisticPrepareCommand();
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case CommitCommand.METHOD_ID:
- returnValue = new CommitCommand();
- break;
+ {
+ CommitCommand returnValue = new CommitCommand();
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case RollbackCommand.METHOD_ID:
- returnValue = new RollbackCommand();
- break;
+ {
+ RollbackCommand returnValue = new RollbackCommand();
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
// --- replicate methods
case ReplicateCommand.MULTIPLE_METHOD_ID:
case ReplicateCommand.SINGLE_METHOD_ID:
- returnValue = new ReplicateCommand();
- break;
+ {
+ ReplicateCommand returnValue = new ReplicateCommand();
+ returnValue.initialize(invoker);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case InvalidateCommand.METHOD_ID:
- returnValue = new InvalidateCommand();
- break;
+ {
+ InvalidateCommand returnValue = new InvalidateCommand();
+ returnValue.initialize(txManager, cacheSpi,
configuration.isNodeLockingOptimistic());
+ returnValue.initialize(notifier, dataContainer);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case ClusteredGetCommand.METHOD_ID:
- returnValue = new ClusteredGetCommand();
- break;
-
+ {
+ ClusteredGetCommand returnValue = new ClusteredGetCommand();
+ returnValue.initialize(dataContainer, invoker);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
// ---- Buddy replication - group organisation commands
case AnnounceBuddyPoolNameCommand.METHOD_ID:
- returnValue = new AnnounceBuddyPoolNameCommand();
- break;
+ {
+ AnnounceBuddyPoolNameCommand returnValue = new
AnnounceBuddyPoolNameCommand();
+ returnValue.initialize(buddyManager);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case AssignToBuddyGroupCommand.METHOD_ID:
- returnValue = new AssignToBuddyGroupCommand();
- break;
+ {
+ AssignToBuddyGroupCommand returnValue = new AssignToBuddyGroupCommand();
+ returnValue.initialize(buddyManager);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case RemoveFromBuddyGroupCommand.METHOD_ID:
- returnValue = new RemoveFromBuddyGroupCommand();
- break;
+ {
+ RemoveFromBuddyGroupCommand returnValue = new RemoveFromBuddyGroupCommand();
+ returnValue.initialize(buddyManager);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case DataGravitationCleanupCommand.METHOD_ID:
- returnValue = new DataGravitationCleanupCommand();
- break;
+ {
+ DataGravitationCleanupCommand returnValue = new
DataGravitationCleanupCommand();
+ returnValue.initialize(buddyManager, invoker, transactionTable, this,
dataContainer);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
case GravitateDataCommand.METHOD_ID:
- returnValue = new GravitateDataCommand();
- break;
-
-
+ {
+ GravitateDataCommand returnValue = new GravitateDataCommand();
+ returnValue.initialize(dataContainer);
+ returnValue.setParameters(id, parameters);
+ return returnValue;
+ }
default:
throw new CacheException("Unknown command id " + id +
"!");
}
-
- returnValue.setParameters(id, parameters);
- registry.wireDependencies(returnValue);
- return returnValue;
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2008-04-30
15:16:01 UTC (rev 5773)
+++ core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -64,6 +64,7 @@
public class ComponentRegistry
{
// TODO: 2.2.0: Needs refactoring
+ //TODO: 2.2.x+ @Start annotation bug: BaseClass.start() and ChildrenClass.start() are
annotated with @Start then only base class method is being called
static final Object NULL_COMPONENT = new Object();
State overallState = CONSTRUCTED;
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -125,7 +125,9 @@
Element element =
XmlHelper.stringToElement("<config><buddyReplicationEnabled>true</buddyReplicationEnabled></config>");
BuddyReplicationConfig cfg =
XmlConfigurationParser.parseBuddyReplicationConfig(element);
bm = new BuddyManager(cfg);
- bm.initFqnTransformer(DUMMY_LOCAL_ADDRESS, new CommandsFactory(null, new
ComponentRegistry(new Configuration())));
+ CommandsFactory commandsFactory = new CommandsFactory();
+ commandsFactory.initialize(null, null, null, null, null, null, null, new
Configuration(), null);
+ bm.initFqnTransformer(DUMMY_LOCAL_ADDRESS, commandsFactory);
}
catch (Exception e)
{
Modified:
core/trunk/src/test/java/org/jboss/cache/marshall/AbstractVersionAwareMarshallerTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/marshall/AbstractVersionAwareMarshallerTest.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/test/java/org/jboss/cache/marshall/AbstractVersionAwareMarshallerTest.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -27,7 +27,7 @@
if (cr.getOverallState() == ComponentRegistry.State.STARTED) cr.stop();
CommandsFactory cf = cr.getComponent(CommandsFactory.class);
- if (cf == null) cf = new CommandsFactory(null, cr);
+ if (cf == null) cf = new CommandsFactory();
cr.registerComponent(CommandsFactory.class.getName(), cf, CommandsFactory.class);
cr.start();
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java 2008-04-30
15:16:01 UTC (rev 5773)
+++
core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java 2008-04-30
15:51:35 UTC (rev 5774)
@@ -47,7 +47,7 @@
CacheMarshaller210 cm210 = new CacheMarshaller210();
ComponentRegistry registry = new ComponentRegistry(new Configuration());
- CommandsFactory factory = new CommandsFactory(null, registry);
+ CommandsFactory factory = new CommandsFactory();
cm210.injectCommandsFactory(factory);
m = cm210;