You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by jo...@apache.org on 2018/05/02 15:19:48 UTC
[1/4] cayenne git commit: Fix NPE in cgen task when looking up
templates in classpath
Repository: cayenne
Updated Branches:
refs/heads/master 319e58970 -> 15b7f696b
Fix NPE in cgen task when looking up templates in classpath
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/240c8155
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/240c8155
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/240c8155
Branch: refs/heads/master
Commit: 240c815501851d1b7a287ab04114eb04a3b07ae6
Parents: 319e589
Author: John Huss <jo...@apache.org>
Authored: Tue May 1 16:52:37 2018 -0500
Committer: John Huss <jo...@gmail.com>
Committed: Wed May 2 10:15:55 2018 -0500
----------------------------------------------------------------------
.../org/apache/cayenne/gen/ClassGeneratorResourceLoader.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/240c8155/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGeneratorResourceLoader.java
----------------------------------------------------------------------
diff --git a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGeneratorResourceLoader.java b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGeneratorResourceLoader.java
index 4a26fd5..add72c4 100644
--- a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGeneratorResourceLoader.java
+++ b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGeneratorResourceLoader.java
@@ -23,6 +23,7 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
@@ -94,10 +95,12 @@ public class ClassGeneratorResourceLoader extends FileResourceLoader {
}
protected Reader loadFromThreadClassLoader(String name) {
- return new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(name));
+ InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
+ return stream != null ? new InputStreamReader(stream) : null;
}
protected Reader loadFromThisClassLoader(String name) {
- return new InputStreamReader(getClass().getClassLoader().getResourceAsStream(name));
+ InputStream stream = getClass().getClassLoader().getResourceAsStream(name);
+ return stream != null ? new InputStreamReader(stream) : null;
}
}
[4/4] cayenne git commit: Enhance CayenneFilter to allow specifying
multiple comma-separated DataDomain locations in web.xml
Posted by jo...@apache.org.
Enhance CayenneFilter to allow specifying multiple comma-separated DataDomain locations in web.xml
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/cac0527e
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/cac0527e
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/cac0527e
Branch: refs/heads/master
Commit: cac0527eaa813bbb15a56aff9d91ee75774ee034
Parents: 20d20c7
Author: John Huss <jo...@apache.org>
Authored: Wed May 2 10:05:40 2018 -0500
Committer: John Huss <jo...@gmail.com>
Committed: Wed May 2 10:16:04 2018 -0500
----------------------------------------------------------------------
.../org/apache/cayenne/configuration/web/CayenneFilter.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/cac0527e/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/CayenneFilter.java
----------------------------------------------------------------------
diff --git a/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/CayenneFilter.java b/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/CayenneFilter.java
index c4c3ab9..2f158c5 100644
--- a/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/CayenneFilter.java
+++ b/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/CayenneFilter.java
@@ -69,11 +69,15 @@ public class CayenneFilter implements Filter {
WebConfiguration configAdapter = new WebConfiguration(config);
String configurationLocation = configAdapter.getConfigurationLocation();
+ String[] configurationLocations = null;
+ if (configurationLocation != null) {
+ configurationLocations = configurationLocation.split(",\\s*");
+ }
Collection<Module> modules = configAdapter.createModules();
modules.addAll(getAdditionalModules());
ServerRuntime runtime = ServerRuntime.builder()
- .addConfig(configurationLocation)
+ .addConfigs(configurationLocations)
.addModules(modules).build();
WebUtil.setCayenneRuntime(config.getServletContext(), runtime);
[2/4] cayenne git commit: Fix flattened attributes with optimistic
locking
Posted by jo...@apache.org.
Fix flattened attributes with optimistic locking
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/20d20c71
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/20d20c71
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/20d20c71
Branch: refs/heads/master
Commit: 20d20c71ddbe6cbb81ec482c3f907f07ca017db2
Parents: 240c815
Author: John Huss <jo...@apache.org>
Authored: Wed May 2 10:05:22 2018 -0500
Committer: John Huss <jo...@gmail.com>
Committed: Wed May 2 10:16:04 2018 -0500
----------------------------------------------------------------------
.../access/DataNodeSyncQualifierDescriptor.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/20d20c71/cayenne-server/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java b/cayenne-server/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java
index e5cd484..176227c 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java
@@ -102,18 +102,18 @@ class DataNodeSyncQualifierDescriptor {
attributes.add(dbAttribute);
valueTransformers.add(input -> {
ObjectId id = (ObjectId) input.getNodeId();
- return id.getIdSnapshot().get(dbAttrPair.getSourceName());
+ return id.getIdSnapshot().get(dbAttrPair.getTargetName());
});
- }
- }
- }
- }
+ }
+ }
+ }
+ }
- if (usingOptimisticLocking) {
+ if (descriptor.isMaster() && usingOptimisticLocking) {
for (final ObjAttribute attribute : descriptor.getEntity().getAttributes()) {
- if (attribute.isUsedForLocking()) {
+ if (attribute.isUsedForLocking() && !attribute.isFlattened()) {
// only care about first step in a flattened attribute
DbAttribute dbAttribute = (DbAttribute) attribute.getDbPathIterator().next();
[3/4] cayenne git commit: Enhance CayenneFilter to allow setting a
custom DataDomain name in web.xml
Posted by jo...@apache.org.
Enhance CayenneFilter to allow setting a custom DataDomain name in web.xml
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/15b7f696
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/15b7f696
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/15b7f696
Branch: refs/heads/master
Commit: 15b7f696be1a0d70273674bbba56ae069f638b1a
Parents: cac0527
Author: John Huss <jo...@apache.org>
Authored: Wed May 2 10:01:39 2018 -0500
Committer: John Huss <jo...@gmail.com>
Committed: Wed May 2 10:16:04 2018 -0500
----------------------------------------------------------------------
.../cayenne/configuration/web/CayenneFilter.java | 4 +++-
.../cayenne/configuration/web/WebConfiguration.java | 16 ++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/15b7f696/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/CayenneFilter.java
----------------------------------------------------------------------
diff --git a/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/CayenneFilter.java b/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/CayenneFilter.java
index 2f158c5..11958b8 100644
--- a/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/CayenneFilter.java
+++ b/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/CayenneFilter.java
@@ -76,7 +76,9 @@ public class CayenneFilter implements Filter {
Collection<Module> modules = configAdapter.createModules();
modules.addAll(getAdditionalModules());
- ServerRuntime runtime = ServerRuntime.builder()
+ String dataDomainName = configAdapter.getDataDomainName();
+
+ ServerRuntime runtime = ServerRuntime.builder(dataDomainName)
.addConfigs(configurationLocations)
.addModules(modules).build();
http://git-wip-us.apache.org/repos/asf/cayenne/blob/15b7f696/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/WebConfiguration.java
----------------------------------------------------------------------
diff --git a/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/WebConfiguration.java b/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/WebConfiguration.java
index 6874e55..a65d913 100644
--- a/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/WebConfiguration.java
+++ b/cayenne-web/src/main/java/org/apache/cayenne/configuration/web/WebConfiguration.java
@@ -18,6 +18,8 @@
****************************************************************/
package org.apache.cayenne.configuration.web;
+import org.apache.cayenne.configuration.server.PropertyDataSourceFactory;
+import org.apache.cayenne.configuration.server.ServerRuntimeBuilder;
import org.apache.cayenne.di.Module;
import org.apache.cayenne.util.Util;
@@ -45,6 +47,7 @@ public class WebConfiguration {
static final String CONFIGURATION_LOCATION_PARAMETER = "configuration-location";
static final String EXTRA_MODULES_PARAMETER = "extra-modules";
+ static final String DATA_DOMAIN_NAME_PARAMETER = "data-domain-name";
private FilterConfig configuration;
@@ -100,6 +103,19 @@ public class WebConfiguration {
}
/**
+ * If you are using multiple configuration files (cayenne-*.xml) this allows you
+ * to specify a name for the data domain other than the default name "cayenne"
+ * (see {@value ServerRuntimeBuilder}).
+ * A specific data domain name is useful if you are setting database connection info
+ * using properties via {@link PropertyDataSourceFactory}.
+ * @return
+ */
+ public String getDataDomainName() {
+ String name = configuration.getInitParameter(DATA_DOMAIN_NAME_PARAMETER);
+ return name;
+ }
+
+ /**
* Creates and returns a collection of modules made of provided standard modules and
* extra custom modules specified via an optional "extra-modules" init parameter. The
* value of the parameter is expected to be a comma or space-separated list of class