cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [cayenne] 03/06: CAY-2571 DataDomainFlushAction redesign switch data domain to new Flush action implementation
Date Wed, 24 Apr 2019 14:54:00 GMT
This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit d0b4244748b8e5fc579587b8711085c1d58de011
Author: Nikita Timofeev <stariy95@gmail.com>
AuthorDate: Mon Apr 22 18:03:04 2019 +0300

    CAY-2571 DataDomainFlushAction redesign
    switch data domain to new Flush action implementation
---
 .../dbsync/reverse/configuration/ToolsModule.java  |  8 +++-
 .../event/JavaGroupsBridgeProviderTest.java        |  6 +++
 .../cayenne/event/JMSBridgeProviderTest.java       |  6 +++
 .../java/org/apache/cayenne/access/DataDomain.java | 12 ++++--
 .../cayenne/access/DataDomainDBDiffBuilder.java    |  2 +
 .../cayenne/access/DataDomainDeleteBucket.java     |  4 +-
 .../cayenne/access/DataDomainFlattenedBucket.java  |  6 ++-
 .../cayenne/access/DataDomainFlushObserver.java    |  2 +
 .../access/DataDomainIndirectDiffBuilder.java      |  7 ++--
 .../cayenne/access/DataDomainInsertBucket.java     |  7 +++-
 .../cayenne/access/DataDomainSyncBucket.java       |  6 ++-
 .../cayenne/access/DataDomainUpdateBucket.java     |  4 +-
 .../access/DataNodeSyncQualifierDescriptor.java    |  2 +
 .../java/org/apache/cayenne/access/DbArcId.java    |  2 +
 .../cayenne/access/DbEntityClassDescriptor.java    |  2 +
 .../org/apache/cayenne/access/FlattenedArcKey.java |  2 +
 ...ction.java => LegacyDataDomainFlushAction.java} | 11 ++++--
 .../access/LegacyDataDomainFlushActionFactory.java | 45 ++++++++++++++++++++++
 .../apache/cayenne/access/OperationObserver.java   |  4 +-
 .../cayenne/configuration/server/ServerModule.java | 14 +++++--
 .../cayenne/event/XMPPBridgeProviderTest.java      |  6 +++
 21 files changed, 132 insertions(+), 26 deletions(-)

diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/ToolsModule.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/ToolsModule.java
index 0f41ffd..ce6d643 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/ToolsModule.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/ToolsModule.java
@@ -19,6 +19,10 @@
 
 package org.apache.cayenne.dbsync.reverse.configuration;
 
+import org.apache.cayenne.access.flush.DataDomainFlushActionFactory;
+import org.apache.cayenne.access.flush.DefaultDataDomainFlushActionFactory;
+import org.apache.cayenne.access.flush.operation.DefaultDbRowOpSorter;
+import org.apache.cayenne.access.flush.operation.DbRowOpSorter;
 import org.apache.cayenne.access.translator.batch.BatchTranslatorFactory;
 import org.apache.cayenne.access.translator.batch.DefaultBatchTranslatorFactory;
 import org.apache.cayenne.access.types.DefaultValueObjectTypeRegistry;
@@ -53,9 +57,7 @@ import org.apache.cayenne.dba.openbase.OpenBaseSniffer;
 import org.apache.cayenne.dba.oracle.OracleSniffer;
 import org.apache.cayenne.dba.postgres.PostgresSniffer;
 import org.apache.cayenne.dba.sqlite.SQLiteSniffer;
-import org.apache.cayenne.dba.sqlserver.SQLServerAdapter;
 import org.apache.cayenne.dba.sqlserver.SQLServerSniffer;
-import org.apache.cayenne.dba.sybase.SybasePkGenerator;
 import org.apache.cayenne.dba.sybase.SybaseSniffer;
 import org.apache.cayenne.di.AdhocObjectFactory;
 import org.apache.cayenne.di.Binder;
@@ -129,6 +131,8 @@ public class ToolsModule implements Module {
         binder.bind(HandlerFactory.class).to(ExtensionAwareHandlerFactory.class);
         binder.bind(DataChannelMetaData.class).to(DefaultDataChannelMetaData.class);
         binder.bind(XMLReader.class).toProviderInstance(new XMLReaderProvider(true)).withoutScope();
+        binder.bind(DataDomainFlushActionFactory.class).to(DefaultDataDomainFlushActionFactory.class);
+        binder.bind(DbRowOpSorter.class).to(DefaultDbRowOpSorter.class);
 
         ProjectModule.contributeExtensions(binder);
     }
