org.gridlab.gat.io
Interface LogicalFile

All Superinterfaces:
Advertisable, Monitorable, Serializable

public interface LogicalFile
extends Monitorable, Serializable, Advertisable

An abstract representation of a set of identical physical files.

A LogicalFile is an abstract representation of a set of identical physical files. This abstraction is useful for a number of reasons. For example, if one wishes to replicate a physical file which is at one URI to a second URI. Normally, one takes all the data at the first URI and replicates it to the second URI even though the "network distance" between the first and second URI may be great. A better solution to this problem is to have a set of identical physical files distributed at different locations in "network space". If one then wishes to replicate a physical file from one URI to a second URI, GAT can then first determine which physical file is closest in "network space" to the second URI, chose that physical file as the source file, and copy it to the destination URI. Similarly, the construct of a LogicalFile allows for migrating programs to use the physical file in "network space" that is closest to its physical location.


Field Summary
static int CREATE
          create new, if logical file does not exist
static int OPEN
          open, if logical file exists
static int TRUNCATE
          create new, if logical file exists
 
Method Summary
 void addFile(File file)
          Adds the passed File instance to the set of physical files represented by this LogicalFile instance.
 void addURI(URI location)
          Adds the physical file at the passed URI to the set of physical files represented by this LogicalFile instance.
 URI getClosestURI(URI loc)
          Returns the URI with the smallest network distance to given URI.
 List<File> getFiles()
          Returns a java.util.List of File instances each of which is a File corresponding to a physical file represented by this instance.
 String getName()
          Returns the name of this logical file
 List<URI> getOrderedURIs(URI location)
          Returns a List of URIs ordered from close to less closer with respect to the given URI.
 List<URI> getURIs()
          Returns a java.util.List of URI instances each of which is the URI of a physical file represented by this instance.
 void removeFile(File file)
          Removes the passed File instance from the set of physical files represented by this LogicalFile instance.
 void removeURI(URI location)
          Removes the physical file at the passed URI from the set of physical files represented by this LogicalFile instance.
 void replicate(URI location)
          Replicates the logical file represented by this instance to the physical file specified by the passed URI.
 
Methods inherited from interface org.gridlab.gat.monitoring.Monitorable
addMetricListener, getMeasurement, getMetricDefinitionByName, getMetricDefinitions, removeMetricListener
 
Methods inherited from interface org.gridlab.gat.advert.Advertisable
marshal
 

Field Detail

OPEN

static final int OPEN
open, if logical file exists

See Also:
Constant Field Values

CREATE

static final int CREATE
create new, if logical file does not exist

See Also:
Constant Field Values

TRUNCATE

static final int TRUNCATE
create new, if logical file exists

See Also:
Constant Field Values
Method Detail

addFile

void addFile(File file)
             throws GATInvocationException,
                    IOException
Adds the passed File instance to the set of physical files represented by this LogicalFile instance.

Parameters:
file - A File instance to add to the set of physical files represented by this LogicalFile instance.
Throws:
GATInvocationException - Thrown upon problems accessing the remote instance
IOException - if an IO operation fails

addURI

void addURI(URI location)
            throws GATInvocationException,
                   IOException
Adds the physical file at the passed URI to the set of physical files represented by this LogicalFile instance.

Parameters:
location - The URI of a physical file to add to the set of physical files represented by this LogicalFile instance.
Throws:
GATInvocationException - Thrown upon problems accessing the remote instance
IOException - if an IO operation fails

removeFile

void removeFile(File file)
                throws GATInvocationException,
                       IOException
Removes the passed File instance from the set of physical files represented by this LogicalFile instance.

Parameters:
file - A File instance to remove from the set of physical files represented by this LogicalFile instance.
Throws:
GATInvocationException - Thrown upon problems accessing the remote instance
IOException - if an IO operation fails

removeURI

void removeURI(URI location)
               throws GATInvocationException,
                      IOException
Removes the physical file at the passed URI from the set of physical files represented by this LogicalFile instance.

Parameters:
location - The URI of a physical file to remove from the set of physical files represented by this LogicalFile instance.
Throws:
GATInvocationException - Thrown upon problems accessing the remote instance
IOException - if an IO operation fails

replicate

void replicate(URI location)
               throws GATInvocationException,
                      IOException
Replicates the logical file represented by this instance to the physical file specified by the passed URI.

Parameters:
location - The URI of the new physical file
Throws:
GATInvocationException - Upon non-remote IO problem
IOException - if an IO operation fails

getURIs

List<URI> getURIs()
                  throws GATInvocationException,
                         IOException
Returns a java.util.List of URI instances each of which is the URI of a physical file represented by this instance.

Returns:
The java.util.List of URIs
Throws:
GATInvocationException - Thrown upon problems accessing the remote instance
IOException - if an IO operation fails

getFiles

List<File> getFiles()
                    throws GATInvocationException,
                           IOException
Returns a java.util.List of File instances each of which is a File corresponding to a physical file represented by this instance.

Returns:
The java.util.List of URIs
Throws:
GATInvocationException - Thrown upon problems accessing the remote instance
IOException - if an IO operation fails

getClosestURI

URI getClosestURI(URI loc)
                  throws GATInvocationException
Returns the URI with the smallest network distance to given URI.

Parameters:
loc - the URI to compare with
Returns:
the URI with the smallest network distance to loc
Throws:
GATInvocationException - if the method fails.

getOrderedURIs

List<URI> getOrderedURIs(URI location)
                         throws GATInvocationException
Returns a List of URIs ordered from close to less closer with respect to the given URI.

Parameters:
location - the location that's used to determine the distance
Returns:
a List of URIs ordered from close to less closer with respect to the given URI.
Throws:
GATInvocationException

getName

String getName()
               throws GATInvocationException
Returns the name of this logical file

Returns:
the name of this logical file
Throws:
GATInvocationException