Convert CRLF (dos) to LF (unix)

Prior to this change, roughly 5% (~300 out of 6000+) of files under the
source tree had CRLF line endings as opposed to the majority which have
LF endings.

This change normalizes these files to LF for consistency going forward.

Command used:

$ git ls-files | xargs file | grep CRLF | cut -d":" -f1 | xargs dos2unix

Issue: SPR-5608
This commit is contained in:
Chris Beams
2011-12-21 14:40:03 +01:00
parent 096de373b4
commit ae72cf2f50
292 changed files with 30756 additions and 30756 deletions

View File

@@ -1,135 +1,135 @@
/*
* Copyright 2002-2011 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.transaction.interceptor;
import java.lang.reflect.Method;
import java.util.Map;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.AutowireCandidateQualifier;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.util.ObjectUtils;
/**
* Utility methods for obtaining a PlatformTransactionManager by
* {@link TransactionAttribute#getQualifier() qualifier value}.
*
* @author Juergen Hoeller
* @since 3.0.2
*/
public abstract class TransactionAspectUtils {
/**
* Obtain a PlatformTransactionManager from the given BeanFactory,
* matching the given qualifier.
* @param beanFactory the BeanFactory to get the PlatformTransactionManager bean from
* @param qualifier the qualifier for selecting between multiple PlatformTransactionManager matches
* @return the chosen PlatformTransactionManager (never <code>null</code>)
* @throws IllegalStateException if no matching PlatformTransactionManager bean found
*/
public static PlatformTransactionManager getTransactionManager(BeanFactory beanFactory, String qualifier) {
if (beanFactory instanceof ConfigurableListableBeanFactory) {
// Full qualifier matching supported.
return getTransactionManager((ConfigurableListableBeanFactory) beanFactory, qualifier);
}
else if (beanFactory.containsBean(qualifier)) {
// Fallback: PlatformTransactionManager at least found by bean name.
return beanFactory.getBean(qualifier, PlatformTransactionManager.class);
}
else {
throw new IllegalStateException("No matching PlatformTransactionManager bean found for bean name '" +
qualifier + "'! (Note: Qualifier matching not supported because given BeanFactory does not " +
"implement ConfigurableListableBeanFactory.)");
}
}
/**
* Obtain a PlatformTransactionManager from the given BeanFactory,
* matching the given qualifier.
* @param bf the BeanFactory to get the PlatformTransactionManager bean from
* @param qualifier the qualifier for selecting between multiple PlatformTransactionManager matches
* @return the chosen PlatformTransactionManager (never <code>null</code>)
* @throws IllegalStateException if no matching PlatformTransactionManager bean found
*/
public static PlatformTransactionManager getTransactionManager(ConfigurableListableBeanFactory bf, String qualifier) {
Map<String, PlatformTransactionManager> tms =
BeanFactoryUtils.beansOfTypeIncludingAncestors(bf, PlatformTransactionManager.class);
PlatformTransactionManager chosen = null;
for (String beanName : tms.keySet()) {
if (isQualifierMatch(qualifier, beanName, bf)) {
if (chosen != null) {
throw new IllegalStateException("No unique PlatformTransactionManager bean found " +
"for qualifier '" + qualifier + "'");
}
chosen = tms.get(beanName);
}
}
if (chosen != null) {
return chosen;
}
else {
throw new IllegalStateException("No matching PlatformTransactionManager bean found for qualifier '" +
qualifier + "' - neither qualifier match nor bean name match!");
}
}
/**
* Check whether we have a qualifier match for the given candidate bean.
* @param qualifier the qualifier that we are looking for
* @param beanName the name of the candidate bean
* @param bf the BeanFactory to get the bean definition from
* @return <code>true</code> if either the bean definition (in the XML case)
* or the bean's factory method (in the @Bean case) defines a matching qualifier
* value (through &lt;qualifier<&gt; or @Qualifier)
*/
private static boolean isQualifierMatch(String qualifier, String beanName, ConfigurableListableBeanFactory bf) {
if (bf.containsBean(beanName)) {
try {
BeanDefinition bd = bf.getMergedBeanDefinition(beanName);
if (bd instanceof AbstractBeanDefinition) {
AbstractBeanDefinition abd = (AbstractBeanDefinition) bd;
AutowireCandidateQualifier candidate = abd.getQualifier(Qualifier.class.getName());
if ((candidate != null && qualifier.equals(candidate.getAttribute(AutowireCandidateQualifier.VALUE_KEY))) ||
qualifier.equals(beanName) || ObjectUtils.containsElement(bf.getAliases(beanName), qualifier)) {
return true;
}
}
if (bd instanceof RootBeanDefinition) {
Method factoryMethod = ((RootBeanDefinition) bd).getResolvedFactoryMethod();
if (factoryMethod != null) {
Qualifier targetAnnotation = factoryMethod.getAnnotation(Qualifier.class);
if (targetAnnotation != null && qualifier.equals(targetAnnotation.value())) {
return true;
}
}
}
}
catch (NoSuchBeanDefinitionException ex) {
// ignore - can't compare qualifiers for a manually registered singleton object
}
}
return false;
}
}
/*
* Copyright 2002-2011 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.transaction.interceptor;
import java.lang.reflect.Method;
import java.util.Map;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.AutowireCandidateQualifier;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.util.ObjectUtils;
/**
* Utility methods for obtaining a PlatformTransactionManager by
* {@link TransactionAttribute#getQualifier() qualifier value}.
*
* @author Juergen Hoeller
* @since 3.0.2
*/
public abstract class TransactionAspectUtils {
/**
* Obtain a PlatformTransactionManager from the given BeanFactory,
* matching the given qualifier.
* @param beanFactory the BeanFactory to get the PlatformTransactionManager bean from
* @param qualifier the qualifier for selecting between multiple PlatformTransactionManager matches
* @return the chosen PlatformTransactionManager (never <code>null</code>)
* @throws IllegalStateException if no matching PlatformTransactionManager bean found
*/
public static PlatformTransactionManager getTransactionManager(BeanFactory beanFactory, String qualifier) {
if (beanFactory instanceof ConfigurableListableBeanFactory) {
// Full qualifier matching supported.
return getTransactionManager((ConfigurableListableBeanFactory) beanFactory, qualifier);
}
else if (beanFactory.containsBean(qualifier)) {
// Fallback: PlatformTransactionManager at least found by bean name.
return beanFactory.getBean(qualifier, PlatformTransactionManager.class);
}
else {
throw new IllegalStateException("No matching PlatformTransactionManager bean found for bean name '" +
qualifier + "'! (Note: Qualifier matching not supported because given BeanFactory does not " +
"implement ConfigurableListableBeanFactory.)");
}
}
/**
* Obtain a PlatformTransactionManager from the given BeanFactory,
* matching the given qualifier.
* @param bf the BeanFactory to get the PlatformTransactionManager bean from
* @param qualifier the qualifier for selecting between multiple PlatformTransactionManager matches
* @return the chosen PlatformTransactionManager (never <code>null</code>)
* @throws IllegalStateException if no matching PlatformTransactionManager bean found
*/
public static PlatformTransactionManager getTransactionManager(ConfigurableListableBeanFactory bf, String qualifier) {
Map<String, PlatformTransactionManager> tms =
BeanFactoryUtils.beansOfTypeIncludingAncestors(bf, PlatformTransactionManager.class);
PlatformTransactionManager chosen = null;
for (String beanName : tms.keySet()) {
if (isQualifierMatch(qualifier, beanName, bf)) {
if (chosen != null) {
throw new IllegalStateException("No unique PlatformTransactionManager bean found " +
"for qualifier '" + qualifier + "'");
}
chosen = tms.get(beanName);
}
}
if (chosen != null) {
return chosen;
}
else {
throw new IllegalStateException("No matching PlatformTransactionManager bean found for qualifier '" +
qualifier + "' - neither qualifier match nor bean name match!");
}
}
/**
* Check whether we have a qualifier match for the given candidate bean.
* @param qualifier the qualifier that we are looking for
* @param beanName the name of the candidate bean
* @param bf the BeanFactory to get the bean definition from
* @return <code>true</code> if either the bean definition (in the XML case)
* or the bean's factory method (in the @Bean case) defines a matching qualifier
* value (through &lt;qualifier<&gt; or @Qualifier)
*/
private static boolean isQualifierMatch(String qualifier, String beanName, ConfigurableListableBeanFactory bf) {
if (bf.containsBean(beanName)) {
try {
BeanDefinition bd = bf.getMergedBeanDefinition(beanName);
if (bd instanceof AbstractBeanDefinition) {
AbstractBeanDefinition abd = (AbstractBeanDefinition) bd;
AutowireCandidateQualifier candidate = abd.getQualifier(Qualifier.class.getName());
if ((candidate != null && qualifier.equals(candidate.getAttribute(AutowireCandidateQualifier.VALUE_KEY))) ||
qualifier.equals(beanName) || ObjectUtils.containsElement(bf.getAliases(beanName), qualifier)) {
return true;
}
}
if (bd instanceof RootBeanDefinition) {
Method factoryMethod = ((RootBeanDefinition) bd).getResolvedFactoryMethod();
if (factoryMethod != null) {
Qualifier targetAnnotation = factoryMethod.getAnnotation(Qualifier.class);
if (targetAnnotation != null && qualifier.equals(targetAnnotation.value())) {
return true;
}
}
}
}
catch (NoSuchBeanDefinitionException ex) {
// ignore - can't compare qualifiers for a manually registered singleton object
}
}
return false;
}
}

