cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject cayenne git commit: refactoring for easier subclassing
Date Fri, 08 Jul 2016 12:37:19 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 34646fd5b -> b1b216863


refactoring for easier subclassing


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

Branch: refs/heads/master
Commit: b1b216863a11a8052fb4c2b0680a2087a6e88548
Parents: 34646fd
Author: Andrus Adamchik <andrus@objectstyle.com>
Authored: Fri Jul 8 15:33:32 2016 +0300
Committer: Andrus Adamchik <andrus@objectstyle.com>
Committed: Fri Jul 8 15:33:56 2016 +0300

----------------------------------------------------------------------
 .../server/DataDomainProvider.java              | 35 +++++++++++---------
 1 file changed, 19 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/b1b21686/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainProvider.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainProvider.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainProvider.java
index 0b8ee5d..b7b34c7 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainProvider.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/DataDomainProvider.java
@@ -18,9 +18,6 @@
  ****************************************************************/
 package org.apache.cayenne.configuration.server;
 
-import java.util.Collection;
-import java.util.List;
-
 import org.apache.cayenne.ConfigurationException;
 import org.apache.cayenne.DataChannel;
 import org.apache.cayenne.DataChannelFilter;
@@ -46,6 +43,9 @@ import org.apache.cayenne.resource.ResourceLocator;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import java.util.Collection;
+import java.util.List;
+
 /**
  * A {@link DataChannel} provider that provides a single instance of DataDomain
  * configured per configuration supplied via injected
@@ -104,18 +104,7 @@ public class DataDomainProvider implements Provider<DataDomain>
{
 
 	protected DataDomain createAndInitDataDomain() throws Exception {
 
-		DataChannelDescriptor descriptor;
-
-		if (locations.isEmpty()) {
-			descriptor = new DataChannelDescriptor();
-		} else {
-			descriptor = descriptorFromConfigs();
-		}
-
-		String nameOverride = runtimeProperties.get(Constants.SERVER_DOMAIN_NAME_PROPERTY);
-		if (nameOverride != null) {
-			descriptor.setName(nameOverride);
-		}
+		DataChannelDescriptor descriptor = loadDescriptor();
 
 		DataDomain dataDomain = createDataDomain(descriptor.getName());
 
@@ -167,6 +156,20 @@ public class DataDomainProvider implements Provider<DataDomain>
{
 
 	/**
 	 * @since 4.0
+     */
+	protected DataChannelDescriptor loadDescriptor() {
+		DataChannelDescriptor descriptor = locations.isEmpty() ? new DataChannelDescriptor() :
loadDescriptorFromConfigs();
+
+		String nameOverride = runtimeProperties.get(Constants.SERVER_DOMAIN_NAME_PROPERTY);
+		if (nameOverride != null) {
+			descriptor.setName(nameOverride);
+		}
+
+		return descriptor;
+	}
+
+	/**
+	 * @since 4.0
 	 */
 	protected DataNode addDataNode(DataDomain dataDomain, DataNodeDescriptor nodeDescriptor)
throws Exception {
 		DataNode dataNode = dataNodeFactory.createDataNode(nodeDescriptor);
@@ -180,7 +183,7 @@ public class DataDomainProvider implements Provider<DataDomain>
{
 		return dataNode;
 	}
 
-	private DataChannelDescriptor descriptorFromConfigs() {
+	private DataChannelDescriptor loadDescriptorFromConfigs() {
 
 		long t0 = System.currentTimeMillis();
 


Mime
View raw message