|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.novell.zos.jdl.DataGrid
public class DataGrid
General interface to the Data Grid.
Interactions with the Data Grid revolve around instances of this class. Operations include copying files from the DataGrid down to the resource for Joblet usage and likewise uploading files from a resource to the DataGrid.
A Data Grid URL is the convention for denoting paths in the Data Grid.
The Data Grid URL convention is the form grid://
.
The gridID is optional and if absent means the default grid.
The ^ symbol can be used as a shortcut to the
Example to copy a file from the a Datagrid directory to a local file. This example assumes you have created the directory 'newdir' in the DataGrid and have uploaded a file named 'results.txt' there:
DataGrid().copy("grid:///newdir/results.txt","local.txt")
Example to copy a file from the job instance directory to a local file:
DataGrid().copy("grid:///^/results.txt","local.txt")Example to copy a file from a named job instance directory to a local file:
DataGrid().copy("grid:///^user.myjob.1024/results.txt","local.txt")Example to copy a local file into the job directory for job 'myjob':
DataGrid().copy("local.txt","grid:///!myjob")Example to copy a local file into a subdir of the job directory:
DataGrid().copy("local.txt","grid:///!myjob/subdir")Example to copy a local file into the current job instance directory:
DataGrid().copy("local.txt","grid:///^/")The DataGrid class is only allowed during Joblet execution on a resource.
Constructor Summary | |
---|---|
DataGrid()
Construct a DataGrid instance |
Method Summary | |
---|---|
void |
append(java.lang.String destfile,
java.lang.String value)
Append the string data to the end of the grid file referenced by this path. |
void |
copy(java.lang.String source,
java.lang.String dest)
Fetch the specified source file to the destination. |
void |
delete(java.lang.String path)
Delete the file or directory referenced by this path. |
boolean |
getCache()
Retrieve setting of using cached data or not |
boolean |
getDebug()
Retrieve value of debug logging. |
boolean |
getMulticast()
Return true if operation is to attempt multicast. |
boolean |
getMulticastFallBack()
If true then fall back to unicast if multicast does not
mee the setMulticastMin requirement. |
int |
getMulticastMin()
Retrieve the minimum number of receivers needed in order to multicast. |
long |
getMulticastMinFileSize()
Retreive the multicast minimum file size |
int |
getMulticastQuorum()
Retrieve number of receivers that constitute a quorum and allow multicast to start. |
int |
getMulticastRate()
Retrieve the requested data rate in bytes per second for multicast. |
int |
getMulticastWait()
Retrieve maximum amount of time a receiver is prepared to wait before start of multicast (ms). |
void |
mkdir(java.lang.String dir)
Recursively create a new empty directory. |
void |
rename(java.lang.String source,
java.lang.String dest)
Move a file or directory from one path to another. |
void |
rmdir(java.lang.String dir)
Delete the file or directory referenced by this path. |
void |
setCache(boolean caching)
To use cached data or not. |
void |
setMulticast(boolean mcast)
Attempt to fetch a file as part of a combined multicast transfer. |
void |
setMulticastFallBack(boolean mcastFallBack)
If true, then a multicast attempt that does not meet
the |
void |
setMulticastMin(int mcastMin)
Set the minimum number of receivers required in order to proceed with the multicast. |
void |
setMulticastMinFileSize(long minFileSize)
Set the multicast minimum file size. |
void |
setMulticastQuorum(int mcastQuorum)
Sets the number of receivers that constitute a quorum and allow multicast to start. |
void |
setMulticastRate(int mcastRate)
Set the multicast send rate limit in bytes per second. |
void |
setMulticastWait(int mcastWait)
Set the number of milliseconds to wait for a more receivers to join the multicast. |
void |
setRecursive(boolean recursive)
Perform recursive copy. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataGrid()
Method Detail |
---|
public boolean getDebug()
public void setCache(boolean caching)
caching
- true to use caching, false to not.public boolean getCache()
public void setMulticast(boolean mcast)
copy()
operation.
Behaves the same as a unicast copy()
, except that an
initial attempt is made to fetch the file as part of a multicast to this
and potentially many other hosts at the same time. If successful,
the total network bandwith consumed by all hosts can be greatly
reduced.
If multicasting is not available or not enough hosts are willing
to multicast the same file in the specified wait period, then
this operation transparently falls back to a normal unicast
copy()
request.
Multicasting is intended for use by a set of nodes running the
same job and requesting the same large file from the data
grid. The multicastMin
, multicastQuorum
,
and multicatWait
are ignored for requests after the
first to join any given multicast session.
Multicast also honors caching requests if caching is used.
mcast
- true to attempt multicast. Default is false.public boolean getMulticast()
public void setMulticastFallBack(boolean mcastFallBack)
true, then a multicast attempt that does not meet
the setMulticastMin
requirement will fall back to
a unicast file copy. If false, then the copy will fail.
mcastFallBack
- true to fallback to unicast, false to notpublic boolean getMulticastFallBack()
true
then fall back to unicast if multicast does not
mee the setMulticastMin
requirement.
public void setMulticastMin(int mcastMin)
mcastMin
- Minimum number of receiverspublic int getMulticastMin()
public void setMulticastWait(int mcastWait)
mcastWait
- Wait time in millisecondspublic int getMulticastWait()
public void setMulticastQuorum(int mcastQuorum)
Once this many receivers join a multicast, the server is free to start sending immediately. A negative or zero value means there is no quorum. The wait time will be allowed to fully expire before sending begins.
mcastQuorum
- Number of receiverspublic int getMulticastQuorum()
public void setMulticastRate(int mcastRate)
mcastRate
- The requested data rate in bytes per secondpublic int getMulticastRate()
public void setMulticastMinFileSize(long minFileSize)
setMulticast()
minFileSize
- Filesize in bytes. Default is 10000000 (10M)public long getMulticastMinFileSize()
public void setRecursive(boolean recursive)
recursive
- True for the copy()
to do a recursive copy, including creating any directories.public void copy(java.lang.String source, java.lang.String dest) throws java.lang.Exception
setRecursive(True)
is
set. The default is a single file copy.
A multicast will be attempted if setMulticast(True)
is
set. The default is to do a unicast copy.
Example to copy down a file from the DataGrid to a resource and then read the lines of the file:
datagrid = DataGrid() datagrid.copy("grid:///images/myFile","myLocalFile") text = open("myLocalFile").readlines()
Example to recursively copy a directory and it's sub directories from the DataGrid to a resource.
datagrid = DataGrid() datagrid.setRecursive(True) datagrid.copy("grid:///testStore/testFiles","/home/tester/myLocalFiles")
Example to copy down a file from the Job deployment area to a resource and then read the lines of the file:
datagrid = DataGrid() datagrid.copy("grid:///!myJob/myFile","myLocalFile") text = open("myLocalFile").readlines()Either the source or the destination must be a DataGrid URL. A local copy operation is not supported.
source
- Full grid:
path or local file path of sourcedest
- Full grid:
path or local file path of destination
java.lang.Exception
- If any error occurs in copy
java.lang.Exception
- Thrown if a system or configuration error prevents the
copy of files to the grid or network failure or I/O error prevents the copy of
files to the grid.public void mkdir(java.lang.String dir) throws java.lang.Exception
If no component in the path referenced by this object is a regular file, and the current user has permission to do so, then a directory is created that reflects the current data grid path. Any intermediate subdirectories are automatically created as well.
dir
- Directory path to create
java.lang.Exception
public void rmdir(java.lang.String dir) throws java.lang.Exception
If this path references a file, then the file is removed from the grid. If a directory is referenced, then the directory is recursively deleted.
dir
- Directory to delete
java.lang.Exception
public void delete(java.lang.String path) throws java.lang.Exception
If this path references a file, then the file is removed from the grid. If a directory is referenced, then the directory is recursively deleted.
path
- File or directory to delete
java.lang.Exception
public void rename(java.lang.String source, java.lang.String dest) throws java.lang.Exception
source
- Source to movedest
- Destination of move
java.lang.Exception
public void append(java.lang.String destfile, java.lang.String value) throws java.lang.Exception
If the file does not exist, it is created.
destfile
- File to append tovalue
- String data to append
java.lang.Exception
- Thrown if a system or configuration error prevents the
append of data to the grid file.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |