nl.uva.vlet.vfs
Class VFSClient

java.lang.Object
  extended by nl.uva.vlet.vfs.VFSClient

public final class VFSClient
extends java.lang.Object

VFSClient class is an interface to the VFS services. It provides methods to the different VFS interfaces and implementations.

Use method openLocation() to get any file/directory anywhere on the grid. First create your local VFS handler object which interacts with the VFS services.

See Also:
VFS, VFSNode, VDir, VFile

Constructor Summary
VFSClient()
          Create VFS Client object
 
Method Summary
 VFSTransfer asyncCopy(VDir dir, VDir dest)
          Copy single VDir in background Returns TransgerInfo object which can be used to monitor the result
 VFSTransfer asyncCopy(VFile file, VDir dest)
          Copy single VFile in background.
 VFSTransfer asyncMove(VDir dir, VDir dest)
          Move single VDir in background Returns TransgerInfo object which can be used to monitor the result.
 VFSTransfer asyncMove(VFile file, VDir dest)
          Move single VFile in background.
 void close()
          Close this client and release resources
 VDir copy(VDir dir, VDir dest)
          Copy single VDir
 VFile copy(VFile vfile, VDir dest)
          Copy VFile to remote (VDir) destination.
 VFile createFile(VRL filepath, boolean force)
          Create file.
 boolean existsDir(VRL location)
          Returns true if location is a VDir and it exists.
 boolean existsFile(VRL location)
          Returns true if location is a VFile and it exists.
static VFSClient getDefault()
          Returns default class object
 VDir getDir(java.lang.String locStr)
          Return VDir specified by the location string
 VDir getDir(VRL location)
          Returns VDir specified by the location
 VFile getFile(java.lang.String locStr)
          Return VFile specified by the location string
 VFile getFile(VRL location)
          Return VFile specified by the location
 VDir getTempDir()
           
 VFSNode getVFSNode(VRL location)
          Return VFile specified by the location
 VRSContext getVRSContext()
          Returns Resource Context associated with this client.
 VDir mkdir(VRL loc)
          Recursive mkdir.
 VDir mkdir(VRL loc, boolean ignoreExisting)
          Recursive mkdir.
 VDir move(VDir dir, VDir dest)
          VFS method to move single Dir
 VFile move(VFile file, VDir dest)
          Move VFile to remore (VDir) destination.
 VFSNode openLocation(java.lang.String location)
          Return VFSNode pointing to the specified location
 VFSNode openLocation(VRL location)
          Return VFSNode pointing to the specified location
 boolean rename(VRL vrl, java.lang.String pathOrName)
          VFS Rename.
 boolean setTempDir(VRL loc)
           
 void setVRSContext(VRSContext context)
          Sets new Resource Context associated with this client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VFSClient

public VFSClient()
Create VFS Client object

Method Detail

getDefault

public static VFSClient getDefault()
Returns default class object


openLocation

public VFSNode openLocation(java.lang.String location)
                     throws VlException
Return VFSNode pointing to the specified location

Throws:
VlException

openLocation

public VFSNode openLocation(VRL location)
                     throws VlException
Return VFSNode pointing to the specified location

Throws:
VlException

getVRSContext

public VRSContext getVRSContext()
Returns Resource Context associated with this client. Currently all VFSClients shared the same default VRSContext. Use setVRSContext(new VRSContext) to privatize your VRSContext.

Returns:
Global (default) VRSContext.

setVRSContext

public void setVRSContext(VRSContext context)
Sets new Resource Context associated with this client. Note that this context only aplies for NEW creates VFiles/VDirs. Other created resources still will use the old context. Preferably set this context before doing any other VFS calls !


getFile

public VFile getFile(java.lang.String locStr)
              throws VlException
Return VFile specified by the location string

Throws:
VlException

getVFSNode

public VFSNode getVFSNode(VRL location)
                   throws VlException
Return VFile specified by the location

Throws:
VlException

getFile

public VFile getFile(VRL location)
              throws VlException
Return VFile specified by the location

Throws:
VlException

getDir

public VDir getDir(java.lang.String locStr)
            throws VlException
Return VDir specified by the location string

Throws:
VlException

getDir

public VDir getDir(VRL location)
            throws VlException
Returns VDir specified by the location

Parameters:
location -
Returns:
Throws:
VlException

move

public VFile move(VFile file,
                  VDir dest)
           throws VlException
Move VFile to remore (VDir) destination.

Calls VFile.moveTo()

Returns:
new VFile node if move succeeded. Returns null othwise.
Throws:
VlException

copy

public VFile copy(VFile vfile,
                  VDir dest)
           throws VlException
Copy VFile to remote (VDir) destination.

Calls VFile.copyTo()

Returns:
new VFile node if move succeeded. Returns null othwise.
Throws:
VlException

copy

public VDir copy(VDir dir,
                 VDir dest)
          throws VlException
Copy single VDir

Throws:
VlException

asyncCopy

public VFSTransfer asyncCopy(VDir dir,
                             VDir dest)
                      throws VlException
Copy single VDir in background Returns TransgerInfo object which can be used to monitor the result

Throws:
VlException

asyncCopy

public VFSTransfer asyncCopy(VFile file,
                             VDir dest)
                      throws VlException
Copy single VFile in background. Returns TransgerInfo object which can be used to monitor the result.

Throws:
VlException

asyncMove

public VFSTransfer asyncMove(VDir dir,
                             VDir dest)
                      throws VlException
Move single VDir in background Returns TransgerInfo object which can be used to monitor the result.

Throws:
VlException

asyncMove

public VFSTransfer asyncMove(VFile file,
                             VDir dest)
                      throws VlException
Move single VFile in background. Returns TransgerInfo object which can be used to monitor the result.

Throws:
VlException

move

public VDir move(VDir dir,
                 VDir dest)
          throws VlException
VFS method to move single Dir

Parameters:
dir -
dest -
Returns:
new directory which is created after the move.
Throws:
VlException

rename

public boolean rename(VRL vrl,
                      java.lang.String pathOrName)
               throws VlException
VFS Rename. If newName starts with a '/' then a the full path of the file or directory will be renamed. If not, only the basename will be renamed.

Parameters:
VRL - original file or directory
pathOrName - is new name or complete path
Returns:
true if rename whas succesful
Throws:
VlException

existsDir

public boolean existsDir(VRL location)
Returns true if location is a VDir and it exists. Returns false if location doesn't exists or an exception occured.


existsFile

public boolean existsFile(VRL location)
Returns true if location is a VFile and it exists. Returns false if location doesn't exists or an exception occured.


close

public void close()
Close this client and release resources


mkdir

public VDir mkdir(VRL loc)
           throws VlException
Recursive mkdir. Tries to create the full path of the location VRL

Throws:
VlException

mkdir

public VDir mkdir(VRL loc,
                  boolean ignoreExisting)
           throws VlException
Recursive mkdir. Tries to create the full path of the location VRL

Throws:
VlException

getTempDir

public VDir getTempDir()
                throws VlException
Throws:
VlException

setTempDir

public boolean setTempDir(VRL loc)

createFile

public VFile createFile(VRL filepath,
                        boolean force)
                 throws VlException
Create file. Parent directory must exist!

Throws:
VlException