edu.sdsc.grid.io.local
Class LocalFileSystem

java.lang.Object
  extended by edu.sdsc.grid.io.GeneralFileSystem
      extended by edu.sdsc.grid.io.local.LocalFileSystem
All Implemented Interfaces:
java.lang.Cloneable

public class LocalFileSystem
extends GeneralFileSystem

The LocalFileSystem class is the class for connection implementations to the local file systems. It was added to the GeneralFileSystem tree to provide compatibility and support for remote metadata queries. Unfortuanely, local filesystems cannot actually be queried.


Field Summary
 
Fields inherited from class edu.sdsc.grid.io.GeneralFileSystem
account, DEBUG, PATH_SEPARATOR, roots
 
Constructor Summary
LocalFileSystem()
          Opens a socket connection to read from and write to.
LocalFileSystem(LocalAccount localAccount)
          Opens a socket connection to read from and write to.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Tests this filesystem object for equality with the given object.
 java.lang.String[] getRootDirectories()
          Returns the root directories of the local file system.
 MetaDataRecordList[] query(MetaDataCondition[] conditions, MetaDataSelect[] selects)
          Queries the file system to find all files that match a set of conditions.
 MetaDataRecordList[] query(MetaDataCondition[] conditions, MetaDataSelect[] selects, int recordsWanted)
          Queries the file system to find all files that match a set of conditions.
protected  void setAccount(GeneralAccount account)
          Sets the account object.
 
Methods inherited from class edu.sdsc.grid.io.GeneralFileSystem
clone, finalize, getAccount, getHomeDirectory, toString
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalFileSystem

public LocalFileSystem()
Opens a socket connection to read from and write to. Loads the default Local user account information from their home directory. The account information stored in this object cannot be changed once constructed.

This constructor is provided for convenience however, it is recommended that all necessary data be sent to the constructor and not left to the defaults.

Throws:
java.io.FileNotFoundException - if the user data file cannot be found.
java.io.IOException - if an IOException occurs.

LocalFileSystem

public LocalFileSystem(LocalAccount localAccount)
Opens a socket connection to read from and write to. Opens the account held in the LocalAccount object. The account information stored in this object cannot be changed once constructed.

This constructor is provided for convenience however, it is recommended that all necessary data be sent to the constructor and not left to the defaults.

Parameters:
localAccount - the Local account information object.
Throws:
java.io.FileNotFoundException - if the user data file cannot be found.
java.io.IOException - if an IOException occurs.
Method Detail

setAccount

protected void setAccount(GeneralAccount account)
Sets the account object.

Specified by:
setAccount in class GeneralFileSystem

getRootDirectories

public java.lang.String[] getRootDirectories()
Returns the root directories of the local file system.

Specified by:
getRootDirectories in class GeneralFileSystem

query

public MetaDataRecordList[] query(MetaDataCondition[] conditions,
                                  MetaDataSelect[] selects)
                           throws java.io.IOException
Queries the file system to find all files that match a set of conditions. For all those that match, the fields indicated in the select array are returned in the result object.

Specified by:
query in class GeneralFileSystem
Throws:
java.io.IOException

query

public MetaDataRecordList[] query(MetaDataCondition[] conditions,
                                  MetaDataSelect[] selects,
                                  int recordsWanted)
                           throws java.io.IOException
Queries the file system to find all files that match a set of conditions. For all those that match, the fields indicated in the select array are returned in the result object.

While condition and select array objects have all been checked for self-consistency during their construction, there are additional problems that must be detected at query time:

For instance, it is possible to build a condition object appropriate for the Local system, then pass that object in a local file system query. That will find that the condition is incompatible and generate a mismatch exception.

Query is implemented by the file-system-specific classes, like that for the SRB, FTP, etc. Those classes must re-map condition and select field names and operator codes to those required by a particular file system and protocol version. Once re-mapped, they issue the query and get results. The results are then mapped back to the standard public field names of the MetaDataGroups. So, if a MetaDataGroup uses a name like "file path", but the SRB calls it "data name", then query maps first from "file path" to "data name" before issuing the query, and then from "data name" back to "file path" within the results. The programmer using this API should never see the internal field names.

Specified by:
query in class GeneralFileSystem
Parameters:
conditionArray - The conditional statements that describe the values to query the system, like WHERE in SQL.
selectArray - The attributes to be returned from those values that met the conditions, like SELECT in SQL.
Throws:
java.io.IOException

equals

public boolean equals(java.lang.Object obj)
Tests this filesystem object for equality with the given object. Returns true if and only if the argument is not null and both are filesystem objects connected to the same filesystem using the same account information.

Specified by:
equals in class GeneralFileSystem
Parameters:
obj - The object to be compared with this abstract pathname
Returns:
true if and only if the objects are the same; false otherwise