diff --git a/cayenne-jgroups/src/test/java/org/apache/cayenne/event/JavaGroupsBridgeProviderTest.java
b/cayenne-jgroups/src/test/java/org/apache/cayenne/event/JavaGroupsBridgeProviderTest.java
index 8df03d8..eee4833 100644
--- a/cayenne-jgroups/src/test/java/org/apache/cayenne/event/JavaGroupsBridgeProviderTest.java
+++ b/cayenne-jgroups/src/test/java/org/apache/cayenne/event/JavaGroupsBridgeProviderTest.java
@@ -20,6 +20,10 @@
 package org.apache.cayenne.event;
 
 import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.access.flush.DataDomainFlushActionFactory;
+import org.apache.cayenne.access.flush.DefaultDataDomainFlushActionFactory;
+import org.apache.cayenne.access.flush.operation.DefaultDbRowOpSorter;
+import org.apache.cayenne.access.flush.operation.DbRowOpSorter;
 import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.configuration.DefaultRuntimeProperties;
 import org.apache.cayenne.configuration.RuntimeProperties;
@@ -93,6 +97,8 @@ public class JavaGroupsBridgeProviderTest {
             binder.bind(TransactionFactory.class).to(DefaultTransactionFactory.class);
             binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
             binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
+            binder.bind(DataDomainFlushActionFactory.class).to(DefaultDataDomainFlushActionFactory.class);
+            binder.bind(DbRowOpSorter.class).to(DefaultDbRowOpSorter.class);
         }
     }
 }
diff --git a/cayenne-jms/src/test/java/org/apache/cayenne/event/JMSBridgeProviderTest.java
b/cayenne-jms/src/test/java/org/apache/cayenne/event/JMSBridgeProviderTest.java
index 9c77f05..117859f 100644
--- a/cayenne-jms/src/test/java/org/apache/cayenne/event/JMSBridgeProviderTest.java
+++ b/cayenne-jms/src/test/java/org/apache/cayenne/event/JMSBridgeProviderTest.java
@@ -20,6 +20,10 @@
 package org.apache.cayenne.event;
 
 import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.access.flush.DataDomainFlushActionFactory;
+import org.apache.cayenne.access.flush.DefaultDataDomainFlushActionFactory;
+import org.apache.cayenne.access.flush.operation.DefaultDbRowOpSorter;
+import org.apache.cayenne.access.flush.operation.DbRowOpSorter;
 import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.configuration.DefaultRuntimeProperties;
 import org.apache.cayenne.configuration.RuntimeProperties;
@@ -82,6 +86,8 @@ public class JMSBridgeProviderTest {
             binder.bind(TransactionFactory.class).to(DefaultTransactionFactory.class);
             binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
             binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
+            binder.bind(DataDomainFlushActionFactory.class).to(DefaultDataDomainFlushActionFactory.class);
+            binder.bind(DbRowOpSorter.class).to(DefaultDbRowOpSorter.class);
         }
     }
 }
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomain.java b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomain.java
index a81c940..6c41466 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomain.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomain.java
@@ -28,6 +28,8 @@ import org.apache.cayenne.DataChannelSyncFilter;
 import org.apache.cayenne.DataChannelSyncFilterChain;
 import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.QueryResponse;
+import org.apache.cayenne.access.flush.DataDomainFlushAction;
+import org.apache.cayenne.access.flush.DataDomainFlushActionFactory;
 import org.apache.cayenne.cache.QueryCache;
 import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.di.BeforeScopeEnd;
@@ -107,6 +109,12 @@ public class DataDomain implements QueryEngine, DataChannel {
 	 */
 	protected List<DataChannelSyncFilter> syncFilters;
 
+	/**
+	 * @since 4.2
+	 */
+	@Inject
+	protected DataDomainFlushActionFactory flushActionFactory;
+
 	protected Map<String, DataNode> nodes;
 	protected Map<String, DataNode> nodesByDataMapName;
 	protected DataNode defaultNode;
@@ -618,9 +626,7 @@ public class DataDomain implements QueryEngine, DataChannel {
 							+ "Unsupported context: %s", originatingContext);
 		}
 
