|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.entityfs.cap.entityattrs.custom.metadata.MetadataCustomAttributesCapabilityProvider<T>
public class MetadataCustomAttributesCapabilityProvider<T extends EntityAttributes>
This capability provider makes the entities in the file system (except for
the root directory) support the ECEntityAttributes
capability. Every
directory has a named metadata file that by default is called entityattrs.dat
that contains the entity attributes for all the directory's
child entities. Exactly how entity attributes are stored in the metadata file
depends on the implementation of ChildEntityAttributeManager
used.
The file system is required to support some kind of
ECNamedMetadata
capability for its
directories. The file system is also required to support the
FSCRandomAccessFiles
capability.
New entities are created with a set of default attributes created by an
EntityType
-specific factory object. See
setDefaultAttributesFactories(Map)
. An optional
EntityAttributesPreparer
can be used to prepare attributes objects
for new entities before they are stored.
If the setStoreAttributesLazily(boolean)
is set, entity attributes
are saved lazily once they differ from their default values. This requires
that the default entity attributes factories creates default attributes that
always have the same property values. If an EntityAttributesPreparer
is set with setEntityAttributesPreparer(EntityAttributesPreparer)
,
new attributes are never stored lazily.
When using this capability, make sure that the file system contents are not modified from anywhere else than through the file system and entity methods. If it is, that can leave this capability seriously confused about the file system state.
For generic information about EntityAttributes
capabilities, see the
ECEntityAttributes
documentation.
The programmer's guide have an example showing how this capability can be used.
Field Summary | |
---|---|
static String |
DEFAULT_ATTRIBUTES_FILE_NAME
The default name of the entity attributes metadata file. |
Constructor Summary | |
---|---|
MetadataCustomAttributesCapabilityProvider()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_ATTRIBUTES_FILE_NAME
setAttributesFileName(String)
,
Constant Field ValuesConstructor Detail |
---|
public MetadataCustomAttributesCapabilityProvider()
Method Detail |
---|
public MetadataCustomAttributesCapabilityProvider<T> setDefaultAttributesFactory(EntityType et, ObjectFactory<T> f)
et
- The entity type.f
- The default attributes factory.
this
setDefaultAttributesFactories(Map)
public MetadataCustomAttributesCapabilityProvider<T> setDefaultAttributesFactories(Map<EntityType,? extends ObjectFactory<T>> m)
Any previously set default attributes factories are discarded.
m
- The mapping between entity types and attribute factories. The
map should at least contain keys for the ETFile
and
ETDirectory
entity types.
this
setDefaultAttributesFactory(EntityType, ObjectFactory)
public Map<EntityType,ObjectFactory<? extends T>> getDefaultAttributesFactories()
public MetadataCustomAttributesCapabilityProvider<T> setAttributesFileName(String name)
DEFAULT_ATTRIBUTES_FILE_NAME
is used.
name
- The name of the entity attributes metadata file. This must be
a valid file name in this file system.
this
public String getAttributesFileName()
public MetadataCustomAttributesCapabilityProvider<T> setEntityAttributesPreparer(EntityAttributesPreparer<T> eap)
EntityAttributesPreparer
that is used to prepare the
entity attributes created by the default entity attributes factory (see
setDefaultAttributesFactory(EntityType, ObjectFactory)
) when a
new entity has been created.
This is optional.
eap
- The entity attributes preparer for new entities.
this
.public EntityAttributesPreparer<T> getEntityAttributesPreparer()
public MetadataCustomAttributesCapabilityProvider<T> setChildEntityAttributeManagerFactory(ChildEntityAttributeManagerFactory<T,? extends ChildEntityAttributeManager<T>> f)
ChildEntityAttributeManager
objects, one per directory, in the file system.
f
- The factory.
this
public ChildEntityAttributeManagerFactory<T,? extends ChildEntityAttributeManager<T>> getChildEntityAttributeManagerFactory()
public MetadataCustomAttributesCapabilityProvider<T> setStoreAttributesLazily(boolean b)
b
- Should attributes objects be stored lazily?
this
.public boolean isStoreAttributesLazily()
public MetadataCustomAttributesCapabilityProvider<T> setAttributesType(Class<T> c)
c
- The attributes class
this
.public Class<T> getAttributesType()
public AdapterFactory proxyAdapterFactory(AdapterFactory af, LogAdapterHolder lah)
CapabilityProviderImplementation
proxyAdapterFactory
in interface CapabilityProviderImplementation
af
- The adapter factory.lah
- The (future) file system's log adapter holder.
null
.public FileSystemDelegate proxyFileSystemDelegate(FileSystemDelegate fsd, SupportObjects so, boolean readOnly)
CapabilityProviderImplementation
This method can check that all capabilities that the capability provider
require in order to work are present in the FileSystemDelegate
to
proxy. If not, the method throws an
FileSystemConfigurationException
.
When this method is called, no owning FileSystemImplementation
is
created yet, so a call to FileSystemDelegate.getOwner()
will
return null
.
proxyFileSystemDelegate
in interface CapabilityProviderImplementation
fsd
- The file system delegate to proxy.so
- The file system's support objects. Maybe useful for
implementations of this method, maybe not.readOnly
- Is the file system read only?
fsd
or fsd
itself. Never null
.public DirectoryDelegate proxyRootDirectoryDelegate(FileSystemImplementation fs, FileSystemDelegate fsd, DirectoryDelegate dd, LogAdapterHolder lah)
CapabilityProviderImplementation
proxyRootDirectoryDelegate
in interface CapabilityProviderImplementation
fs
- The file system object.fsd
- The file system delegate created by
CapabilityProviderImplementation.proxyFileSystemDelegate(FileSystemDelegate, SupportObjects, boolean)
.dd
- The root directory delegate.
dd
or dd
itself. Never null
.public boolean isReadOnlyFileSystemSupported()
isReadOnlyFileSystemSupported
in interface CapabilityProviderImplementation
true
, always.public boolean isReadWriteFileSystemSupported()
isReadWriteFileSystemSupported
in interface CapabilityProviderImplementation
true
, always.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |