|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.sdsc.grid.io.GeneralFile
edu.sdsc.grid.io.RemoteFile
edu.sdsc.grid.io.srb.SRBFile
public class SRBFile
An abstract representation of file and directory pathnames on the SRB.
In the terminology of SRB, files are known as data sets. A data set is a "stream-of-bytes" entity that can be uniquely identified. For example, a file in HPSS or Unix is a data set, or a LOB stored in a SRB Vault database is a data set. Importantly, note that a data set is not a set of data objects/files. Each data set in SRB is given a unique internal identifier by SRB. A dataset is associated with a collection.
A SRB collection is a logical name given to a set of data sets. All data sets stored in SRB/MCAT are stored in some collection. A collection can have sub-collections, and hence provides a hierarchical structure. A collection in SRB/MCAT can be equated to a directory in a Unix file system. But unlike a file system, a collection is not limited to a single device (or partition). A collection is logical but the datsets grouped under a collection can be stored in heterogeneous storage devices. There is one obvious restriction, the name given to a data set in a collection or sub-collection should be unique in that collection.
This class shares many similarities with the java.io.File class:
User interfaces and operating systems use system-dependent pathname strings to name files and directories. This class presents an abstract, SRB view of hierarchical pathnames. An abstract pathname has two components:
"/"
When an abstract pathname is converted into a pathname string, each name is separated from the next by a single copy of the default separator character.
A pathname in string form may be either absolute or
relative. On construction the pathname is made absolute.
An absolute pathname is complete in that no other information is required in
order to locate the file that it denotes. A relative pathname, in contrast,
must be interpreted in terms of information taken from some other pathname.
By default the classes in the edu.sdsc.grid.io.srb package always
resolve relative pathnames against the user home directory. This directory
is named in the .MdasEnv file.
The prefix concept is used to handle root directories on the SRB is the same as for UNIX platforms.
For the SRB, the prefix of an absolute pathname is always
"/". Relative pathnames have no prefix. The abstract pathname
denoting the root directory has the prefix "/" and an empty
name sequence.
Instances of the SRBFile class are immutable; that is, once created, the abstract pathname represented by a SRBFile object will never change.
File,
GeneralFile,
RemoteFile| Field Summary | |
|---|---|
boolean |
completeDirectoryList
For list() should the entire contents be listed, or just SRBFileSystem.DEFAULT_RECORDS_WANTED in number. |
static int |
FILE_CATALOG
A SRB catalog type. |
static int |
LDAP_CATALOG
A SRB catalog type. |
static int |
MDAS_CATALOG
Default SRB catalog type. |
protected SRBFileSystem |
srbFileSystem
Holds the server object used by this srb file. |
| Fields inherited from class edu.sdsc.grid.io.GeneralFile |
|---|
BUFFER_MAX_SIZE, directory, fileName, fileSystem, PATH_SEPARATOR, PATH_SEPARATOR_CHAR, pathSeparator, pathSeparatorChar, separator, separatorChar |
| Constructor Summary | |
|---|---|
SRBFile(SRBFile parent,
java.lang.String child)
Creates a new SRBFile instance from a parent abstract
pathname and a child pathname string. |
|
SRBFile(SRBFileSystem srbFileSystem,
java.lang.String filePath)
Creates a new SRBFile instance by converting the given
pathname string into an abstract pathname. |
|
SRBFile(SRBFileSystem srbFileSystem,
java.lang.String parent,
java.lang.String child)
Creates a new SRBFile instance from a parent pathname
string and a child pathname string. |
|
SRBFile(java.net.URI uri)
Creates a new GeneralFile instance by converting the given file: URI into an abstract pathname. |
|
| Method Summary | |
|---|---|
void |
backup(java.lang.String backupResource)
Backup a data object. |
boolean |
canRead()
Tests whether the application can read the file denoted by this abstract pathname. |
boolean |
canWrite()
Tests whether the application can modify to the file denoted by this abstract pathname. |
void |
changePermissions(java.lang.String permission,
java.lang.String newUserName,
java.lang.String userMdasDomain)
Change the permissions for this SRBFile. |
void |
changePermissions(java.lang.String permission,
java.lang.String newUserName,
java.lang.String userMdasDomain,
boolean recursive)
Change the permissions for this SRBFile. |
java.lang.String |
checksum()
Checksum a SRB data file. |
java.lang.String |
checksum(boolean force)
Checksum a SRB data file. |
void |
copyFrom(GeneralFile file,
boolean forceOverwrite)
Copies this file to another file. |
void |
copyFrom(GeneralFile file,
boolean forceOverwrite,
boolean bulkCopy)
Copies this file to another file. |
void |
copyTo(GeneralFile file,
boolean forceOverwrite)
Copies this file to another file. |
void |
copyTo(GeneralFile file,
boolean forceOverwrite,
boolean bulkCopy)
Copies this file to another file. |
boolean |
createNewFile()
Atomically creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist. |
static GeneralFile |
createTempFile(java.lang.String prefix,
java.lang.String suffix,
GeneralFile directory)
Creates a new empty file in the specified directory, using the given prefix and suffix strings to generate its name. |
boolean |
delete()
Deletes the file or directory denoted by this abstract pathname. |
boolean |
delete(boolean force)
Deletes the file or directory denoted by this abstract pathname. |
void |
deleteOnExit()
Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates. |
boolean |
equals(java.lang.Object obj)
Tests this abstract pathname for equality with the given object. |
java.io.InputStream |
executeProxyCommand(java.lang.String command,
java.lang.String commandArgs)
Proxy Operation that executes a command. |
boolean |
exists()
Tests whether the file denoted by this abstract pathname exists. |
long |
fileCopyStatus()
The number of bytes transfered so far by a currently executing SRBFile.copyTo/copyFrom command. |
protected void |
finalize()
Finalizes the object by explicitly letting go of each of its internally held values. |
java.lang.String |
getCanonicalPath()
Returns the canonical pathname string of this abstract pathname. |
int |
getCatalogType()
|
java.lang.String |
getDataType()
|
GeneralFileSystem |
getFileSystem()
|
java.lang.String |
getName()
|
java.lang.String |
getPath()
|
java.lang.String |
getPathSeparator()
Deprecated. Use separator and pathSeparator |
char |
getPathSeparatorChar()
Deprecated. Use separatorChar and pathSeparatorChar |
java.lang.String |
getPermissions()
Get the permissions of the current user for this SRBFile: write, read, all, annotate or null. |
MetaDataRecordList[] |
getPermissions(boolean allUsers)
Gets all the non-null permissions of all SRB users for this SRBFile: write, read, all, annotate or null. |
int |
getReplicaNumber()
Gets the specific physical data replication refered to by this object. |
java.lang.String |
getResource()
|
java.lang.String |
getServerLocalPath()
The local filepath of the data when logged on the SRB server. |
long[] |
getStat()
Retrieves the platform independent stat structure. |
int |
hashCode()
Computes a hash code for this abstract pathname. |
boolean |
isAbsolute()
Tests whether this abstract pathname is absolute. |
boolean |
isContainer()
Tests whether the file denoted by this abstract pathname is a SRB container. |
boolean |
isDirectory()
Tests whether the file denoted by this abstract pathname is a directory. |
boolean |
isDirectory(boolean update)
Tests whether the file denoted by this abstract pathname is a directory. |
boolean |
isFile()
Tests whether the file denoted by this abstract pathname is a normal file. |
boolean |
isFile(boolean update)
Tests whether the file denoted by this abstract pathname is a file. |
boolean |
isHidden()
Tests whether the file named by this abstract pathname is a hidden file. |
long |
lastModified()
Returns the time that the file denoted by this abstract pathname was last modified. |
void |
link(SRBFile newLink)
Links newLink with this object as the source. |
java.lang.String[] |
list()
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname. |
java.lang.String[] |
list(MetaDataCondition[] conditions)
Returns the array of strings naming the files and directories in the directory denoted by this abstract pathname and which match a query formed using these conditions. |
boolean |
mkdir()
Creates the directory named by this abstract pathname. |
void |
modifyMetaData(MetaDataRecordList record)
Change the values of the metadata associated with this file object. |
MetaDataRecordList[] |
query(MetaDataCondition[] conditions,
MetaDataSelect[] selects)
Queries the file server to find all files that match a set of conditions. |
MetaDataRecordList[] |
query(MetaDataCondition[] conditions,
MetaDataSelect[] selects,
int recordsWanted)
|
MetaDataRecordList[] |
query(MetaDataSelect select)
Queries metadata specific to this SRBFile object and selects one metadata value, select, to be returned. |
MetaDataRecordList[] |
query(MetaDataSelect[] selects)
Queries metadata specific to this SRBFile object. |
MetaDataRecordList[] |
query(MetaDataSelect[] selects,
int recordsWanted)
|
MetaDataRecordList[] |
query(java.lang.String fieldName)
Queries metadata specific to this SRBFile object and selects one metadata value, fieldName, to be returned. |
MetaDataRecordList[] |
query(java.lang.String[] fieldNames)
Queries metadata specific to this SRBFile object. |
void |
register(java.lang.String registeringObjectPath,
long dataSize)
Registers the location of a file on a SRB physical resource. |
boolean |
renameTo(GeneralFile dest)
Renames the file denoted by this abstract pathname. |
void |
replicate(java.lang.String newResource)
Replicates this SRBFile to a new resource. |
void |
setDataType(java.lang.String dataTypeName)
Sets the dataType string of this SRBFile. |
protected void |
setDirectory(java.lang.String dir)
Set the directory. |
protected void |
setFileName(java.lang.String filePath)
Set the file name. |
protected void |
setFileSystem(GeneralFileSystem fileSystem)
Sets the SRB server used of this SRBFile object. |
boolean |
setLastModified(long time)
This method will only change the lastModified time to the current time. |
boolean |
setReadOnly()
Marks the file or directory named by this abstract pathname so that only read operations are allowed. |
void |
setReplicaNumber(int replicaNumber)
Sets the specific physical data replication refered to by this object. |
void |
setResource(java.lang.String resourceName)
Sets the physical resource this SRBFile object will be stored on. |
void |
setServerLocalPath(java.lang.String serverLocalPath)
The local filepath of the data when logged on the SRB server. |
java.lang.String |
toString()
Returns a string representation of this file object. |
java.net.URI |
toURI()
Constructs a file: URI that represents this abstract pathname. |
java.net.URL |
toURL()
Converts this abstract pathname into a file: URL. |
| Methods inherited from class edu.sdsc.grid.io.GeneralFile |
|---|
compareTo, compareTo, copyFrom, copyTo, createTempFile, firstQueryResult, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getParent, getParentFile, length, listFiles, listRoots, listRoots, mkdirs |
| Methods inherited from class java.lang.Object |
|---|
clone, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int MDAS_CATALOG
public static final int LDAP_CATALOG
public static final int FILE_CATALOG
protected SRBFileSystem srbFileSystem
fileSystem variable, but cast from GeneralFileSystem to
SRBFileSystem.
public boolean completeDirectoryList
| Constructor Detail |
|---|
public SRBFile(SRBFileSystem srbFileSystem,
java.lang.String filePath)
throws java.lang.NullPointerException
SRBFile instance by converting the given
pathname string into an abstract pathname.
fileSystem - The connection to the SRBfilePath - The pathname string
java.lang.NullPointerException - If the given string is null or
the empty string.
public SRBFile(SRBFileSystem srbFileSystem,
java.lang.String parent,
java.lang.String child)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException
SRBFile instance from a parent pathname
string and a child pathname string.
If parent is null then the new
SRBFile instance is created as if by invoking the
single-argument SRBFile constructor on the given
child pathname string.
Otherwise the parent pathname string is taken to denote a
directory, and the child pathname string is taken to denote
either a directory or a file. If the child pathname string
is absolute then it is converted into a relative pathname in a
SRB pathname. If parent is the empty string then the new
SRBFile instance is created by converting child
into an abstract pathname and resolving the result against the user's
SRB default home directory. Otherwise each pathname string is
converted into an abstract pathname and the child abstract
pathname is resolved against the parent.
fileSystem - The connection to the SRBparent - The parent pathname stringchild - The child pathname string
java.lang.NullPointerException - If the child string is null or
the empty string.
java.lang.IllegalArgumentException
public SRBFile(SRBFile parent,
java.lang.String child)
throws java.lang.NullPointerException
SRBFile instance from a parent abstract
pathname and a child pathname string.
If parent is null then the new SRBFile instance is created
as if by invoking the single-argument SRBFile constructor
on the given child pathname string.
Otherwise the parent abstract pathname is taken to denote a
directory, and the child pathname string is taken to denote
either a directory or a file. If the child pathname string is
absolute then it is converted into a relative pathname in a
SRB pathname. If parent is the empty abstract
pathname then the new SRBFile instance is created by
converting child into an abstract pathname and resolving
the result against the user's SRB default home directory. Otherwise
each pathname string is converted into an abstract pathname and the
child abstract pathname is resolved against the
parent.
parent - The parent abstract pathnamechild - The child pathname string
java.lang.NullPointerException - If the child string is null or
the empty string.
public SRBFile(java.net.URI uri)
throws java.lang.NullPointerException,
java.io.IOException
SRB URI protocol:
srb:// [ userName . domainHome [ : password ] @ ] host [ : port ][ / path ]
example:
srb://testuser.sdsc:mypassword@srb.sdsc.edu:5555/home/testuser.sdsc/testfile.txt
uri - An absolute, hierarchical URI using the srb scheme.
java.lang.NullPointerException - if uri is null.
java.lang.IllegalArgumentException - If the preconditions on the parameter
do not hold.
java.io.IOException - Can occur during the creation of the internal
fileSystem object.| Method Detail |
|---|
protected void finalize()
throws java.lang.Throwable
finalize in class GeneralFilejava.lang.Throwableprotected void setFileName(java.lang.String filePath)
setFileName in class GeneralFilefleName - The file name or fileName plus some or all of the
directory path.protected void setDirectory(java.lang.String dir)
setDirectory in class GeneralFiledir - The directory path, need not be absolute.
protected void setFileSystem(GeneralFileSystem fileSystem)
throws java.lang.IllegalArgumentException
setFileSystem in class GeneralFilefileSystem - The SRB server to be used.
java.lang.IllegalArgumentException - - if the argument is null.
java.lang.ClassCastException - - if the argument is not a SRBFileSystem object.
public void setResource(java.lang.String resourceName)
throws java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException
resource - The name of resource to be used.
java.lang.NullPointerException - If resourceName is null.
java.lang.IllegalArgumentException - If resourceName is not a valid resource.
java.io.IOException - If an IOException occurs during the system change.
public void setDataType(java.lang.String dataTypeName)
throws java.io.IOException
dataTypeName
is null, the default type of "generic", will be used.
java.io.IOException - If an IOException occurs during the system change.public void setReplicaNumber(int replicaNumber)
public void setServerLocalPath(java.lang.String serverLocalPath)
The serverLocalPath points to a filepath
on the SRB server (the directory plus filename.) Most files
are stored in the SRB Vault, but this file can be stored anywhere on
the server that you have permissions. You must have a user account on
the SRB server machine, and that account must have read/write
permissions to this abstract filepath.
public int getReplicaNumber()
public java.lang.String getResource()
throws java.io.IOException
getResource in class RemoteFilejava.io.IOException - If an IOException occurs during the system query.
public java.lang.String getDataType()
throws java.io.IOException
java.io.IOException - If an IOException occurs during the system query.public int getCatalogType()
public final java.lang.String getPathSeparator()
getPathSeparator in class GeneralFilepublic final char getPathSeparatorChar()
getPathSeparatorChar in class GeneralFile
public GeneralFileSystem getFileSystem()
throws java.lang.NullPointerException
getFileSystem in class GeneralFilejava.lang.NullPointerException - if fileSystem is null.public java.lang.String getServerLocalPath()
The serverLocalPath points to a filepath
on the SRB server (the directory plus filename.) Most files
are stored in the SRB Vault, but this file can be stored anywhere on
the server that you have permissions. You must have a user account on
the SRB server machine, and that account must have read/write
permissions to this abstract filepath.
public MetaDataRecordList[] query(java.lang.String fieldName)
throws java.io.IOException
fieldName, to be returned.
fieldName - The string name used to form the select object.
fieldName
java.io.IOException
public MetaDataRecordList[] query(java.lang.String[] fieldNames)
throws java.io.IOException
query in class GeneralFilefieldNames - The string names used to form the select objects.
fieldNames
java.io.IOException
public MetaDataRecordList[] query(MetaDataSelect select)
throws java.io.IOException
select, to be returned.
java.io.IOException
public MetaDataRecordList[] query(MetaDataSelect[] selects)
throws java.io.IOException
query in class GeneralFilejava.io.IOException
public MetaDataRecordList[] query(MetaDataSelect[] selects,
int recordsWanted)
throws java.io.IOException
java.io.IOException
public MetaDataRecordList[] query(MetaDataCondition[] conditions,
MetaDataSelect[] selects)
throws java.io.IOException
GeneralFileWhile 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 SRB, 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-server-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 server 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.
query in class GeneralFilejava.io.IOException
public MetaDataRecordList[] query(MetaDataCondition[] conditions,
MetaDataSelect[] selects,
int recordsWanted)
throws java.io.IOException
java.io.IOException
public void modifyMetaData(MetaDataRecordList record)
throws java.io.IOException
modifyMetaData in class GeneralFilejava.io.FileNotFoundException - If the vault storage path can't be found.
This can occur if the file was improperly deleted, removing the data
on disk without removing the metadata.
java.io.IOException
public void copyTo(GeneralFile file,
boolean forceOverwrite)
throws java.io.IOException
note: Files will be transferred using the SRB parallel transfer protocol. However, appending a file cannot use the parallel copy method. Also, the parallel method may be blocked by some firewalls, see also SRBFileSystem.setFirewallPorts( int, int )
copyTo in class GeneralFilefile - The file to receive the data.forceOverwrite - If the file exists, force it to be overwritten.
If the file cannot be overwritten throw IOException.
java.lang.NullPointerException - If file is null.
java.io.IOException - If an IOException occurs.
public void copyTo(GeneralFile file,
boolean forceOverwrite,
boolean bulkCopy)
throws java.io.IOException
note: Files will be transferred using the SRB parallel transfer protocol. However, appending a file cannot use the parallel copy method. Also, the parallel method may be blocked by some firewalls, see also SRBFileSystem.setFirewallPorts( int, int )
file - The file to receive the data.forceOverwrite - If the file exists, force it to be overwritten.
If the file cannot be overwritten throw IOException.bulkCopy - If true, bulk copy: Default option, new ports may be
opened. Files copied in parallel or bulk as appropriate. java.lang.NullPointerException - If file is null.
java.io.IOException - If an IOException occurs.
public void copyFrom(GeneralFile file,
boolean forceOverwrite)
throws java.io.IOException
note: Files will be transferred using the SRB parallel transfer protocol. However, appending a file cannot use the parallel copy method. Also, the parallel method may be blocked by some firewalls, see also SRBFileSystem.setFirewallPorts( int, int )
copyFrom in class GeneralFilefile - The file to receive the data.
java.lang.NullPointerException - If file is null.
java.io.IOException - If an IOException occurs.
public void copyFrom(GeneralFile file,
boolean forceOverwrite,
boolean bulkCopy)
throws java.io.IOException
note: Files will be transferred using the SRB parallel transfer protocol. However, appending a file cannot use the parallel copy method. Also, the parallel method may be blocked by some firewalls, see also SRBFileSystem.setFirewallPorts( int, int )
file - The file to receive the data.bulkCopy - If true, bulk copy: Default option, new ports may be
opened. Files copied in parallel or bulk as appropriate. java.lang.NullPointerException - If file is null.
java.io.IOException - If an IOException occurs.public long fileCopyStatus()
public long[] getStat()
throws java.io.IOException
Returns:
st_size = 0. File size in bytes (long).
st_dev = 1. Device.
st_ino = 2. Inode.
st_mode = 3. File mode.
st_nlink = 4. Number of links.
st_uid = 5. User ID of the file's owner.
st_gid = 6. Group ID of the file's group.
st_rdev = 7. ID of device.
This entry is defined only for character or block special files.
st_atim = 8. Time of last access.
Use st_atim instead of st_atime because in solaris, st_atime is
defined to be somthing else.
st_spare1 = 9.
st_mtime = 10. Time of last data modification.
st_spare2 = 11.
st_ctim = 12. Time of last file status change.
st_spare3 = 13.
Time measured in seconds since 00:00:00 GMT, Jan. 1, 1970.
st_blksize = 14. Optimal blocksize for file system i/o ops.
st_blocks = 15. Actual number of blocks allocated in DEV_BSIZE blocks.
st_vfstype = 16. Type of fs (see vnode.h).
st_vfs = 17. Vfs number.
st_type = 18. Vnode type.
st_gen = 19. Inode generation number.
st_flag = 20. Flag word.
Reserved1 = 21. Reserved.
Reserved2 = 22. Reserved.
st_access = 23. Process' access to file.
st_dummy = 24. pat to 32 bit boundary.
st_spare4 = 25+. Reserved.
java.io.IOException - If an IOException occurs.
public java.lang.String getPermissions()
throws java.io.IOException
java.io.IOException - If an IOException occurs.
public MetaDataRecordList[] getPermissions(boolean allUsers)
throws java.io.IOException
java.io.IOException - If an IOException occurs.
public void changePermissions(java.lang.String permission,
java.lang.String newUserName,
java.lang.String userMdasDomain)
throws java.io.IOException
permission - "w" - write;"r" - read;"rw" or "all" - read/write;
"n" - null;"t" - annotate;"o" - owner;"c" - curatenewUserName - The permissions are changed for this user,userMdasDomain - at this Mdas domain.
java.io.IOException - If an IOException occurs.
public void changePermissions(java.lang.String permission,
java.lang.String newUserName,
java.lang.String userMdasDomain,
boolean recursive)
throws java.io.IOException
permission - "w" - write;"r" - read;"rw" or "all" - read/write;
"n" - null;"t" - annotate;"o" - owner;"c" - curatenewUserName - The permissions are changed for this user,userMdasDomain - at this Mdas domain.recursive - Changes this and all subdirectories
java.io.IOException - If an IOException occurs.
public void replicate(java.lang.String newResource)
throws java.io.IOException
In SRB, one can make copies of a data set and store the copies in different locations. But, all these copies in SRB are considered to be identifiable by the same identifier. That is, each copy is considered to be equivalent to each other.
When a user reads a replicated data set, SRB cycles through all the copies of the datset and reads the one that is accessible at that time. It uses a simple replica identification mechanism to order this list of replicated datasets.
replicate in class RemoteFilenewResource - The storage resource name of the new copy.
java.io.IOException - If an IOException occurs.
public void backup(java.lang.String backupResource)
throws java.io.IOException
backupResource - - The backup resource
java.io.IOException
public java.lang.String checksum()
throws java.io.IOException
checksum in class GeneralFilejava.io.IOException
public java.lang.String checksum(boolean force)
throws java.io.IOException
force - If true force compute and register of chksum even if one
already exists. If false compute chksum, but don't register if one
already exists.
java.io.IOException
public void register(java.lang.String registeringObjectPath,
long dataSize)
throws java.io.IOException
registeringObjectPath.
registeringObjectPath - The file/DB path of the data.dataSize - The size of the dataset if known. 0 = unknown.
java.io.IOExceptionsetResource(java.lang.String)
public java.io.InputStream executeProxyCommand(java.lang.String command,
java.lang.String commandArgs)
throws java.io.IOException
command - The command to run.commandArgs - The command argument string.
java.io.IOException - If an IOException occurs.SRBFileSystem.executeProxyCommand(java.lang.String, java.lang.String)
public void link(SRBFile newLink)
throws java.io.IOException
newLink with this object as the source.
The user should have at least 'read' access permission for the target.
java.io.IOExceptionpublic boolean canRead()
canRead in class GeneralFiletrue if and only if the file specified by this
abstract pathname exists and can be read; otherwise
false.public boolean canWrite()
canWrite in class GeneralFiletrue if and only if the file system actually
contains a file denoted by this abstract pathname and
the application is allowed to write to the file; otherwise
false.
public boolean createNewFile()
throws java.io.IOException
Note: this method should not be used for file-locking, as the resulting protocol cannot be made to work reliably.
createNewFile in class GeneralFiletrue if the named file does not exist and was
successfully created; false if the named file
already exists
java.io.IOException - If an I/O error occurred
public static GeneralFile createTempFile(java.lang.String prefix,
java.lang.String suffix,
GeneralFile directory)
throws java.io.IOException,
java.lang.IllegalArgumentException
Creates a new empty file in the specified directory, using the given prefix and suffix strings to generate its name. If this method returns successfully then it is guaranteed that:
deleteOnExit method.
The prefix argument must be at least three characters
long. It is recommended that the prefix be a short, meaningful string
such as "hjb" or "mail". The
suffix argument may be null, in which case the
suffix ".tmp" will be used.
To create the new file, the prefix and the suffix may first be
adjusted to fit the limitations of the underlying platform. If the
prefix is too long then it will be truncated, but its first three
characters will always be preserved. If the suffix is too long then it
too will be truncated, but if it begins with a period character
('.') then the period and the first three characters
following it will always be preserved. Once these adjustments have been
made the name of the new file will be generated by concatenating the
prefix, five or more internally-generated characters, and the suffix.
If the directory argument is null then the
default temporary-file directory will be used. Since the SRB does not
have a standard temporary directory, files will be placed in a temp/
directory in the user's SRB home directory.
There are certain difficulties creating a static connection to the SRB.
For this static method to connect to the SRB, .Mdas files must be
available in the local home directory/.srb. That is the information that
will be used when storing the temporary file. This comprimise is
necessary to maintain the designs unity with the java.io.File class.
prefix - The prefix string to be used in generating the file's
name; must be at least three characters longsuffix - The suffix string to be used in generating the file's
name; may be null, in which case the
suffix ".tmp" will be useddirectory - The directory in which the file is to be created, or
null if the default temporary-file
directory is to be used
java.lang.IllegalArgumentException - If the prefix argument contains fewer than three
characters
java.io.IOException - If a file could not be createdpublic boolean delete()
delete in class GeneralFiletrue if and only if the file or directory is
successfully deleted; false otherwisepublic boolean delete(boolean force)
true if and only if the file or directory is
successfully deleted; false otherwisepublic void deleteOnExit()
Once deletion has been requested, it is not possible to cancel the request. This method should therefore be used with care.
Note: this method should not be used for file-locking, as the resulting protocol cannot be made to work reliably.
deleteOnExit in class GeneralFilepublic boolean equals(java.lang.Object obj)
true if and only if the argument is not
null and is an abstract pathname that denotes the same file
or directory as this abstract pathname.
equals in class GeneralFileobj - The object to be compared with this abstract pathname
true if and only if the objects are the same;
false otherwisepublic boolean exists()
exists in class GeneralFiletrue if and only if the file denoted by this
abstract pathname exists; false otherwise
public java.lang.String getCanonicalPath()
throws java.io.IOException
getCanonicalPath in class GeneralFilejava.io.IOException - If an I/O error occurs, which is possible because the
construction of the canonical pathname may require
filesystem queriespublic java.lang.String getName()
getName in class GeneralFilepublic java.lang.String getPath()
getPath in class GeneralFilepublic int hashCode()
1234321.
hashCode in class java.lang.Objectpublic boolean isAbsolute()
"/".
isAbsolute in class GeneralFiletrue if this abstract pathname is absolute,
false otherwisepublic boolean isContainer()
true if and only if the file denoted by this
abstract pathname exists and is a container;
false otherwisepublic boolean isDirectory()
A SRB collection is a logical name given to a set of data sets. All data sets stored in SRB/MCAT are stored in some collection. A collection can have sub-collections, and hence provides a hierarchical structure. A collection in SRB/MCAT can be equated to a directory in a Unix file system. But unlike a file system, a collection is not limited to a single device (or partition). A collection is logical but the datsets grouped under a collection can be stored in heterogeneous storage devices. There is one obvious restriction, the name given to a data set in a collection or sub-collection should be unique in that collection.
isDirectory in class GeneralFiletrue if and only if the file denoted by this
abstract pathname exists and is a directory;
false otherwisepublic boolean isDirectory(boolean update)
update - If true, send a new query to the SRB to determine if
this abstract pathname refers to a directory. If false, this
method will return a previously stored value. Also queries the SRB
if the value is not already stored with this object.
true if and only if the file denoted by this
abstract pathname exists and is a directory;
false otherwisepublic boolean isFile()
In the terminology of SRB, files are known as data sets. A data set is a "stream-of-bytes" entity that can be uniquely identified. For example, a file in HPSS or Unix is a data set, or a LOB stored in a SRB Vault database is a data set. Importantly, note that a data set is not a set of data objects/files. Each data set in SRB is given a unique internal identifier by SRB. A dataset is associated with a collection.
isFile in class GeneralFiletrue if and only if the file denoted by this
abstract pathname exists and is a normal file;
false otherwisepublic boolean isFile(boolean update)
update - If true, send a new query to the SRB to determine if
this abstract pathname refers to a file. If false, this
method will return a previously stored value. Also queries the SRB
if the value is not already stored with this object.
true if and only if the file denoted by this
abstract pathname exists and is a directory;
false otherwisepublic boolean isHidden()
isHidden in class GeneralFiletrue if and only if the file denoted by this
abstract pathname is hidden.public long lastModified()
lastModified in class GeneralFilelong value representing the time the file was
last modified, measured in milliseconds since the epoch
(00:00:00 GMT, January 1, 1970), or 0L if the
file does not exist or if an I/O error occurspublic java.lang.String[] list()
There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.
If this SRBFile object denotes a file, the directory containing that file will be listed instead.
This method will return all the files in the directory. Listing directories with a large number of files may take a very long time. The more generic SRBFile.query() method could be used to iterate through the file list piecewise.
list in class GeneralFilepublic java.lang.String[] list(MetaDataCondition[] conditions)
conditions.
list in class GeneralFilelist()public boolean mkdir()
mkdir in class GeneralFile
public boolean renameTo(GeneralFile dest)
throws java.lang.IllegalArgumentException
Whether or not this method can move a file from one filesystem to another is platform-dependent. The return value should always be checked to make sure that the rename operation was successful.
renameTo in class GeneralFiledest - The new abstract pathname for the named file
java.lang.IllegalArgumentException - If parameter dest is not a SRBFile.
public boolean setLastModified(long time)
throws java.lang.IllegalArgumentException
setLastModified in class GeneralFiletime - The new last-modified time, measured in a
system-dependent way.
java.lang.IllegalArgumentException - - If the argument is negativepublic boolean setReadOnly()
setReadOnly in class GeneralFilepublic java.net.URI toURI()
The exact form of the URI is according to the SRB. If it can be determined that the file denoted by this abstract pathname is a directory, then the resulting URI will end with a slash.
For a given abstract pathname f, it is guaranteed that
new SRBFile
( f.toURI()).equals( f)
so long as the original abstract pathname, the URI, and the new abstract
pathname are all created in (possibly different invocations of) the same
Java virtual machine. However, this relationship typically does not hold
when a file: URI that is created in a virtual machine on one
operating system is converted into an abstract pathname in a virtual
machine on a different operating system.
toURI in class GeneralFileSRBFile(java.net.URI),
URI,
URI.toURL()
public java.net.URL toURL()
throws java.net.MalformedURLException
file: URL. The
exact form of the URL is is according to the SRB. If it can be
determined that the file denoted by this abstract pathname is a
directory, then the resulting URL will end with a slash.
Usage note: This method does not automatically escape
characters that are illegal in URLs. It is recommended that new code
convert an abstract pathname into a URL by first converting it into a
URI, via the toURI method, and then converting the URI
into a URL via the URI.toURL method.
toURL in class GeneralFilejava.net.MalformedURLException - If the path cannot be parsed as a URLtoURI(),
URI,
URI.toURL(),
URLpublic java.lang.String toString()
toString in class GeneralFile
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||