org.entityfs.cap.entityattrs.ntfs.util
Class ECNtfsAttributesUtil

java.lang.Object
  extended by org.entityfs.cap.entityattrs.ntfs.util.ECNtfsAttributesUtil

public final class ECNtfsAttributesUtil
extends Object

This class contains static utility methods for working with the ECNtfsAttributes capability.

Since:
1.0
Author:
Karl Gustafsson
In_jar:
entityfs-entity_attributes

Method Summary
static NtfsAttributes getAttributes(EntityView ev)
          Get NTFS attributes for an entity.
static ECNtfsAttributes getCapability(EntityView ev)
          Get the ECNtfsAttributes capability for an entity.
static long getCreationTime(EntityView ev)
          Get the creation time attribute.
static Set<NtFileAttributes> getNtFileAttributes(EntityView ev)
          Get the NT file attributes for the entity.
static UidGid getUidGid(EntityView ev)
          Get the user and group id attributes for the entity.
static UnixEntityMode getUnixEntityMode(EntityView ev)
          Get the Unix entity permission mode for the entity.
static void setAttributes(EntityView ev, NtfsAttributes attr)
          Set the NTFS attributes for an entity.
static void setCreationTime(EntityView ev, long creationTime)
          Set the creation time attribute.
static void setGid(EntityView ev, int gid)
          Set the group id attribute for the entity.
static void setNtFileAttributes(EntityView ev, int fattr)
          Set the NT file attributes for an entity.
static void setNtFileAttributes(EntityView ev, Set<NtFileAttributes> s)
          Set the NT file attributes for an entity.
static void setUid(EntityView ev, int uid)
          Set the user id attribute for the entity.
static void setUidGid(EntityView ev, UidGid ug)
          Set the user and group id attributes for the entity.
static void setUnixEntityMode(EntityView ev, int mode)
          Set the Unix entity permission mode for the entity.
static void setUnixEntityMode(EntityView ev, UnixEntityMode m)
          Set the Unix entity permission mode for the entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCapability

public static ECNtfsAttributes getCapability(EntityView ev)
                                      throws UnsupportedCapabilityException
Get the ECNtfsAttributes capability for an entity.

Some implementations do not support entity attributes for all entities in a file system. Often, the root directory is not supported.

Parameters:
ev - The entity.
Returns:
The capability.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.

getAttributes

public static NtfsAttributes getAttributes(EntityView ev)
                                    throws UnsupportedCapabilityException,
                                           AccessDeniedException
Get NTFS attributes for an entity.

This method temporarily acquires a read lock on the entity's parent directory.

Parameters:
ev - The entity to get the attributes for.
Returns:
The NTFS attributes for the entity.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.
AccessDeniedException - If the client does not have read access to the entity's parent directory.
Permissions_required:
Execute access to the entity's parent directory.

setAttributes

public static void setAttributes(EntityView ev,
                                 NtfsAttributes attr)
                          throws UnsupportedCapabilityException,
                                 AccessDeniedException,
                                 ReadOnlyException
Set the NTFS attributes for an entity.

This method temporarily acquires a write lock on the entity's parent directory.

Parameters:
ev - The entity to set the attributes for.
attr - The attributes.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.
AccessDeniedException - If the client does not have write access to the entity's parent directory.
ReadOnlyException - If the file system is read only.
Permissions_required:
Write and execute access to the entity's parent directory.

getCreationTime

public static long getCreationTime(EntityView ev)
                            throws UnsupportedCapabilityException,
                                   AccessDeniedException
Get the creation time attribute.

The entity's parent directory is temporarily locked for reading by this method.

Parameters:
ev - The entity to get the creation time for.
Returns:
The value of the creation time attribute.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.
AccessDeniedException - If the client does not have read access to the entity's parent directory.
See Also:
setCreationTime(EntityView, long)
Permissions_required:
Execute access to the entity's parent directory.

setCreationTime

public static void setCreationTime(EntityView ev,
                                   long creationTime)
                            throws UnsupportedCapabilityException,
                                   AccessDeniedException,
                                   ReadOnlyException
Set the creation time attribute.

The entity's parent directory is temporarily locked for writing by this method.

Parameters:
ev - The entity to set the creation time for.
creationTime - The new value of the creation time attribute.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.
AccessDeniedException - If the client does not have write access to the entity's parent directory.
ReadOnlyException - If the file system is read only.
See Also:
getCreationTime(EntityView)
Permissions_required:
Write and execute access to the entity's parent directory.

getNtFileAttributes

public static Set<NtFileAttributes> getNtFileAttributes(EntityView ev)
                                                 throws UnsupportedCapabilityException,
                                                        AccessDeniedException
Get the NT file attributes for the entity.

The entity's parent directory is temporarily locked for reading by this method.

Parameters:
ev - The entity to get the NT file attributes for.
Returns:
The NT file attributes for the entity.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.
AccessDeniedException - If the client does not have read access to the entity's parent directory.
See Also:
setNtFileAttributes(EntityView, int), setNtFileAttributes(EntityView, Set)
Permissions_required:
Execute access to the entity's parent directory.

setNtFileAttributes

public static void setNtFileAttributes(EntityView ev,
                                       Set<NtFileAttributes> s)
                                throws UnsupportedCapabilityException,
                                       AccessDeniedException,
                                       ReadOnlyException
Set the NT file attributes for an entity.

The entity's parent directory is temporarily locked for writing by this method.

Parameters:
ev - The entity to set the NT file attributes for.
s - The attributes.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.
AccessDeniedException - If the client does not have write access to the entity's parent directory.
ReadOnlyException - If the file system is read only.
See Also:
getNtFileAttributes(EntityView), setNtFileAttributes(EntityView, int)
Permissions_required:
Write and execute access to the entity's parent directory.

