|
|||||||||
| 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
edu.sdsc.grid.io.srb.SRBContainer
public class SRBContainer
An abstract representation of a container on the SRB. A container is a way to put together a lot of small files into one larger file to improve performance. This works very well with resources that include tapes (such as HPSS). The whole container is retrieved from tape, cached on SRB disk, and then multiple files can be quickly read and written on the container copy on disk. The SRB handles the book-keeping for the container.
SRBContainer subclasses SRBFile and have certain similarities with SRB directories/collections, the logical groupings of files on the SRB. Containers represent a physical grouping of files on a particular SRB resource. Containers can be placed anywhere on the SRB the user has write privileges.
SRBFile| Field Summary | |
|---|---|
static java.lang.String |
PRIMARY_SYNC
Delete the cache copy once the copies have been synchronized. |
static java.lang.String |
PURGE_SYNC
Delete the cache copy once the copies have been synchronized. |
| Fields inherited from class edu.sdsc.grid.io.srb.SRBFile |
|---|
completeDirectoryList, FILE_CATALOG, LDAP_CATALOG, MDAS_CATALOG, srbFileSystem |
| 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 | |
|---|---|
SRBContainer(SRBFile parent,
java.lang.String child)
Creates a new SRBContainer instance by converting the given
pathname string into an abstract pathname. |
|
SRBContainer(SRBFile parent,
java.lang.String child,
long containerMaxSize)
Creates a new SRBContainer instance by converting the given
pathname string into an abstract pathname. |
|
SRBContainer(SRBFileSystem fileSystem,
java.lang.String filePath)
Creates a new SRBContainer instance by converting the given
pathname string into an abstract pathname. |
|
SRBContainer(SRBFileSystem fileSystem,
java.lang.String filePath,
long containerMaxSize)
Creates a new SRBContainer instance by converting the given
pathname string into an abstract pathname. |
|
SRBContainer(SRBFileSystem fileSystem,
java.lang.String parent,
java.lang.String child)
Creates a new SRBContainer instance by converting the given
pathname string into an abstract pathname. |
|
SRBContainer(SRBFileSystem fileSystem,
java.lang.String parent,
java.lang.String child,
long containerMaxSize)
Creates a new SRBContainer instance by converting the given
pathname string into an abstract pathname. |
|
SRBContainer(java.net.URI uri)
Creates a new SRBContainer instance by converting the given
uri string into an abstract pathname. |
|
| Method Summary | |
|---|---|
void |
backup(java.lang.String syncType)
Sync a container. |
boolean |
canRead()
Tests whether the application can read from the container denoted by this abstract pathname. |
boolean |
canWrite()
Tests whether the application can modify to the container denoted by this abstract pathname. |
int |
compareTo(GeneralFile pathname)
Compares two containers lexicographically. |
int |
compareTo(java.lang.Object o)
Compares this container to another object. |
void |
copyFrom(GeneralFile file,
boolean forceOverwrite,
boolean bulkCopy)
Copies this file to another file. |
void |
copyFromLocal(LocalFile localFile)
Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods. |
void |
copyFromLocal(java.lang.String localFilePath)
Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods. |
void |
copyTo(GeneralFile file,
boolean forceOverwrite,
boolean bulkCopy)
Copies this file to another file. |
void |
copyToLocal(LocalFile localFile)
Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods. |
void |
copyToLocal(java.lang.String localFilePath)
Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods. |
void |
copyToRemote(RemoteFile remoteFile)
Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods. |
boolean |
createNewFile()
Atomically creates a new, empty container named by this abstract pathname if and only if a container with this name does not yet exist. |
static GeneralFile |
createTempFile(java.lang.String prefix,
java.lang.String suffix)
Creates an empty file in the default temporary-file directory, using the given prefix and suffix to generate its name. |
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 container denoted by this SRBContainer. |
boolean |
delete(boolean force)
Deletes the file or directory denoted by this abstract pathname. |
boolean |
equals(java.lang.Object obj)
Tests this abstract pathname for equality with the given object. |
boolean |
exists()
Tests whether the container denoted by this abstract pathname exists. |
GeneralFile |
getAbsoluteFile()
Returns the absolute form of this abstract pathname. |
GeneralFile |
getCanonicalFile()
Returns the canonical form of this abstract pathname. |
long |
getContainerMaxSize()
|
java.lang.String |
getDataType()
|
GeneralFile |
getParentFile()
Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent
directory. |
java.lang.String |
getPermissions()
Get the permissions of the current user for this SRBContainer: write, read, all, annotate or null. |
MetaDataRecordList[] |
getPermissions(boolean allUsers)
Gets all the non null permissions of all SRB users for this SRBContainer: write, read, all, annotate or null. |
java.lang.String |
getResource()
|
void |
include(GeneralFile file)
Adds the named file to this container. |
boolean |
isContainer()
Tests whether the object denoted by this abstract pathname is a container. |
boolean |
isDirectory()
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 |
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. |
long |
length()
Returns the length of the container denoted by this abstract pathname. |
java.lang.String[] |
list()
Returns an array of strings naming the files and directories in the container denoted by this abstract pathname. |
boolean |
mkdir()
Creates the container named by this abstract pathname. |
MetaDataRecordList[] |
query(MetaDataSelect[] selects)
Removes the named file to this container |
MetaDataRecordList[] |
query(MetaDataSelect[] selects,
int recordsWanted)
|
boolean |
renameTo(GeneralFile dest)
Renames the container denoted by this abstract pathname. |
void |
replicate(java.lang.String newResource)
Replicates this container to a new resource. |
void |
setContainerMaxSize(long containerMaxSize)
Sets the container size of this SRBContainer object, in bytes. |
| Methods inherited from class edu.sdsc.grid.io.srb.SRBFile |
|---|
changePermissions, changePermissions, checksum, checksum, copyFrom, copyTo, deleteOnExit, executeProxyCommand, fileCopyStatus, finalize, getCanonicalPath, getCatalogType, getFileSystem, getName, getPath, getPathSeparator, getPathSeparatorChar, getReplicaNumber, getServerLocalPath, getStat, hashCode, isAbsolute, isDirectory, isFile, link, list, modifyMetaData, query, query, query, query, query, register, setDataType, setDirectory, setFileName, setFileSystem, setLastModified, setReadOnly, setReplicaNumber, setResource, setServerLocalPath, toString, toURI, toURL |
| Methods inherited from class edu.sdsc.grid.io.GeneralFile |
|---|
copyFrom, copyTo, firstQueryResult, getAbsolutePath, getParent, listFiles, listRoots, listRoots, mkdirs |
| Methods inherited from class java.lang.Object |
|---|
clone, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PURGE_SYNC
public static final java.lang.String PRIMARY_SYNC
| Constructor Detail |
|---|
public SRBContainer(SRBFileSystem fileSystem,
java.lang.String filePath)
SRBContainer instance by converting the given
pathname string into an abstract pathname.
fileSystem - The connection to the SRBfilePath - The pathname string
public SRBContainer(SRBFileSystem fileSystem,
java.lang.String filePath,
long containerMaxSize)
SRBContainer instance by converting the given
pathname string into an abstract pathname.
fileSystem - The connection to the SRBfilePath - A pathname stringcontainerMaxSize - The size of the container, in bytes
public SRBContainer(SRBFile parent,
java.lang.String child)
SRBContainer instance by converting the given
pathname string into an abstract pathname.
If parent is null then the new
SRBContainer instance is created as if by invoking the
single-argument SRBContainer 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 the container
name. 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 SRBContainer instance is
created by converting child into an abstract pathname and
resolving the result against the SRB default container 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
public SRBContainer(SRBFile parent,
java.lang.String child,
long containerMaxSize)
SRBContainer instance by converting the given
pathname string into an abstract pathname.
If parent is null then the new
SRBContainer instance is created as if by invoking the
single-argument SRBContainer 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 the container
name. 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 SRBContainer instance is
created by converting child into an abstract pathname and
resolving the result against the SRB default container 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 stringcontainerMaxSize - The size of the container, in bytes
public SRBContainer(SRBFileSystem fileSystem,
java.lang.String parent,
java.lang.String child)
SRBContainer instance by converting the given
pathname string into an abstract pathname.
If parent is null then the new
SRBContainer instance is created as if by invoking the
single-argument SRBContainer 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 the container
name. 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 SRBContainer instance is
created by converting child into an abstract pathname and
resolving the result against the SRB default container 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
public SRBContainer(SRBFileSystem fileSystem,
java.lang.String parent,
java.lang.String child,
long containerMaxSize)
SRBContainer instance by converting the given
pathname string into an abstract pathname.
If parent is null then the new
SRBContainer instance is created as if by invoking the
single-argument SRBContainer 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 the container
name. 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 SRBContainer instance is
created by converting child into an abstract pathname and
resolving the result against the SRB default container 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 stringcontainerMaxSize - The size of the container, in bytes
public SRBContainer(java.net.URI uri)
throws java.io.IOException
SRBContainer instance by converting the given
uri string into an abstract pathname.
fileSystem - The connection to the SRBuri - The uri pathname stringcontainerMaxSize - The size of the container, in bytes
java.io.IOException - If an IOException occurs.| Method Detail |
|---|
public void setContainerMaxSize(long containerMaxSize)
Currently, containers cannot have a max size over 2GB, though they will
accept files larger than 2GB. If the container runs out of space it will
be renamed to a new container plus some random digits and a new
container will be created.
eg. container foo will be renamed foo.1234 and a new foo container
will be created.
java.lang.IllegalArgumentException - If the containerMaxSize
is less than zero.public long getContainerMaxSize()
public java.lang.String getResource()
throws java.io.IOException
getResource in class SRBFilejava.io.IOException - If an IOException occurs.
public java.lang.String getDataType()
throws java.io.IOException
getDataType in class SRBFilejava.io.IOException - If an IOException occurs.
public void include(GeneralFile file)
throws java.io.IOException
java.io.IOException
public MetaDataRecordList[] query(MetaDataSelect[] selects)
throws java.io.IOException
query in class SRBFilejava.io.IOException
public MetaDataRecordList[] query(MetaDataSelect[] selects,
int recordsWanted)
throws java.io.IOException
query in class SRBFilejava.io.IOException
public void copyTo(GeneralFile file,
boolean forceOverwrite,
boolean bulkCopy)
throws java.io.IOException
SRBFilenote: 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 SRBFilefile - 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.io.IOException - If an IOException occurs.
public void copyFrom(GeneralFile file,
boolean forceOverwrite,
boolean bulkCopy)
throws java.io.IOException
SRBFilenote: 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 SRBFilefile - 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.io.IOException - If an IOException occurs.
public void copyFromLocal(LocalFile localFile)
throws java.io.IOException
java.io.IOException
public void copyFromLocal(java.lang.String localFilePath)
throws java.io.IOException
java.io.IOException
public void copyToLocal(LocalFile localFile)
throws java.io.IOException
localFile - The file to receive the data
java.lang.NullPointerException - If localFile is null.
java.io.IOException
public void copyToLocal(java.lang.String localFilePath)
throws java.io.IOException
localFile - The file to be copied
java.lang.NullPointerException - If localFile is null.
java.io.IOException
public void copyToRemote(RemoteFile remoteFile)
throws java.io.IOException,
java.lang.ClassCastException
remoteFile does not exist, one will be created.
Otherwise this SRB file is appended to the end of the remote file.
Copying a container to a new logical space would be an unusual action. Replicate is better.
remoteFile - The local file to receive the data.
java.lang.ClassCastException - - if the argument is not a SRBFile object.
java.lang.NullPointerException - If remoteFile is null.
java.io.IOException
public java.lang.String getPermissions()
throws java.io.IOException
getPermissions in class SRBFilejava.io.IOException - If an IOException occurs.
public MetaDataRecordList[] getPermissions(boolean allUsers)
throws java.io.IOException
getPermissions in class SRBFilejava.io.IOException - If an IOException occurs.
public void replicate(java.lang.String newResource)
throws java.io.IOException
replicate in class SRBFilenewResource - The storage resource name of the new copy.
java.io.IOException - If an IOException occurs.
public void backup(java.lang.String syncType)
throws java.io.IOException
PURGE_SYNC or PRIMARY_SYNC
backup in class SRBFilesyncType - synchronization type, see PURGE_SYNC and PRIMARY_SYNC.
default value is to synchronize all archival resources.
java.io.IOExceptionpublic boolean canRead()
canRead in class SRBFiletrue if and only if the container specified by this
abstract pathname exists and can be read; otherwise
false.public boolean canWrite()
canWrite in class SRBFiletrue if and only if the container system actually
contains a file denoted by this abstract pathname and
the application is allowed to write to the container; otherwise
false.public int compareTo(GeneralFile pathname)
compareTo in class GeneralFilepathname - The container to be compared to this abstract
pathname
public int compareTo(java.lang.Object o)
throws java.lang.ClassCastException
compareTo(GeneralFile). Otherwise, it throws a
ClassCastException, since containers can only be
compared to containers.
compareTo in interface java.lang.ComparablecompareTo in class GeneralFileo - The Object to be compared to this abstract
pathname
java.lang.ClassCastException - - if the argument is not an containerpublic boolean createNewFile()
createNewFile in class SRBFiletrue if the named file does not exist and was
successfully created; false if the named file
already exists
public static GeneralFile createTempFile(java.lang.String prefix,
java.lang.String suffix)
throws java.io.IOException,
java.lang.IllegalArgumentException
createTempFile(prefix, suffix, null).
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 used
java.lang.IllegalArgumentException - If the prefix argument contains fewer than three
characters
java.io.IOException - If a file could not be created
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:
SRBFile.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
SRB default temporary-file directory will be used. The
default temporary-file directory is specified by the system property
java.io.tmpdir. On UNIX systems the default value of this
property is typically "/tmp" or "/var/tmp"; on
Microsoft Windows systems it is typically "c:\\temp". A different
value may be given to this system property when the Java virtual machine
is invoked, but programmatic changes to this property are not guaranteed
to have any effect upon the the temporary directory used by this method.
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 SRBFiletrue if and only if the file or directory is
successfully deleted; false otherwisepublic boolean delete(boolean force)
delete in class SRBFiletrue if and only if the file or directory is
successfully deleted; false otherwisepublic 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
container as this abstract pathname.
equals in class SRBFileobj - 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 SRBFiletrue if and only if the container denoted by this
abstract pathname exists; false otherwisepublic GeneralFile getAbsoluteFile()
new SRBContainer(this.SRBFile.getFileSystem()(),
this.GeneralFile.getAbsolutePath()()).
getAbsoluteFile in class GeneralFilepublic GeneralFile getCanonicalFile()
new SRBContainer(this.SRBFile.getCanonicalPath()()).
getCanonicalFile 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 GeneralFile getParentFile()
null if this pathname does not name a parent
directory.
The parent of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.
getParentFile in class GeneralFilenull if this pathname
does not name a parentpublic boolean isContainer()
isContainer in class SRBFiletrue if and only if the file denoted by this
abstract pathname exists and is a container;
false otherwisepublic boolean isDirectory()
isDirectory in class SRBFiletrue if and only if the file denoted by this
abstract pathname exists and is a directory;
false otherwisepublic boolean isFile()
isFile in class SRBFiletrue if and only if the file denoted by this
abstract pathname exists and is a normal file;
false otherwisepublic boolean isHidden()
isHidden in class SRBFiletrue if and only if the file denoted by this
abstract pathname is hidden.public long lastModified()
lastModified in class SRBFilelong 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 long length()
length in class GeneralFile0L if the container does not existpublic 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.
list in class SRBFilepublic boolean mkdir()
mkdir in class SRBFilepublic boolean renameTo(GeneralFile dest)
renameTo in class SRBFiledest - The new abstract pathname for the named container
java.lang.IllegalArgumentException - If parameter dest is not a SRBFile.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||