org.entityfs.util.cap.fs
Class FSCFileResolvableUtil

java.lang.Object
  extended by org.entityfs.util.cap.fs.FSCFileResolvableUtil

public final class FSCFileResolvableUtil
extends Object

This utility class contains static methods for working with file systems that support the FSCFileResolvable file system capability.

Since:
1.0
Author:
Karl Gustafsson
See Also:
FSCFileResolvable

Method Summary
static FSCFileResolvable getCapability(FileSystem fs)
          Get the capability object for the file system.
static Entity getEntityForFile(FileSystem fs, File f)
          Get the entity referenced by the java.io.File object.
static AbsoluteLocation getEntityLocationForFile(FileSystem fs, File f)
          Get the absolute entity location referenced by the java.io.File object.
static File getFileForEntity(EntityView ev)
          Get a java.io.File object that references the supplied entity.
static File getFileForFileSystemRoot(FileSystem fs)
          Get a java.io.File object that references the file system root in the backing file system.
static boolean supportsCapability(FileSystem fs)
          Check if the file system supports the FSCFileResolvable capability.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

supportsCapability

public static boolean supportsCapability(FileSystem fs)
Check if the file system supports the FSCFileResolvable capability.

Parameters:
fs - The file system
Returns:
true if the file system supports the capability, false if not.

getCapability

public static FSCFileResolvable getCapability(FileSystem fs)
                                       throws UnsupportedCapabilityException
Get the capability object for the file system.

Parameters:
fs - The file system.
Returns:
The capability object for the file system.
Throws:
UnsupportedCapabilityException - If the file system does not support the FSCFileResolvable capability.

getFileForFileSystemRoot

public static File getFileForFileSystemRoot(FileSystem fs)
                                     throws UnsupportedCapabilityException
Get a java.io.File object that references the file system root in the backing file system.

Parameters:
fs - The file system.
Returns:
A java.io.File object referencing the file system root.
Throws:
UnsupportedCapabilityException - If the file system does not support the FSCFileResolvable capability.
See Also:
FSCFileResolvable.getFileForFileSystemRoot()
Permissions_required:
None

getFileForEntity

public static File getFileForEntity(EntityView ev)
                             throws UnsupportedCapabilityException
Get a java.io.File object that references the supplied entity.

Parameters:
ev - The entity to get the File object for.
Returns:
A File object that is referencing the entity.
Throws:
UnsupportedCapabilityException - If the file system does not support the FSCFileResolvable capability.
Permissions_required:
Execute permissions for all the entity's parent directories.

getEntityLocationForFile

public static AbsoluteLocation getEntityLocationForFile(FileSystem fs,
                                                        File f)
                                                 throws UnsupportedCapabilityException,
                                                        EntityNotFoundException
Get the absolute entity location referenced by the java.io.File object. The file object must reference a location within the file system.

Parameters:
fs - The file system.
f - The file.
Returns:
The absolute entity location for the file in the file system.
Throws:
UnsupportedCapabilityException - If the file system does not support the FSCFileResolvable capability.
EntityNotFoundException - If the file does not reference a location within the file system.
See Also:
FSCFileResolvable.getEntityLocationForFile(File), getEntityForFile(FileSystem, File)
Permissions_required:
None

getEntityForFile

public static Entity getEntityForFile(FileSystem fs,
                                      File f)
                               throws UnsupportedCapabilityException,
                                      EntityNotFoundException
Get the entity referenced by the java.io.File object. The file object must reference an entity within the supplied file system.

This method will temporarily acquire read locks on all entities from the file system's root directory to the requested entity's parent directory.

Parameters:
fs - The file system.
f - The file.
Returns:
The entity referenced by the file.
Throws:
UnsupportedCapabilityException - If the file system does not support the FSCFileResolvable capability.
EntityNotFoundException - If the file does not reference an entity within the file system.
See Also:
getEntityLocationForFile(FileSystem, File)
Permissions_required:
Execute access to all directories from the file system's root directory to the entity's parent directory.