[springframework] add derby 10.6+ support
gil
gil at fedoraproject.org
Fri Mar 6 13:11:34 UTC 2015
commit 02fa36dc7bec55aa66566aaa69d920d58adf23a6
Author: gil <puntogil at libero.it>
Date: Fri Mar 6 14:11:26 2015 +0100
add derby 10.6+ support
springframework-3.2.13-derby.patch | 99 ++++++++++++++++++++++++++++++++++++++
springframework.spec | 27 +++++------
2 files changed, 111 insertions(+), 15 deletions(-)
---
diff --git a/springframework-3.2.13-derby.patch b/springframework-3.2.13-derby.patch
new file mode 100644
index 0000000..72321e6
--- /dev/null
+++ b/springframework-3.2.13-derby.patch
@@ -0,0 +1,99 @@
+--- spring-framework-3.2.13.RELEASE/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/DerbyEmbeddedDatabaseConfigurer.java 2014-12-30 17:22:59.000000000 +0100
++++ spring-framework-3.2.13.RELEASE/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/DerbyEmbeddedDatabaseConfigurer.java.derby 2015-03-06 13:41:54.412646283 +0100
+@@ -16,19 +16,16 @@
+
+ package org.springframework.jdbc.datasource.embedded;
+
+-import java.io.File;
+-import java.io.IOException;
+ import java.sql.SQLException;
+ import java.util.Properties;
+ import javax.sql.DataSource;
+
+-import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+-import org.apache.derby.impl.io.VFMemoryStorageFactory;
+ import org.apache.derby.jdbc.EmbeddedDriver;
+
+ /**
+- * {@link EmbeddedDatabaseConfigurer} for the Apache Derby database.
++ * {@link EmbeddedDatabaseConfigurer} for the Apache Derby database 10.6+.
++ * <p>Call {@link #getInstance()} to get the singleton instance of this class.
+ *
+ * @author Oliver Gierke
+ * @author Juergen Hoeller
+@@ -36,14 +33,9 @@
+ */
+ final class DerbyEmbeddedDatabaseConfigurer implements EmbeddedDatabaseConfigurer {
+
+- private static final Log logger = LogFactory.getLog(DerbyEmbeddedDatabaseConfigurer.class);
+-
+ private static final String URL_TEMPLATE = "jdbc:derby:memory:%s;%s";
+
+- // Error code that indicates successful shutdown
+- private static final String SHUTDOWN_CODE = "08006";
+-
+- private static DerbyEmbeddedDatabaseConfigurer INSTANCE;
++ private static DerbyEmbeddedDatabaseConfigurer instance;
+
+
+ /**
+@@ -52,18 +44,20 @@
+ * @throws ClassNotFoundException if Derby is not on the classpath
+ */
+ public static synchronized DerbyEmbeddedDatabaseConfigurer getInstance() throws ClassNotFoundException {
+- if (INSTANCE == null) {
++ if (instance == null) {
+ // disable log file
+ System.setProperty("derby.stream.error.method",
+ OutputStreamFactory.class.getName() + ".getNoopOutputStream");
+- INSTANCE = new DerbyEmbeddedDatabaseConfigurer();
++ instance = new DerbyEmbeddedDatabaseConfigurer();
+ }
+- return INSTANCE;
++ return instance;
+ }
+
++
+ private DerbyEmbeddedDatabaseConfigurer() {
+ }
+
++ @Override
+ public void configureConnectionProperties(ConnectionProperties properties, String databaseName) {
+ properties.setDriverClass(EmbeddedDriver.class);
+ properties.setUrl(String.format(URL_TEMPLATE, databaseName, "create=true"));
+@@ -71,28 +65,16 @@
+ properties.setPassword("");
+ }
+
++ @Override
+ public void shutdown(DataSource dataSource, String databaseName) {
+- EmbeddedDriver embeddedDriver = new EmbeddedDriver();
+- boolean isAtLeastDotSix = (embeddedDriver.getMinorVersion() >= 6);
+- String shutdownCommand = String.format("%s=true", isAtLeastDotSix ? "drop" : "shutdown");
+ try {
+- embeddedDriver.connect(
+- String.format(URL_TEMPLATE, databaseName, shutdownCommand), new Properties());
++ new EmbeddedDriver().connect(
++ String.format(URL_TEMPLATE, databaseName, "drop=true"), new Properties());
+ }
+ catch (SQLException ex) {
+- if (!SHUTDOWN_CODE.equals(ex.getSQLState())) {
+- logger.warn("Could not shutdown in-memory Derby database", ex);
+- return;
+- }
+- if (!isAtLeastDotSix) {
+- // Explicitly purge the in-memory database, to prevent it
+- // from hanging around after being shut down.
+- try {
+- VFMemoryStorageFactory.purgeDatabase(new File(databaseName).getCanonicalPath());
+- }
+- catch (IOException ex2) {
+- logger.warn("Could not purge in-memory Derby database", ex2);
+- }
++ // Error code that indicates successful shutdown
++ if (!"08006".equals(ex.getSQLState())) {
++ LogFactory.getLog(getClass()).warn("Could not shutdown in-memory Derby database", ex);
+ }
+ }
+ }
diff --git a/springframework.spec b/springframework.spec
index a343892..4b38ef3 100644
--- a/springframework.spec
+++ b/springframework.spec
@@ -3,7 +3,7 @@
Name: springframework
Version: 3.2.13
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Spring Java Application Framework
Epoch: 0
License: ASL 2.0
@@ -37,8 +37,11 @@ Patch2: springframework-3.2.6-port-spring-orm-to-javax.persistence-2.0.pa
Patch3: springframework-3.2.6-port-spring-test-to-servlet-3.1.patch
Patch4: springframework-3.2.6-port-spring-tx-to-javax.resources-1.7.patch
Patch5: springframework-3.2.6-port-to-hibernate-validator-5.patch
+# Derby 10.6+ support
+Patch6: springframework-3.2.13-derby.patch
+
# TODO: rebase the patch for 3.2.x
-#Patch6: springframework-3.1.4-osgi-support.patch
+#Patch7: springframework-3.1.4-osgi-support.patch
BuildRequires: maven-local
BuildRequires: mvn(aopalliance:aopalliance)
@@ -128,8 +131,9 @@ BuildRequires: mvn(velocity:velocity)
BuildRequires: mvn(xmlunit:xmlunit)
BuildRequires: mvn(javax.el:el-api)
BuildRequires: mvn(org.apache.taglibs:taglibs-standard-jstlel)
-Buildrequires: mvn(javax.servlet:jstl)
+BuildRequires: mvn(javax.servlet:jstl)
BuildRequires: mvn(org.apache.taglibs:taglibs-standard-spec)
+BuildRequires: mvn(com.jayway.jsonpath:json-path)
BuildArch: noarch
@@ -279,7 +283,8 @@ find -name "*.jar" -print -delete
%patch3 -p1
%patch4 -p1
%patch5 -p1
-#%%patch6 -p1
+%patch6 -p1
+#%%patch7 -p1
cp %{SOURCE101} pom.xml
@@ -307,9 +312,6 @@ cp %{SOURCE119} spring-webmvc-portlet/pom.xml
%pom_remove_dep :hibernate-entitymanager spring-orm
%pom_add_dep org.hibernate:hibernate-entitymanager:3 spring-orm
-# missing dep
-%pom_remove_dep com.jayway.jsonpath:json-path spring-test
-
%pom_remove_dep struts:struts spring-struts
%pom_add_dep org.apache.struts:struts-core spring-struts
%pom_add_dep org.apache.struts:struts-extras spring-struts
@@ -394,14 +396,6 @@ rm -Rf spring-context-support/src/main/java/org/springframework/scheduling/
%pom_add_dep org.apache.taglibs:taglibs-standard-spec spring-webmvc '<optional>true</optional>'
-# Disable part of Derby support, require derby 10.5
-# unavailable method purgeDatabase in org.apache.derby.impl.io.VFMemoryStorageFactory
-rm -r spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/DerbyEmbeddedDatabaseConfigurer.java
-sed -i "s|case DERBY:||" \
- spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseConfigurerFactory.java
-sed -i "s|return DerbyEmbeddedDatabaseConfigurer.getInstance();||" \
- spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseConfigurerFactory.java
-
# ERROR: XThis is not public in Bsh
rm spring-context/src/main/java/org/springframework/scripting/bsh/BshScriptFactory.java
rm spring-context/src/main/java/org/springframework/scripting/bsh/BshScriptUtils.java
@@ -465,6 +459,9 @@ cp -p src/dist/* .
%changelog
+* Fri Mar 06 2015 gil cattaneo <puntogil at libero.it> - 0:3.2.13-4
+- add derby 10.6+ support
+
* Fri Mar 06 2015 Michal Srb <msrb at redhat.com> - 0:3.2.13-3
- Switch to jstl 1.2
More information about the scm-commits
mailing list