setNtFileAttributes

public static void setNtFileAttributes(EntityView ev,
                                       int fattr)
                                throws UnsupportedCapabilityException,
                                       AccessDeniedException,
                                       ReadOnlyException
Set the NT file attributes for an entity.

The entity's parent directory is temporarily locked for writing by this method.

Parameters:
ev - The entity to set the NT file attributes for.
fattr - The attributes, represented by an integer. See NtFileAttributes.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.
AccessDeniedException - If the client does not have write access to the entity's parent directory.
ReadOnlyException - If the file system is read only.
See Also:
getNtFileAttributes(EntityView), setNtFileAttributes(EntityView, Set)
Permissions_required:
Write and execute access to the entity's parent directory.

getUnixEntityMode

public static UnixEntityMode getUnixEntityMode(EntityView ev)
                                        throws UnsupportedCapabilityException,
                                               AccessDeniedException
Get the Unix entity permission mode for the entity.

The entity's parent directory is temporarily locked for reading by this method.

Parameters:
ev - The entity to get the Unix entity permission mode for.
Returns:
The Unix entity permission mode.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.
AccessDeniedException - If the client does not have read access to the entity's parent directory.
See Also:
setUnixEntityMode(EntityView, int), setUnixEntityMode(EntityView, UnixEntityMode)
Permissions_required:
Execute access to the entity's parent directory.

setUnixEntityMode

public static void setUnixEntityMode(EntityView ev,
                                     UnixEntityMode m)
                              throws UnsupportedCapabilityException,
                                     AccessDeniedException,
                                     ReadOnlyException
Set the Unix entity permission mode for the entity.

The entity's parent directory is temporarily locked for writing by this method.

Parameters:
ev - The entity to set the Unix entity permission mode for.
m - The new Unix entity permission mode.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.
AccessDeniedException - If the client does not have write access to the entity's parent directory.
ReadOnlyException - If the file system is read only.
See Also:
getUnixEntityMode(EntityView), setUnixEntityMode(EntityView, int)
Permissions_required:
Write and execute access to the entity's parent directory.

setUnixEntityMode

public static void setUnixEntityMode(EntityView ev,
                                     int mode)
                              throws UnsupportedCapabilityException,
                                     AccessDeniedException,
                                     ReadOnlyException
Set the Unix entity permission mode for the entity.

The entity's parent directory is temporarily locked for writing by this method.

Parameters:
ev - The entity to set the Unix entity permission mode for.
mode - Integer representation of the new Unix entity permission mode. See UnixEntityMode.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.
AccessDeniedException - If the client does not have write access to the entity's parent directory.
ReadOnlyException - If the file system is read only.
See Also:
getUnixEntityMode(EntityView), setUnixEntityMode(EntityView, UnixEntityMode)
Permissions_required:
Write and execute access to the entity's parent directory.

getUidGid

public static UidGid getUidGid(EntityView ev)
                        throws UnsupportedCapabilityException,
                               AccessDeniedException
Get the user and group id attributes for the entity.

The entity's parent directory is temporarily locked for reading by this method.

Parameters:
ev - The entity to get the UID and GID for.
Returns:
The UID and GID attributes.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.
AccessDeniedException - If the client does not have read access to the entity's parent directory.
See Also:
setUidGid(EntityView, UidGid), setUid(EntityView, int), setGid(EntityView, int)
Permissions_required:
Execute access to the entity's parent directory.

setUidGid

public static void setUidGid(EntityView ev,
                             UidGid ug)
                      throws UnsupportedCapabilityException,
                             AccessDeniedException,
                             ReadOnlyException
Set the user and group id attributes for the entity.

The entity's parent directory is temporarily locked for writing by this method.

Parameters:
ev - The entity to set the UID and GID attributes for.
ug - The new UID and GID values. The UidGid:s primary GID is used for the GID value.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.
AccessDeniedException - If the client does not have write access to the entity's parent directory.
ReadOnlyException - If the file system is read only.
See Also:
getUidGid(EntityView), setUid(EntityView, int), setGid(EntityView, int)
Permissions_required:
Write and execute access to the entity's parent directory.

setUid

public static void setUid(EntityView ev,
                          int uid)
                   throws UnsupportedCapabilityException,
                          AccessDeniedException,
                          ReadOnlyException
Set the user id attribute for the entity.

The entity's parent directory is temporarily locked for writing by this method.

Parameters:
ev - The entity to set the UID attribute for.
uid - The new UID.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.
AccessDeniedException - If the client does not have write access to the entity's parent directory.
ReadOnlyException - If the file system is read only.
See Also:
getUidGid(EntityView), setUidGid(EntityView, UidGid), setGid(EntityView, int)
Permissions_required:
Write and execute access to the entity's parent directory.

setGid

public static void setGid(EntityView ev,
                          int gid)
                   throws UnsupportedCapabilityException,
                          AccessDeniedException,
                          ReadOnlyException
Set the group id attribute for the entity.

The entity's parent directory is temporarily locked for writing by this method.

Parameters:
ev - The entity to set the GID attribute for.
gid - The new GID.
Throws:
UnsupportedCapabilityException - If the entity does not support the ECNtfsAttributes capability.
AccessDeniedException - If the client does not have write access to the entity's parent directory.
ReadOnlyException - If the file system is read only.
See Also:
getUidGid(EntityView), setUidGid(EntityView, UidGid), setUid(EntityView, int)
Permissions_required:
Write and execute access to the entity's parent directory.