first part of moving over cross-store classes/aspect; added aspectj compile support
This commit is contained in:
10
.classpath
10
.classpath
@@ -1,6 +1,7 @@
|
|||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
|
<classpathentry kind="src" path="src/main/java" including="**/*.java|**/*.aj"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
<classpathentry kind="var" path="M2_REPO/javax/persistence/persistence-api/1.0.0/persistence-api-1.0.0.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" sourcepath="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" sourcepath="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar" sourcepath="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar" sourcepath="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1-sources.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.0/jcl-over-slf4j-1.6.0.jar" sourcepath="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.0/jcl-over-slf4j-1.6.0-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.0/jcl-over-slf4j-1.6.0.jar" sourcepath="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.0/jcl-over-slf4j-1.6.0-sources.jar"/>
|
||||||
@@ -13,7 +14,11 @@
|
|||||||
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.6.0/slf4j-log4j12-1.6.0.jar" sourcepath="M2_REPO/org/slf4j/slf4j-log4j12/1.6.0/slf4j-log4j12-1.6.0-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.6.0/slf4j-log4j12-1.6.0.jar" sourcepath="M2_REPO/org/slf4j/slf4j-log4j12/1.6.0/slf4j-log4j12-1.6.0-sources.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-aop/3.0.2.RELEASE/spring-aop-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-aop/3.0.2.RELEASE/spring-aop-3.0.2.RELEASE-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-aop/3.0.2.RELEASE/spring-aop-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-aop/3.0.2.RELEASE/spring-aop-3.0.2.RELEASE-sources.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-asm/3.0.2.RELEASE/spring-asm-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-asm/3.0.2.RELEASE/spring-asm-3.0.2.RELEASE-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-asm/3.0.2.RELEASE/spring-asm-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-asm/3.0.2.RELEASE/spring-asm-3.0.2.RELEASE-sources.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-aspects/3.0.2.RELEASE/spring-aspects-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-aspects/3.0.2.RELEASE/spring-aspects-3.0.2.RELEASE-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-aspects/3.0.2.RELEASE/spring-aspects-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-aspects/3.0.2.RELEASE/spring-aspects-3.0.2.RELEASE-sources.jar">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="org.eclipse.ajdt.aspectpath" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-beans/3.0.2.RELEASE/spring-beans-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-beans/3.0.2.RELEASE/spring-beans-3.0.2.RELEASE-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-beans/3.0.2.RELEASE/spring-beans-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-beans/3.0.2.RELEASE/spring-beans-3.0.2.RELEASE-sources.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-context/3.0.2.RELEASE/spring-context-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-context/3.0.2.RELEASE/spring-context-3.0.2.RELEASE-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-context/3.0.2.RELEASE/spring-context-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-context/3.0.2.RELEASE/spring-context-3.0.2.RELEASE-sources.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-context-support/3.0.2.RELEASE/spring-context-support-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-context-support/3.0.2.RELEASE/spring-context-support-3.0.2.RELEASE-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-context-support/3.0.2.RELEASE/spring-context-support-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-context-support/3.0.2.RELEASE/spring-context-support-3.0.2.RELEASE-sources.jar"/>
|
||||||
@@ -22,4 +27,5 @@
|
|||||||
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-test/3.0.2.RELEASE/spring-test-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-test/3.0.2.RELEASE/spring-test-3.0.2.RELEASE-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-test/3.0.2.RELEASE/spring-test-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-test/3.0.2.RELEASE/spring-test-3.0.2.RELEASE-sources.jar"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-tx/3.0.2.RELEASE/spring-tx-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-tx/3.0.2.RELEASE/spring-tx-3.0.2.RELEASE-sources.jar"/>
|
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-tx/3.0.2.RELEASE/spring-tx-3.0.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-tx/3.0.2.RELEASE/spring-tx-3.0.2.RELEASE-sources.jar"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
73
.project
73
.project
@@ -1,38 +1,37 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>data-commons</name>
|
<name>data-commons</name>
|
||||||
<comment></comment>
|
<comment/>
|
||||||
<projects>
|
<projects/>
|
||||||
</projects>
|
<buildSpec>
|
||||||
<buildSpec>
|
<buildCommand>
|
||||||
<buildCommand>
|
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
</buildCommand>
|
||||||
<arguments>
|
<buildCommand>
|
||||||
</arguments>
|
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
<name>org.eclipse.ajdt.core.ajbuilder</name>
|
||||||
<arguments>
|
</buildCommand>
|
||||||
</arguments>
|
<buildCommand>
|
||||||
</buildCommand>
|
<name>org.springframework.ide.eclipse.core.springbuilder</name>
|
||||||
<buildCommand>
|
</buildCommand>
|
||||||
<name>org.eclipse.ajdt.core.ajbuilder</name>
|
<buildCommand>
|
||||||
<arguments>
|
<name>org.eclipse.ajdt.core.ajbuilder</name>
|
||||||
</arguments>
|
<arguments>
|
||||||
</buildCommand>
|
<dictionary>
|
||||||
<buildCommand>
|
<key>aspectPath</key>
|
||||||
<name>org.springframework.ide.eclipse.core.springbuilder</name>
|
<value>org.springframework.aspects</value>
|
||||||
<arguments>
|
</dictionary>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||||
<nature>org.eclipse.ajdt.ui.ajnature</nature>
|
<nature>org.eclipse.ajdt.ui.ajnature</nature>
|
||||||
<nature>com.springsource.sts.roo.core.nature</nature>
|
<nature>com.springsource.sts.roo.core.nature</nature>
|
||||||
<nature>org.springframework.ide.eclipse.core.springnature</nature>
|
<nature>org.springframework.ide.eclipse.core.springnature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
50
pom.xml
50
pom.xml
@@ -9,6 +9,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<spring.version>3.0.2.RELEASE</spring.version>
|
<spring.version>3.0.2.RELEASE</spring.version>
|
||||||
|
<aspectj.version>1.6.9</aspectj.version>
|
||||||
<slf4j.version>1.6.0</slf4j.version>
|
<slf4j.version>1.6.0</slf4j.version>
|
||||||
</properties>
|
</properties>
|
||||||
<repositories>
|
<repositories>
|
||||||
@@ -120,6 +121,11 @@
|
|||||||
<artifactId>spring-tx</artifactId>
|
<artifactId>spring-tx</artifactId>
|
||||||
<version>${spring.version}</version>
|
<version>${spring.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.aspectj</groupId>
|
||||||
|
<artifactId>aspectjrt</artifactId>
|
||||||
|
<version>${aspectj.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
@@ -133,6 +139,13 @@
|
|||||||
<version>1.8.0</version>
|
<version>1.8.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Java Persistence API (requires manual install) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.persistence</groupId>
|
||||||
|
<artifactId>persistence-api</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
@@ -146,6 +159,43 @@
|
|||||||
<target>1.6</target>
|
<target>1.6</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>aspectj-maven-plugin</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<dependencies>
|
||||||
|
<!-- NB: You must use Maven 2.0.9 or above or these are ignored (see MNG-2972) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.aspectj</groupId>
|
||||||
|
<artifactId>aspectjrt</artifactId>
|
||||||
|
<version>${aspectj.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.aspectj</groupId>
|
||||||
|
<artifactId>aspectjtools</artifactId>
|
||||||
|
<version>${aspectj.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>compile</goal>
|
||||||
|
<goal>test-compile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<outxml>true</outxml>
|
||||||
|
<aspectLibraries>
|
||||||
|
<aspectLibrary>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-aspects</artifactId>
|
||||||
|
</aspectLibrary>
|
||||||
|
</aspectLibraries>
|
||||||
|
<source>1.6</source>
|
||||||
|
<target>1.6</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package org.springframework.persistence;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listener interface for asynchronous storage operations.
|
||||||
|
* Can be annotated with OnlyOnFailure as an optimization
|
||||||
|
* if the listener is only interested in compensating transactions
|
||||||
|
* in the event of write failure.
|
||||||
|
*
|
||||||
|
* @author Rod Johnson
|
||||||
|
*
|
||||||
|
* @param <V> new value type
|
||||||
|
*/
|
||||||
|
public interface AsynchStoreCompletionListener<V> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constant indicating no store completion action
|
||||||
|
*/
|
||||||
|
class NONE implements AsynchStoreCompletionListener<Object> {
|
||||||
|
public void onCompletion(AsynchStoreCompletionListener.StoreResult result, Object newValue, Field foreignStore) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum StoreResult {
|
||||||
|
SUCCESS,
|
||||||
|
FAILURE,
|
||||||
|
INDETERMINATE
|
||||||
|
};
|
||||||
|
|
||||||
|
void onCompletion(StoreResult result, V newValue, Field foreignStore);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package org.springframework.persistence;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Persistence policies that can be attached to entities or relationship
|
||||||
|
* fields.
|
||||||
|
* @author rodjohnson
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ElementType.TYPE, ElementType.FIELD})
|
||||||
|
public @interface PersistencePolicy {
|
||||||
|
|
||||||
|
enum LATENCY_SENSITIVITY { NONE, MEDIUM, HIGH };
|
||||||
|
|
||||||
|
boolean largeObject() default false;
|
||||||
|
|
||||||
|
boolean queryable() default true;
|
||||||
|
|
||||||
|
boolean immutable() default false;
|
||||||
|
|
||||||
|
boolean transactional() default true;
|
||||||
|
|
||||||
|
boolean lossAcceptable() default false;
|
||||||
|
|
||||||
|
// TODO freshness, or should this be handled separately in a caching annotation
|
||||||
|
|
||||||
|
LATENCY_SENSITIVITY latencySensitivity() default LATENCY_SENSITIVITY.HIGH;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package org.springframework.persistence;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Annotation indicating that a field may be stored in a foreign store
|
||||||
|
* and specifying the necessary guarantees. Conceptual rather than
|
||||||
|
* implementation-specific.
|
||||||
|
* @see ForeignStoreKeyManager
|
||||||
|
*
|
||||||
|
* @author Rod Johnson
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
public @interface RelatedEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Optional information as to how to compute or locate the key value.
|
||||||
|
* Some strategies may take this into account.
|
||||||
|
*/
|
||||||
|
String keyExpression() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should we use the key of the present entity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean sameKey() default false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Policies for persistence
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PersistencePolicy policy() default @PersistencePolicy();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name for the preferred data store. Merely a hint. May not be followed.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String preferredStore() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is asynchronous store OK?
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean asynchStore() default false;
|
||||||
|
|
||||||
|
// TODO - indicates if an asynchronous write should begin
|
||||||
|
// only after commit of a transaction
|
||||||
|
boolean afterCommit() default false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Completion listener class. Only used if asynchStore is true.
|
||||||
|
* Must have a no-arg constructor.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Class<? extends AsynchStoreCompletionListener> storeCompletionListenerClass() default AsynchStoreCompletionListener.NONE.class;
|
||||||
|
|
||||||
|
String storeCompletionListenerBeanName() default "";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package org.springframework.persistence.support;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Configurable;
|
||||||
|
import org.springframework.persistence.RelatedEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract superaspect to advise field read and write
|
||||||
|
* and introduce a mixin interface.
|
||||||
|
*
|
||||||
|
* @param <N> type of introduced interface
|
||||||
|
*
|
||||||
|
* @author Rod Johnson
|
||||||
|
*/
|
||||||
|
privileged abstract public aspect AbstractMixinFields<N> {
|
||||||
|
|
||||||
|
protected final Log log = LogFactory.getLog(getClass());
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// ITDs to add behavior and state to classes
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// Enable Spring DI for all mixed-in objects
|
||||||
|
declare @type: N+: @Configurable;
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// Advice for field get/set to delegate to backing Node.
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
protected pointcut entityFieldGet(N entity) :
|
||||||
|
get(* N+.*) &&
|
||||||
|
this(entity) &&
|
||||||
|
!(get(@RelatedEntity * *)
|
||||||
|
|| get(* N.*)
|
||||||
|
|| getsNotToAdvise());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Never matches. Subclasses can override to exempt certain field reads from advice
|
||||||
|
*/
|
||||||
|
protected pointcut getsNotToAdvise();
|
||||||
|
|
||||||
|
protected pointcut entityFieldSet(N entity, Object newVal) :
|
||||||
|
set(* N+.*) &&
|
||||||
|
this(entity) &&
|
||||||
|
args(newVal) &&
|
||||||
|
!(set(@RelatedEntity * *) ||
|
||||||
|
set(* N.*) ||
|
||||||
|
setsNotToAdvise());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Never matches. Subclasses can override to exempt certain field writes from advice
|
||||||
|
*/
|
||||||
|
protected pointcut setsNotToAdvise();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package org.springframework.persistence.support;
|
||||||
|
|
||||||
|
import java.lang.annotation.Annotation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract superaspect for aspects that advice
|
||||||
|
* field access with a mixin for all types annotated with
|
||||||
|
* a given annotation.
|
||||||
|
*
|
||||||
|
* @param <ET> annotation on entity
|
||||||
|
* @param <N> type of introduced interface
|
||||||
|
*
|
||||||
|
* @author Rod Johnson
|
||||||
|
*/
|
||||||
|
privileged abstract public aspect AbstractTypeAnnotatingMixinFields<ET extends Annotation, N>
|
||||||
|
extends AbstractMixinFields<N> {
|
||||||
|
|
||||||
|
// ITD to introduce N state to Annotated objects
|
||||||
|
declare parents : (@ET *) implements N;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package org.springframework.persistence.support;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface to be implemented by classes that can instantiate and
|
||||||
|
* configure entities.
|
||||||
|
* The framework must do this when creating objects resulting from finders,
|
||||||
|
* even when there may be no no-arg constructor supplied by the user.
|
||||||
|
*
|
||||||
|
* @author Rod Johnson
|
||||||
|
*/
|
||||||
|
public interface EntityInstantiator<BACKING_INTERFACE,STATE> {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The best solution if available is to add a constructor that takes Node
|
||||||
|
* to each GraphEntity. This means generating an aspect beside every
|
||||||
|
* class as Roo presently does.
|
||||||
|
*
|
||||||
|
* An alternative that does not require Roo
|
||||||
|
* is a user-authored constructor taking Node and calling setUnderlyingNode()
|
||||||
|
* but this is less elegant and pollutes the domain object.
|
||||||
|
*
|
||||||
|
* If the user supplies a no-arg constructor, instantiation can occur by invoking it
|
||||||
|
* prior to calling setUnderlyingNode().
|
||||||
|
*
|
||||||
|
* If the user does NOT supply a no-arg constructor, we must rely on Sun-specific
|
||||||
|
* code to instantiate entities without invoking a constructor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
<T extends BACKING_INTERFACE> T createEntityFromState(STATE s, Class<T> c);
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user