View File

@@ -1,89 +1,89 @@
/*
* Copyright 2002-2010 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.transaction.jta;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.RollbackException;
import javax.transaction.Synchronization;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.xa.XAResource;
import org.springframework.util.Assert;
/**
* Adapter for a managed JTA Transaction handle, taking a JTA
* {@link javax.transaction.TransactionManager} reference and creating
* a JTA {@link javax.transaction.Transaction} handle for it.
*
* @author Juergen Hoeller
* @since 3.0.2
*/
public class ManagedTransactionAdapter implements Transaction {
private final TransactionManager transactionManager;
/**
* Create a new ManagedTransactionAdapter for the given TransactionManager.
* @param transactionManager the JTA TransactionManager to wrap
*/
public ManagedTransactionAdapter(TransactionManager transactionManager) throws SystemException {
Assert.notNull(transactionManager, "TransactionManager must not be null");
this.transactionManager = transactionManager;
}
/**
* Return the JTA TransactionManager that this adapter delegates to.
*/
public final TransactionManager getTransactionManager() {
return this.transactionManager;
}
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
SecurityException, SystemException {
this.transactionManager.commit();
}
public void rollback() throws SystemException {
this.transactionManager.rollback();
}
public void setRollbackOnly() throws SystemException {
this.transactionManager.setRollbackOnly();
}
public int getStatus() throws SystemException {
return this.transactionManager.getStatus();
}
public boolean enlistResource(XAResource xaRes) throws RollbackException, SystemException {
return this.transactionManager.getTransaction().enlistResource(xaRes);
}
public boolean delistResource(XAResource xaRes, int flag) throws SystemException {
return this.transactionManager.getTransaction().delistResource(xaRes, flag);
}
public void registerSynchronization(Synchronization sync) throws RollbackException, SystemException {
this.transactionManager.getTransaction().registerSynchronization(sync);
}
}
/*
* Copyright 2002-2010 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.transaction.jta;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.RollbackException;
import javax.transaction.Synchronization;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.xa.XAResource;
import org.springframework.util.Assert;
/**
* Adapter for a managed JTA Transaction handle, taking a JTA
* {@link javax.transaction.TransactionManager} reference and creating
* a JTA {@link javax.transaction.Transaction} handle for it.
*
* @author Juergen Hoeller
* @since 3.0.2
*/
public class ManagedTransactionAdapter implements Transaction {
private final TransactionManager transactionManager;
/**
* Create a new ManagedTransactionAdapter for the given TransactionManager.
* @param transactionManager the JTA TransactionManager to wrap
*/
public ManagedTransactionAdapter(TransactionManager transactionManager) throws SystemException {
Assert.notNull(transactionManager, "TransactionManager must not be null");
this.transactionManager = transactionManager;
}
/**
* Return the JTA TransactionManager that this adapter delegates to.
*/
public final TransactionManager getTransactionManager() {
return this.transactionManager;
}
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
SecurityException, SystemException {
this.transactionManager.commit();
}
public void rollback() throws SystemException {
this.transactionManager.rollback();
}
public void setRollbackOnly() throws SystemException {
this.transactionManager.setRollbackOnly();
}
public int getStatus() throws SystemException {
return this.transactionManager.getStatus();
}
public boolean enlistResource(XAResource xaRes) throws RollbackException, SystemException {
return this.transactionManager.getTransaction().enlistResource(xaRes);
}
public boolean delistResource(XAResource xaRes, int flag) throws SystemException {
return this.transactionManager.getTransaction().delistResource(xaRes, flag);
}
public void registerSynchronization(Synchronization sync) throws RollbackException, SystemException {
this.transactionManager.getTransaction().registerSynchronization(sync);
}
}

View File

@@ -1,45 +1,45 @@
/*
* Copyright 2002-2010 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.transaction.config;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.CallCountingTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
/**
* @author Juergen Hoeller
*/
@Configuration
public class TransactionManagerConfiguration {
@Bean
@Qualifier("synch")
public PlatformTransactionManager transactionManager1() {
return new CallCountingTransactionManager();
}
@Bean
@Qualifier("noSynch")
public PlatformTransactionManager transactionManager2() {
CallCountingTransactionManager tm = new CallCountingTransactionManager();
tm.setTransactionSynchronization(CallCountingTransactionManager.SYNCHRONIZATION_NEVER);
return tm;
}
}
/*
* Copyright 2002-2010 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.transaction.config;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.CallCountingTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
/**
* @author Juergen Hoeller
*/
@Configuration
public class TransactionManagerConfiguration {
@Bean
@Qualifier("synch")
public PlatformTransactionManager transactionManager1() {
return new CallCountingTransactionManager();
}
@Bean
@Qualifier("noSynch")
public PlatformTransactionManager transactionManager2() {
CallCountingTransactionManager tm = new CallCountingTransactionManager();
tm.setTransactionSynchronization(CallCountingTransactionManager.SYNCHRONIZATION_NEVER);
return tm;
}
}