|
Prevayler™
The Free Software Prevalence Layer |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.prevayler.PrevaylerFactory
Provides easy access to all Prevayler configurations and implementations available in this distribution.
Static methods are also provided as short-cuts for the most common configurations.
By default, the Prevayler instances created by this class will write their Transactions to .transactionLog files before executing them. The FileDescriptor.sync() method is called to make sure the Java file write-buffers have been written to the operating system. Many operating systems, including most recent versions of Linux and Windows, allow the hard-drive's write-cache to be disabled. This guarantees no executed Transaction will be lost in the event of a power shortage, for example.
Also by default, the Prevayler instances created by this class will filter out all Transactions that would throw a RuntimeException or Error if executed on the Prevalent System. This requires enough RAM to hold another copy of the prevalent system.
Prevayler
Field Summary | |
static int |
DEFAULT_REPLICATION_PORT
|
Constructor Summary | |
PrevaylerFactory()
|
Method Summary | |
void |
configureClock(Clock clock)
Configures the Clock that will be used by the created Prevayler. |
void |
configurePrevalenceBase(java.lang.String prevalenceBase)
Configures the directory where the created Prevayler will read and write its .transactionLog and .snapshot files. |
void |
configurePrevalentSystem(java.lang.Object newPrevalentSystem)
Configures the prevalent system that will be used by the Prevayler created by this factory. |
void |
configureReplicationClient(java.lang.String remoteServerIpAddress,
int remoteServerPort)
Reserved for future implementation. |
void |
configureReplicationServer(int port)
Reserved for future implementation. |
void |
configureSnapshotManager(org.prevayler.implementation.snapshot.SnapshotManager snapshotManager)
Configures the SnapshotManager to be used by the Prevayler created by this factory. |
void |
configureTransactionFiltering(boolean transactionFiltering)
Determines whether the Prevayler created by this factory should filter out all Transactions that would throw a RuntimeException or Error if executed on the Prevalent System (default is true). |
void |
configureTransactionLogFileAgeThreshold(long ageInMilliseconds)
|
void |
configureTransactionLogFileSizeThreshold(long sizeInBytes)
|
void |
configureTransientMode(boolean transientMode)
Determines whether the Prevayler created by this factory should be transient (transientMode = true) or persistent (transientMode = false). |
Prevayler |
create()
Returns a Prevayler created according to what was defined by calls to the configuration methods above. |
static Prevayler |
createCheckpointPrevayler(java.io.Serializable newPrevalentSystem,
java.lang.String snapshotDirectory)
Creates a Prevayler that will execute Transactions WITHOUT writing them to disk. |
static Prevayler |
createPrevayler(java.io.Serializable newPrevalentSystem)
Creates a Prevayler that will use a directory called "PrevalenceBase" under the current directory to read and write its .snapshot and .transactionLog files. |
static Prevayler |
createPrevayler(java.io.Serializable newPrevalentSystem,
java.lang.String prevalenceBase)
Creates a Prevayler that will use the given prevalenceBase directory to read and write its .snapshot and .transactionLog files. |
static Prevayler |
createTransientPrevayler(java.io.Serializable newPrevalentSystem)
Creates a Prevayler that will execute Transactions WITHOUT writing them to disk. |
static Prevayler |
createTransientPrevayler(java.io.Serializable newPrevalentSystem,
java.lang.String snapshotDirectory)
Deprecated. Use createCheckpointPrevayler() instead of this method. Deprecated since Prevayler2.00.001. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DEFAULT_REPLICATION_PORT
Constructor Detail |
public PrevaylerFactory()
Method Detail |
public static Prevayler createPrevayler(java.io.Serializable newPrevalentSystem) throws java.io.IOException, java.lang.ClassNotFoundException
newPrevalentSystem
- The newly started, "empty" prevalent system that will be used as a starting point for every system startup, until the first snapshot is taken.
java.io.IOException
java.lang.ClassNotFoundException
public static Prevayler createPrevayler(java.io.Serializable newPrevalentSystem, java.lang.String prevalenceBase) throws java.io.IOException, java.lang.ClassNotFoundException
newPrevalentSystem
- The newly started, "empty" prevalent system that will be used as a starting point for every system startup, until the first snapshot is taken.prevalenceBase
- The directory where the .snapshot files and .transactionLog files will be read and written.
java.io.IOException
java.lang.ClassNotFoundException
public static Prevayler createTransientPrevayler(java.io.Serializable newPrevalentSystem)
newPrevalentSystem
- The newly started, "empty" prevalent system.createCheckpointPrevayler(Serializable newPrevalentSystem, String snapshotDirectory)
public static Prevayler createTransientPrevayler(java.io.Serializable newPrevalentSystem, java.lang.String snapshotDirectory)
public static Prevayler createCheckpointPrevayler(java.io.Serializable newPrevalentSystem, java.lang.String snapshotDirectory)
newPrevalentSystem
- The newly started, "empty" prevalent system that will be used as a starting point for every system startup, until the first snapshot is taken.snapshotDirectory
- The directory where the .snapshot files will be read and written.public void configureTransientMode(boolean transientMode)
public void configureClock(Clock clock)
public void configurePrevalenceBase(java.lang.String prevalenceBase)
prevalenceBase
- Will be ignored for the .snapshot files if a SnapshotManager is configured.public void configurePrevalentSystem(java.lang.Object newPrevalentSystem)
newPrevalentSystem
- Will be ignored if a SnapshotManager is configured too because a SnapshotManager already has a prevalent system. If the default SnapshotManager is used, this prevalentSystem must be Serializable. If another SnapshotManager is used, this prevalentSystem must be compatible with it.configureSnapshotManager(SnapshotManager)
public void configureReplicationClient(java.lang.String remoteServerIpAddress, int remoteServerPort)
public void configureReplicationServer(int port)
public void configureSnapshotManager(org.prevayler.implementation.snapshot.SnapshotManager snapshotManager)
public void configureTransactionFiltering(boolean transactionFiltering)
public Prevayler create() throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
- If there is trouble creating the Prevalence Base directory or reading a .transactionLog or .snapshot file.
java.lang.ClassNotFoundException
- If a class of a serialized Object is not found when reading a .transactionLog or .snapshot file.public void configureTransactionLogFileSizeThreshold(long sizeInBytes)
public void configureTransactionLogFileAgeThreshold(long ageInMilliseconds)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |