You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2016/12/11 12:48:56 UTC
[1/2] cayenne git commit: CAY-2165 Explicit "contribution" API for
easier expansion of DI collections and maps
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 <an...@objectstyle.com>
Authored: Sun Dec 11 14:49:30 2016 +0300
Committer: Andrus Adamchik <an...@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<String, String> 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<DataChannelFilter> 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<ExtendedType> 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<ExtendedType> 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<ExtendedTypeFactory> 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)
[2/2] cayenne git commit: CAY-2165 Explicit "contribution" API for
easier expansion of DI collections and maps
Posted by aa...@apache.org.
CAY-2165 Explicit "contribution" API for easier expansion of DI collections and maps
* splitting ROP constants away from server constants
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/1ace4e72
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/1ace4e72
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/1ace4e72
Branch: refs/heads/master
Commit: 1ace4e728d00a17792db18e258ee08c29fd58d3e
Parents: 50bee84
Author: Andrus Adamchik <an...@objectstyle.com>
Authored: Sun Dec 11 14:49:30 2016 +0300
Committer: Andrus Adamchik <an...@objectstyle.com>
Committed: Sun Dec 11 15:48:24 2016 +0300
----------------------------------------------------------------------
.../rop/JettyHttp2ClientConnectionProvider.java | 6 +-
.../rop/JettyHttpClientConnectionProvider.java | 16 +-
.../rop/client/CayenneContextFactory.java | 4 +-
.../rop/client/ClientChannelProvider.java | 2 +-
.../rop/client/ClientConstants.java | 50 +++
.../rop/HttpClientConnectionProvider.java | 16 +-
.../CayenneContextClientChannelEventsIT.java | 11 +-
.../rop/client/ClientModuleTest.java | 4 +-
.../cayenne/rop/protostuff/RuntimeBase.java | 4 +-
.../apache/cayenne/configuration/Constants.java | 408 ++++++++++---------
.../apache/cayenne/tutorial/Http2Client.java | 14 +-
.../tutorial/persistent/client/Main.java | 8 +-
12 files changed, 313 insertions(+), 230 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/1ace4e72/cayenne-client-jetty/src/main/java/org/apache/cayenne/rop/JettyHttp2ClientConnectionProvider.java
----------------------------------------------------------------------
diff --git a/cayenne-client-jetty/src/main/java/org/apache/cayenne/rop/JettyHttp2ClientConnectionProvider.java b/cayenne-client-jetty/src/main/java/org/apache/cayenne/rop/JettyHttp2ClientConnectionProvider.java
index b1411e9..09bc125 100644
--- a/cayenne-client-jetty/src/main/java/org/apache/cayenne/rop/JettyHttp2ClientConnectionProvider.java
+++ b/cayenne-client-jetty/src/main/java/org/apache/cayenne/rop/JettyHttp2ClientConnectionProvider.java
@@ -20,7 +20,7 @@
package org.apache.cayenne.rop;
import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.configuration.Constants;
+import org.apache.cayenne.configuration.rop.client.ClientConstants;
import org.apache.cayenne.di.Provider;
import org.apache.cayenne.remote.ClientConnection;
import org.apache.cayenne.rop.http.JettyHttpROPConnector;
@@ -34,7 +34,7 @@ import org.eclipse.jetty.util.ssl.SslContextFactory;
* {@link org.eclipse.jetty.client.HttpClient} over {@link org.eclipse.jetty.http2.client.HTTP2Client}.
* It works without ALPN by default.
* <p>
- * In order to use it with ALPN you have to set {@link Constants#ROP_SERVICE_USE_ALPN_PROPERTY} to true
+ * In order to use it with ALPN you have to set {@link ClientConstants#ROP_SERVICE_USE_ALPN_PROPERTY} to true
* and provide the alpn-boot-XXX.jar into the bootstrap classpath.
*/
public class JettyHttp2ClientConnectionProvider extends JettyHttpClientConnectionProvider {
@@ -44,7 +44,7 @@ public class JettyHttp2ClientConnectionProvider extends JettyHttpClientConnectio
try {
HttpClientTransportOverHTTP2 http2 = new HttpClientTransportOverHTTP2(new HTTP2Client());
- boolean useALPN = runtimeProperties.getBoolean(Constants.ROP_SERVICE_USE_ALPN_PROPERTY, false);
+ boolean useALPN = runtimeProperties.getBoolean(ClientConstants.ROP_SERVICE_USE_ALPN_PROPERTY, false);
http2.setUseALPN(useALPN);
HttpClient httpClient = new HttpClient(http2, new SslContextFactory());
http://git-wip-us.apache.org/repos/asf/cayenne/blob/1ace4e72/cayenne-client-jetty/src/main/java/org/apache/cayenne/rop/JettyHttpClientConnectionProvider.java
----------------------------------------------------------------------
diff --git a/cayenne-client-jetty/src/main/java/org/apache/cayenne/rop/JettyHttpClientConnectionProvider.java b/cayenne-client-jetty/src/main/java/org/apache/cayenne/rop/JettyHttpClientConnectionProvider.java
index c430c79..6a616df 100644
--- a/cayenne-client-jetty/src/main/java/org/apache/cayenne/rop/JettyHttpClientConnectionProvider.java
+++ b/cayenne-client-jetty/src/main/java/org/apache/cayenne/rop/JettyHttpClientConnectionProvider.java
@@ -21,8 +21,8 @@ package org.apache.cayenne.rop;
import org.apache.cayenne.CayenneRuntimeException;
import org.apache.cayenne.ConfigurationException;
-import org.apache.cayenne.configuration.Constants;
import org.apache.cayenne.configuration.RuntimeProperties;
+import org.apache.cayenne.configuration.rop.client.ClientConstants;
import org.apache.cayenne.di.DIRuntimeException;
import org.apache.cayenne.di.Inject;
import org.apache.cayenne.di.Provider;
@@ -54,7 +54,7 @@ public class JettyHttpClientConnectionProvider implements Provider<ClientConnect
@Override
public ClientConnection get() throws DIRuntimeException {
String sharedSession = runtimeProperties
- .get(Constants.ROP_SERVICE_SHARED_SESSION_PROPERTY);
+ .get(ClientConstants.ROP_SERVICE_SHARED_SESSION_PROPERTY);
JettyHttpROPConnector ropConnector = createJettyHttpRopConnector();
ProxyRemoteService remoteService = new ProxyRemoteService(serializationService, ropConnector);
@@ -66,16 +66,16 @@ public class JettyHttpClientConnectionProvider implements Provider<ClientConnect
}
protected JettyHttpROPConnector createJettyHttpRopConnector() {
- String url = runtimeProperties.get(Constants.ROP_SERVICE_URL_PROPERTY);
+ String url = runtimeProperties.get(ClientConstants.ROP_SERVICE_URL_PROPERTY);
if (url == null) {
throw new ConfigurationException(
"No property defined for '%s', can't initialize connection",
- Constants.ROP_SERVICE_URL_PROPERTY);
+ ClientConstants.ROP_SERVICE_URL_PROPERTY);
}
- String username = runtimeProperties.get(Constants.ROP_SERVICE_USERNAME_PROPERTY);
+ String username = runtimeProperties.get(ClientConstants.ROP_SERVICE_USERNAME_PROPERTY);
long readTimeout = runtimeProperties.getLong(
- Constants.ROP_SERVICE_TIMEOUT_PROPERTY,
+ ClientConstants.ROP_SERVICE_TIMEOUT_PROPERTY,
-1L);
HttpClient httpClient = initJettyHttpClient();
@@ -103,8 +103,8 @@ public class JettyHttpClientConnectionProvider implements Provider<ClientConnect
}
protected void addBasicAuthentication(HttpClient httpClient, String url, String username) {
- String password = runtimeProperties.get(Constants.ROP_SERVICE_PASSWORD_PROPERTY);
- String realm = runtimeProperties.get(Constants.ROP_SERVICE_REALM_PROPERTY);
+ String password = runtimeProperties.get(ClientConstants.ROP_SERVICE_PASSWORD_PROPERTY);
+ String realm = runtimeProperties.get(ClientConstants.ROP_SERVICE_REALM_PROPERTY);
if (username != null && password != null) {
if (realm == null && logger.isWarnEnabled()) {
http://git-wip-us.apache.org/repos/asf/cayenne/blob/1ace4e72/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/CayenneContextFactory.java
----------------------------------------------------------------------
diff --git a/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/CayenneContextFactory.java b/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/CayenneContextFactory.java
index 991e9ab..d90cea0 100644
--- a/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/CayenneContextFactory.java
+++ b/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/CayenneContextFactory.java
@@ -49,11 +49,11 @@ public class CayenneContextFactory implements ObjectContextFactory {
public ObjectContext createContext(DataChannel parent) {
boolean changeEvents = properties.getBoolean(
- Constants.ROP_CONTEXT_CHANGE_EVENTS_PROPERTY,
+ ClientConstants.ROP_CONTEXT_CHANGE_EVENTS_PROPERTY,
false);
boolean lifecycleEvents = properties.getBoolean(
- Constants.ROP_CONTEXT_LIFECYCLE_EVENTS_PROPERTY,
+ ClientConstants.ROP_CONTEXT_LIFECYCLE_EVENTS_PROPERTY,
false);
CayenneContext context = newInstance(parent, changeEvents, lifecycleEvents);
http://git-wip-us.apache.org/repos/asf/cayenne/blob/1ace4e72/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/ClientChannelProvider.java
----------------------------------------------------------------------
diff --git a/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/ClientChannelProvider.java b/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/ClientChannelProvider.java
index b5bc3e3..7936a1e 100644
--- a/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/ClientChannelProvider.java
+++ b/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/ClientChannelProvider.java
@@ -42,7 +42,7 @@ public class ClientChannelProvider implements Provider<DataChannel> {
public DataChannel get() throws ConfigurationException {
boolean channelEvents = properties.getBoolean(
- Constants.ROP_CHANNEL_EVENTS_PROPERTY,
+ ClientConstants.ROP_CHANNEL_EVENTS_PROPERTY,
false);
return new ClientChannel(connection, channelEvents, eventManager, channelEvents);
http://git-wip-us.apache.org/repos/asf/cayenne/blob/1ace4e72/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/ClientConstants.java
----------------------------------------------------------------------
diff --git a/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/ClientConstants.java b/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/ClientConstants.java
new file mode 100644
index 0000000..c2c0833
--- /dev/null
+++ b/cayenne-client/src/main/java/org/apache/cayenne/configuration/rop/client/ClientConstants.java
@@ -0,0 +1,50 @@
+/*
+ * 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.configuration.rop.client;
+
+/**
+ * Defines the names of runtime properties and named collections used in DI modules related to ROP client.
+ *
+ * @since 4.0
+ */
+public class ClientConstants {
+
+ public static final String ROP_SERVICE_URL_PROPERTY = "cayenne.rop.service_url";
+
+ public static final String ROP_SERVICE_USERNAME_PROPERTY = "cayenne.rop.service_username";
+
+ public static final String ROP_SERVICE_PASSWORD_PROPERTY = "cayenne.rop.service_password";
+
+ public static final String ROP_SERVICE_REALM_PROPERTY = "cayenne.rop.service_realm";
+
+ /**
+ * A boolean property that defines whether ALPN should be used. Possible values are "true" or "false".
+ */
+ public static final String ROP_SERVICE_USE_ALPN_PROPERTY = "cayenne.rop.service_use_alpn";
+
+ public static final String ROP_SERVICE_SHARED_SESSION_PROPERTY = "cayenne.rop.shared_session_name";
+
+ public static final String ROP_SERVICE_TIMEOUT_PROPERTY = "cayenne.rop.service_timeout";
+
+ public static final String ROP_CHANNEL_EVENTS_PROPERTY = "cayenne.rop.channel_events";
+
+ public static final String ROP_CONTEXT_CHANGE_EVENTS_PROPERTY = "cayenne.rop.context_change_events";
+
+ public static final String ROP_CONTEXT_LIFECYCLE_EVENTS_PROPERTY = "cayenne.rop.context_lifecycle_events";
+}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/1ace4e72/cayenne-client/src/main/java/org/apache/cayenne/rop/HttpClientConnectionProvider.java
----------------------------------------------------------------------
diff --git a/cayenne-client/src/main/java/org/apache/cayenne/rop/HttpClientConnectionProvider.java b/cayenne-client/src/main/java/org/apache/cayenne/rop/HttpClientConnectionProvider.java
index ed4036c..c327de9 100644
--- a/cayenne-client/src/main/java/org/apache/cayenne/rop/HttpClientConnectionProvider.java
+++ b/cayenne-client/src/main/java/org/apache/cayenne/rop/HttpClientConnectionProvider.java
@@ -19,8 +19,8 @@
package org.apache.cayenne.rop;
import org.apache.cayenne.ConfigurationException;
-import org.apache.cayenne.configuration.Constants;
import org.apache.cayenne.configuration.RuntimeProperties;
+import org.apache.cayenne.configuration.rop.client.ClientConstants;
import org.apache.cayenne.di.DIRuntimeException;
import org.apache.cayenne.di.Inject;
import org.apache.cayenne.di.Provider;
@@ -38,7 +38,7 @@ public class HttpClientConnectionProvider implements Provider<ClientConnection>
@Override
public ClientConnection get() throws DIRuntimeException {
String sharedSession = runtimeProperties
- .get(Constants.ROP_SERVICE_SHARED_SESSION_PROPERTY);
+ .get(ClientConstants.ROP_SERVICE_SHARED_SESSION_PROPERTY);
HttpROPConnector ropConnector = createHttpRopConnector();
ProxyRemoteService remoteService = new ProxyRemoteService(serializationService, ropConnector);
@@ -50,19 +50,17 @@ public class HttpClientConnectionProvider implements Provider<ClientConnection>
}
protected HttpROPConnector createHttpRopConnector() {
- String url = runtimeProperties.get(Constants.ROP_SERVICE_URL_PROPERTY);
+ String url = runtimeProperties.get(ClientConstants.ROP_SERVICE_URL_PROPERTY);
if (url == null) {
throw new ConfigurationException(
"No property defined for '%s', can't initialize HessianConnection",
- Constants.ROP_SERVICE_URL_PROPERTY);
+ ClientConstants.ROP_SERVICE_URL_PROPERTY);
}
- String userName = runtimeProperties.get(Constants.ROP_SERVICE_USERNAME_PROPERTY);
- String password = runtimeProperties.get(Constants.ROP_SERVICE_PASSWORD_PROPERTY);
+ String userName = runtimeProperties.get(ClientConstants.ROP_SERVICE_USERNAME_PROPERTY);
+ String password = runtimeProperties.get(ClientConstants.ROP_SERVICE_PASSWORD_PROPERTY);
- long readTimeout = runtimeProperties.getLong(
- Constants.ROP_SERVICE_TIMEOUT_PROPERTY,
- -1L);
+ long readTimeout = runtimeProperties.getLong(ClientConstants.ROP_SERVICE_TIMEOUT_PROPERTY, -1L);
HttpROPConnector result = new HttpROPConnector(url, userName, password);
http://git-wip-us.apache.org/repos/asf/cayenne/blob/1ace4e72/cayenne-client/src/test/java/org/apache/cayenne/CayenneContextClientChannelEventsIT.java
----------------------------------------------------------------------
diff --git a/cayenne-client/src/test/java/org/apache/cayenne/CayenneContextClientChannelEventsIT.java b/cayenne-client/src/test/java/org/apache/cayenne/CayenneContextClientChannelEventsIT.java
index efe5736..891f146 100644
--- a/cayenne-client/src/test/java/org/apache/cayenne/CayenneContextClientChannelEventsIT.java
+++ b/cayenne-client/src/test/java/org/apache/cayenne/CayenneContextClientChannelEventsIT.java
@@ -19,7 +19,7 @@
package org.apache.cayenne;
-import org.apache.cayenne.configuration.Constants;
+import org.apache.cayenne.configuration.rop.client.ClientConstants;
import org.apache.cayenne.configuration.rop.client.ClientRuntime;
import org.apache.cayenne.di.Inject;
import org.apache.cayenne.query.ObjectIdQuery;
@@ -36,19 +36,14 @@ import org.apache.cayenne.unit.di.server.UseServerRuntime;
import org.junit.Before;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
/**
* Tests peer context synchronization via ClientChannel events.
*/
@UseServerRuntime(CayenneProjects.MULTI_TIER_PROJECT)
@ClientRuntimeProperty({
- Constants.ROP_CHANNEL_EVENTS_PROPERTY, "true"
+ ClientConstants.ROP_CHANNEL_EVENTS_PROPERTY, "true"
})
public class CayenneContextClientChannelEventsIT extends ClientCase {
http://git-wip-us.apache.org/repos/asf/cayenne/blob/1ace4e72/cayenne-client/src/test/java/org/apache/cayenne/configuration/rop/client/ClientModuleTest.java
----------------------------------------------------------------------
diff --git a/cayenne-client/src/test/java/org/apache/cayenne/configuration/rop/client/ClientModuleTest.java b/cayenne-client/src/test/java/org/apache/cayenne/configuration/rop/client/ClientModuleTest.java
index 8786ff1..acf77c4 100644
--- a/cayenne-client/src/test/java/org/apache/cayenne/configuration/rop/client/ClientModuleTest.java
+++ b/cayenne-client/src/test/java/org/apache/cayenne/configuration/rop/client/ClientModuleTest.java
@@ -45,7 +45,7 @@ public class ClientModuleTest {
public void testClientConnection() {
Map<String, String> properties = new HashMap<>();
- properties.put(Constants.ROP_SERVICE_URL_PROPERTY, "http://localhost/YuM");
+ properties.put(ClientConstants.ROP_SERVICE_URL_PROPERTY, "http://localhost/YuM");
ClientModule module = new ClientModule(properties);
Injector injector = DIBootstrap.createInjector(module);
@@ -114,7 +114,7 @@ public class ClientModuleTest {
public void testDataChannel_NoChannelEvents() {
Map<String, String> properties = new HashMap<>();
- properties.put(Constants.ROP_CHANNEL_EVENTS_PROPERTY, "true");
+ properties.put(ClientConstants.ROP_CHANNEL_EVENTS_PROPERTY, "true");
ClientModule module = new ClientModule(properties) {
@Override
http://git-wip-us.apache.org/repos/asf/cayenne/blob/1ace4e72/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/RuntimeBase.java
----------------------------------------------------------------------
diff --git a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/RuntimeBase.java b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/RuntimeBase.java
index f474353..91bd033 100644
--- a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/RuntimeBase.java
+++ b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/RuntimeBase.java
@@ -20,7 +20,7 @@
package org.apache.cayenne.rop.protostuff;
import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.configuration.Constants;
+import org.apache.cayenne.configuration.rop.client.ClientConstants;
import org.apache.cayenne.configuration.rop.client.ClientLocalRuntime;
import org.apache.cayenne.configuration.rop.client.ClientRuntime;
import org.apache.cayenne.configuration.rop.client.ProtostuffModule;
@@ -47,7 +47,7 @@ public class RuntimeBase extends ProtostuffProperties {
new CayenneJava8Module());
Map<String, String> properties = new HashMap<>();
- properties.put(Constants.ROP_CHANNEL_EVENTS_PROPERTY, Boolean.TRUE.toString());
+ properties.put(ClientConstants.ROP_CHANNEL_EVENTS_PROPERTY, Boolean.TRUE.toString());
Module module = binder -> binder.bind(ClientConnection.class)
.toProviderInstance(new ProtostuffLocalConnectionProvider());
http://git-wip-us.apache.org/repos/asf/cayenne/blob/1ace4e72/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 53f3de7..7844d6e 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
@@ -21,67 +21,66 @@ 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.
- *
+ * Defines the names of runtime properties and named collections used in DI modules.
+ *
* @since 3.1
*/
public interface Constants {
- // DI "collections"
-
- /**
- * A DI container key for the Map<String, String> 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";
-
- /**
- * A DI container key for the List<DbAdapterDetector> that contains
- * objects that can discover the type of current database and install the
- * correct DbAdapter in runtime.
- */
- public static final String SERVER_ADAPTER_DETECTORS_LIST = "cayenne.server.adapter_detectors";
-
- /**
- * A DI container key for the List<DataChannelFilter> storing
- * DataDomain filters.
+ // DI "collections"
+
+ /**
+ * A DI container key for the Map<String, String> 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";
+
+ /**
+ * A DI container key for the List<DbAdapterDetector> that contains
+ * objects that can discover the type of current database and install the
+ * correct DbAdapter in runtime.
+ */
+ public static final String SERVER_ADAPTER_DETECTORS_LIST = "cayenne.server.adapter_detectors";
+
+ /**
+ * A DI container key for the List<DataChannelFilter> storing
+ * DataDomain filters.
*
* @see org.apache.cayenne.configuration.server.ServerModule#contributeDomainFilters(Binder).
- */
- public static final String SERVER_DOMAIN_FILTERS_LIST = "cayenne.server.domain_filters";
-
- /**
- * A DI container key for the List<String> storing locations of the
- * one of more project configuration files.
- */
- public static final String SERVER_PROJECT_LOCATIONS_LIST = "cayenne.server.project_locations";
-
- /**
- * A DI container key for the List<ExtendedType> 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<ExtendedType> 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<ExtendedTypeFactory> 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";
+ */
+ public static final String SERVER_DOMAIN_FILTERS_LIST = "cayenne.server.domain_filters";
+
+ /**
+ * A DI container key for the List<String> storing locations of the
+ * one of more project configuration files.
+ */
+ public static final String SERVER_PROJECT_LOCATIONS_LIST = "cayenne.server.project_locations";
+
+ /**
+ * A DI container key for the List<ExtendedType> 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<ExtendedType> 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<ExtendedTypeFactory> 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";
/**
* A server-side DI container key for binding {@link org.apache.cayenne.resource.ResourceLocator}
@@ -89,139 +88,180 @@ public interface Constants {
public final static String SERVER_RESOURCE_LOCATOR = "cayenne.server.resource_locator";
/**
- * A server-side DI container key for the Map<String, String> storing
- * event bridge properties passed to the ROP client on bootstrap.
- */
- public static final String SERVER_ROP_EVENT_BRIDGE_PROPERTIES_MAP = "cayenne.server.rop_event_bridge_properties";
+ * A server-side DI container key for the Map<String, String> storing
+ * event bridge properties passed to the ROP client on bootstrap.
+ */
+ public static final String SERVER_ROP_EVENT_BRIDGE_PROPERTIES_MAP = "cayenne.server.rop_event_bridge_properties";
+
+ // Runtime properties
+
+ public static final String JDBC_DRIVER_PROPERTY = "cayenne.jdbc.driver";
+
+ public static final String JDBC_URL_PROPERTY = "cayenne.jdbc.url";
+
+ public static final String JDBC_USERNAME_PROPERTY = "cayenne.jdbc.username";
+
+ public static final String JDBC_PASSWORD_PROPERTY = "cayenne.jdbc.password";
+
+ public static final String JDBC_MIN_CONNECTIONS_PROPERTY = "cayenne.jdbc.min_connections";
+
+ public static final String JDBC_MAX_CONNECTIONS_PROPERTY = "cayenne.jdbc.max_connections";
+
+ /**
+ * Defines a maximum time in milliseconds that a connection request could
+ * wait in the connection queue. After this period expires, an exception
+ * will be thrown in the calling method. A value of zero will make the
+ * thread wait until a connection is available with no time out. Defaults to
+ * 20 seconds.
+ *
+ * @since 4.0
+ */
+ public static final String JDBC_MAX_QUEUE_WAIT_TIME = "cayenne.jdbc.max_wait";
+
+ /**
+ * @since 4.0
+ */
+ public static final String JDBC_VALIDATION_QUERY_PROPERTY = "cayenne.jdbc.validation_query";
+
+ /**
+ * An integer property defining the maximum number of entries in the query
+ * cache. Note that not all QueryCache providers may respect this property.
+ * MapQueryCache uses it, but the rest would use alternative configuration
+ * methods.
+ */
+ public static final String QUERY_CACHE_SIZE_PROPERTY = "cayenne.querycache.size";
+
+ /**
+ * An optional name of the runtime DataDomain. If not specified (which is
+ * normally the case), the name is inferred from the configuration name.
+ *
+ * @since 4.0
+ */
+ public static final String SERVER_DOMAIN_NAME_PROPERTY = "cayenne.server.domain.name";
+
+ /**
+ * A boolean property defining whether cross-contexts synchronization is
+ * enabled. Possible values are "true" or "false".
+ */
+ public static final String SERVER_CONTEXTS_SYNC_PROPERTY = "cayenne.server.contexts_sync_strategy";
+
+ /**
+ * A String property that defines how ObjectContexts should retain cached
+ * committed objects. Possible values are "weak", "soft", "hard".
+ */
+ public static final String SERVER_OBJECT_RETAIN_STRATEGY_PROPERTY = "cayenne.server.object_retain_strategy";
+
+ /**
+ * A boolean property that defines whether runtime should use external
+ * transactions. Possible values are "true" or "false".
+ */
+ public static final String SERVER_EXTERNAL_TX_PROPERTY = "cayenne.server.external_tx";
+
+ /**
+ * The name of the {@link org.apache.cayenne.event.EventBridgeFactory} that
+ * is passed from the ROP server to the client. Client would instantiate the
+ * factory to receive events from the server. Note that this property is
+ * stored in {@link #SERVER_ROP_EVENT_BRIDGE_PROPERTIES_MAP}, not
+ * {@link #PROPERTIES_MAP}.
+ */
+ public static final String SERVER_ROP_EVENT_BRIDGE_FACTORY_PROPERTY = "cayenne.server.rop_event_bridge_factory";
+
+ /**
+ * A property that defines a maximum number of ID qualifiers in where clause
+ * of queries that are generated for example in
+ * {@link org.apache.cayenne.access.IncrementalFaultList} or in
+ * DISJOINT_BY_ID prefetch processing. This is needed to avoid where clause
+ * size limitations and memory usage efficiency.
+ */
+ public static final String SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY = "cayenne.server.max_id_qualifier_size";
+
+ /**
+ * Defines a maximum time in milliseconds that a connection request could
+ * wait in the connection queue. After this period expires, an exception
+ * will be thrown in the calling method. A value of zero will make the
+ * thread wait until a connection is available with no time out. Defaults to
+ * 20 seconds.
+ *
+ * @deprecated since 4.0 renamed to {@link #JDBC_MAX_QUEUE_WAIT_TIME}. Property name is preserved.
+ */
+ public static final String SERVER_MAX_QUEUE_WAIT_TIME = JDBC_MAX_QUEUE_WAIT_TIME;
+
+ /**
+ * Defines if database uses case-insensitive collation
+ */
+ public final static String CI_PROPERTY = "cayenne.runtime.db.collation.assume.ci";
+
+ /**
+ * A integer property that enables logging for just long running queries
+ * (rather than all queries). The value is the minimum number of
+ * milliseconds a query must run before is logged. A value less than or
+ * equal to zero (the default) disables this feature.
+ *
+ * @since 4.0
+ */
+ public final static String QUERY_EXECUTION_TIME_LOGGING_THRESHOLD_PROPERTY = "cayenne.server.query_execution_time_logging_threshold";
+
+ /**
+ * @deprecated since 4.0 moved to cayenne-client org.apache.cayenne.configuration.rop.client.ClientConstants.
+ */
+ @Deprecated
+ public static final String ROP_SERVICE_URL_PROPERTY = "cayenne.rop.service_url";
- // Runtime properties
+ /**
+ * @deprecated since 4.0 moved to cayenne-client org.apache.cayenne.configuration.rop.client.ClientConstants.
+ */
+ @Deprecated
+ public static final String ROP_SERVICE_USERNAME_PROPERTY = "cayenne.rop.service_username";
- public static final String JDBC_DRIVER_PROPERTY = "cayenne.jdbc.driver";
+ /**
+ * @deprecated since 4.0 moved to cayenne-client org.apache.cayenne.configuration.rop.client.ClientConstants.
+ */
+ @Deprecated
+ public static final String ROP_SERVICE_PASSWORD_PROPERTY = "cayenne.rop.service_password";
- public static final String JDBC_URL_PROPERTY = "cayenne.jdbc.url";
+ /**
+ * @deprecated since 4.0 moved to cayenne-client org.apache.cayenne.configuration.rop.client.ClientConstants.
+ */
+ @Deprecated
+ public static final String ROP_SERVICE_REALM_PROPERTY = "cayenne.rop.service_realm";
- public static final String JDBC_USERNAME_PROPERTY = "cayenne.jdbc.username";
+ /**
+ * A boolean property that defines whether ALPN should be used.
+ * Possible values are "true" or "false".
+ *
+ * @deprecated since 4.0 moved to cayenne-client org.apache.cayenne.configuration.rop.client.ClientConstants.
+ */
+ @Deprecated
+ public static final String ROP_SERVICE_USE_ALPN_PROPERTY = "cayenne.rop.service_use_alpn";
- public static final String JDBC_PASSWORD_PROPERTY = "cayenne.jdbc.password";
-
- public static final String JDBC_MIN_CONNECTIONS_PROPERTY = "cayenne.jdbc.min_connections";
-
- public static final String JDBC_MAX_CONNECTIONS_PROPERTY = "cayenne.jdbc.max_connections";
-
- /**
- * Defines a maximum time in milliseconds that a connection request could
- * wait in the connection queue. After this period expires, an exception
- * will be thrown in the calling method. A value of zero will make the
- * thread wait until a connection is available with no time out. Defaults to
- * 20 seconds.
- *
- * @since 4.0
- */
- public static final String JDBC_MAX_QUEUE_WAIT_TIME = "cayenne.jdbc.max_wait";
-
- /**
- * @since 4.0
- */
- public static final String JDBC_VALIDATION_QUERY_PROPERTY = "cayenne.jdbc.validation_query";
-
- /**
- * An integer property defining the maximum number of entries in the query
- * cache. Note that not all QueryCache providers may respect this property.
- * MapQueryCache uses it, but the rest would use alternative configuration
- * methods.
- */
- public static final String QUERY_CACHE_SIZE_PROPERTY = "cayenne.querycache.size";
-
- /**
- * An optional name of the runtime DataDomain. If not specified (which is
- * normally the case), the name is inferred from the configuration name.
- *
- * @since 4.0
- */
- public static final String SERVER_DOMAIN_NAME_PROPERTY = "cayenne.server.domain.name";
-
- /**
- * A boolean property defining whether cross-contexts synchronization is
- * enabled. Possible values are "true" or "false".
- */
- public static final String SERVER_CONTEXTS_SYNC_PROPERTY = "cayenne.server.contexts_sync_strategy";
-
- /**
- * A String property that defines how ObjectContexts should retain cached
- * committed objects. Possible values are "weak", "soft", "hard".
- */
- public static final String SERVER_OBJECT_RETAIN_STRATEGY_PROPERTY = "cayenne.server.object_retain_strategy";
-
- /**
- * A boolean property that defines whether runtime should use external
- * transactions. Possible values are "true" or "false".
- */
- public static final String SERVER_EXTERNAL_TX_PROPERTY = "cayenne.server.external_tx";
-
- public static final String ROP_SERVICE_URL_PROPERTY = "cayenne.rop.service_url";
-
- public static final String ROP_SERVICE_USERNAME_PROPERTY = "cayenne.rop.service_username";
-
- public static final String ROP_SERVICE_PASSWORD_PROPERTY = "cayenne.rop.service_password";
-
- public static final String ROP_SERVICE_REALM_PROPERTY = "cayenne.rop.service_realm";
-
- /**
- * A boolean property that defines whether ALPN should be used.
- * Possible values are "true" or "false".
- */
- public static final String ROP_SERVICE_USE_ALPN_PROPERTY = "cayenne.rop.service_use_alpn";
-
- public static final String ROP_SERVICE_SHARED_SESSION_PROPERTY = "cayenne.rop.shared_session_name";
-
- public static final String ROP_SERVICE_TIMEOUT_PROPERTY = "cayenne.rop.service_timeout";
-
- public static final String ROP_CHANNEL_EVENTS_PROPERTY = "cayenne.rop.channel_events";
-
- public static final String ROP_CONTEXT_CHANGE_EVENTS_PROPERTY = "cayenne.rop.context_change_events";
-
- public static final String ROP_CONTEXT_LIFECYCLE_EVENTS_PROPERTY = "cayenne.rop.context_lifecycle_events";
-
- /**
- * The name of the {@link org.apache.cayenne.event.EventBridgeFactory} that
- * is passed from the ROP server to the client. Client would instantiate the
- * factory to receive events from the server. Note that this property is
- * stored in {@link #SERVER_ROP_EVENT_BRIDGE_PROPERTIES_MAP}, not
- * {@link #PROPERTIES_MAP}.
- */
- public static final String SERVER_ROP_EVENT_BRIDGE_FACTORY_PROPERTY = "cayenne.server.rop_event_bridge_factory";
-
- /**
- * A property that defines a maximum number of ID qualifiers in where clause
- * of queries that are generated for example in
- * {@link org.apache.cayenne.access.IncrementalFaultList} or in
- * DISJOINT_BY_ID prefetch processing. This is needed to avoid where clause
- * size limitations and memory usage efficiency.
- */
- public static final String SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY = "cayenne.server.max_id_qualifier_size";
-
- /**
- * Defines a maximum time in milliseconds that a connection request could
- * wait in the connection queue. After this period expires, an exception
- * will be thrown in the calling method. A value of zero will make the
- * thread wait until a connection is available with no time out. Defaults to
- * 20 seconds.
- *
- * @deprecated since 4.0 renamed to {@link #JDBC_MAX_QUEUE_WAIT_TIME}. Property name is preserved.
- */
- public static final String SERVER_MAX_QUEUE_WAIT_TIME = JDBC_MAX_QUEUE_WAIT_TIME;
-
- /** Defines if database uses case-insensitive collation */
- public final static String CI_PROPERTY = "cayenne.runtime.db.collation.assume.ci";
-
- /**
- * A integer property that enables logging for just long running queries
- * (rather than all queries). The value is the minimum number of
- * milliseconds a query must run before is logged. A value less than or
- * equal to zero (the default) disables this feature.
- *
- * @since 4.0
- * */
- public final static String QUERY_EXECUTION_TIME_LOGGING_THRESHOLD_PROPERTY = "cayenne.server.query_execution_time_logging_threshold";
+ /**
+ * @deprecated since 4.0 moved to cayenne-client org.apache.cayenne.configuration.rop.client.ClientConstants.
+ */
+ @Deprecated
+ public static final String ROP_SERVICE_SHARED_SESSION_PROPERTY = "cayenne.rop.shared_session_name";
+
+ /**
+ * @deprecated since 4.0 moved to cayenne-client org.apache.cayenne.configuration.rop.client.ClientConstants.
+ */
+ @Deprecated
+ public static final String ROP_SERVICE_TIMEOUT_PROPERTY = "cayenne.rop.service_timeout";
+
+ /**
+ * @deprecated since 4.0 moved to cayenne-client org.apache.cayenne.configuration.rop.client.ClientConstants.
+ */
+ @Deprecated
+ public static final String ROP_CHANNEL_EVENTS_PROPERTY = "cayenne.rop.channel_events";
+
+ /**
+ * @deprecated since 4.0 moved to cayenne-client org.apache.cayenne.configuration.rop.client.ClientConstants.
+ */
+ @Deprecated
+ public static final String ROP_CONTEXT_CHANGE_EVENTS_PROPERTY = "cayenne.rop.context_change_events";
+
+ /**
+ * @deprecated since 4.0 moved to cayenne-client org.apache.cayenne.configuration.rop.client.ClientConstants.
+ */
+ @Deprecated
+ public static final String ROP_CONTEXT_LIFECYCLE_EVENTS_PROPERTY = "cayenne.rop.context_lifecycle_events";
}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/1ace4e72/tutorials/tutorial-rop-client-http2/src/main/java/org/apache/cayenne/tutorial/Http2Client.java
----------------------------------------------------------------------
diff --git a/tutorials/tutorial-rop-client-http2/src/main/java/org/apache/cayenne/tutorial/Http2Client.java b/tutorials/tutorial-rop-client-http2/src/main/java/org/apache/cayenne/tutorial/Http2Client.java
index 97b589e..6fb819d 100644
--- a/tutorials/tutorial-rop-client-http2/src/main/java/org/apache/cayenne/tutorial/Http2Client.java
+++ b/tutorials/tutorial-rop-client-http2/src/main/java/org/apache/cayenne/tutorial/Http2Client.java
@@ -20,7 +20,7 @@
package org.apache.cayenne.tutorial;
import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.configuration.Constants;
+import org.apache.cayenne.configuration.rop.client.ClientConstants;
import org.apache.cayenne.configuration.rop.client.ClientJettyHttp2Module;
import org.apache.cayenne.configuration.rop.client.ClientRuntime;
import org.apache.cayenne.configuration.rop.client.ProtostuffModule;
@@ -43,7 +43,7 @@ import java.util.Map;
* and {@link JettyHttpROPConnector} initialized by {@link JettyHttp2ClientConnectionProvider}, which is bound
* in {@link ClientJettyHttp2Module}. It works without ALPN by default.
* <p>
- * In order to run it with ALPN, you have to set {@link Constants#ROP_SERVICE_USE_ALPN_PROPERTY} to true
+ * In order to run it with ALPN, you have to set {@link ClientConstants#ROP_SERVICE_USE_ALPN_PROPERTY} to true
* and provide the alpn-boot-XXX.jar into the bootstrap classpath.
*/
public class Http2Client {
@@ -60,11 +60,11 @@ public class Http2Client {
System.setProperty("protostuff.runtime.pojo_schema_on_map_fields", "true");
Map<String, String> properties = new HashMap<>();
- properties.put(Constants.ROP_SERVICE_URL_PROPERTY, "https://localhost:8443/");
- properties.put(Constants.ROP_SERVICE_USE_ALPN_PROPERTY, "false");
- properties.put(Constants.ROP_SERVICE_USERNAME_PROPERTY, "cayenne-user");
- properties.put(Constants.ROP_SERVICE_PASSWORD_PROPERTY, "secret");
- properties.put(Constants.ROP_SERVICE_REALM_PROPERTY, "Cayenne Realm");
+ properties.put(ClientConstants.ROP_SERVICE_URL_PROPERTY, "https://localhost:8443/");
+ properties.put(ClientConstants.ROP_SERVICE_USE_ALPN_PROPERTY, "false");
+ properties.put(ClientConstants.ROP_SERVICE_USERNAME_PROPERTY, "cayenne-user");
+ properties.put(ClientConstants.ROP_SERVICE_PASSWORD_PROPERTY, "secret");
+ properties.put(ClientConstants.ROP_SERVICE_REALM_PROPERTY, "Cayenne Realm");
ClientRuntime runtime = new ClientRuntime(properties,
new ClientJettyHttp2Module(),
http://git-wip-us.apache.org/repos/asf/cayenne/blob/1ace4e72/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java
----------------------------------------------------------------------
diff --git a/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java b/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java
index ddb00e5..b86852b 100644
--- a/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java
+++ b/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java
@@ -19,7 +19,7 @@
package org.apache.cayenne.tutorial.persistent.client;
import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.configuration.Constants;
+import org.apache.cayenne.configuration.rop.client.ClientConstants;
import org.apache.cayenne.configuration.rop.client.ClientRuntime;
import org.apache.cayenne.query.ObjectSelect;
@@ -32,9 +32,9 @@ public class Main {
public static void main(String[] args) {
Map<String, String> properties = new HashMap<>();
- properties.put(Constants.ROP_SERVICE_URL_PROPERTY, "http://localhost:8080/tutorial-rop-server/cayenne-service");
- properties.put(Constants.ROP_SERVICE_USERNAME_PROPERTY, "cayenne-user");
- properties.put(Constants.ROP_SERVICE_PASSWORD_PROPERTY, "secret");
+ properties.put(ClientConstants.ROP_SERVICE_URL_PROPERTY, "http://localhost:8080/tutorial-rop-server/cayenne-service");
+ properties.put(ClientConstants.ROP_SERVICE_USERNAME_PROPERTY, "cayenne-user");
+ properties.put(ClientConstants.ROP_SERVICE_PASSWORD_PROPERTY, "secret");
ClientRuntime runtime = new ClientRuntime(properties);