|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.entityfs.impl.AbstractFileSystemBuilder<T>
org.entityfs.impl.impl.AbstractFileSystemBuilderImpl<RamFileSystemBuilder>
org.entityfs.ram.RamFileSystemBuilder
public class RamFileSystemBuilder
This is a builder object for building read/write Ram file systems. A Ram file system keeps all file system data in-memory. It can have an optional size limit (other than the Java process' max heap space...).
File data in the Ram file system is partitioned into file segments. The default size of a file segment is 4096 bytes. A file can never occupy less space in memory than its segment size (plus other internal file data (instance variables)).
Field Summary | |
---|---|
static int |
DEFAULT_FILE_SEGMENT_SIZE_BYTES
The default file segment size is 4096 bytes. |
static long |
DEFAULT_MAX_FILE_SYSTEM_SIZE_BYTES
The default maximum file system size is -1 bytes (unlimited size). |
Fields inherited from interface org.entityfs.FileSystemBuilder |
---|
DEFAULT_BUFFER_SIZE |
Constructor Summary | |
---|---|
RamFileSystemBuilder()
Create a builder with default settings: LogAdapter : DefaultLogAdapter.DEFAULT_ADAPTER
EntityValidityControlStrategy : null (the backend is
only accessible through the file system)
|
Method Summary | |
---|---|
protected AdapterFactory |
createAdapterFactory()
Subclasses implement this to create the right AdapterFactory
implementation. |
protected ChildEntityManagerFactory<EntityImplementation> |
createDefaultChildEntityManagerFactory(FileSystemAdapter fsa,
LogAdapterHolder lah)
Create a default ChildEntityManagerFactory if none is set. |
protected FileSystemImplementation |
createFileSystem(SupportObjects fso,
FileSystemDelegate fsd)
Subclasses implement this to return a new file system instance. |
protected FileSystemDelegate |
createFileSystemDelegate(FileSystemAdapter fsa)
This method is implemented by a subclass to create the file system delegate to use. |
int |
getFileSegmentSizeBytes()
Get the Ram file segment size in bytes. |
long |
getMaxFileSystemSizeBytes()
Get the maximum size of the file system data in bytes. |
boolean |
isLockingSupported()
Does the file system being built support locking? |
protected boolean |
isReadOnly()
Subclasses implement this method to tell if the file system they are about to create is read only. |
RamFileSystemBuilder |
setFileSegmentSizeBytes(int noBytes)
Set the size of a Ram file segment. |
RamFileSystemBuilder |
setMaxFileSystemSizeBytes(long size)
Set the maximum size of the file system data in bytes. |
protected Collection<String> |
validate()
Validate that we can create a file system with the current properties. |
Methods inherited from class org.entityfs.impl.impl.AbstractFileSystemBuilderImpl |
---|
create, enableEvents, getChildEntityManagerFactory, getEventManager, isFileSystemSupportedByAllCapabilities, setChildEntityManagerFactory, setEventManager |
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_FILE_SEGMENT_SIZE_BYTES
public static final long DEFAULT_MAX_FILE_SYSTEM_SIZE_BYTES
Constructor Detail |
---|
public RamFileSystemBuilder()
LogAdapter
: DefaultLogAdapter.DEFAULT_ADAPTER
EntityValidityControlStrategy
: null
(the backend is
only accessible through the file system)
Method Detail |
---|
public RamFileSystemBuilder setFileSegmentSizeBytes(int noBytes)
noBytes
- The Ram file segment in bytes.
this
).public int getFileSegmentSizeBytes()
public RamFileSystemBuilder setMaxFileSystemSizeBytes(long size)
-1
to have "unlimited" maximum size. (The available heap space
for the Java process sets the effective limit.)
The default max file system size is set to -1
("unlimited" size).
size
- The maximum size for the file system. Set to -1
for
"unlimited" size.
this
).public long getMaxFileSystemSizeBytes()
-1
if the file system can have "unlimited" size.protected AdapterFactory createAdapterFactory()
AbstractFileSystemBuilderImpl
AdapterFactory
implementation.
This method is called from AbstractFileSystemBuilderImpl.create()
.
createAdapterFactory
in class AbstractFileSystemBuilderImpl<RamFileSystemBuilder>
AdapterFactory
implementation.protected ChildEntityManagerFactory<EntityImplementation> createDefaultChildEntityManagerFactory(FileSystemAdapter fsa, LogAdapterHolder lah)
AbstractFileSystemBuilderImpl
ChildEntityManagerFactory
if none is set.
The default implementation creates a
ChildEntityManagerFactoryImpl
. That implementation can let entity
objects be garbage collected, which is fine for file systems that are
backed by another file system, such as the FS file system or the Zip file
system. For file systems where the entities themselves contain all file
data, such as the RAM file system, another implementation must be used.
This method is called from AbstractFileSystemBuilderImpl.create()
.
createDefaultChildEntityManagerFactory
in class AbstractFileSystemBuilderImpl<RamFileSystemBuilder>
fsa
- The file system adapterlah
- The log adapter holder.
ChildEntityManagerFactory
.protected FileSystemDelegate createFileSystemDelegate(FileSystemAdapter fsa)
AbstractFileSystemBuilderImpl
This method is called from AbstractFileSystemBuilderImpl.create()
.
createFileSystemDelegate
in class AbstractFileSystemBuilderImpl<RamFileSystemBuilder>
fsa
- The file system adapter.
protected FileSystemImplementation createFileSystem(SupportObjects fso, FileSystemDelegate fsd)
AbstractFileSystemBuilderImpl
This method is called from AbstractFileSystemBuilderImpl.create()
.
createFileSystem
in class AbstractFileSystemBuilderImpl<RamFileSystemBuilder>
fso
- A collection of support objects.fsd
- The file system delegate.
protected Collection<String> validate()
AbstractFileSystemBuilder
super.validate()
).
validate
in class AbstractFileSystemBuilder<RamFileSystemBuilder>
Collection
of error messages. Can be empty but never
null
.public boolean isLockingSupported()
FileSystemBuilder
isLockingSupported
in interface FileSystemBuilder<RamFileSystemBuilder>
true
.FileSystemBuilder.enableLocking()
protected boolean isReadOnly()
AbstractFileSystemBuilderImpl
This method is called from AbstractFileSystemBuilderImpl.create()
.
isReadOnly
in class AbstractFileSystemBuilderImpl<RamFileSystemBuilder>
false
, always.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |