cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject cayenne git commit: CAY-2165 Explicit "contribution" API for easier expansion of DI collections and maps
Date Sun, 11 Dec 2016 13:12:08 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 1ace4e728 -> bd0bbcdc2


CAY-2165 Explicit "contribution" API for easier expansion of DI collections and maps

* DbSyncModule contribution API
* ROPServerModule contribution API


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/bd0bbcdc
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/bd0bbcdc
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/bd0bbcdc

Branch: refs/heads/master
Commit: bd0bbcdc2e42c0e1a97344f0026a158f609db0ab
Parents: 1ace4e7
Author: Andrus Adamchik <andrus@objectstyle.com>
Authored: Sun Dec 11 14:49:30 2016 +0300
Committer: Andrus Adamchik <andrus@objectstyle.com>
Committed: Sun Dec 11 15:53:31 2016 +0300

----------------------------------------------------------------------
 .../org/apache/cayenne/dbsync/DbSyncModule.java     |  7 ++++++-
 .../configuration/rop/server/ROPServerModule.java   | 16 +++++++++++-----
 2 files changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/bd0bbcdc/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/DbSyncModule.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/DbSyncModule.java b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/DbSyncModule.java
index f73044d..c44793d 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/DbSyncModule.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/DbSyncModule.java
@@ -48,6 +48,7 @@ import org.apache.cayenne.dbsync.merge.factory.PostgresMergerTokenFactory;
 import org.apache.cayenne.dbsync.merge.factory.SQLServerMergerTokenFactory;
 import org.apache.cayenne.dbsync.merge.factory.SybaseMergerTokenFactory;
 import org.apache.cayenne.di.Binder;
+import org.apache.cayenne.di.MapBuilder;
 import org.apache.cayenne.di.Module;
 
 /**
@@ -61,12 +62,16 @@ public class DbSyncModule implements Module {
      */
     public static final String MERGER_FACTORIES_MAP = "cayenne.dbsync.mergerfactories";
 
+    public static MapBuilder<MergerTokenFactory> contributeMergerTokenFactories(Binder
binder) {
+        return binder.bindMap(MERGER_FACTORIES_MAP);
+    }
+
     @Override
     public void configure(Binder binder) {
 
         // default and per adapter merger factories...
         binder.bind(MergerTokenFactory.class).to(DefaultMergerTokenFactory.class);
-        binder.bindMap(MERGER_FACTORIES_MAP)
+        contributeMergerTokenFactories(binder)
                 .put(DB2Adapter.class.getName(), DB2MergerTokenFactory.class)
                 .put(DerbyAdapter.class.getName(), DerbyMergerTokenFactory.class)
                 .put(FirebirdAdapter.class.getName(), FirebirdMergerTokenFactory.class)

http://git-wip-us.apache.org/repos/asf/cayenne/blob/bd0bbcdc/cayenne-server/src/main/java/org/apache/cayenne/configuration/rop/server/ROPServerModule.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/rop/server/ROPServerModule.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/rop/server/ROPServerModule.java
index ceefd62..e5bcc09 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/rop/server/ROPServerModule.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/rop/server/ROPServerModule.java
@@ -18,16 +18,16 @@
  ****************************************************************/
 package org.apache.cayenne.configuration.rop.server;
 
-import java.util.Map;
-
 import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.MapBuilder;
 import org.apache.cayenne.di.Module;
 import org.apache.cayenne.remote.RemoteService;
+import org.apache.cayenne.rop.ROPSerializationService;
 import org.apache.cayenne.rop.ServerHessianSerializationServiceProvider;
 import org.apache.cayenne.rop.ServerHttpRemoteService;
-import org.apache.cayenne.rop.ROPSerializationService;
+
+import java.util.Map;
 
 /**
  * A DI module that defines services for the server-side of an ROP application based on
@@ -39,14 +39,20 @@ public class ROPServerModule implements Module {
 
     protected Map<String, String> eventBridgeProperties;
 
+    /**
+     * @since 4.0
+     */
+    public static MapBuilder<String> contributeROPBridgeProperties(Binder binder) {
+        return binder.bindMap(Constants.SERVER_ROP_EVENT_BRIDGE_PROPERTIES_MAP);
+    }
+
     public ROPServerModule(Map<String, String> eventBridgeProperties) {
         this.eventBridgeProperties = eventBridgeProperties;
     }
 
     public void configure(Binder binder) {
 
-        MapBuilder<String> mapBuilder = binder
-                .bindMap(Constants.SERVER_ROP_EVENT_BRIDGE_PROPERTIES_MAP);
+        MapBuilder<String> mapBuilder = contributeROPBridgeProperties(binder);
         mapBuilder.putAll(eventBridgeProperties);
 
         binder.bind(RemoteService.class).to(ServerHttpRemoteService.class);


Mime
View raw message