From b6d77c32bd6647870a8a81787c40086125be7bbc Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Wed, 26 Jun 2013 15:45:31 -0400 Subject: [PATCH 01/10] Harmonize with current dspace-pom so it will build. --- LICENSE | 40 ++++++++++++++++++++++++++++++++++++++++ LICENSE_HEADER | 5 +++++ NOTICE | 15 +++++++++++++++ pom.xml | 46 ++++++++++++++++++++++++++-------------------- webapp/pom.xml | 8 +++++++- 5 files changed, 93 insertions(+), 21 deletions(-) create mode 100644 LICENSE create mode 100644 LICENSE_HEADER create mode 100644 NOTICE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..79882c7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,40 @@ +DSpace source code license: + + +Copyright (c) 2002-2012, DuraSpace. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name DuraSpace nor the name of the DSpace Foundation +nor the names of its contributors may be used to endorse or promote +products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + + +DSpace uses third-party libraries which may be distributed under +different licenses to the above. Information about these licenses +is detailed in the LICENSES_THIRD_PARTY file at the root of the source +tree. You must agree to the terms of these licenses, in addition to +the above DSpace source code license, in order to use this software. diff --git a/LICENSE_HEADER b/LICENSE_HEADER new file mode 100644 index 0000000..6b4f12e --- /dev/null +++ b/LICENSE_HEADER @@ -0,0 +1,5 @@ +The contents of this file are subject to the license and copyright +detailed in the LICENSE and NOTICE files at the root of the source +tree and available online at + +http://www.dspace.org/license/ \ No newline at end of file diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..ffb5224 --- /dev/null +++ b/NOTICE @@ -0,0 +1,15 @@ + +Licensing Notice + +Fedora Commons joined with the DSpace Foundation and began operating under +the new name DuraSpace in July 2009. DuraSpace holds the copyrights of +the DSpace Foundation, Inc. + +The DSpace Foundation, Inc. is a 501(c)3 corporation established in July 2007 +with a mission to promote and advance the dspace platform enabling management, +access and preservation of digital works. The Foundation was able to transfer +the legal copyright from Hewlett-Packard Company (HP) and Massachusetts +Institute of Technology (MIT) to the DSpace Foundation in October 2007. Many +of the files in the source code may contain a copyright statement stating HP +and MIT possess the copyright, in these instances please note that the copy +right has transferred to the DSpace foundation, and subsequently to DuraSpace. diff --git a/pom.xml b/pom.xml index 2985f11..1ecdfdd 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ org.dspace dspace-pom - 10 + 12 org.dspace @@ -36,6 +36,11 @@ http://issues.apache.org/jira/browse/SOLR + + + ${basedir} + 2006 @@ -87,6 +92,7 @@ org.apache.maven.plugins maven-javadoc-plugin + 2.9 attach-javadocs @@ -99,25 +105,25 @@ - com.google.code.maven-license-plugin - maven-license-plugin - 1.4.0 - -
http://scm.dspace.org/svn/repo/licenses/LICENSE_HEADER
- - src/** - - - UTF-8 -
- - - - check - - - -
+ com.mycila.maven-license-plugin + maven-license-plugin + 1.9.0 + +
${root.basedir}/LICENSE_HEADER
+ + src/main/*/org/apache/** + + + UTF-8 +
+ + + + check + + + + diff --git a/webapp/pom.xml b/webapp/pom.xml index f624b41..b2b1921 100644 --- a/webapp/pom.xml +++ b/webapp/pom.xml @@ -30,12 +30,17 @@ Apache Solr Server war + + + ${basedir}/.. + + org.apache.maven.plugins maven-war-plugin - 2.1-alpha-2 @@ -88,6 +93,7 @@ + From 9e32854ad45d1d970111fce21186da82d43e7b2e Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Wed, 26 Jun 2013 15:48:27 -0400 Subject: [PATCH 02/10] Add a .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f7896d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +target/ From 14f33bb7137d7937afd625b0099d436dd87acf1c Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Wed, 26 Jun 2013 16:14:09 -0400 Subject: [PATCH 03/10] License header updates also needed to build --- pom.xml | 1 + .../solr/filters/LocalHostRestrictionFilter.java | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 1ecdfdd..2d18463 100644 --- a/pom.xml +++ b/pom.xml @@ -112,6 +112,7 @@
${root.basedir}/LICENSE_HEADER
src/main/*/org/apache/** + **/web.xml UTF-8 diff --git a/webapp/src/main/java/org/dspace/solr/filters/LocalHostRestrictionFilter.java b/webapp/src/main/java/org/dspace/solr/filters/LocalHostRestrictionFilter.java index d6ba2a5..424ab53 100644 --- a/webapp/src/main/java/org/dspace/solr/filters/LocalHostRestrictionFilter.java +++ b/webapp/src/main/java/org/dspace/solr/filters/LocalHostRestrictionFilter.java @@ -1,12 +1,9 @@ /** - * $Id: $ - * $URL: $ - * ************************************************************************* - * Copyright (c) 2002-2009, DuraSpace. All rights reserved - * Licensed under the DuraSpace License. + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at * - * A copy of the DuraSpace License has been included in this - * distribution and is available at: http://scm.dspace.org/svn/repo/licenses/LICENSE.txt + * http://www.dspace.org/license/ */ package org.dspace.solr.filters; From 5442153457c81fdec538c4889c7c94867ae8fbe8 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Thu, 27 Jun 2013 10:24:26 -0400 Subject: [PATCH 04/10] Replace J.U.L. logging with log4j. --- webapp/pom.xml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/webapp/pom.xml b/webapp/pom.xml index b2b1921..a100596 100644 --- a/webapp/pom.xml +++ b/webapp/pom.xml @@ -68,7 +68,11 @@ true classes WEB-INF/classes/** - WEB-INF/classes/** + + WEB-INF/classes/**, + WEB-INF/lib/slf4j-jdk14-*.jar, + WEB-INF/lib/log4j-over-slf4j-*.jar + war @@ -108,6 +112,20 @@ 3.5.0 jar
+ + + + org.slf4j + jul-to-slf4j + 1.6.1 + + + org.slf4j + slf4j-log4j12 + 1.6.1 + runtime + + commons-logging From ad7e1e959a5a2d780720cc97c93a0b443a12b692 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Thu, 27 Jun 2013 10:46:57 -0400 Subject: [PATCH 05/10] LocalHostRestrictionFilter creates a logger but never uses it. If we remove it, we can get rid of the Commons Logging dependency. Also add some direct dependencies drawn in by our modified FacetComponent. --- webapp/pom.xml | 17 ++++++++++------- .../filters/LocalHostRestrictionFilter.java | 7 ------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/webapp/pom.xml b/webapp/pom.xml index a100596..7efe1a9 100644 --- a/webapp/pom.xml +++ b/webapp/pom.xml @@ -112,6 +112,16 @@ 3.5.0 jar + + org.apache.solr + solr-solrj + 3.5.0 + + + org.apache.lucene + lucene-core + 3.5.0 + @@ -125,13 +135,6 @@ 1.6.1 runtime - - - - commons-logging - commons-logging - 1.0.4 -
diff --git a/webapp/src/main/java/org/dspace/solr/filters/LocalHostRestrictionFilter.java b/webapp/src/main/java/org/dspace/solr/filters/LocalHostRestrictionFilter.java index 424ab53..723aee5 100644 --- a/webapp/src/main/java/org/dspace/solr/filters/LocalHostRestrictionFilter.java +++ b/webapp/src/main/java/org/dspace/solr/filters/LocalHostRestrictionFilter.java @@ -16,17 +16,10 @@ import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - public class LocalHostRestrictionFilter implements Filter { - private static Log log = LogFactory - .getLog(LocalHostRestrictionFilter.class); - private boolean enabled = true; public LocalHostRestrictionFilter() { From ced6e9652cc03815f1fe075b1f38ae75238f8771 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Thu, 27 Jun 2013 15:19:47 -0400 Subject: [PATCH 06/10] Add code to configure log4j from a file that can be specified by a context parameter. --- webapp/pom.xml | 6 ++ .../solr/filters/ConfigureLog4jListener.java | 83 +++++++++++++++++++ webapp/src/main/webapp/WEB-INF/web.xml | 6 +- 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 webapp/src/main/java/org/dspace/solr/filters/ConfigureLog4jListener.java diff --git a/webapp/pom.xml b/webapp/pom.xml index 7efe1a9..c25eba6 100644 --- a/webapp/pom.xml +++ b/webapp/pom.xml @@ -135,6 +135,12 @@ 1.6.1 runtime + + log4j + log4j + jar + 1.2.16 + diff --git a/webapp/src/main/java/org/dspace/solr/filters/ConfigureLog4jListener.java b/webapp/src/main/java/org/dspace/solr/filters/ConfigureLog4jListener.java new file mode 100644 index 0000000..a90d787 --- /dev/null +++ b/webapp/src/main/java/org/dspace/solr/filters/ConfigureLog4jListener.java @@ -0,0 +1,83 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ + +package org.dspace.solr.filters; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.servlet.ServletContext; +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; +import org.apache.log4j.Hierarchy; +import org.apache.log4j.Level; +import org.apache.log4j.PropertyConfigurator; +import org.apache.log4j.helpers.Loader; +import org.apache.log4j.spi.Configurator; +import org.apache.log4j.spi.RootLogger; +import org.apache.log4j.xml.DOMConfigurator; + +/** + * Initialize Log4J at application startup. + * This class mimics the default Log4J initialization procedure, except + * that it is controlled by context parameters rather than system properties. + * + * @author Mark H. Wood + */ +public class ConfigureLog4jListener + implements ServletContextListener +{ + public void contextInitialized(ServletContextEvent sce) + { + ServletContext ctx = sce.getServletContext(); + + String logConfig = ctx.getInitParameter("log4j.configuration"); + if (null == logConfig) + logConfig = "log4j.properties"; + + URL configURL; + try { + configURL = new URL(logConfig); + } catch (MalformedURLException e) { + configURL = Loader.getResource(logConfig); + } + + if (null == configURL) + { + ctx.log("Log4J configuration not found. Left unconfigured."); + return; + } + else + { + String configuratorName = ctx.getInitParameter("log4j.configuratorClass"); + if (null != configuratorName) + { + Configurator configurator; + try + { + configurator = (Configurator) Class.forName(configuratorName).newInstance(); + } catch (Exception ex) + { + ctx.log("Unable to load custom Log4J configuration class '" + + configuratorName + "': " + ex.getMessage()); + return; + } + + configurator.doConfigure(configURL, new Hierarchy(new RootLogger(Level.OFF))); + } + else if (configURL.getFile().endsWith(".xml")) + DOMConfigurator.configure(configURL); + else + PropertyConfigurator.configure(configURL); + } + } + + public void contextDestroyed(ServletContextEvent sce) + { + // Nothing to be done + } +} diff --git a/webapp/src/main/webapp/WEB-INF/web.xml b/webapp/src/main/webapp/WEB-INF/web.xml index c842642..d9d305d 100644 --- a/webapp/src/main/webapp/WEB-INF/web.xml +++ b/webapp/src/main/webapp/WEB-INF/web.xml @@ -99,7 +99,11 @@ - + + + org.dspace.solr.filters.ConfigureLog4jListener + + SolrServer Solr From f53b6df7a473e01ffb1e87263bcc4828edd91c7b Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Thu, 27 Jun 2013 16:14:43 -0400 Subject: [PATCH 07/10] Display the source of the configuration to the context's log. --- .../java/org/dspace/solr/filters/ConfigureLog4jListener.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webapp/src/main/java/org/dspace/solr/filters/ConfigureLog4jListener.java b/webapp/src/main/java/org/dspace/solr/filters/ConfigureLog4jListener.java index a90d787..205cdc0 100644 --- a/webapp/src/main/java/org/dspace/solr/filters/ConfigureLog4jListener.java +++ b/webapp/src/main/java/org/dspace/solr/filters/ConfigureLog4jListener.java @@ -53,6 +53,9 @@ public void contextInitialized(ServletContextEvent sce) } else { + ctx.log(" In context " + ctx.getContextPath() + + ", configuring Log4J from " + configURL.toExternalForm()); + String configuratorName = ctx.getInitParameter("log4j.configuratorClass"); if (null != configuratorName) { From 61a33b66e46928edc8eb9de6522fb1f25efcefe0 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Fri, 26 Jul 2013 13:46:36 -0400 Subject: [PATCH 08/10] Provide a filterable default path to the logging configuration --- webapp/src/main/webapp/WEB-INF/web.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/webapp/src/main/webapp/WEB-INF/web.xml b/webapp/src/main/webapp/WEB-INF/web.xml index d9d305d..998f739 100644 --- a/webapp/src/main/webapp/WEB-INF/web.xml +++ b/webapp/src/main/webapp/WEB-INF/web.xml @@ -40,6 +40,12 @@ java.lang.String --> + + + log4j.configuration + file://${dspace.dir}/config/log4j.properties + URL locating a Log4J configuration file (properties or XML). + From 1d1fcc7b365bf37383842c426f506fe9d8af2557 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Fri, 26 Jul 2013 13:47:06 -0400 Subject: [PATCH 09/10] Replace 'dspace-pom', now deprecated --- pom.xml | 164 ++++++++++++++++++++++++++++++++++++++++--------- webapp/pom.xml | 1 + 2 files changed, 136 insertions(+), 29 deletions(-) diff --git a/pom.xml b/pom.xml index 2d18463..a282424 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,7 @@ - + + ${basedir} @@ -49,19 +55,100 @@ Apache 2 http://www.apache.org/licenses/LICENSE-2.0.txt + + DuraSpace BSD License + https://raw.github.com/DSpace/DSpace/master/LICENSE + repo + + A BSD 3-Clause license for the DSpace codebase. + + - + + JIRA + https://jira.duraspace.org/browse/DS + + scm:git:git@github.com:DSpace/dspace-solr.git scm:git:git@github.com:DSpace/dspace-solr.git git@github.com:DSpace/dspace-solr.git + + + DSpace Technical Users List + + http://lists.sourceforge.net/mailman/listinfo/dspace-tech + + + http://lists.sourceforge.net/mailman/listinfo/dspace-tech + + dspace-tech AT lists.sourceforge.net + + http://sourceforge.net/mailarchive/forum.php?forum_name=dspace-tech + + + + DSpace Developers List + + http://lists.sourceforge.net/mailman/listinfo/dspace-devel + + + http://lists.sourceforge.net/mailman/listinfo/dspace-devel + + dspace-devel AT lists.sourceforge.net + + http://sourceforge.net/mailarchive/forum.php?forum_name=dspace-devel + + + + DSpace General Issues List + + http://lists.sourceforge.net/mailman/listinfo/dspace-general + + + http://lists.sourceforge.net/mailman/listinfo/dspace-general + + dspace-general AT lists.sourceforge.net + + http://sourceforge.net/mailarchive/forum.php?forum_name=dspace-general + + + + DSpace SCM Commit Change-Log + + http://lists.sourceforge.net/mailman/listinfo/dspace-changelog + + + http://lists.sourceforge.net/mailman/listinfo/dspace-changelog + + noreply AT lists.sourceforge.net + + http://sourceforge.net/mailarchive/forum.php?forum_name=dspace-changelog + + + + + + + + + + + Add Your Name Here and submit a patch! + contributor at myu.edu + http://www.myu.edu/me + My University + http://www.myu.edu + + developer + + 0 + + + webapp @@ -70,15 +157,16 @@ maven-compiler-plugin + 2.5.1 - 1.5 - 1.5 + 1.6 + 1.6 org.apache.maven.plugins maven-source-plugin - 2.1.1 + 2.2.1 attach-sources @@ -92,7 +180,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9 + 2.9.1 attach-javadocs @@ -109,13 +197,30 @@ maven-license-plugin 1.9.0 -
${root.basedir}/LICENSE_HEADER
- - src/main/*/org/apache/** - **/web.xml - - - UTF-8 +
${root.basedir}/LICENSE_HEADER
+ + src/main/*/org/apache/** + **/web.xml + **/src/test/resources/** + **/META-INF/** + **/robots.txt + **/*.LICENSE + **/LICENSE* + **/README* + **/NOTICE + **/readme* + **/.gitignore + + + + XML_STYLE + XML_STYLE + TEXT + + + UTF-8 + true
@@ -143,4 +248,5 @@ test +
diff --git a/webapp/pom.xml b/webapp/pom.xml index c25eba6..74bae8f 100644 --- a/webapp/pom.xml +++ b/webapp/pom.xml @@ -41,6 +41,7 @@ org.apache.maven.plugins maven-war-plugin + 2.4 From 71468f669cc9019d5952154aad97dcfce9ef6095 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Mon, 29 Jul 2013 09:25:01 -0400 Subject: [PATCH 10/10] Also add Travis configuration --- .travis.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..dff5f3a --- /dev/null +++ b/.travis.yml @@ -0,0 +1 @@ +language: java