cayenne-commits mailing list archives

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


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

* exposing all collections from ServerModule


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

Branch: refs/heads/master
Commit: 50bee8408d9cd5d8cc0f82448488c1a322c56f6f
Parents: 22f6bd2
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:36:48 2016 +0300

----------------------------------------------------------------------
 .../configuration/rop/client/ClientModule.java  |   3 +-
 .../cayenne/java8/CayenneJava8Module.java       |   3 +-
 .../apache/cayenne/joda/CayenneJodaModule.java  |   3 +-
 .../postcommit/PostCommitModuleBuilder.java     |  14 ++-
 .../apache/cayenne/configuration/Constants.java |  12 +++
 .../configuration/server/ServerModule.java      | 100 +++++++++++++++----
 .../server/ServerRuntimeBuilder.java            |  16 +--
 .../server/DataDomainProviderTest.java          |  14 +--
 .../server/DefaultDbAdapterFactoryTest.java     |  20 ++--
 .../unit/di/server/ServerCaseModule.java        |   8 +-
 .../tools/configuration/ToolsModule.java        |  10 +-
 11 files changed, 132 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/50bee840/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/ClientModule.java
----------------------------------------------------------------------
diff --git a/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/ClientModule.java
b/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/ClientModule.java
index b74d482..519a1d3 100644
--- a/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/ClientModule.java
+++ b/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/ClientModule.java
@@ -27,6 +27,7 @@ import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.configuration.DefaultRuntimeProperties;
 import org.apache.cayenne.configuration.ObjectContextFactory;
 import org.apache.cayenne.configuration.RuntimeProperties;
+import org.apache.cayenne.configuration.server.ServerModule;
 import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.Module;
 import org.apache.cayenne.event.DefaultEventManager;
