Browse Source

moved persistence classes to cross-store project

pull/2/head
Thomas Risberg 16 years ago
parent
commit
7700d501e5
  1. 32
      src/main/java/org/springframework/persistence/AsynchStoreCompletionListener.java
  2. 34
      src/main/java/org/springframework/persistence/PersistencePolicy.java
  3. 65
      src/main/java/org/springframework/persistence/RelatedEntity.java

32
src/main/java/org/springframework/persistence/AsynchStoreCompletionListener.java

@ -1,32 +0,0 @@ @@ -1,32 +0,0 @@
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);
}

34
src/main/java/org/springframework/persistence/PersistencePolicy.java

@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
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;
}

65
src/main/java/org/springframework/persistence/RelatedEntity.java

@ -1,65 +0,0 @@ @@ -1,65 +0,0 @@
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 "";
}
Loading…
Cancel
Save