[spring-ldap] First import after review (#804055)

Juan Hernandez jhernand at fedoraproject.org
Mon Mar 26 18:10:59 UTC 2012


commit 73b8fd2188d34e985487b9f78f980ab726ee852d
Author: Juan Hernandez <juan.hernandez at redhat.com>
Date:   Mon Mar 26 20:10:39 2012 +0200

    First import after review (#804055)

 .gitignore                                 |    1 +
 sources                                    |    1 +
 spring-ldap-build-core-only.patch          |   15 ++
 spring-ldap-disable-aws-extension.patch    |   18 ++
 spring-ldap-remove-ldapbp.patch            |   43 +++++
 spring-ldap-remove-spring-orm.patch        |  256 ++++++++++++++++++++++++++++
 spring-ldap-use-java-5-to-build-core.patch |   27 +++
 spring-ldap.spec                           |  163 ++++++++++++++++++
 8 files changed, 524 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..381b7e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/spring-ldap-1.3.1.tar.xz
diff --git a/sources b/sources
index e69de29..8b6270a 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+5a17c8e36a9cd85215d3eb7ff2bb9ccc  spring-ldap-1.3.1.tar.xz
diff --git a/spring-ldap-build-core-only.patch b/spring-ldap-build-core-only.patch
new file mode 100644
index 0000000..41e47cd
--- /dev/null
+++ b/spring-ldap-build-core-only.patch
@@ -0,0 +1,15 @@
+diff --git a/pom.xml b/pom.xml
+index a30ada1..285bad3 100644
+--- a/pom.xml
++++ b/pom.xml
+@@ -124,10 +124,6 @@
+ 		<module>parent</module>
+ 		<module>core</module>
+ 		<module>core-tiger</module>
+-		<module>test-support</module>
+-		<module>test</module>
+-		<module>ldif</module>
+-		<module>odm</module>
+ 	</modules>
+ 	<profiles>
+ 		<profile>
diff --git a/spring-ldap-disable-aws-extension.patch b/spring-ldap-disable-aws-extension.patch
new file mode 100644
index 0000000..12bc025
--- /dev/null
+++ b/spring-ldap-disable-aws-extension.patch
@@ -0,0 +1,18 @@
+diff --git a/parent/pom.xml b/parent/pom.xml
+index e5cdb9f..321398f 100644
+--- a/parent/pom.xml
++++ b/parent/pom.xml
+@@ -216,13 +216,6 @@
+ 				</plugin>
+ 			</plugins>
+ 		</pluginManagement>
+-		<extensions>
+-			<extension>
+-				<groupId>org.springframework.build.aws</groupId>
+-				<artifactId>org.springframework.build.aws.maven</artifactId>
+-				<version>3.0.0.RELEASE</version>
+-			</extension>
+-		</extensions>
+ 		<plugins>
+ 			<!-- Building -->
+ 			<plugin>
diff --git a/spring-ldap-remove-ldapbp.patch b/spring-ldap-remove-ldapbp.patch
new file mode 100644
index 0000000..ea6b311
--- /dev/null
+++ b/spring-ldap-remove-ldapbp.patch
@@ -0,0 +1,43 @@
+From d9dd98eea3638f75c12a40e0e9f7b9661cac1f27 Mon Sep 17 00:00:00 2001
+From: Juan Hernandez <juan.hernandez at redhat.com>
+Date: Thu, 16 Feb 2012 11:09:21 +0100
+Subject: [PATCH 4/4] Remove ldapbp
+
+---
+ core/pom.xml                                       |    6 ------
+ .../ldap/control/PagedResultsCookie.java           |    2 --
+ 2 files changed, 0 insertions(+), 8 deletions(-)
+
+diff --git a/core/pom.xml b/core/pom.xml
+index 836f5ec..2a55fd4 100644
+--- a/core/pom.xml
++++ b/core/pom.xml
+@@ -54,12 +54,6 @@
+ 			<artifactId>commons-pool</artifactId>
+ 			<scope>provided</scope>
+ 		</dependency>
+-		<dependency>
+-			<groupId>com.sun</groupId>
+-			<artifactId>ldapbp</artifactId>
+-			<version>1.0</version>
+-			<scope>provided</scope>
+-		</dependency>
+ 		<!-- Spring Dependencies -->
+ 		<dependency>
+ 			<groupId>org.springframework</groupId>
+diff --git a/core/src/main/java/org/springframework/ldap/control/PagedResultsCookie.java b/core/src/main/java/org/springframework/ldap/control/PagedResultsCookie.java
+index 99da083..6393b6b 100644
+--- a/core/src/main/java/org/springframework/ldap/control/PagedResultsCookie.java
++++ b/core/src/main/java/org/springframework/ldap/control/PagedResultsCookie.java
+@@ -20,8 +20,6 @@ import org.apache.commons.lang.ArrayUtils;
+ import org.apache.commons.lang.builder.EqualsBuilder;
+ import org.apache.commons.lang.builder.HashCodeBuilder;
+ 
+-import com.sun.jndi.ldap.ctl.PagedResultsControl;
+-
+ /**
+  * Wrapper class for the cookie returned when using the
+  * {@link PagedResultsControl}.
+-- 
+1.7.9
+
diff --git a/spring-ldap-remove-spring-orm.patch b/spring-ldap-remove-spring-orm.patch
new file mode 100644
index 0000000..dfa66b4
--- /dev/null
+++ b/spring-ldap-remove-spring-orm.patch
@@ -0,0 +1,256 @@
+From e12cada125239f957cc5cd7114414ebb41c2b658 Mon Sep 17 00:00:00 2001
+From: Juan Hernandez <juan.hernandez at redhat.com>
+Date: Thu, 15 Mar 2012 11:38:56 +0100
+Subject: [PATCH 6/6] Remove spring orm
+
+---
+ core/pom.xml                                       |    5 -
+ ...ontextSourceAndHibernateTransactionManager.java |  203 --------------------
+ parent/pom.xml                                     |    5 -
+ 3 files changed, 213 deletions(-)
+ delete mode 100755 core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndHibernateTransactionManager.java
+
+diff --git a/core/pom.xml b/core/pom.xml
+index 35998e0..efccbd9 100644
+--- a/core/pom.xml
++++ b/core/pom.xml
+@@ -77,11 +77,6 @@
+ 			<artifactId>spring-jdbc</artifactId>
+ 			<scope>provided</scope>
+ 		</dependency>
+-		<dependency>
+-			<groupId>org.springframework</groupId>
+-			<artifactId>spring-orm</artifactId>
+-			<scope>provided</scope>
+-		</dependency>
+ 		<!-- Test Dependencies -->
+ 		<dependency>
+ 			<groupId>junit</groupId>
+diff --git a/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndHibernateTransactionManager.java b/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndHibernateTransactionManager.java
+deleted file mode 100755
+index fdf588b..0000000
+--- a/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndHibernateTransactionManager.java
++++ /dev/null
+@@ -1,203 +0,0 @@
+-/*
+- * Copyright 2002-2008 the original author or authors.
+- *
+- * Licensed 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.springframework.ldap.transaction.compensating.manager;
+-
+-import org.springframework.ldap.core.ContextSource;
+-import org.springframework.ldap.transaction.compensating.TempEntryRenamingStrategy;
+-import org.springframework.ldap.transaction.compensating.manager.ContextSourceTransactionManagerDelegate;
+-import org.springframework.orm.hibernate3.HibernateTransactionManager;
+-import org.springframework.transaction.TransactionDefinition;
+-import org.springframework.transaction.TransactionException;
+-import org.springframework.transaction.TransactionSuspensionNotSupportedException;
+-import org.springframework.transaction.support.DefaultTransactionStatus;
+-/**
+- * A Transaction Manager to manage LDAP and Hibernate 3 operations within the same
+- * transaction. Note that even though the same logical transaction is used, this
+- * is <b>not</b> a JTA XA transaction; no two-phase commit will be performed,
+- * and thus commit and rollback may yield unexpected results.<br />
+- * This Transaction Manager is as good as it gets when you are using in LDAP in 
+- * combination with a Hibernate 3 and unable to use XA transactions because LDAP
+- * is not transactional by design to begin with.<br />
+- * 
+- * Furthermore, this manager <b>does not support nested transactions</b>
+- * @author Hans Westerbeek
+- * @since 1.2.2
+- */
+-public class ContextSourceAndHibernateTransactionManager extends HibernateTransactionManager {
+-
+-	/**
+-	 * 
+-	 */
+-	private static final long serialVersionUID = 1L;
+-
+-	private ContextSourceTransactionManagerDelegate ldapManagerDelegate = new ContextSourceTransactionManagerDelegate();
+-
+-	 /*
+-     * @see org.springframework.orm.hibernate3.HibernateTransactionManager#isExistingTransaction(java.lang.Object)
+-     */
+-    protected boolean isExistingTransaction(Object transaction) {
+-        ContextSourceAndHibernateTransactionObject actualTransactionObject = (ContextSourceAndHibernateTransactionObject) transaction;
+-
+-        return super.isExistingTransaction(actualTransactionObject
+-                .getHibernateTransactionObject());
+-    }
+-
+-    /*
+-     * @see org.springframework.orm.hibernate3.HibernateTransactionManager#doGetTransaction()
+-     */
+-    protected Object doGetTransaction() throws TransactionException {
+-        Object dataSourceTransactionObject = super.doGetTransaction();
+-        Object contextSourceTransactionObject = ldapManagerDelegate
+-                .doGetTransaction();
+-
+-        return new ContextSourceAndHibernateTransactionObject(
+-                contextSourceTransactionObject, dataSourceTransactionObject);
+-    }
+-
+-    /*
+-     * @see org.springframework.orm.hibernate3.HibernateTransactionManager#doBegin(java.lang.Object,
+-     *      org.springframework.transaction.TransactionDefinition)
+-     */
+-    protected void doBegin(Object transaction, TransactionDefinition definition)
+-            throws TransactionException {
+-        ContextSourceAndHibernateTransactionObject actualTransactionObject = (ContextSourceAndHibernateTransactionObject) transaction;
+-
+-        super.doBegin(actualTransactionObject.getHibernateTransactionObject(),
+-                definition);
+-        ldapManagerDelegate.doBegin(actualTransactionObject
+-                .getLdapTransactionObject(), definition);
+-    }
+-
+-    /*
+-     * @see org.springframework.orm.hibernate3.HibernateTransactionManager#doCleanupAfterCompletion(java.lang.Object)
+-     */
+-    protected void doCleanupAfterCompletion(Object transaction) {
+-        ContextSourceAndHibernateTransactionObject actualTransactionObject = (ContextSourceAndHibernateTransactionObject) transaction;
+-
+-        super.doCleanupAfterCompletion(actualTransactionObject
+-                .getHibernateTransactionObject());
+-        ldapManagerDelegate.doCleanupAfterCompletion(actualTransactionObject
+-                .getLdapTransactionObject());
+-    }
+-
+-    /*
+-     * @see org.springframework.orm.hibernate3.HibernateTransactionManager#doCommit(org.springframework.transaction.support.DefaultTransactionStatus)
+-     */
+-    protected void doCommit(DefaultTransactionStatus status)
+-            throws TransactionException {
+-
+-        ContextSourceAndHibernateTransactionObject actualTransactionObject = (ContextSourceAndHibernateTransactionObject) status
+-                .getTransaction();
+-
+-        try {
+-            super.doCommit(new DefaultTransactionStatus(actualTransactionObject
+-                    .getHibernateTransactionObject(), status
+-                    .isNewTransaction(), status.isNewSynchronization(), status
+-                    .isReadOnly(), status.isDebug(), status
+-                    .getSuspendedResources()));
+-        } catch (TransactionException ex) {
+-            if (isRollbackOnCommitFailure()) {
+-                logger.debug("Failed to commit db resource, rethrowing", ex);
+-                // If we are to rollback on commit failure, just rethrow the
+-                // exception - this will cause a rollback to be performed on
+-                // both resources.
+-                throw ex;
+-            } else {
+-                logger
+-                        .warn("Failed to commit and resource is rollbackOnCommit not set -"
+-                                + " proceeding to commit ldap resource.");
+-            }
+-        }
+-        ldapManagerDelegate.doCommit(new DefaultTransactionStatus(
+-                actualTransactionObject.getLdapTransactionObject(), status
+-                        .isNewTransaction(), status.isNewSynchronization(),
+-                status.isReadOnly(), status.isDebug(), status
+-                        .getSuspendedResources()));
+-    }
+-
+-    /*
+-     * @see org.springframework.orm.hibernate3.HibernateTransactionManager#doRollback(org.springframework.transaction.support.DefaultTransactionStatus)
+-     */
+-    protected void doRollback(DefaultTransactionStatus status)
+-            throws TransactionException {
+-        ContextSourceAndHibernateTransactionObject actualTransactionObject = (ContextSourceAndHibernateTransactionObject) status
+-                .getTransaction();
+-
+-        super.doRollback(new DefaultTransactionStatus(actualTransactionObject
+-                .getHibernateTransactionObject(), status.isNewTransaction(),
+-                status.isNewSynchronization(), status.isReadOnly(), status
+-                        .isDebug(), status.getSuspendedResources()));
+-        ldapManagerDelegate.doRollback(new DefaultTransactionStatus(
+-                actualTransactionObject.getLdapTransactionObject(), status
+-                        .isNewTransaction(), status.isNewSynchronization(),
+-                status.isReadOnly(), status.isDebug(), status
+-                        .getSuspendedResources()));
+-    }
+-
+-    public ContextSource getContextSource() {
+-        return ldapManagerDelegate.getContextSource();
+-    }
+-
+-    public void setContextSource(ContextSource contextSource) {
+-        ldapManagerDelegate.setContextSource(contextSource);
+-    }
+-
+-    protected void setRenamingStrategy(
+-            TempEntryRenamingStrategy renamingStrategy) {
+-        ldapManagerDelegate.setRenamingStrategy(renamingStrategy);
+-    }
+-
+-    private final static class ContextSourceAndHibernateTransactionObject {
+-        private Object ldapTransactionObject;
+-
+-        private Object hibernateTransactionObject;
+-
+-        public ContextSourceAndHibernateTransactionObject(
+-                Object ldapTransactionObject, Object hibernateTransactionObject) {
+-            this.ldapTransactionObject = ldapTransactionObject;
+-            this.hibernateTransactionObject = hibernateTransactionObject;
+-        }
+-
+-        public Object getHibernateTransactionObject() {
+-            return hibernateTransactionObject;
+-        }
+-
+-        public Object getLdapTransactionObject() {
+-            return ldapTransactionObject;
+-        }
+-    }
+-
+-    /*
+-     * @see org.springframework.orm.hibernate3.HibernateTransactionManager#doSuspend(java.lang.Object)
+-     */
+-    protected Object doSuspend(Object transaction) throws TransactionException {
+-        throw new TransactionSuspensionNotSupportedException(
+-                "Transaction manager [" + getClass().getName()
+-                        + "] does not support transaction suspension");
+-    }
+-
+-    /*
+-     * @see org.springframework.orm.hibernate3.HibernateTransactionManager#doResume(java.lang.Object,
+-     *      java.lang.Object)
+-     */
+-    protected void doResume(Object transaction, Object suspendedResources)
+-            throws TransactionException {
+-        throw new TransactionSuspensionNotSupportedException(
+-                "Transaction manager [" + getClass().getName()
+-                        + "] does not support transaction suspension");
+-    }
+-   
+-}
+diff --git a/parent/pom.xml b/parent/pom.xml
+index 827b548..92fb4f2 100644
+--- a/parent/pom.xml
++++ b/parent/pom.xml
+@@ -247,11 +247,6 @@
+ 			</dependency>
+ 			<dependency>
+ 				<groupId>org.springframework</groupId>
+-				<artifactId>spring-orm</artifactId>
+-				<version>${spring.version}</version>
+-			</dependency>
+-			<dependency>
+-				<groupId>org.springframework</groupId>
+ 				<artifactId>spring-jdbc</artifactId>
+ 				<version>${spring.version}</version>
+ 			</dependency>
+-- 
+1.7.9.3
+
diff --git a/spring-ldap-use-java-5-to-build-core.patch b/spring-ldap-use-java-5-to-build-core.patch
new file mode 100644
index 0000000..6fe5f9e
--- /dev/null
+++ b/spring-ldap-use-java-5-to-build-core.patch
@@ -0,0 +1,27 @@
+From 9795fa7e09b2c43fbf9d51ce7557471c4d0ab108 Mon Sep 17 00:00:00 2001
+From: Juan Hernandez <juan.hernandez at redhat.com>
+Date: Thu, 16 Feb 2012 11:11:34 +0100
+Subject: [PATCH 5/5] Use Java 5 to build core
+
+---
+ core/pom.xml |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/core/pom.xml b/core/pom.xml
+index 2a55fd4..35998e0 100644
+--- a/core/pom.xml
++++ b/core/pom.xml
+@@ -20,8 +20,8 @@
+ 			<plugin>
+ 				<artifactId>maven-compiler-plugin</artifactId>
+ 				<configuration>
+-					<source>1.4</source>
+-					<target>1.4</target>
++					<source>1.5</source>
++					<target>1.5</target>
+ 				</configuration>
+ 			</plugin>
+ 			<plugin>
+-- 
+1.7.9
+
diff --git a/spring-ldap.spec b/spring-ldap.spec
new file mode 100644
index 0000000..e20c1c5
--- /dev/null
+++ b/spring-ldap.spec
@@ -0,0 +1,163 @@
+Name: spring-ldap
+Version: 1.3.1
+Release: 1%{?dist}
+Summary: Java library for simplifying LDAP operations
+
+Group: Development/Libraries
+License: ASL 2.0
+URL: http://www.springframework.org/ldap
+
+# svn export https://src.springframework.org/svn/spring-ldap/tags/spring-ldap-1.3.1.RELEASE spring-ldap-1.3.1
+# tar cfJ spring-ldap-1.3.1.tar.xz spring-ldap-1.3.1
+Source0: %{name}-%{version}.tar.xz
+
+# Build the core only:
+Patch0: %{name}-build-core-only.patch
+
+# Disable the AWS extension:
+Patch1: %{name}-disable-aws-extension.patch
+
+# Don't use ldapbp.jar, as I couldn't find the source and I doubt it has a valid
+# open source license:
+Patch2: %{name}-remove-ldapbp.patch
+
+# Use Java 5 to build the core as the JavaCC generated source code uses Java 5
+# features like generics and annotations:
+Patch3: %{name}-use-java-5-to-build-core.patch
+
+# Remove the dependency on spring-orm:
+Patch4: %{name}-remove-spring-orm.patch
+
+BuildArch: noarch
+
+BuildRequires: dos2unix
+BuildRequires: jpackage-utils
+BuildRequires: java-devel
+BuildRequires: maven
+BuildRequires: maven-compiler-plugin
+BuildRequires: maven-install-plugin
+BuildRequires: maven-jar-plugin
+BuildRequires: maven-javadoc-plugin
+BuildRequires: maven-release-plugin
+BuildRequires: maven-resources-plugin
+BuildRequires: maven-surefire-plugin
+BuildRequires: maven-shade-plugin
+BuildRequires: javacc-maven-plugin
+BuildRequires: springframework
+BuildRequires: springframework-beans
+BuildRequires: springframework-context
+BuildRequires: springframework-tx
+BuildRequires: springframework-jdbc
+
+Requires: java
+Requires: jpackage-utils
+Requires: springframework
+Requires: springframework-beans
+Requires: springframework-context
+Requires: springframework-tx
+Requires: springframework-jdbc
+
+
+%description
+Spring LDAP is a Java library for simplifying LDAP operations, based on the
+pattern of Spring's JdbcTemplate. The framework relieves the user of common
+chores, such as looking up and closing contexts, looping through results,
+encoding/decoding values and filters, and more. The LdapTemplate class
+encapsulates all the plumbing work involved in traditional LDAP programming,
+such as creating a DirContext, looping through NamingEnumerations, handling
+exceptions and cleaning up resources. This leaves the programmer to handle the
+important stuff - where to find data (DNs and Filters) and what do do with it
+(map to and from domain objects, bind, modify, unbind, etc.), in the same way
+that JdbcTemplate relieves the programmer of all but the actual SQL and how the
+data maps to the domain model. In addition to this, Spring LDAP provides
+transaction support, a pooling library, exception translation from
+NamingExceptions to a mirrored unchecked Exception hierarchy, as well as
+several utilities for working with filters, LDAP paths and Attributes.
+
+
+%package javadoc
+Summary: Javadocs for %{name}
+Group: Documentation
+Requires: jpackage-utils
+
+%description javadoc
+This package contains javadoc for %{name}.
+
+
+%prep
+
+# Unpack and patch the source:
+%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+
+# Remove binary files:
+find . -name '*.jar' -print -delete
+
+# Fix line endings in documentation files:
+dos2unix notice.txt
+dos2unix license.txt
+dos2unix readme.txt
+
+
+%build
+
+# Skip the tests for now, as they bring dependencies that are not available in
+# the distribution right now:
+mvn-rpmbuild \
+  -Dmaven.test.skip=true \
+  -Dproject.build.sourceEncoding=UTF-8 \
+  install \
+  javadoc:aggregate 
+
+
+%install
+
+# Jar files:
+mkdir -p %{buildroot}%{_javadir}/%{name}
+cp -p core/target/%{name}-core-%{version}.RELEASE.jar %{buildroot}%{_javadir}/%{name}/%{name}-core.jar
+cp -p core-tiger/target/%{name}-core-tiger-%{version}.RELEASE.jar %{buildroot}%{_javadir}/%{name}/%{name}-core-tiger.jar
+
+# POM files:
+install -d -m 755 %{buildroot}%{_mavenpomdir}
+install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}.pom
+install -pm 644 parent/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-parent.pom
+install -pm 644 core/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-core.pom
+install -pm 644 core-tiger/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-core-tiger.pom
+
+# Dependency map:
+%add_maven_depmap JPP.%{name}-%{name}.pom
+%add_maven_depmap JPP.%{name}-%{name}-parent.pom
+%add_maven_depmap JPP.%{name}-%{name}-core.pom %{name}/%{name}-core.jar
+%add_maven_depmap JPP.%{name}-%{name}-core-tiger.pom %{name}/%{name}-core-tiger.jar
+
+# Javadoc files:
+install -d -m 755 %{buildroot}%{_javadocdir}/%{name}
+cp -rp target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}/.
+
+
+%files
+%{_mavenpomdir}/*
+%{_mavendepmapfragdir}/*
+%{_javadir}/%{name}
+%doc license.txt
+%doc notice.txt
+%doc readme.txt
+
+
+%files javadoc
+%{_javadocdir}/%{name}
+%doc license.txt
+%doc notice.txt
+
+
+%changelog
+* Fri Mar 23 2012 Juan Hernandez <juan.hernandez at redhat.com> 1.3.1-1
+- Updated to upstream version 1.3.1
+
+* Sat Feb 11 2012 Juan Hernandez <juan.hernandez at redhat.com> 1.3.0-1
+- Initial packaging
+


More information about the scm-commits mailing list