Removed all references to 'DAO', 'hades' and 'Synyx'.
Polished JavaDoc here and there.
This commit is contained in:
@@ -101,7 +101,7 @@ public interface Repository<T, ID extends Serializable> {
|
||||
|
||||
|
||||
/**
|
||||
* Deletes all entities managed by the DAO.
|
||||
* Deletes all entities managed by the repository.
|
||||
*/
|
||||
void deleteAll();
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public abstract class AbstractRepositoryConfigDefinitionParser<S extends GlobalR
|
||||
|
||||
private static final Class<?> PET_POST_PROCESSOR =
|
||||
PersistenceExceptionTranslationPostProcessor.class;
|
||||
private static final String DAO_INTERFACE_POST_PROCESSOR =
|
||||
private static final String REPOSITORY_INTERFACE_POST_PROCESSOR =
|
||||
"org.springframework.data.repository.support.RepositoryInterfaceAwareBeanPostProcessor";
|
||||
|
||||
|
||||
@@ -111,14 +111,15 @@ public abstract class AbstractRepositoryConfigDefinitionParser<S extends GlobalR
|
||||
ResourceLoader resourceLoader =
|
||||
parser.getReaderContext().getResourceLoader();
|
||||
|
||||
// Detect available DAO interfaces
|
||||
// Detect available repository interfaces
|
||||
Set<String> repositoryInterfaces =
|
||||
getRepositoryInterfacesForAutoConfig(config, resourceLoader,
|
||||
parser.getReaderContext());
|
||||
|
||||
for (String daoInterface : repositoryInterfaces) {
|
||||
registerGenericRepositoryFactoryBean(parser,
|
||||
config.getAutoconfigRepositoryInformation(daoInterface));
|
||||
for (String repositoryInterface : repositoryInterfaces) {
|
||||
registerGenericRepositoryFactoryBean(
|
||||
parser,
|
||||
config.getAutoconfigRepositoryInformation(repositoryInterface));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,8 +169,9 @@ public abstract class AbstractRepositoryConfigDefinitionParser<S extends GlobalR
|
||||
|
||||
LOG.debug("Triggering manual repository detection");
|
||||
|
||||
for (T daoContext : context.getSingleRepositoryConfigInformations()) {
|
||||
registerGenericRepositoryFactoryBean(parser, daoContext);
|
||||
for (T repositoryContext : context
|
||||
.getSingleRepositoryConfigInformations()) {
|
||||
registerGenericRepositoryFactoryBean(parser, repositoryContext);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,7 +353,8 @@ public abstract class AbstractRepositoryConfigDefinitionParser<S extends GlobalR
|
||||
|
||||
AbstractBeanDefinition definition =
|
||||
BeanDefinitionBuilder.rootBeanDefinition(
|
||||
DAO_INTERFACE_POST_PROCESSOR).getBeanDefinition();
|
||||
REPOSITORY_INTERFACE_POST_PROCESSOR)
|
||||
.getBeanDefinition();
|
||||
|
||||
registerWithSourceAndGeneratedBeanName(registry, definition, source);
|
||||
}
|
||||
@@ -431,13 +434,13 @@ public abstract class AbstractRepositoryConfigDefinitionParser<S extends GlobalR
|
||||
protected boolean isCandidateComponent(
|
||||
AnnotatedBeanDefinition beanDefinition) {
|
||||
|
||||
boolean isNonHadesInterfaces =
|
||||
boolean isNonRepositoryInterface =
|
||||
!isGenericRepositoryInterface(beanDefinition
|
||||
.getBeanClassName());
|
||||
boolean isTopLevelType =
|
||||
!beanDefinition.getMetadata().hasEnclosingClass();
|
||||
|
||||
return isNonHadesInterfaces && isTopLevelType;
|
||||
return isNonRepositoryInterface && isTopLevelType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ManualRepositoryConfigInformation<T extends CommonRepositoryConfigI
|
||||
|
||||
|
||||
/**
|
||||
* Returns if a custom DAO implementation shall be autodetected.
|
||||
* Returns if a custom implementation shall be autodetected.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -8,8 +8,8 @@ import org.w3c.dom.Element;
|
||||
|
||||
|
||||
/**
|
||||
* Base class for {@link SingleRepositoryConfigInformation} implementations. So these
|
||||
* implementations will capture information for XML elements manually
|
||||
* Base class for {@link SingleRepositoryConfigInformation} implementations. So
|
||||
* these implementations will capture information for XML elements manually
|
||||
* configuring a single repository bean.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
@@ -21,8 +21,8 @@ public abstract class ParentDelegatingRepositoryConfigInformation<T extends Comm
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new {@link ParentDelegatingRepositoryConfigInformation} with the given
|
||||
* {@link CommonRepositoryConfigInformation} as parent.
|
||||
* Creates a new {@link ParentDelegatingRepositoryConfigInformation} with
|
||||
* the given {@link CommonRepositoryConfigInformation} as parent.
|
||||
*
|
||||
* @param parent
|
||||
*/
|
||||
@@ -128,8 +128,8 @@ public abstract class ParentDelegatingRepositoryConfigInformation<T extends Comm
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.springframework.data.jpa.repository.config.RepositoryInformation#
|
||||
* getDaoImplPostfix()
|
||||
* org.springframework.data.repository.config.CommonRepositoryConfigInformation
|
||||
* #getRepositoryImplementationSuffix()
|
||||
*/
|
||||
public String getRepositoryImplementationSuffix() {
|
||||
|
||||
@@ -141,8 +141,8 @@ public abstract class ParentDelegatingRepositoryConfigInformation<T extends Comm
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.springframework.data.jpa.repository.config.RepositoryInformation#
|
||||
* getDaoFactoryClassName()
|
||||
* org.springframework.data.repository.config.CommonRepositoryConfigInformation
|
||||
* #getRepositoryFactoryBeanClassName()
|
||||
*/
|
||||
public String getRepositoryFactoryBeanClassName() {
|
||||
|
||||
|
||||
@@ -39,10 +39,11 @@ import org.w3c.dom.NodeList;
|
||||
public abstract class RepositoryConfig<T extends SingleRepositoryConfigInformation<S>, S extends CommonRepositoryConfigInformation>
|
||||
implements GlobalRepositoryConfigInformation<T> {
|
||||
|
||||
public static final String DEFAULT_DAO_IMPL_POSTFIX = "Impl";
|
||||
public static final String DEFAULT_REPOSITORY_IMPL_POSTFIX = "Impl";
|
||||
public static final String QUERY_LOOKUP_STRATEGY = "query-lookup-strategy";
|
||||
public static final String BASE_PACKAGE = "base-package";
|
||||
public static final String REPOSITORY_IMPL_POSTFIX = "dao-impl-postfix";
|
||||
public static final String REPOSITORY_IMPL_POSTFIX =
|
||||
"repository-impl-postfix";
|
||||
public static final String REPOSITORY_FACTORY_CLASS_NAME = "factory-class";
|
||||
public static final String TRANSACTION_MANAGER_REF =
|
||||
"transaction-manager-ref";
|
||||
@@ -153,7 +154,7 @@ public abstract class RepositoryConfig<T extends SingleRepositoryConfigInformati
|
||||
|
||||
String postfix = element.getAttribute(REPOSITORY_IMPL_POSTFIX);
|
||||
return StringUtils.hasText(postfix) ? postfix
|
||||
: DEFAULT_DAO_IMPL_POSTFIX;
|
||||
: DEFAULT_REPOSITORY_IMPL_POSTFIX;
|
||||
}
|
||||
|
||||
|
||||
@@ -200,9 +201,9 @@ public abstract class RepositoryConfig<T extends SingleRepositoryConfigInformati
|
||||
Node node = nodes.item(i);
|
||||
|
||||
boolean isElement = Node.ELEMENT_NODE == node.getNodeType();
|
||||
boolean isDao = "repository".equals(node.getLocalName());
|
||||
boolean isRepository = "repository".equals(node.getLocalName());
|
||||
|
||||
if (isElement && isDao) {
|
||||
if (isElement && isRepository) {
|
||||
result.add((Element) node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,8 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Abstraction of a method that is designated to execute a finder query.
|
||||
* Enriches the standard {@link Method} interface with Hades specific
|
||||
* information that is necessary to construct {@link HadesQuery}s for the
|
||||
* method.
|
||||
* Enriches the standard {@link Method} interface with specific information that
|
||||
* is necessary to construct {@link RepositoryQuery}s for the method.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,8 @@ public class PersistableEntityInformation implements IsNewAware, IdAware {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.synyx.hades.dao.orm.GenericJpaDao.IsNewStrategy#isNew(java.lang
|
||||
* @see
|
||||
* org.springframework.data.repository.support.IsNewAware#isNew(java.lang
|
||||
* .Object)
|
||||
*/
|
||||
public boolean isNew(Object entity) {
|
||||
@@ -27,8 +28,9 @@ public class PersistableEntityInformation implements IsNewAware, IdAware {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.synyx.hades.dao.orm.GenericDaoSupport.IdAware#getId(java.lang
|
||||
* .Object)
|
||||
* @see
|
||||
* org.springframework.data.repository.support.IdAware#getId(java.lang.Object
|
||||
* )
|
||||
*/
|
||||
public Object getId(Object entity) {
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ public abstract class RepositoryFactoryBeanSupport<T extends Repository<?, ?>>
|
||||
this.factory = createRepositoryFactory();
|
||||
this.factory.setQueryLookupStrategyKey(queryLookupStrategyKey);
|
||||
this.factory.validate(repositoryInterface, customImplementation);
|
||||
this.factory.addDaoProxyPostProcessor(txPostProcessor);
|
||||
this.factory.addRepositoryProxyPostProcessor(txPostProcessor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public abstract class RepositoryFactorySupport {
|
||||
*
|
||||
* @param processor
|
||||
*/
|
||||
protected void addDaoProxyPostProcessor(
|
||||
protected void addRepositoryProxyPostProcessor(
|
||||
RepositoryProxyPostProcessor processor) {
|
||||
|
||||
Assert.notNull(processor);
|
||||
@@ -107,14 +107,14 @@ public abstract class RepositoryFactorySupport {
|
||||
*
|
||||
* @param <T>
|
||||
* @param repositoryInterface
|
||||
* @param customDaoImplementation
|
||||
* @param customImplementation
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends Repository<?, ?>> T getRepository(
|
||||
Class<T> repositoryInterface, Object customDaoImplementation) {
|
||||
Class<T> repositoryInterface, Object customImplementation) {
|
||||
|
||||
validate(repositoryInterface, customDaoImplementation);
|
||||
validate(repositoryInterface, customImplementation);
|
||||
|
||||
Class<?> domainClass = getDomainClass(repositoryInterface);
|
||||
RepositorySupport<?, ?> target = getTargetRepository(domainClass);
|
||||
@@ -129,7 +129,7 @@ public abstract class RepositoryFactorySupport {
|
||||
}
|
||||
|
||||
result.addAdvice(new QueryExecuterMethodInterceptor(
|
||||
repositoryInterface, customDaoImplementation, target));
|
||||
repositoryInterface, customImplementation, target));
|
||||
|
||||
return (T) result.getProxy();
|
||||
}
|
||||
@@ -166,26 +166,26 @@ public abstract class RepositoryFactorySupport {
|
||||
|
||||
|
||||
/**
|
||||
* Returns if the configured DAO interface has custom methods, that might
|
||||
* have to be delegated to a custom DAO implementation. This is used to
|
||||
* verify DAO configuration.
|
||||
* Returns if the configured repository interface has custom methods, that
|
||||
* might have to be delegated to a custom implementation. This is used to
|
||||
* verify repository configuration.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean hasCustomMethod(
|
||||
Class<? extends Repository<?, ?>> daoInterface) {
|
||||
Class<? extends Repository<?, ?>> repositoryInterface) {
|
||||
|
||||
boolean hasCustomMethod = false;
|
||||
|
||||
// No detection required if no typing interface was configured
|
||||
if (isGenericRepositoryInterface(daoInterface)) {
|
||||
if (isGenericRepositoryInterface(repositoryInterface)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Method method : daoInterface.getMethods()) {
|
||||
for (Method method : repositoryInterface.getMethods()) {
|
||||
|
||||
if (isCustomMethod(method, daoInterface)
|
||||
&& !isBaseClassMethod(method, daoInterface)) {
|
||||
if (isCustomMethod(method, repositoryInterface)
|
||||
&& !isBaseClassMethod(method, repositoryInterface)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -195,34 +195,39 @@ public abstract class RepositoryFactorySupport {
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the given method is considered to be a DAO base class
|
||||
* method.
|
||||
* Returns whether the given method is considered to be a repository base
|
||||
* class method.
|
||||
*
|
||||
* @param method
|
||||
* @param repositoryInterface
|
||||
* @return
|
||||
*/
|
||||
private boolean isBaseClassMethod(Method method, Class<?> daoInterface) {
|
||||
private boolean isBaseClassMethod(Method method,
|
||||
Class<?> repositoryInterface) {
|
||||
|
||||
Assert.notNull(method);
|
||||
|
||||
if (method.getDeclaringClass().isAssignableFrom(getRepositoryClass())) {
|
||||
if (method.getDeclaringClass().isAssignableFrom(
|
||||
getRepositoryClass(repositoryInterface))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !method.equals(getBaseClassMethod(method, daoInterface));
|
||||
return !method.equals(getBaseClassMethod(method, repositoryInterface));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the base class method that is backing the given method. This can
|
||||
* be necessary if a DAO interface redeclares a method in {@link GenericDao}
|
||||
* (e.g. for transaction behaviour customization). Returns the method itself
|
||||
* if the base class does not implement the given method.
|
||||
* be necessary if a repository interface redeclares a method in
|
||||
* {@link Repository} (e.g. for transaction behaviour customization).
|
||||
* Returns the method itself if the base class does not implement the given
|
||||
* method.
|
||||
*
|
||||
* @param method
|
||||
* @return
|
||||
*/
|
||||
private Method getBaseClassMethod(Method method, Class<?> daoInterface) {
|
||||
private Method getBaseClassMethod(Method method,
|
||||
Class<?> repositoryInterface) {
|
||||
|
||||
Assert.notNull(method);
|
||||
|
||||
@@ -234,7 +239,7 @@ public abstract class RepositoryFactorySupport {
|
||||
|
||||
result =
|
||||
getBaseClassMethodFor(method, getRepositoryClass(),
|
||||
daoInterface);
|
||||
repositoryInterface);
|
||||
methodCache.put(method, result);
|
||||
|
||||
return result;
|
||||
@@ -242,38 +247,39 @@ public abstract class RepositoryFactorySupport {
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the given method is a custom DAO method.
|
||||
* Returns whether the given method is a custom repository method.
|
||||
*
|
||||
* @param method
|
||||
* @param daoInterface
|
||||
* @param repositoryInterface
|
||||
* @return
|
||||
*/
|
||||
private boolean isCustomMethod(Method method, Class<?> daoInterface) {
|
||||
private boolean isCustomMethod(Method method, Class<?> repositoryInterface) {
|
||||
|
||||
Class<?> declaringClass = method.getDeclaringClass();
|
||||
|
||||
boolean isQueryMethod = declaringClass.equals(daoInterface);
|
||||
boolean isHadesDaoInterface =
|
||||
boolean isQueryMethod = declaringClass.equals(repositoryInterface);
|
||||
boolean isRepositoryInterface =
|
||||
isGenericRepositoryInterface(declaringClass);
|
||||
boolean isBaseClassMethod = isBaseClassMethod(method, daoInterface);
|
||||
boolean isBaseClassMethod =
|
||||
isBaseClassMethod(method, repositoryInterface);
|
||||
|
||||
return !(isHadesDaoInterface || isBaseClassMethod || isQueryMethod);
|
||||
return !(isRepositoryInterface || isBaseClassMethod || isQueryMethod);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns all methods considered to be finder methods.
|
||||
*
|
||||
* @param daoInterface
|
||||
* @param repositoryInterface
|
||||
* @return
|
||||
*/
|
||||
private Iterable<Method> getFinderMethods(Class<?> daoInterface) {
|
||||
private Iterable<Method> getFinderMethods(Class<?> repositoryInterface) {
|
||||
|
||||
Set<Method> result = new HashSet<Method>();
|
||||
|
||||
for (Method method : daoInterface.getDeclaredMethods()) {
|
||||
if (!isCustomMethod(method, daoInterface)
|
||||
&& !isBaseClassMethod(method, daoInterface)) {
|
||||
for (Method method : repositoryInterface.getDeclaredMethods()) {
|
||||
if (!isCustomMethod(method, repositoryInterface)
|
||||
&& !isBaseClassMethod(method, repositoryInterface)) {
|
||||
result.add(method);
|
||||
}
|
||||
}
|
||||
@@ -285,13 +291,13 @@ public abstract class RepositoryFactorySupport {
|
||||
/**
|
||||
* Validates the given repository interface.
|
||||
*
|
||||
* @param daoInterface
|
||||
* @param repositoryInterface
|
||||
*/
|
||||
private void validate(Class<?> daoInterface) {
|
||||
private void validate(Class<?> repositoryInterface) {
|
||||
|
||||
Assert.notNull(daoInterface);
|
||||
Assert.notNull(repositoryInterface);
|
||||
Assert.notNull(
|
||||
getDomainClass(daoInterface),
|
||||
getDomainClass(repositoryInterface),
|
||||
"Could not retrieve domain class from interface. Make sure it extends GenericRepository.");
|
||||
|
||||
}
|
||||
|
||||
@@ -29,9 +29,10 @@ import org.springframework.util.ClassUtils;
|
||||
* A
|
||||
* {@link org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor}
|
||||
* implementing {@code #predictBeanType(Class, String)} to return the configured
|
||||
* DAO interface from {@link GenericDaoFactoryBean}s. This is done as shortcut
|
||||
* to prevent the need of instantiating {@link GenericDaoFactoryBean}s just to
|
||||
* find out what DAO interface they actually create.
|
||||
* repository interface from {@link RepositoryFactoryBeanSupport}s. This is done
|
||||
* as shortcut to prevent the need of instantiating
|
||||
* {@link RepositoryFactoryBeanSupport}s just to find out what repository
|
||||
* interface they actually create.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@@ -39,7 +40,7 @@ class RepositoryInterfaceAwareBeanPostProcessor extends
|
||||
InstantiationAwareBeanPostProcessorAdapter implements BeanFactoryAware {
|
||||
|
||||
private static final Class<?> REPOSITORY_TYPE =
|
||||
RepositoryFactoryBeanSupport.class;
|
||||
RepositoryFactoryBeanSupport.class;
|
||||
|
||||
private ConfigurableListableBeanFactory context;
|
||||
|
||||
@@ -54,7 +55,6 @@ class RepositoryInterfaceAwareBeanPostProcessor extends
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
|
||||
if (beanFactory instanceof ConfigurableListableBeanFactory) {
|
||||
|
||||
this.context = (ConfigurableListableBeanFactory) beanFactory;
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,8 @@ class RepositoryInterfaceAwareBeanPostProcessor extends
|
||||
|
||||
BeanDefinition definition = context.getBeanDefinition(beanName);
|
||||
PropertyValue value =
|
||||
definition.getPropertyValues().getPropertyValue("repositoryInterface");
|
||||
definition.getPropertyValues().getPropertyValue(
|
||||
"repositoryInterface");
|
||||
|
||||
return getClassForPropertyValue(value);
|
||||
}
|
||||
@@ -107,7 +108,8 @@ class RepositoryInterfaceAwareBeanPostProcessor extends
|
||||
|
||||
try {
|
||||
return ClassUtils.resolveClassName(className,
|
||||
RepositoryInterfaceAwareBeanPostProcessor.class.getClassLoader());
|
||||
RepositoryInterfaceAwareBeanPostProcessor.class
|
||||
.getClassLoader());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ import org.springframework.aop.framework.ProxyFactory;
|
||||
|
||||
|
||||
/**
|
||||
* Callback interface used during DAO proxy creation. Allows manipulating the
|
||||
* {@link ProxyFactory} creating the DAO.
|
||||
* Callback interface used during repository proxy creation. Allows manipulating
|
||||
* the {@link ProxyFactory} creating the repository.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
|
||||
@@ -24,9 +24,9 @@ import org.springframework.util.Assert;
|
||||
|
||||
|
||||
/**
|
||||
* {@link DaoProxyPostProcessor} to add transactional behaviour to DAO proxies.
|
||||
* Adds a {@link PersistenceExceptionTranslationInterceptor} as well as an
|
||||
* annotation based {@link TransactionInterceptor} to the proxy.
|
||||
* {@link RepositoryProxyPostProcessor} to add transactional behaviour to
|
||||
* repository proxies. Adds a {@link PersistenceExceptionTranslationInterceptor}
|
||||
* as well as an annotation based {@link TransactionInterceptor} to the proxy.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@@ -64,8 +64,8 @@ class TransactionalRepositoryProxyPostProcessor implements
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.synyx.hades.dao.orm.DaoProxyPostProcessor#postProcess(org.springframework
|
||||
* .aop.framework.ProxyFactory)
|
||||
* org.springframework.data.repository.support.RepositoryProxyPostProcessor
|
||||
* #postProcess(org.springframework.aop.framework.ProxyFactory)
|
||||
*/
|
||||
public void postProcess(ProxyFactory factory) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user