-public class ShardTransaction extends AbstractUntypedActor {
-
- private final ActorRef shardActor;
- private final SchemaContext schemaContext;
-
- // FIXME : see below
- // If transactionChain is not null then this transaction is part of a
- // transactionChain. Not really clear as to what that buys us
- private final DOMStoreTransactionChain transactionChain;
-
- private final DOMStoreReadWriteTransaction transaction;
-
- private final MutableCompositeModification modification =
- new MutableCompositeModification();
-
- private final LoggingAdapter log =
- Logging.getLogger(getContext().system(), this);
-
- public ShardTransaction(DOMStoreReadWriteTransaction transaction,
- ActorRef shardActor, SchemaContext schemaContext) {
- this(null, transaction, shardActor, schemaContext);
- }
-
- public ShardTransaction(DOMStoreTransactionChain transactionChain, DOMStoreReadWriteTransaction transaction,
- ActorRef shardActor, SchemaContext schemaContext) {
- this.transactionChain = transactionChain;
- this.transaction = transaction;
- this.shardActor = shardActor;
- this.schemaContext = schemaContext;
- }
-
-
-
- public static Props props(final DOMStoreReadWriteTransaction transaction,
- final ActorRef shardActor, final SchemaContext schemaContext) {
- return Props.create(new Creator<ShardTransaction>() {
-
- @Override
- public ShardTransaction create() throws Exception {
- return new ShardTransaction(transaction, shardActor, schemaContext);
- }
- });
+public abstract class ShardTransaction extends AbstractUntypedActor {
+
+ private final ActorRef shardActor;
+ protected final SchemaContext schemaContext;
+
+ // FIXME : see below
+ // If transactionChain is not null then this transaction is part of a
+ // transactionChain. Not really clear as to what that buys us
+ private final DOMStoreTransactionChain transactionChain;
+
+
+ private final MutableCompositeModification modification =
+ new MutableCompositeModification();
+
+ private final LoggingAdapter log =
+ Logging.getLogger(getContext().system(), this);
+
+ protected ShardTransaction(
+ ActorRef shardActor, SchemaContext schemaContext) {
+ this(null, shardActor, schemaContext);
+ }
+
+ protected ShardTransaction(DOMStoreTransactionChain transactionChain,
+ ActorRef shardActor, SchemaContext schemaContext) {
+ this.transactionChain = transactionChain;
+ this.shardActor = shardActor;
+ this.schemaContext = schemaContext;
+ }
+
+
+
+ public static Props props(final DOMStoreReadTransaction transaction,
+ final ActorRef shardActor, final SchemaContext schemaContext) {
+ return Props.create(new Creator<ShardTransaction>() {
+
+ @Override
+ public ShardTransaction create() throws Exception {
+ return new ShardReadTransaction(transaction, shardActor, schemaContext);
+ }
+ });
+ }
+
+ public static Props props(final DOMStoreTransactionChain transactionChain, final DOMStoreReadTransaction transaction,
+ final ActorRef shardActor, final SchemaContext schemaContext) {
+ return Props.create(new Creator<ShardTransaction>() {
+
+ @Override
+ public ShardTransaction create() throws Exception {
+ return new ShardReadTransaction(transactionChain, transaction, shardActor, schemaContext);
+ }
+ });
+ }
+
+ public static Props props(final DOMStoreReadWriteTransaction transaction,
+ final ActorRef shardActor, final SchemaContext schemaContext) {
+ return Props.create(new Creator<ShardTransaction>() {
+
+ @Override
+ public ShardTransaction create() throws Exception {
+ return new ShardReadWriteTransaction(transaction, shardActor, schemaContext);
+ }
+ });
+ }
+
+ public static Props props(final DOMStoreTransactionChain transactionChain, final DOMStoreReadWriteTransaction transaction,
+ final ActorRef shardActor, final SchemaContext schemaContext) {
+ return Props.create(new Creator<ShardTransaction>() {
+
+ @Override
+ public ShardTransaction create() throws Exception {
+ return new ShardReadWriteTransaction(transactionChain, transaction, shardActor, schemaContext);
+ }
+ });
+ }
+
+
+ public static Props props(final DOMStoreWriteTransaction transaction,
+ final ActorRef shardActor, final SchemaContext schemaContext) {
+ return Props.create(new Creator<ShardTransaction>() {
+
+ @Override
+ public ShardTransaction create() throws Exception {
+ return new ShardWriteTransaction(transaction, shardActor, schemaContext);
+ }
+ });
+ }
+
+ public static Props props(final DOMStoreTransactionChain transactionChain, final DOMStoreWriteTransaction transaction,
+ final ActorRef shardActor, final SchemaContext schemaContext) {
+ return Props.create(new Creator<ShardTransaction>() {
+
+ @Override
+ public ShardTransaction create() throws Exception {
+ return new ShardWriteTransaction(transactionChain, transaction, shardActor, schemaContext);
+ }
+ });
+ }
+
+
+ @Override
+ public void handleReceive(Object message) throws Exception {
+ if (message.getClass().equals(CloseTransaction.SERIALIZABLE_CLASS)) {
+ closeTransaction(new CloseTransaction());
+ } else if (message instanceof GetCompositedModification) {
+ // This is here for testing only
+ getSender().tell(new GetCompositeModificationReply(
+ new ImmutableCompositeModification(modification)), getSelf());
+ }else{
+ throw new UnknownMessageException(message);