@@ -56,7 +57,7 @@ public class ClientModule implements Module {
     public void configure(Binder binder) {
 
         // expose user-provided ROP properties as the main properties map
-        binder.<String> bindMap(Constants.PROPERTIES_MAP).putAll(properties);
+        ServerModule.contributeProperties(binder).putAll(properties);
 
         binder.bind(ObjectContextFactory.class).to(CayenneContextFactory.class);
         binder.bind(ROPSerializationService.class).toProvider(ClientHessianSerializationServiceProvider.class);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/50bee840/cayenne-java8/src/main/java/org/apache/cayenne/java8/CayenneJava8Module.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/main/java/org/apache/cayenne/java8/CayenneJava8Module.java
b/cayenne-java8/src/main/java/org/apache/cayenne/java8/CayenneJava8Module.java
index 7a565a6..251718e 100644
--- a/cayenne-java8/src/main/java/org/apache/cayenne/java8/CayenneJava8Module.java
+++ b/cayenne-java8/src/main/java/org/apache/cayenne/java8/CayenneJava8Module.java
@@ -19,7 +19,6 @@
 
 package org.apache.cayenne.java8;
 
-import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.configuration.server.ServerModule;
 import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.Module;
@@ -34,7 +33,7 @@ public class CayenneJava8Module implements Module {
 
     @Override
     public void configure(Binder binder) {
-        ServerModule.contributeDefaultExtendedTypes(binder)
+        ServerModule.contributeDefaultTypes(binder)
                 .add(new LocalDateType())
                 .add(new LocalTimeType())
                 .add(new LocalDateTimeType());

http://git-wip-us.apache.org/repos/asf/cayenne/blob/50bee840/cayenne-joda/src/main/java/org/apache/cayenne/joda/CayenneJodaModule.java
----------------------------------------------------------------------
diff --git a/cayenne-joda/src/main/java/org/apache/cayenne/joda/CayenneJodaModule.java b/cayenne-joda/src/main/java/org/apache/cayenne/joda/CayenneJodaModule.java
index 0d88053..0821b68 100644
--- a/cayenne-joda/src/main/java/org/apache/cayenne/joda/CayenneJodaModule.java
+++ b/cayenne-joda/src/main/java/org/apache/cayenne/joda/CayenneJodaModule.java
@@ -21,7 +21,6 @@ package org.apache.cayenne.joda;
  * **************************************************************
  */
 
-import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.configuration.server.ServerModule;
 import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.Module;
@@ -43,7 +42,7 @@ public class CayenneJodaModule implements Module {
 
     @Override
     public void configure(Binder binder) {
-        ServerModule.contributeDefaultExtendedTypes(binder)
+        ServerModule.contributeDefaultTypes(binder)
                 .add(new DateTimeType())
                 .add(new LocalDateType())
                 .add(new LocalTimeType())

http://git-wip-us.apache.org/repos/asf/cayenne/blob/50bee840/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/postcommit/PostCommitModuleBuilder.java
----------------------------------------------------------------------
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/postcommit/PostCommitModuleBuilder.java
b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/postcommit/PostCommitModuleBuilder.java
index 7c1eb5d..daf81c5 100644
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/postcommit/PostCommitModuleBuilder.java
+++ b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/postcommit/PostCommitModuleBuilder.java
@@ -18,10 +18,7 @@
  ****************************************************************/
 package org.apache.cayenne.lifecycle.postcommit;
 
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.apache.cayenne.configuration.Constants;
+import org.apache.cayenne.configuration.server.ServerModule;
 import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.ListBuilder;
 import org.apache.cayenne.di.Module;
@@ -34,6 +31,9 @@ import org.apache.cayenne.tx.TransactionFilter;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import java.util.Collection;
+import java.util.HashSet;
+
 /**
  * A builder of a module that integrates {@link PostCommitFilter} and
  * {@link PostCommitListener} in Cayenne.
@@ -133,11 +133,9 @@ public class PostCommitModuleBuilder {
 				binder.bind(PostCommitFilter.class).to(PostCommitFilter.class);
 
 				if (excludeFromTransaction) {
-					binder.bindList(Constants.SERVER_DOMAIN_FILTERS_LIST).add(PostCommitFilter.class)
-							.after(TransactionFilter.class);
+					ServerModule.contributeDomainFilters(binder).add(PostCommitFilter.class).after(TransactionFilter.class);
 				} else {
-					binder.bindList(Constants.SERVER_DOMAIN_FILTERS_LIST).add(PostCommitFilter.class)
-							.before(TransactionFilter.class);
+					ServerModule.contributeDomainFilters(binder).add(PostCommitFilter.class).before(TransactionFilter.class);
 				}
 			}
 		};

http://git-wip-us.apache.org/repos/asf/cayenne/blob/50bee840/cayenne-server/src/main/java/org/apache/cayenne/configuration/Constants.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/Constants.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/Constants.java
index 6742863..53f3de7 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/Constants.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/Constants.java
@@ -18,6 +18,8 @@
  ****************************************************************/
 package org.apache.cayenne.configuration;
 
+import org.apache.cayenne.di.Binder;
+
 /**
  * Defines the names of runtime properties and DI collections used in DI modules
  * used to configure server and client runtime.
@@ -31,6 +33,8 @@ public interface Constants {
 	/**
 	 * A DI container key for the Map&lt;String, String&gt; storing properties
 	 * used by built-in Cayenne service.
+	 *
+	 * @see org.apache.cayenne.configuration.server.ServerModule#contributeProperties(Binder).
 	 */
 	public static final String PROPERTIES_MAP = "cayenne.properties";
 
@@ -44,6 +48,8 @@ public interface Constants {
 	/**
 	 * A DI container key for the List&lt;DataChannelFilter&gt; storing
 	 * DataDomain filters.
+     *
+     * @see org.apache.cayenne.configuration.server.ServerModule#contributeDomainFilters(Binder).
 	 */
 	public static final String SERVER_DOMAIN_FILTERS_LIST = "cayenne.server.domain_filters";
 
@@ -56,18 +62,24 @@ public interface Constants {
 	/**
 	 * A DI container key for the List&lt;ExtendedType&gt; storing default
 	 * adapter-agnostic ExtendedTypes.
+	 *
+	 * @see org.apache.cayenne.configuration.server.ServerModule#contributeDefaultTypes(Binder).
 	 */
 	public static final String SERVER_DEFAULT_TYPES_LIST = "cayenne.server.default_types";
 
 	/**
 	 * A DI container key for the List&lt;ExtendedType&gt; storing a
 	 * user-provided ExtendedTypes.
+	 *
+	 * @see org.apache.cayenne.configuration.server.ServerModule#contributeUserTypes(Binder).
 	 */
 	public static final String SERVER_USER_TYPES_LIST = "cayenne.server.user_types";
 
 	/**
 	 * A DI container key for the List&lt;ExtendedTypeFactory&gt; storing
 	 * default and user-provided ExtendedTypeFactories.
+	 *
+	 * @see org.apache.cayenne.configuration.server.ServerModule#contributeTypeFactories(Binder).
 	 */
 	public static final String SERVER_TYPE_FACTORIES_LIST = "cayenne.server.type_factories";
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/50bee840/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
----------------------------------------------------------------------
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 5f188de..8042949 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
@@ -19,6 +19,7 @@
 package org.apache.cayenne.configuration.server;
 
 import org.apache.cayenne.DataChannel;
+import org.apache.cayenne.DataChannelFilter;
 import org.apache.cayenne.access.DataDomain;
 import org.apache.cayenne.access.DefaultObjectMapRetainStrategy;
 import org.apache.cayenne.access.ObjectMapRetainStrategy;
@@ -63,12 +64,7 @@ import org.apache.cayenne.dba.postgres.PostgresSniffer;
 import org.apache.cayenne.dba.sqlite.SQLiteSniffer;
 import org.apache.cayenne.dba.sqlserver.SQLServerSniffer;
 import org.apache.cayenne.dba.sybase.SybaseSniffer;
-import org.apache.cayenne.di.AdhocObjectFactory;
-import org.apache.cayenne.di.Binder;
-import org.apache.cayenne.di.ClassLoaderManager;
-import org.apache.cayenne.di.Key;
-import org.apache.cayenne.di.ListBuilder;
-import org.apache.cayenne.di.Module;
+import org.apache.cayenne.di.*;
 import org.apache.cayenne.di.spi.DefaultAdhocObjectFactory;
 import org.apache.cayenne.di.spi.DefaultClassLoaderManager;
 import org.apache.cayenne.event.DefaultEventManager;
@@ -100,24 +96,88 @@ public class ServerModule implements Module {
     protected String[] configurationLocations;
 
     /**
-     * Provides access to a DI collection builder for default adapter-agnostic {@link ExtendedType}'s.
+     * Provides access to a DI collection builder for String locations that allows downstream
modules to
+     * "contribute" their own Cayenne project locations.
+     *
+     * @param binder DI binder passed to the module during injector startup.
+     * @return ListBuilder for String locations.
+     * @since 4.0
+     */
+    public static ListBuilder<String> contributeProjectLocations(Binder binder) {
+        return binder.bindList(Constants.SERVER_PROJECT_LOCATIONS_LIST);
+    }
+
+    /**
+     * Provides access to a DI collection builder for {@link DataChannelFilter}'s that allows
downstream modules to
+     * "contribute" their own DataDomain filters
+     *
+     * @param binder DI binder passed to the module during injector startup.
+     * @return ListBuilder for DataChannelFilter.
+     * @since 4.0
+     */
+    public static ListBuilder<DataChannelFilter> contributeDomainFilters(Binder binder)
{
+        return binder.bindList(Constants.SERVER_DOMAIN_FILTERS_LIST);
+    }
+
+    /**
+     * Provides access to a DI collection builder for {@link DbAdapterDetector}'s that allows
downstream modules to
+     * "contribute" their own adapter detectors.
+     *
+     * @param binder DI binder passed to the module during injector startup.
+     * @return ListBuilder for DbAdapterDetectors.
+     * @since 4.0
+     */
+    public static ListBuilder<DbAdapterDetector> contributeAdapterDetectors(Binder
binder) {
+        return binder.bindList(Constants.SERVER_ADAPTER_DETECTORS_LIST);
+    }
+
+    /**
+     * Provides access to a DI map builder for runtime properties that allows downstream
modules to
+     * "contribute" their own properties.
+     *
+     * @param binder DI binder passed to the module during injector startup.
+     * @return MapBuilder for properties.
+     * @since 4.0
+     */
+    public static MapBuilder<String> contributeProperties(Binder binder) {
+        return binder.bindMap(Constants.PROPERTIES_MAP);
+    }
+
+    /**
+     * Provides access to a DI collection builder for {@link ExtendedTypeFactory}'s that
allows downstream modules to
+     * "contribute" their own factories.
+     *
+     * @param binder DI binder passed to the module during injector startup.
+     * @return ListBuilder for ExtendedTypes.
+     * @since 4.0
+     */
+    public static ListBuilder<ExtendedTypeFactory> contributeTypeFactories(Binder binder)
{
+        return binder.bindList(Constants.SERVER_TYPE_FACTORIES_LIST);
+    }
+
+    /**
+     * Provides access to a DI collection builder for default adapter-agnostic {@link ExtendedType}'s
that allows
+     * downstream modules to "contribute" their own types. "Default" types are loaded before
adapter-provided or "user"
+     * types, so they may be overridden by those.
      *
      * @param binder DI binder passed to the module during injector startup.
      * @return ListBuilder for ExtendedTypes.
      * @since 4.0
      */
-    public static ListBuilder<ExtendedType> contributeDefaultExtendedTypes(Binder binder)
{
+    public static ListBuilder<ExtendedType> contributeDefaultTypes(Binder binder) {
         return binder.bindList(Constants.SERVER_DEFAULT_TYPES_LIST);
     }
 
     /**
-     * Provides access to a DI collection builder for user-provided {@link ExtendedType}'s.
+     * Provides access to a DI collection builder for {@link ExtendedType}'s that allows
downstream modules to "contribute"
+     * their own types. Unlike "default" types (see {@link #contributeDefaultTypes(Binder)}),
"user" types are loaded
+     * after the adapter-provided types and can override those.
      *
      * @param binder DI binder passed to the module during injector startup.
      * @return ListBuilder for ExtendedTypes.
      * @since 4.0
      */
-    public static ListBuilder<ExtendedType> contributeUserExtendedTypes(Binder binder)
{
+    public static ListBuilder<ExtendedType> contributeUserTypes(Binder binder) {
         return binder.bindList(Constants.SERVER_USER_TYPES_LIST);
     }
 
@@ -137,40 +197,38 @@ public class ServerModule implements Module {
     public void configure(Binder binder) {
 
         // configure global stack properties
-        binder.bindMap(Constants.PROPERTIES_MAP).put(Constants.SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY,
-                String.valueOf(DEFAULT_MAX_ID_QUALIFIER_SIZE));
+        contributeProperties(binder)
+                .put(Constants.SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY, String.valueOf(DEFAULT_MAX_ID_QUALIFIER_SIZE));
 
         binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class);
         binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
         binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
 
         // configure known DbAdapter detectors in reverse order of popularity.
-        // Users can
-        // add their own to install custom adapters automatically
+        // Users can add their own to install custom adapters automatically
 
-        binder.bindList(Constants.SERVER_ADAPTER_DETECTORS_LIST).add(FirebirdSniffer.class).add(OpenBaseSniffer.class)
+        contributeAdapterDetectors(binder).add(FirebirdSniffer.class).add(OpenBaseSniffer.class)
                 .add(FrontBaseSniffer.class).add(IngresSniffer.class).add(SQLiteSniffer.class).add(DB2Sniffer.class)
                 .add(H2Sniffer.class).add(HSQLDBSniffer.class).add(SybaseSniffer.class).add(DerbySniffer.class)
                 .add(SQLServerSniffer.class).add(OracleSniffer.class).add(PostgresSniffer.class)
                 .add(MySQLSniffer.class);
 
         // configure a filter chain with only one TransactionFilter as default
-        binder.bindList(Constants.SERVER_DOMAIN_FILTERS_LIST)
-                .add(TransactionFilter.class);
+        contributeDomainFilters(binder).add(TransactionFilter.class);
 
         // configure extended types
-        contributeDefaultExtendedTypes(binder).add(new VoidType()).add(new BigDecimalType())
+        contributeDefaultTypes(binder).add(new VoidType()).add(new BigDecimalType())
                 .add(new BigIntegerType()).add(new BooleanType()).add(new ByteArrayType(false,
true))
                 .add(new ByteType(false)).add(new CharType(false, true)).add(new DateType()).add(new
DoubleType())
                 .add(new FloatType()).add(new IntegerType()).add(new LongType()).add(new
ShortType(false))
                 .add(new TimeType()).add(new TimestampType()).add(new UtilDateType())
                 .add(new CalendarType<GregorianCalendar>(GregorianCalendar.class))
                 .add(new CalendarType<Calendar>(Calendar.class)).add(new UUIDType());
-        contributeUserExtendedTypes(binder);
-        binder.bindList(Constants.SERVER_TYPE_FACTORIES_LIST);
+        contributeUserTypes(binder);
+        contributeTypeFactories(binder);
 
         // configure explicit configurations
-        ListBuilder<Object> locationsListBuilder = binder.bindList(Constants.SERVER_PROJECT_LOCATIONS_LIST);
+        ListBuilder<String> locationsListBuilder = contributeProjectLocations(binder);
         for (String location : configurationLocations) {
             locationsListBuilder.add(location);
         }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/50bee840/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilder.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilder.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilder.java
index f1a447b..1c067cd 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilder.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilder.java
@@ -18,14 +18,6 @@
  ****************************************************************/
 package org.apache.cayenne.configuration.server;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.List;
-
-import javax.sql.DataSource;
-
 import org.apache.cayenne.access.DataDomain;
 import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.datasource.DataSourceBuilder;
@@ -33,6 +25,9 @@ import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.MapBuilder;
 import org.apache.cayenne.di.Module;
 
+import javax.sql.DataSource;
+import java.util.*;
+
 /**
  * A convenience class to assemble custom ServerRuntime. It allows to easily
  * configure custom modules, multiple config locations, or quickly create a
@@ -226,8 +221,7 @@ public class ServerRuntimeBuilder {
             prepend(new Module() {
                 @Override
                 public void configure(Binder binder) {
-                    binder.bindMap(Constants.PROPERTIES_MAP).put(Constants.SERVER_DOMAIN_NAME_PROPERTY,
-                            finalNameOverride);
+                    ServerModule.contributeProperties(binder).put(Constants.SERVER_DOMAIN_NAME_PROPERTY,
finalNameOverride);
                 }
             });
         }
@@ -250,7 +244,7 @@ public class ServerRuntimeBuilder {
                 @Override
                 public void configure(Binder binder) {
                     binder.bind(DataDomain.class).toProvider(SyntheticNodeDataDomainProvider.class);
-                    MapBuilder<Object> props = binder.bindMap(Constants.PROPERTIES_MAP)
+                    MapBuilder<String> props = ServerModule.contributeProperties(binder)
                             .put(Constants.JDBC_DRIVER_PROPERTY, jdbcDriver).put(Constants.JDBC_URL_PROPERTY,
jdbcUrl);
 
                     if (jdbcUser != null) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/50bee840/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataDomainProviderTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataDomainProviderTest.java
b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataDomainProviderTest.java
index aa85465..1828a0c 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataDomainProviderTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataDomainProviderTest.java
@@ -141,20 +141,20 @@ public class DataDomainProviderTest {
 				binder.bind(ClassLoaderManager.class).toInstance(classLoaderManager);
 				binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
 
-				binder.bindMap(Constants.PROPERTIES_MAP);
+				ServerModule.contributeProperties(binder);
 
-				binder.bindList(Constants.SERVER_ADAPTER_DETECTORS_LIST).add(FirebirdSniffer.class)
+				ServerModule.contributeAdapterDetectors(binder).add(FirebirdSniffer.class)
 						.add(OpenBaseSniffer.class).add(FrontBaseSniffer.class).add(IngresSniffer.class)
 						.add(SQLiteSniffer.class).add(DB2Sniffer.class).add(H2Sniffer.class).add(HSQLDBSniffer.class)
 						.add(SybaseSniffer.class).add(DerbySniffer.class).add(SQLServerSniffer.class)
 						.add(OracleSniffer.class).add(PostgresSniffer.class).add(MySQLSniffer.class);
-				binder.bindList(Constants.SERVER_DOMAIN_FILTERS_LIST);
-				binder.bindList(Constants.SERVER_PROJECT_LOCATIONS_LIST).add(testConfigName);
+				ServerModule.contributeDomainFilters(binder);
+				ServerModule.contributeProjectLocations(binder).add(testConfigName);
 
 				// configure extended types
-				ServerModule.contributeDefaultExtendedTypes(binder);
-				ServerModule.contributeUserExtendedTypes(binder);
-				binder.bindList(Constants.SERVER_TYPE_FACTORIES_LIST);
+				ServerModule.contributeDefaultTypes(binder);
+				ServerModule.contributeUserTypes(binder);
+				ServerModule.contributeTypeFactories(binder);
 
 				binder.bind(EventManager.class).toInstance(eventManager);
 				binder.bind(EntitySorter.class).toInstance(new AshwoodEntitySorter());

http://git-wip-us.apache.org/repos/asf/cayenne/blob/50bee840/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java
b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java
index d2f8dc3..d03e2e3 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java
@@ -80,7 +80,7 @@ public class DefaultDbAdapterFactoryTest {
         Module testModule = new Module() {
 
             public void configure(Binder binder) {
-                binder.bindMap(Constants.PROPERTIES_MAP);
+                ServerModule.contributeProperties(binder);
 
                 binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class);
                 binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
@@ -107,10 +107,10 @@ public class DefaultDbAdapterFactoryTest {
         Module testModule = new Module() {
 
             public void configure(Binder binder) {
-                binder.bindMap(Constants.PROPERTIES_MAP);
-                ServerModule.contributeDefaultExtendedTypes(binder);
-                ServerModule.contributeUserExtendedTypes(binder);
-                binder.bindList(Constants.SERVER_TYPE_FACTORIES_LIST);
+                ServerModule.contributeProperties(binder);
+                ServerModule.contributeDefaultTypes(binder);
+                ServerModule.contributeUserTypes(binder);
+                ServerModule.contributeTypeFactories(binder);
 
                 binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class);
                 binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
@@ -144,10 +144,10 @@ public class DefaultDbAdapterFactoryTest {
         Module testModule = new Module() {
 
             public void configure(Binder binder) {
-                binder.bindMap(Constants.PROPERTIES_MAP);
-                ServerModule.contributeDefaultExtendedTypes(binder);
-                ServerModule.contributeUserExtendedTypes(binder);
-                binder.bindList(Constants.SERVER_TYPE_FACTORIES_LIST);
+                ServerModule.contributeProperties(binder);
+                ServerModule.contributeDefaultTypes(binder);
+                ServerModule.contributeUserTypes(binder);
+                ServerModule.contributeTypeFactories(binder);
 
                 binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class);
                 binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
@@ -191,7 +191,7 @@ public class DefaultDbAdapterFactoryTest {
         Module testModule = new Module() {
 
             public void configure(Binder binder) {
-                binder.bindMap(Constants.PROPERTIES_MAP);
+                ServerModule.contributeProperties(binder);
 
                 binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
                 binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/50bee840/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java
b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java
index c4475dd..aa01c07 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java
@@ -155,10 +155,10 @@ public class ServerCaseModule implements Module {
                 IngresUnitDbAdapter.class.getName()).put(
                 SQLiteAdapter.class.getName(),
                 SQLiteUnitDbAdapter.class.getName());
-        binder.bindMap(Constants.PROPERTIES_MAP);
+        ServerModule.contributeProperties(binder);
         
         // configure extended types
-        ServerModule.contributeDefaultExtendedTypes(binder)
+        ServerModule.contributeDefaultTypes(binder)
                 .add(new VoidType())
                 .add(new BigDecimalType())
                 .add(new BigIntegerType())
@@ -178,8 +178,8 @@ public class ServerCaseModule implements Module {
                 .add(new CalendarType<GregorianCalendar>(GregorianCalendar.class))
                 .add(new CalendarType<Calendar>(Calendar.class))
                 .add(new UUIDType());
-        binder.bindList(Constants.SERVER_USER_TYPES_LIST);
-        binder.bindList(Constants.SERVER_TYPE_FACTORIES_LIST);
+        ServerModule.contributeUserTypes(binder);
+        ServerModule.contributeTypeFactories(binder);
 
         binder.bind(SchemaBuilder.class).to(SchemaBuilder.class);
         binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/50bee840/cayenne-tools/src/main/java/org/apache/cayenne/tools/configuration/ToolsModule.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/configuration/ToolsModule.java
b/cayenne-tools/src/main/java/org/apache/cayenne/tools/configuration/ToolsModule.java
index ef8b048..7abe3b0 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/configuration/ToolsModule.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/configuration/ToolsModule.java
@@ -78,11 +78,11 @@ public class ToolsModule implements Module {
         binder.bind(Log.class).toInstance(logger);
 
         // configure empty global stack properties
-        binder.bindMap(Constants.PROPERTIES_MAP);
+        ServerModule.contributeProperties(binder);
 
-        ServerModule.contributeDefaultExtendedTypes(binder);
-        ServerModule.contributeUserExtendedTypes(binder);
-        binder.bindList(Constants.SERVER_TYPE_FACTORIES_LIST);
+        ServerModule.contributeDefaultTypes(binder);
+        ServerModule.contributeUserTypes(binder);
+        ServerModule.contributeTypeFactories(binder);
 
         binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
         binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
@@ -93,7 +93,7 @@ public class ToolsModule implements Module {
         binder.bind(BatchTranslatorFactory.class).to(DefaultBatchTranslatorFactory.class);
         binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class);
 
-        binder.bindList(Constants.SERVER_ADAPTER_DETECTORS_LIST).add(FirebirdSniffer.class).add(OpenBaseSniffer.class)
+        ServerModule.contributeAdapterDetectors(binder).add(FirebirdSniffer.class).add(OpenBaseSniffer.class)
                 .add(FrontBaseSniffer.class).add(IngresSniffer.class).add(SQLiteSniffer.class).add(DB2Sniffer.class)
                 .add(H2Sniffer.class).add(HSQLDBSniffer.class).add(SybaseSniffer.class).add(DerbySniffer.class)
                 .add(SQLServerSniffer.class).add(OracleSniffer.class).add(PostgresSniffer.class)


Mime
View raw message