No effective change - change newline char

This commit is contained in:
rbygrave
2015-05-09 01:02:55 +12:00
parent 27a0e93fda
commit c2ddab2ba0
10 changed files with 483 additions and 483 deletions
@@ -1,34 +1,34 @@
package com.avaje.ebean.event;
import com.avaje.ebean.bean.BeanCollection;
/**
* Used to override the finding implementation for a bean.
* <p>
* For beans that are not in a JDBC data source you can implement this handle
* bean finding. For example, read a log file building each entry as a bean and
* returning that.
* </p>
* <p>
* There are a number of internal BeanFinders in Ebean to return meta data from
* Ebean at runtime such as query execution statistics etc. See the beans in
* com.avaje.ebean.meta and finders in com.avaje.ebean.server.meta.
* </p>
*/
public interface BeanFinder<T> {
/**
* Find a bean using its id or unique predicate.
*/
T find(BeanQueryRequest<T> request);
/**
* Return a List, Set or Map for the given find request.
* <p>
* Note the returning object is cast to a List Set or Map so you do need to
* get the return type right.
* </p>
*/
BeanCollection<T> findMany(BeanQueryRequest<T> request);
}
package com.avaje.ebean.event;
import com.avaje.ebean.bean.BeanCollection;
/**
* Used to override the finding implementation for a bean.
* <p>
* For beans that are not in a JDBC data source you can implement this handle
* bean finding. For example, read a log file building each entry as a bean and
* returning that.
* </p>
* <p>
* There are a number of internal BeanFinders in Ebean to return meta data from
* Ebean at runtime such as query execution statistics etc. See the beans in
* com.avaje.ebean.meta and finders in com.avaje.ebean.server.meta.
* </p>
*/
public interface BeanFinder<T> {
/**
* Find a bean using its id or unique predicate.
*/
T find(BeanQueryRequest<T> request);
/**
* Return a List, Set or Map for the given find request.
* <p>
* Note the returning object is cast to a List Set or Map so you do need to
* get the return type right.
* </p>
*/
BeanCollection<T> findMany(BeanQueryRequest<T> request);
}
@@ -1,75 +1,75 @@
package com.avaje.ebean.event;
import java.util.Set;
import com.avaje.ebean.config.ServerConfig;
/**
* A no operation implementation of BeanPersistController. Objects extending
* this need to only override the methods they want to.
* <p>
* A BeanPersistAdapter is either found automatically via class path search or
* can be added programmatically via
* {@link ServerConfig#add(BeanPersistController)} or
* {@link ServerConfig#setPersistControllers(java.util.List)}.
* </p>
*/
public abstract class BeanPersistAdapter implements BeanPersistController {
public abstract boolean isRegisterFor(Class<?> cls);
/**
* Returns 10 - override this to control the order in which
* BeanPersistController's are executed when there is multiple of them
* registered for a given entity type (class).
*/
public int getExecutionOrder() {
return 10;
}
/**
* Returns true indicating normal processing should continue.
*/
public boolean preDelete(BeanPersistRequest<?> request) {
return true;
}
/**
* Returns true indicating normal processing should continue.
*/
public boolean preInsert(BeanPersistRequest<?> request) {
return true;
}
/**
* Returns true indicating normal processing should continue.
*/
public boolean preUpdate(BeanPersistRequest<?> request) {
return true;
}
/**
* Does nothing by default.
*/
public void postDelete(BeanPersistRequest<?> request) {
}
/**
* Does nothing by default.
*/
public void postInsert(BeanPersistRequest<?> request) {
}
/**
* Does nothing by default.
*/
public void postUpdate(BeanPersistRequest<?> request) {
}
/**
* Does nothing by default.
*/
public void postLoad(Object bean, Set<String> includedProperties) {
}
}
package com.avaje.ebean.event;
import java.util.Set;
import com.avaje.ebean.config.ServerConfig;
/**
* A no operation implementation of BeanPersistController. Objects extending
* this need to only override the methods they want to.
* <p>
* A BeanPersistAdapter is either found automatically via class path search or
* can be added programmatically via
* {@link ServerConfig#add(BeanPersistController)} or
* {@link ServerConfig#setPersistControllers(java.util.List)}.
* </p>
*/
public abstract class BeanPersistAdapter implements BeanPersistController {
public abstract boolean isRegisterFor(Class<?> cls);
/**
* Returns 10 - override this to control the order in which
* BeanPersistController's are executed when there is multiple of them
* registered for a given entity type (class).
*/
public int getExecutionOrder() {
return 10;
}
/**
* Returns true indicating normal processing should continue.
*/
public boolean preDelete(BeanPersistRequest<?> request) {
return true;
}
/**
* Returns true indicating normal processing should continue.
*/
public boolean preInsert(BeanPersistRequest<?> request) {
return true;
}
/**
* Returns true indicating normal processing should continue.
*/
public boolean preUpdate(BeanPersistRequest<?> request) {
return true;
}
/**
* Does nothing by default.
*/
public void postDelete(BeanPersistRequest<?> request) {
}
/**
* Does nothing by default.
*/
public void postInsert(BeanPersistRequest<?> request) {
}
/**
* Does nothing by default.
*/
public void postUpdate(BeanPersistRequest<?> request) {
}
/**
* Does nothing by default.
*/
public void postLoad(Object bean, Set<String> includedProperties) {
}
}
@@ -1,115 +1,115 @@
package com.avaje.ebean.event;
import java.util.Set;
/**
* Used to enhance or override the default bean persistence mechanism.
* <p>
* Note that if want to totally change the finding, you need to use a BeanQueryAdapter
* rather than using postLoad().
* </p>
* <p>
* Note that getTransaction() on the PersistRequest returns the transaction used
* for the insert, update, delete or fetch. To explicitly use this same
* transaction you should use this transaction via methods on EbeanServer.
* </p>
*
* <pre class="code">
*
* Object extaBeanToSave = ...;
* Transaction t = request.getTransaction();
* EbeanServer server = request.getEbeanServer();
* server.save(extraBeanToSave, t);
*
* </pre>
*
* <p>
* It is worth noting that BeanPersistListener is different in three main ways
* from BeanPersistController postXXX methods.
* <ul>
* <li>BeanPersistListener only sees successfully committed events.
* BeanController pre and post methods occur before the commit or a rollback and
* will see events that are later rolled back</li>
* <li>BeanPersistListener runs in a background thread and will not effect the
* response time of the actual persist where as BeanController code will</li>
* <li>BeanPersistListener can be notified of events from other servers in a
* cluster.</li>
* </ul>
* </p>
* <p>
* A BeanPersistController is either found automatically via class path search
* or can be added programmatically via ServerConfiguration.addEntity().
* </p>
*/
public interface BeanPersistController {
/**
* When there are multiple BeanPersistController's for a given entity type
* this controls the order in which they are executed.
* <p>
* Lowest values are executed first.
* </p>
*
* @return an int used to control the order BeanPersistController's are
* executed
*/
int getExecutionOrder();
/**
* Return true if this BeanPersistController should be registered for events
* on this entity type.
*/
boolean isRegisterFor(Class<?> cls);
/**
* Prior to the insert perform some action. Return true if you want the
* default functionality to continue.
* <p>
* Return false if you have completely replaced the insert functionality and
* do not want the default insert to be performed.
* </p>
*/
boolean preInsert(BeanPersistRequest<?> request);
/**
* Prior to the update perform some action. Return true if you want the
* default functionality to continue.
* <p>
* Return false if you have completely replaced the update functionality and
* do not want the default update to be performed.
* </p>
*/
boolean preUpdate(BeanPersistRequest<?> request);
/**
* Prior to the delete perform some action. Return true if you want the
* default functionality to continue.
* <p>
* Return false if you have completely replaced the delete functionality and
* do not want the default delete to be performed.
* </p>
*/
boolean preDelete(BeanPersistRequest<?> request);
/**
* Called after the insert was performed.
*/
void postInsert(BeanPersistRequest<?> request);
/**
* Called after the update was performed.
*/
void postUpdate(BeanPersistRequest<?> request);
/**
* Called after the delete was performed.
*/
void postDelete(BeanPersistRequest<?> request);
/**
* Called after every each bean is fetched and loaded from the database. You
* can override this to derive some information to set to the bean.
*/
void postLoad(Object bean, Set<String> includedProperties);
}
package com.avaje.ebean.event;
import java.util.Set;
/**
* Used to enhance or override the default bean persistence mechanism.
* <p>
* Note that if want to totally change the finding, you need to use a BeanQueryAdapter
* rather than using postLoad().
* </p>
* <p>
* Note that getTransaction() on the PersistRequest returns the transaction used
* for the insert, update, delete or fetch. To explicitly use this same
* transaction you should use this transaction via methods on EbeanServer.
* </p>
*
* <pre class="code">
*
* Object extaBeanToSave = ...;
* Transaction t = request.getTransaction();
* EbeanServer server = request.getEbeanServer();
* server.save(extraBeanToSave, t);
*
* </pre>
*
* <p>
* It is worth noting that BeanPersistListener is different in three main ways
* from BeanPersistController postXXX methods.
* <ul>
* <li>BeanPersistListener only sees successfully committed events.
* BeanController pre and post methods occur before the commit or a rollback and
* will see events that are later rolled back</li>
* <li>BeanPersistListener runs in a background thread and will not effect the
* response time of the actual persist where as BeanController code will</li>
* <li>BeanPersistListener can be notified of events from other servers in a
* cluster.</li>
* </ul>
* </p>
* <p>
* A BeanPersistController is either found automatically via class path search
* or can be added programmatically via ServerConfiguration.addEntity().
* </p>
*/
public interface BeanPersistController {
/**
* When there are multiple BeanPersistController's for a given entity type
* this controls the order in which they are executed.
* <p>
* Lowest values are executed first.
* </p>
*
* @return an int used to control the order BeanPersistController's are
* executed
*/
int getExecutionOrder();
/**
* Return true if this BeanPersistController should be registered for events
* on this entity type.
*/
boolean isRegisterFor(Class<?> cls);
/**
* Prior to the insert perform some action. Return true if you want the
* default functionality to continue.
* <p>
* Return false if you have completely replaced the insert functionality and
* do not want the default insert to be performed.
* </p>
*/
boolean preInsert(BeanPersistRequest<?> request);
/**
* Prior to the update perform some action. Return true if you want the
* default functionality to continue.
* <p>
* Return false if you have completely replaced the update functionality and
* do not want the default update to be performed.
* </p>
*/
boolean preUpdate(BeanPersistRequest<?> request);
/**
* Prior to the delete perform some action. Return true if you want the
* default functionality to continue.
* <p>
* Return false if you have completely replaced the delete functionality and
* do not want the default delete to be performed.
* </p>
*/
boolean preDelete(BeanPersistRequest<?> request);
/**
* Called after the insert was performed.
*/
void postInsert(BeanPersistRequest<?> request);
/**
* Called after the update was performed.
*/
void postUpdate(BeanPersistRequest<?> request);
/**
* Called after the delete was performed.
*/
void postDelete(BeanPersistRequest<?> request);
/**
* Called after every each bean is fetched and loaded from the database. You
* can override this to derive some information to set to the bean.
*/
void postLoad(Object bean, Set<String> includedProperties);
}
@@ -1,101 +1,101 @@
package com.avaje.ebean.event;
import java.util.Set;
import com.avaje.ebean.config.ServerConfig;
/**
* Listens for committed bean events.
* <p>
* These listen events occur after a successful commit. They also occur in a
* background thread rather than the thread used to perform the actual insert
* update or delete. In this way there is a delay between the commit and when
* the listener is notified of the event.
* </p>
* <p>
* For a cluster these events may need to be broadcast. Each of the inserted(),
* updated() and deleted() methods return true if you want those events to be
* broadcast to the other members of a cluster (the id values are broadcast). If
* these methods return false then the events are not broadcast.
* </p>
* <p>
* It is worth noting that BeanPersistListener is different in three main ways
* from BeanPersistController postXXX methods.
* <ul>
* <li>BeanPersistListener only sees successfully committed events.
* BeanPersistController pre and post methods occur before the commit or a
* rollback and will see events that are later rolled back</li>
* <li>BeanPersistListener runs in a background thread and will not effect the
* response time of the actual persist where as BeanPersistController code will</li>
* <li>BeanPersistListener can be notified of events from other servers in a
* cluster.</li>
* </ul>
* </p>
* <p>
* A BeanPersistListener is either found automatically via class path search or
* can be added programmatically via {@link ServerConfig#add(BeanPersistListener)}}.
* </p>
* @see ServerConfig#add(BeanPersistListener)
*/
public interface BeanPersistListener {
/**
* Return true if this BeanPersistListener should be registered for events
* on this entity type.
*/
boolean isRegisterFor(Class<?> cls);
/**
* Notified that a bean has been inserted locally. Return true if you want the
* cluster to be notified of the event.
*
* @param bean
* The bean that was inserted.
*/
boolean inserted(Object bean);
/**
* Notified that a bean has been updated locally. Return true if you want the
* cluster to be notified of the event.
*
* @param bean
* The bean that was updated.
* @param updatedProperties
* The properties that were modified by this update.
*/
boolean updated(Object bean, Set<String> updatedProperties);
/**
* Notified that a bean has been deleted locally. Return true if you want the
* cluster to be notified of the event.
*
* @param bean
* The bean that was deleted.
*/
boolean deleted(Object bean);
/**
* Notify that a bean was inserted on another node of the cluster.
*
* @param id
* the id value of the inserted bean
*/
void remoteInsert(Object id);
/**
* Notify that a bean was updated on another node of the cluster.
*
* @param id
* the id value of the updated bean.
*/
void remoteUpdate(Object id);
/**
* Notify that a bean was deleted on another node of the cluster.
*
* @param id
* the id value of the deleted bean.
*/
void remoteDelete(Object id);
}
package com.avaje.ebean.event;
import java.util.Set;
import com.avaje.ebean.config.ServerConfig;
/**
* Listens for committed bean events.
* <p>
* These listen events occur after a successful commit. They also occur in a
* background thread rather than the thread used to perform the actual insert
* update or delete. In this way there is a delay between the commit and when
* the listener is notified of the event.
* </p>
* <p>
* For a cluster these events may need to be broadcast. Each of the inserted(),
* updated() and deleted() methods return true if you want those events to be
* broadcast to the other members of a cluster (the id values are broadcast). If
* these methods return false then the events are not broadcast.
* </p>
* <p>
* It is worth noting that BeanPersistListener is different in three main ways
* from BeanPersistController postXXX methods.
* <ul>
* <li>BeanPersistListener only sees successfully committed events.
* BeanPersistController pre and post methods occur before the commit or a
* rollback and will see events that are later rolled back</li>
* <li>BeanPersistListener runs in a background thread and will not effect the
* response time of the actual persist where as BeanPersistController code will</li>
* <li>BeanPersistListener can be notified of events from other servers in a
* cluster.</li>
* </ul>
* </p>
* <p>
* A BeanPersistListener is either found automatically via class path search or
* can be added programmatically via {@link ServerConfig#add(BeanPersistListener)}}.
* </p>
* @see ServerConfig#add(BeanPersistListener)
*/
public interface BeanPersistListener {
/**
* Return true if this BeanPersistListener should be registered for events
* on this entity type.
*/
boolean isRegisterFor(Class<?> cls);
/**
* Notified that a bean has been inserted locally. Return true if you want the
* cluster to be notified of the event.
*
* @param bean
* The bean that was inserted.
*/
boolean inserted(Object bean);
/**
* Notified that a bean has been updated locally. Return true if you want the
* cluster to be notified of the event.
*
* @param bean
* The bean that was updated.
* @param updatedProperties
* The properties that were modified by this update.
*/
boolean updated(Object bean, Set<String> updatedProperties);
/**
* Notified that a bean has been deleted locally. Return true if you want the
* cluster to be notified of the event.
*
* @param bean
* The bean that was deleted.
*/
boolean deleted(Object bean);
/**
* Notify that a bean was inserted on another node of the cluster.
*
* @param id
* the id value of the inserted bean
*/
void remoteInsert(Object id);
/**
* Notify that a bean was updated on another node of the cluster.
*
* @param id
* the id value of the updated bean.
*/
void remoteUpdate(Object id);
/**
* Notify that a bean was deleted on another node of the cluster.
*
* @param id
* the id value of the deleted bean.
*/
void remoteDelete(Object id);
}
@@ -1,41 +1,41 @@
package com.avaje.ebean.event;
import com.avaje.ebean.config.ServerConfig;
/**
* Objects extending this modify queries prior their execution.
* <p>
* This can be used to add expressions to a query - for example to enable
* partitioning based on the user executing the query.
* </p>
* <p>
* A BeanQueryAdapter is either found automatically via class path search or can
* be added programmatically via {@link ServerConfig#add(BeanQueryAdapter)}.
* </p>
* <p>
* Note that a BeanQueryAdapter should be thread safe (stateless) and if
* registered automatically via class path search it needs to have a default
* constructor.
* </p>
*/
public interface BeanQueryAdapter {
/**
* Return true if this adapter is interested in queries for the given entity
* type.
*/
boolean isRegisterFor(Class<?> cls);
/**
* Returns an int to to control the order in which BeanQueryAdapter are
* executed when there is multiple of them registered for a given entity type
* (class).
*/
int getExecutionOrder();
/**
* Modify the associated query prior to it being executed.
*/
void preQuery(BeanQueryRequest<?> request);
}
package com.avaje.ebean.event;
import com.avaje.ebean.config.ServerConfig;
/**
* Objects extending this modify queries prior their execution.
* <p>
* This can be used to add expressions to a query - for example to enable
* partitioning based on the user executing the query.
* </p>
* <p>
* A BeanQueryAdapter is either found automatically via class path search or can
* be added programmatically via {@link ServerConfig#add(BeanQueryAdapter)}.
* </p>
* <p>
* Note that a BeanQueryAdapter should be thread safe (stateless) and if
* registered automatically via class path search it needs to have a default
* constructor.
* </p>
*/
public interface BeanQueryAdapter {
/**
* Return true if this adapter is interested in queries for the given entity
* type.
*/
boolean isRegisterFor(Class<?> cls);
/**
* Returns an int to to control the order in which BeanQueryAdapter are
* executed when there is multiple of them registered for a given entity type
* (class).
*/
int getExecutionOrder();
/**
* Modify the associated query prior to it being executed.
*/
void preQuery(BeanQueryRequest<?> request);
}
@@ -1,30 +1,30 @@
package com.avaje.ebean.event;
/**
* The bulk table event.
*
* @author Robin Bygrave
*/
public interface BulkTableEvent {
/**
* Return the name of the table that was involved.
*/
String getTableName();
/**
* Return true if rows were inserted.
*/
boolean isInsert();
/**
* Return true if rows were updated.
*/
boolean isUpdate();
/**
* Return true if rows were deleted.
*/
boolean isDelete();
}
package com.avaje.ebean.event;
/**
* The bulk table event.
*
* @author Robin Bygrave
*/
public interface BulkTableEvent {
/**
* Return the name of the table that was involved.
*/
String getTableName();
/**
* Return true if rows were inserted.
*/
boolean isInsert();
/**
* Return true if rows were updated.
*/
boolean isUpdate();
/**
* Return true if rows were deleted.
*/
boolean isDelete();
}
@@ -1,30 +1,30 @@
package com.avaje.ebean.event;
import java.util.Set;
import com.avaje.ebean.Ebean;
/**
* Listen for bulk table events that occur.
* <p>
* These events can be triggered via
* {@link Ebean#externalModification(String, boolean, boolean, boolean)} or
* automatically determined from Ebean bulk update statements.
* </p>
*
* @author Robin Bygrave
*
*/
public interface BulkTableEventListener {
/**
* Return the tables that this listener is interested in.
*/
Set<String> registeredTables();
/**
* Process the event.
*/
void process(BulkTableEvent bulkTableEvent);
}
package com.avaje.ebean.event;
import java.util.Set;
import com.avaje.ebean.Ebean;
/**
* Listen for bulk table events that occur.
* <p>
* These events can be triggered via
* {@link Ebean#externalModification(String, boolean, boolean, boolean)} or
* automatically determined from Ebean bulk update statements.
* </p>
*
* @author Robin Bygrave
*
*/
public interface BulkTableEventListener {
/**
* Return the tables that this listener is interested in.
*/
Set<String> registeredTables();
/**
* Process the event.
*/
void process(BulkTableEvent bulkTableEvent);
}
@@ -1,21 +1,21 @@
package com.avaje.ebean.event;
import com.avaje.ebean.config.ServerConfig;
/**
* Used to configure the server on startup.
* <p>
* Provides a simple way to construct and register multiple listeners and
* adapters that need shared services without using DI.
* </p>
*
* @author Robin Bygrave
*/
public interface ServerConfigStartup {
/**
* On starting configure the ServerConfig.
*/
void onStart(ServerConfig serverConfig);
}
package com.avaje.ebean.event;
import com.avaje.ebean.config.ServerConfig;
/**
* Used to configure the server on startup.
* <p>
* Provides a simple way to construct and register multiple listeners and
* adapters that need shared services without using DI.
* </p>
*
* @author Robin Bygrave
*/
public interface ServerConfigStartup {
/**
* On starting configure the ServerConfig.
*/
void onStart(ServerConfig serverConfig);
}
@@ -1,18 +1,18 @@
package com.avaje.ebean.event;
import com.avaje.ebean.Transaction;
/**
* Used to get notified about commit or rollback of a transaction
*/
public interface TransactionEventListener {
/**
* Called after the transaction has been committed
*/
void postTransactionCommit(Transaction tx);
/**
* Called after the transaction has been rolled back
*/
void postTransactionRollback(Transaction tx, Throwable cause);
}
package com.avaje.ebean.event;
import com.avaje.ebean.Transaction;
/**
* Used to get notified about commit or rollback of a transaction
*/
public interface TransactionEventListener {
/**
* Called after the transaction has been committed
*/
void postTransactionCommit(Transaction tx);
/**
* Called after the transaction has been rolled back
*/
void postTransactionRollback(Transaction tx, Throwable cause);
}
@@ -1,18 +1,18 @@
package com.avaje.ebean.event;
import com.avaje.ebean.Transaction;
/**
* A no operation implementation of TransactionEventListener. Objects extending
* this need to only override the methods they want to.
*/
public abstract class TransactionEventListenerAdapter implements TransactionEventListener {
public void postTransactionCommit(Transaction tx) {
// do nothing by default
}
public void postTransactionRollback(Transaction tx, Throwable cause) {
// do nothing by default
}
}
package com.avaje.ebean.event;
import com.avaje.ebean.Transaction;
/**
* A no operation implementation of TransactionEventListener. Objects extending
* this need to only override the methods they want to.
*/
public abstract class TransactionEventListenerAdapter implements TransactionEventListener {
public void postTransactionCommit(Transaction tx) {
// do nothing by default
}
public void postTransactionRollback(Transaction tx, Throwable cause) {
// do nothing by default
}
}