-		DataDomainFlushAction action = new DataDomainFlushAction(this);
-		action.setJdbcEventLogger(jdbcEventLogger);
-
+		DataDomainFlushAction action = flushActionFactory.createFlushAction(this);
 		return action.flush((DataContext) originatingContext, childChanges);
 	}
 
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainDBDiffBuilder.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainDBDiffBuilder.java
index ea6964d..a9ccd39 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainDBDiffBuilder.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainDBDiffBuilder.java
@@ -42,7 +42,9 @@ import java.util.Map.Entry;
  * INSERT.
  * 
  * @since 1.2
+ * @deprecated since 4.2 as part of deprecated {@link LegacyDataDomainFlushAction}
  */
+@Deprecated
 class DataDomainDBDiffBuilder implements GraphChangeHandler {
 
     private ObjEntity objEntity;
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainDeleteBucket.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainDeleteBucket.java
index 7d1e772..46193bd 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainDeleteBucket.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainDeleteBucket.java
@@ -36,10 +36,12 @@ import org.apache.cayenne.query.Query;
 
 /**
  * @since 1.2
+ * @deprecated since 4.2 as part of deprecated {@link LegacyDataDomainFlushAction}
  */
+@Deprecated
 class DataDomainDeleteBucket extends DataDomainSyncBucket {
 
-    DataDomainDeleteBucket(DataDomainFlushAction parent) {
+    DataDomainDeleteBucket(LegacyDataDomainFlushAction parent) {
         super(parent);
     }
 
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainFlattenedBucket.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainFlattenedBucket.java
index ba2a844..321daee 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainFlattenedBucket.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainFlattenedBucket.java
@@ -38,14 +38,16 @@ import java.util.Map;
  * A sync bucket that holds flattened queries.
  * 
  * @since 1.2
+ * @deprecated since 4.2 as part of deprecated {@link LegacyDataDomainFlushAction}
  */
+@Deprecated
 class DataDomainFlattenedBucket {
 
-    final DataDomainFlushAction parent;
+    final LegacyDataDomainFlushAction parent;
     final Map<DbEntity, List<FlattenedArcKey>> insertArcKeys;
     final Map<DbEntity, DeleteBatchQuery> flattenedDeleteQueries;
 
-    DataDomainFlattenedBucket(DataDomainFlushAction parent) {
+    DataDomainFlattenedBucket(LegacyDataDomainFlushAction parent) {
         this.parent = parent;
         this.insertArcKeys = new HashMap<>();
         this.flattenedDeleteQueries = new HashMap<>();
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainFlushObserver.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainFlushObserver.java
index 44923dc..58d1d4a 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainFlushObserver.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainFlushObserver.java
@@ -36,7 +36,9 @@ import org.apache.cayenne.util.Util;
  * Used as an observer for DataContext commit operations.
  * 
  * @since 1.2
+ * @deprecated since 4.2 as part of deprecated {@link LegacyDataDomainFlushAction}
  */
+@Deprecated
 class DataDomainFlushObserver implements OperationObserver {
 
     /**
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainIndirectDiffBuilder.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainIndirectDiffBuilder.java
index b7aeaf2..57686ac 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainIndirectDiffBuilder.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainIndirectDiffBuilder.java
@@ -28,7 +28,6 @@ import org.apache.cayenne.graph.ArcId;
 import org.apache.cayenne.graph.GraphChangeHandler;
 import org.apache.cayenne.graph.GraphDiff;
 import org.apache.cayenne.map.DbEntity;
-import org.apache.cayenne.map.DbRelationship;
 import org.apache.cayenne.map.EntityResolver;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
@@ -38,16 +37,18 @@ import org.apache.cayenne.map.ObjRelationship;
  * and to-many relationships.
  * 
  * @since 1.2
+ * @deprecated since 4.2 as part of deprecated {@link LegacyDataDomainFlushAction}
  */
+@Deprecated
 final class DataDomainIndirectDiffBuilder implements GraphChangeHandler {
 
-    private final DataDomainFlushAction parent;
+    private final LegacyDataDomainFlushAction parent;
     private final EntityResolver resolver;
     private final Collection<ObjectId> indirectModifications;
     private final Collection<FlattenedArcKey> flattenedInserts;
     private final Collection<FlattenedArcKey> flattenedDeletes;
 
-    DataDomainIndirectDiffBuilder(DataDomainFlushAction parent) {
+    DataDomainIndirectDiffBuilder(LegacyDataDomainFlushAction parent) {
         this.parent = parent;
         this.indirectModifications = parent.getResultIndirectlyModifiedIds();
         this.resolver = parent.getDomain().getEntityResolver();
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainInsertBucket.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainInsertBucket.java
index eee50ab..8fbdd18 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainInsertBucket.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainInsertBucket.java
@@ -41,12 +41,14 @@ import org.apache.cayenne.query.Query;
 
 /**
  * @since 1.2
+ * @deprecated since 4.2 as part of deprecated {@link LegacyDataDomainFlushAction}
  */
+@Deprecated
 class DataDomainInsertBucket extends DataDomainSyncBucket {
 
     List<FlattenedInsert> flattenedInserts;
 
-    DataDomainInsertBucket(DataDomainFlushAction parent) {
+    DataDomainInsertBucket(LegacyDataDomainFlushAction parent) {
         super(parent);
     }
 
@@ -222,13 +224,14 @@ class DataDomainInsertBucket extends DataDomainSyncBucket {
     private static class FlattenedInsert {
         private final String path;
         private final Persistent object;
+
         private FlattenedInsert(String path, Persistent object) {
             this.path = path;
             this.object = object;
         }
 
         private void register(ObjectStore objectStore) {
-            objectStore.markFlattenedPath(object.getObjectId(), path);
+            objectStore.markFlattenedPath(object.getObjectId(), path, ObjectId.of("tmp"));
         }
     }
 }
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainSyncBucket.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainSyncBucket.java
index 4e9dd0d..afb6a82 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainSyncBucket.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainSyncBucket.java
@@ -48,16 +48,18 @@ import java.util.function.Supplier;
  * A superclass of batch query wrappers.
  * 
  * @since 1.2
+ * @deprecated since 4.2 as part of deprecated {@link LegacyDataDomainFlushAction}
  */
+@Deprecated
 abstract class DataDomainSyncBucket {
 
     final Map<ClassDescriptor, List<Persistent>> objectsByDescriptor;
-    final DataDomainFlushAction parent;
+    final LegacyDataDomainFlushAction parent;
 
     List<DbEntity> dbEntities;
     Map<DbEntity, Collection<DbEntityClassDescriptor>> descriptorsByDbEntity;
 
-    DataDomainSyncBucket(DataDomainFlushAction parent) {
+    DataDomainSyncBucket(LegacyDataDomainFlushAction parent) {
         this.objectsByDescriptor = new HashMap<>();
         this.parent = parent;
     }
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainUpdateBucket.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainUpdateBucket.java
index 57d871a..9fcf23a 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainUpdateBucket.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainUpdateBucket.java
@@ -40,10 +40,12 @@ import org.apache.cayenne.reflect.ClassDescriptor;
 
 /**
  * @since 1.2
+ * @deprecated since 4.2 as part of deprecated {@link LegacyDataDomainFlushAction}
  */
+@Deprecated
 class DataDomainUpdateBucket extends DataDomainSyncBucket {
 
-    DataDomainUpdateBucket(DataDomainFlushAction parent) {
+    DataDomainUpdateBucket(LegacyDataDomainFlushAction parent) {
         super(parent);
     }
 
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java
index 176227c..cc75bae 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java
@@ -38,7 +38,9 @@ import org.apache.cayenne.map.ObjRelationship;
  * Builds update qualifier snapshots, including optimistic locking.
  * 
  * @since 1.2
+ * @deprecated since 4.2 as part of deprecated {@link LegacyDataDomainFlushAction}
  */
+@Deprecated
 class DataNodeSyncQualifierDescriptor {
 
 	private List<DbAttribute> attributes;
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DbArcId.java b/cayenne-server/src/main/java/org/apache/cayenne/access/DbArcId.java
index 4d66101..3ac905d 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DbArcId.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DbArcId.java
@@ -30,7 +30,9 @@ import org.apache.cayenne.util.HashCodeBuilder;
  * 'hashCode' implementations adequate for use as a map key.
  * 
  * @since 4.0
+ * @deprecated since 4.2 as part of deprecated {@link LegacyDataDomainFlushAction}
  */
+@Deprecated
 final class DbArcId {
 
     private int hashCode;
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DbEntityClassDescriptor.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/DbEntityClassDescriptor.java
index 273ce33..b8e8344 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DbEntityClassDescriptor.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DbEntityClassDescriptor.java
@@ -36,7 +36,9 @@ import java.util.List;
  * commit.
  * 
  * @since 3.0
+ * @deprecated since 4.2 as part of deprecated {@link LegacyDataDomainFlushAction}
  */
+@Deprecated
 class DbEntityClassDescriptor {
 
     private ClassDescriptor classDescriptor;
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java b/cayenne-server/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java
index 2b2217d..3209add 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java
@@ -48,7 +48,9 @@ import java.util.Map;
  * A holder of flattened relationship modification data.
  * 
  * @since 1.2
+ * @deprecated since 4.2 as part of deprecated {@link LegacyDataDomainFlushAction}
  */
+@Deprecated
 final class FlattenedArcKey {
 
 	ObjRelationship relationship;
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainFlushAction.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/LegacyDataDomainFlushAction.java
similarity index 95%
rename from cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainFlushAction.java
rename to cayenne-server/src/main/java/org/apache/cayenne/access/LegacyDataDomainFlushAction.java
index 2acb561..b4d21d5 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainFlushAction.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/LegacyDataDomainFlushAction.java
@@ -24,6 +24,7 @@ import org.apache.cayenne.DataRow;
 import org.apache.cayenne.ObjectId;
 import org.apache.cayenne.PersistenceState;
 import org.apache.cayenne.Persistent;
+import org.apache.cayenne.access.flush.DefaultDataDomainFlushAction;
 import org.apache.cayenne.graph.CompoundDiff;
 import org.apache.cayenne.graph.GraphDiff;
 import org.apache.cayenne.log.JdbcEventLogger;
@@ -46,10 +47,12 @@ import java.util.Map;
  * DataContextCommitAction resolves primary key dependencies, referential integrity
  * dependencies (including multi-reflexive entities), generates primary keys, creates
  * batches for massive data modifications, assigns operations to data nodes.
- * 
+ *
  * @since 1.2
+ * @deprecated this implementation is deprecated since 4.2, {@link DefaultDataDomainFlushAction}
is used
  */
-class DataDomainFlushAction {
+@Deprecated
+public class LegacyDataDomainFlushAction implements org.apache.cayenne.access.flush.DataDomainFlushAction
{
 
     private final DataDomain domain;
     private DataContext context;
@@ -69,7 +72,7 @@ class DataDomainFlushAction {
 
     private JdbcEventLogger logger;
 
-    DataDomainFlushAction(DataDomain domain) {
+    public LegacyDataDomainFlushAction(DataDomain domain) {
         this.domain = domain;
     }
 
@@ -117,7 +120,7 @@ class DataDomainFlushAction {
         flattenedBucket.addFlattenedDelete(flattenedEntity, flattenedDeleteInfo);
     }
 
-    GraphDiff flush(DataContext context, GraphDiff changes) {
+    public GraphDiff flush(DataContext context, GraphDiff changes) {
 
         if (changes == null) {
             return new CompoundDiff();
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/LegacyDataDomainFlushActionFactory.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/LegacyDataDomainFlushActionFactory.java
new file mode 100644
index 0000000..b822b03
--- /dev/null
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/LegacyDataDomainFlushActionFactory.java
@@ -0,0 +1,45 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.access;
+
+import org.apache.cayenne.access.flush.DataDomainFlushAction;
+import org.apache.cayenne.access.flush.DataDomainFlushActionFactory;
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.log.JdbcEventLogger;
+
+/**
+ * Factory for {@link LegacyDataDomainFlushAction}.
+ * A fallback factory to use deprecated implementation if absolutely needed.
+ *
+ * @since 4.2
+ */
+@Deprecated
+public class LegacyDataDomainFlushActionFactory implements DataDomainFlushActionFactory {
+
+    @Inject
+    private JdbcEventLogger jdbcEventLogger;
+
+    @Override
+    public DataDomainFlushAction createFlushAction(DataDomain dataDomain) {
+        LegacyDataDomainFlushAction action = new LegacyDataDomainFlushAction(dataDomain);
+        action.setJdbcEventLogger(jdbcEventLogger);
+        return action;
+    }
+}
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/OperationObserver.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/OperationObserver.java
index 2c7734a..80f2906 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/OperationObserver.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/OperationObserver.java
@@ -69,11 +69,11 @@ public interface OperationObserver extends OperationHints {
      * Callback method invoked on exceptions that happen during an execution of a specific
      * query.
      */
-    public void nextQueryException(Query query, Exception ex);
+    void nextQueryException(Query query, Exception ex);
 
     /**
      * Callback method invoked on exceptions that are not tied to a specific query
      * execution, such as JDBC connection exceptions, etc.
      */
-    public void nextGlobalException(Exception ex);
+    void nextGlobalException(Exception ex);
 }
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
index 197ad72..bdeb97f 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
@@ -29,9 +29,14 @@ import org.apache.cayenne.access.DataDomain;
 import org.apache.cayenne.access.DataRowStoreFactory;
 import org.apache.cayenne.access.DefaultDataRowStoreFactory;
 import org.apache.cayenne.access.DefaultObjectMapRetainStrategy;
+import org.apache.cayenne.access.LegacyDataDomainFlushActionFactory;
 import org.apache.cayenne.access.ObjectMapRetainStrategy;
 import org.apache.cayenne.access.dbsync.DefaultSchemaUpdateStrategyFactory;
 import org.apache.cayenne.access.dbsync.SchemaUpdateStrategyFactory;
+import org.apache.cayenne.access.flush.DataDomainFlushActionFactory;
+import org.apache.cayenne.access.flush.DefaultDataDomainFlushActionFactory;
+import org.apache.cayenne.access.flush.operation.DbRowOpSorter;
+import org.apache.cayenne.access.flush.operation.DefaultDbRowOpSorter;
 import org.apache.cayenne.access.jdbc.SQLTemplateProcessor;
 import org.apache.cayenne.access.jdbc.reader.DefaultRowReaderFactory;
 import org.apache.cayenne.access.jdbc.reader.RowReaderFactory;
@@ -473,12 +478,10 @@ public class ServerModule implements Module {
 
         binder.bind(SchemaUpdateStrategyFactory.class).to(DefaultSchemaUpdateStrategyFactory.class);
 
-        // a default DBAdapterFactory used to load custom and automatic
-        // DbAdapters
+        // a default DBAdapterFactory used to load custom and automatic DbAdapters
         binder.bind(DbAdapterFactory.class).to(DefaultDbAdapterFactory.class);
 
-        // binding AshwoodEntitySorter without scope, as this is a stateful
-        // object and is
+        // binding AshwoodEntitySorter without scope, as this is a stateful object and is
         // configured by the owning domain
         binder.bind(EntitySorter.class).to(AshwoodEntitySorter.class).withoutScope();
 
@@ -501,5 +504,8 @@ public class ServerModule implements Module {
         binder.bind(HandlerFactory.class).to(DefaultHandlerFactory.class);
         binder.bind(DataChannelMetaData.class).to(NoopDataChannelMetaData.class);
         binder.bind(XMLReader.class).toProviderInstance(new XMLReaderProvider(false)).withoutScope();
+
+        binder.bind(DataDomainFlushActionFactory.class).to(DefaultDataDomainFlushActionFactory.class);
+        binder.bind(DbRowOpSorter.class).to(DefaultDbRowOpSorter.class);
     }
 }
diff --git a/cayenne-xmpp/src/test/java/org/apache/cayenne/event/XMPPBridgeProviderTest.java
b/cayenne-xmpp/src/test/java/org/apache/cayenne/event/XMPPBridgeProviderTest.java
index e2de1bb..1f84d45 100644
--- a/cayenne-xmpp/src/test/java/org/apache/cayenne/event/XMPPBridgeProviderTest.java
+++ b/cayenne-xmpp/src/test/java/org/apache/cayenne/event/XMPPBridgeProviderTest.java
@@ -20,6 +20,10 @@
 package org.apache.cayenne.event;
 
 import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.access.flush.DataDomainFlushActionFactory;
+import org.apache.cayenne.access.flush.DefaultDataDomainFlushActionFactory;
+import org.apache.cayenne.access.flush.operation.DefaultDbRowOpSorter;
+import org.apache.cayenne.access.flush.operation.DbRowOpSorter;
 import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.configuration.DefaultRuntimeProperties;
 import org.apache.cayenne.configuration.RuntimeProperties;
@@ -101,6 +105,8 @@ public class XMPPBridgeProviderTest {
             binder.bind(TransactionFactory.class).to(DefaultTransactionFactory.class);
             binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
             binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
+            binder.bind(DataDomainFlushActionFactory.class).to(DefaultDataDomainFlushActionFactory.class);
+            binder.bind(DbRowOpSorter.class).to(DefaultDbRowOpSorter.class);
         }
     }
 }


Mime
View raw message