|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.entityfs.cap.entityattrs.ntfs.metadata.MetadataNtfsAttributesCapabilityProvider
public class MetadataNtfsAttributesCapabilityProvider
This capability provider makes the entities in the file system (except for
the root directory) support the ECNtfsAttributes
capability. The
entity attributes for an entity are kept in a named metadata file called
ntfsattrs.dat
in its parent directory, so this capability requires
that the file system supports 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)
.
The capability can try to set the ownership attributes (UID and GID) of new
entities when they are created. If the thread creating an entity has a
Subject
that is an
UidGidSubject
, that Subject
is set
as the owner of the new entity, otherwise the entity is set to be owned by
the default UID and GID (see setDefaultAttributesFactories(Map)
,
setDefaultUid(int)
and setDefaultGid(int)
). Ownership
setting is enabled by default, but can be disabled by calling
setSetEntityOwnership(boolean)
.
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.
The capability implementation does not honor the read only NTFS attribute. Clients must implement their own support for that if they need it.
For generic information about EntityAttributes
capabilities, see the
ECEntityAttributes
documentation.
Constructor Summary | |
---|---|
MetadataNtfsAttributesCapabilityProvider()
|
Method Summary | |
---|---|
Map<EntityType,ObjectFactory<NtfsAttributes>> |
getDefaultAttributesFactories()
Get (a copy of) the map containing default attributes factories for each entity type. |
int |
getDefaultGid()
Get the GID to set on a new entity if the ownership attributes should be set on new entities and the GID of the current Subject cannot be determined. |
int |
getDefaultUid()
Get the UID to set on a new entity if the ownership attributes should be set on new entities and the UID of the current Subject cannot be determined. |
boolean |
isReadOnlyFileSystemSupported()
|
boolean |
isReadWriteFileSystemSupported()
|
boolean |
isSetEntityOwnership()
Are the ownership attributes (UID and GID) set on new entities? |
AdapterFactory |
proxyAdapterFactory(AdapterFactory af,
LogAdapterHolder lah)
This is called to let the capability provider proxy the file system's adapter factory before the file system is created. |
FileSystemDelegate |
proxyFileSystemDelegate(FileSystemDelegate fsd,
SupportObjects so,
boolean readOnly)
This is used when creating the file system to let the capability provider proxy the file system delegate. |
DirectoryDelegate |
proxyRootDirectoryDelegate(FileSystemImplementation fs,
FileSystemDelegate fsd,
DirectoryDelegate dd,
LogAdapterHolder lah)
This is used when creating a file system to let the capability provider proxy the root directory delegate. |
MetadataNtfsAttributesCapabilityProvider |
setDefaultAttributesFactories(Map<EntityType,? extends ObjectFactory<NtfsAttributes>> m)
Set the default NTFS attributes factories. |
MetadataNtfsAttributesCapabilityProvider |
setDefaultAttributesFactory(EntityType et,
ObjectFactory<NtfsAttributes> f)
Set the default NTFS attributes factory for the specified entity type. |
MetadataNtfsAttributesCapabilityProvider |
setDefaultGid(int gid)
Set the default GID to set if the ownership attributes should be set on new entities and the GID of the current Subject cannot be determined. |
MetadataNtfsAttributesCapabilityProvider |
setDefaultUid(int uid)
Set the default UID to set if the ownership attributes should be set on new entities and the UID of the current Subject cannot be determined. |
MetadataNtfsAttributesCapabilityProvider |
setSetEntityOwnership(boolean b)
Should the ownership attributes (UID and GID) be set on new entities? This is enabled by default. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MetadataNtfsAttributesCapabilityProvider()
Method Detail |
---|
public MetadataNtfsAttributesCapabilityProvider setSetEntityOwnership(boolean b)
b
- Should the ownership attributes be set on new entities?
this
.public boolean isSetEntityOwnership()
true
if the ownership attributes are set on new entities.public MetadataNtfsAttributesCapabilityProvider setDefaultUid(int uid) throws IllegalArgumentException
Subject
cannot be determined.
Any value set here takes precedence over whatever set by the default attributes factory.
uid
- The default owner UID for new entities. This is an integer
equal to or greater than zero.
this
IllegalArgumentException
- If the UID is invalid.setDefaultAttributesFactories(Map)
,
setSetEntityOwnership(boolean)
,
setDefaultGid(int)
public int getDefaultUid()
Subject
cannot be determined.
public MetadataNtfsAttributesCapabilityProvider setDefaultGid(int gid) throws IllegalArgumentException
Subject
cannot be determined.
Any value set here takes precedence over whatever set by the default attributes factory.
gid
- The default owner GID for new entities. This is an integer
equal to or greater than zero.
this
IllegalArgumentException
- If the GID is invalid.setDefaultAttributesFactories(Map)
,
setSetEntityOwnership(boolean)
,
setDefaultUid(int)
public int getDefaultGid()
Subject
cannot be determined.
public MetadataNtfsAttributesCapabilityProvider setDefaultAttributesFactory(EntityType et, ObjectFactory<NtfsAttributes> f)
The default default attribute factory for files gives files the
UnixEntityMode
0640
. The factory for directories gives
directories the UnixEntityMode
0750
.
et
- The entity type.f
- The default attributes factory.
this
setDefaultAttributesFactories(Map)
public MetadataNtfsAttributesCapabilityProvider setDefaultAttributesFactories(Map<EntityType,? extends ObjectFactory<NtfsAttributes>> m)
The default default attribute factory for files gives files the
UnixEntityMode
0640
. The factory for directories gives
directories the UnixEntityMode
0750
.
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<NtfsAttributes>> getDefaultAttributesFactories()
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 |