org.globus.cog.abstraction.impl.file.local
Class FileResourceImpl

java.lang.Object
  extended byorg.globus.cog.abstraction.impl.file.local.FileResourceImpl
All Implemented Interfaces:
FileResource, GridResource

public class FileResourceImpl
extends Object
implements FileResource

enables access to local file system through the file resource interface Supports absolute and relative path names


Field Summary
 
Fields inherited from interface org.globus.cog.abstraction.interfaces.FileResource
FTP, GridFTP, Local, WebDAV
 
Fields inherited from interface org.globus.cog.abstraction.interfaces.GridResource
EXECUTION, FILE, INFORMATION
 
Constructor Summary
FileResourceImpl()
           
FileResourceImpl(String name)
           
 
Method Summary
 void changeMode(GridFile newGridFile)
          chmod for the gridFile.
 void changeMode(String filename, int mode)
          chmod on a file.
 void createDirectory(String directory)
          make a new directory
 void deleteDirectory(String directory, boolean force)
          delete the given directory.
 void deleteFile(String fileName)
          remove a file
 boolean exists(String filename)
          return true of file exists
 Enumeration getAllAttributes()
           
 Object getAttribute(String name)
          get an attribute
 String getCurrentDirectory()
          return current path
 void getDirectory(String remoteDirName, String localDirName)
          copy a directory
 void getFile(String remoteFileName, String localFileName)
          copy a file
 GridFile getGridFile(String fileName)
          get file information
 Identity getIdentity()
          return identity of the resource
 void getMultipleFiles(String[] remoteFileNames, String localDirName)
          copy multiple files
 void getMultipleFiles(String[] remoteFileNames, String[] localFileNames)
          copy multiple files
 String getName()
          get name of the file resource
 String getProtocol()
          return protocol ="file"
 SecurityContext getSecurityContext()
          get security context of the file resource
 ServiceContact getServiceContact()
          get service contact
 int getType()
          return type = FILE which is defined in GridResource
 boolean isDirectory(String dirName)
          return true if input is a directory
 boolean isStarted()
           
 Collection list()
          list the contents of the current directory
 Collection list(String directory)
          list contents of the given directory
 void putDirectory(String localDirName, String remoteDirName)
          copy a directory
 void putFile(String localFileName, String remoteFileName)
          copy a file
 void putMultipleFiles(String[] localFileNames, String remoteDirName)
          copy multiple files
 void putMultipleFiles(String[] localFileNames, String[] remoteFileNames)
          copy multiple files
 void rename(String remoteFileName1, String remoteFileName2)
          rename a file.
 void setAttribute(String name, Object value)
          set an attribute
 void setCurrentDirectory(String directory)
          equivalent to cd
 void setIdentity(Identity identity)
          Set identity of the resource
 void setName(String name)
          set name for the file resource
 void setSecurityContext(SecurityContext securityContext)
          set security context for the file resource
 void setServiceContact(ServiceContact serviceContact)
          set service contact
 void start()
          set user's home directory as the current directory
 void stop()
          close the file
 void submit(ExecutableObject commandWorkflow)
          submit a workflow to local resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileResourceImpl

public FileResourceImpl()

FileResourceImpl

public FileResourceImpl(String name)
Method Detail

setName

public void setName(String name)
set name for the file resource

Specified by:
setName in interface GridResource

getName

public String getName()
get name of the file resource

Specified by:
getName in interface GridResource

setIdentity

public void setIdentity(Identity identity)
Set identity of the resource

Specified by:
setIdentity in interface GridResource

getIdentity

public Identity getIdentity()
return identity of the resource

Specified by:
getIdentity in interface GridResource

getType

public int getType()
return type = FILE which is defined in GridResource

Specified by:
getType in interface GridResource

getProtocol

public String getProtocol()
return protocol ="file"

Specified by:
getProtocol in interface FileResource

setSecurityContext

public void setSecurityContext(SecurityContext securityContext)
set security context for the file resource

Specified by:
setSecurityContext in interface FileResource

getSecurityContext

public SecurityContext getSecurityContext()
get security context of the file resource

Specified by:
getSecurityContext in interface FileResource

setServiceContact

public void setServiceContact(ServiceContact serviceContact)
set service contact

Specified by:
setServiceContact in interface FileResource

getServiceContact

public ServiceContact getServiceContact()
get service contact

Specified by:
getServiceContact in interface FileResource

start

public void start()
           throws IllegalHostException,
                  InvalidSecurityContextException,
                  GeneralException
set user's home directory as the current directory

Specified by:
start in interface FileResource
Throws:
IllegalHostException
InvalidSecurityContextException
GeneralException

stop

public void stop()
          throws GeneralException
close the file

Specified by:
stop in interface FileResource
Throws:
GeneralException

isStarted

public boolean isStarted()
Specified by:
isStarted in interface FileResource

setCurrentDirectory

public void setCurrentDirectory(String directory)
                         throws DirectoryNotFoundException,
                                GeneralException
equivalent to cd

Specified by:
setCurrentDirectory in interface FileResource
Throws:
DirectoryNotFoundException
GeneralException

getCurrentDirectory

public String getCurrentDirectory()
                           throws GeneralException
return current path

Specified by:
getCurrentDirectory in interface FileResource
Throws:
GeneralException

list

public Collection list()
                throws GeneralException
list the contents of the current directory

Specified by:
list in interface FileResource
Throws:
GeneralException

list

public Collection list(String directory)
                throws DirectoryNotFoundException,
                       GeneralException
list contents of the given directory

Specified by:
list in interface FileResource
Throws:
DirectoryNotFoundException
GeneralException

createDirectory

public void createDirectory(String directory)
                     throws GeneralException
make a new directory

Specified by:
createDirectory in interface FileResource
Throws:
GeneralException

deleteDirectory

public void deleteDirectory(String directory,
                            boolean force)
                     throws DirectoryNotFoundException,
                            GeneralException
delete the given directory. If force == true, recursive delete

Specified by:
deleteDirectory in interface FileResource
Throws:
DirectoryNotFoundException
GeneralException

deleteFile

public void deleteFile(String fileName)
                throws FileNotFoundException,
                       GeneralException
remove a file

Specified by:
deleteFile in interface FileResource
Throws:
FileNotFoundException
GeneralException

getFile

public void getFile(String remoteFileName,
                    String localFileName)
             throws FileNotFoundException,
                    GeneralException
copy a file

Specified by:
getFile in interface FileResource
Throws:
FileNotFoundException
GeneralException

putFile

public void putFile(String localFileName,
                    String remoteFileName)
             throws FileNotFoundException,
                    GeneralException
copy a file

Specified by:
putFile in interface FileResource
Throws:
FileNotFoundException
GeneralException

getDirectory

public void getDirectory(String remoteDirName,
                         String localDirName)
                  throws DirectoryNotFoundException,
                         GeneralException
copy a directory

Specified by:
getDirectory in interface FileResource
Throws:
DirectoryNotFoundException
GeneralException

putDirectory

public void putDirectory(String localDirName,
                         String remoteDirName)
                  throws DirectoryNotFoundException,
                         GeneralException
copy a directory

Specified by:
putDirectory in interface FileResource
Throws:
DirectoryNotFoundException
GeneralException

getMultipleFiles

public void getMultipleFiles(String[] remoteFileNames,
                             String[] localFileNames)
                      throws FileNotFoundException,
                             GeneralException
copy multiple files

Specified by:
getMultipleFiles in interface FileResource
Throws:
FileNotFoundException
GeneralException

getMultipleFiles

public void getMultipleFiles(String[] remoteFileNames,
                             String localDirName)
                      throws FileNotFoundException,
                             DirectoryNotFoundException,
                             GeneralException
copy multiple files

Specified by:
getMultipleFiles in interface FileResource
Throws:
FileNotFoundException
DirectoryNotFoundException
GeneralException

putMultipleFiles

public void putMultipleFiles(String[] localFileNames,
                             String[] remoteFileNames)
                      throws FileNotFoundException,
                             GeneralException
copy multiple files

Specified by:
putMultipleFiles in interface FileResource
Throws:
FileNotFoundException
GeneralException

putMultipleFiles

public void putMultipleFiles(String[] localFileNames,
                             String remoteDirName)
                      throws FileNotFoundException,
                             DirectoryNotFoundException,
                             GeneralException
copy multiple files

Specified by:
putMultipleFiles in interface FileResource
Throws:
FileNotFoundException
DirectoryNotFoundException
GeneralException

rename

public void rename(String remoteFileName1,
                   String remoteFileName2)
            throws FileNotFoundException,
                   GeneralException
rename a file.

Specified by:
rename in interface FileResource
Throws:
FileNotFoundException
GeneralException

changeMode

public void changeMode(String filename,
                       int mode)
                throws FileNotFoundException,
                       GeneralException
chmod on a file. not implemented for local resource

Specified by:
changeMode in interface FileResource
Throws:
FileNotFoundException
GeneralException

changeMode

public void changeMode(GridFile newGridFile)
                throws FileNotFoundException,
                       GeneralException
chmod for the gridFile. not implemented for local resource

Specified by:
changeMode in interface FileResource
Throws:
FileNotFoundException
GeneralException

getGridFile

public GridFile getGridFile(String fileName)
                     throws FileNotFoundException,
                            GeneralException
get file information

Specified by:
getGridFile in interface FileResource
Throws:
FileNotFoundException
GeneralException

exists

public boolean exists(String filename)
               throws FileNotFoundException,
                      GeneralException
return true of file exists

Specified by:
exists in interface FileResource
Throws:
FileNotFoundException
GeneralException

isDirectory

public boolean isDirectory(String dirName)
                    throws GeneralException
return true if input is a directory

Specified by:
isDirectory in interface FileResource
Throws:
GeneralException

submit

public void submit(ExecutableObject commandWorkflow)
            throws IllegalSpecException,
                   TaskSubmissionException
submit a workflow to local resource. not implemented

Specified by:
submit in interface FileResource
Throws:
IllegalSpecException
TaskSubmissionException

setAttribute

public void setAttribute(String name,
                         Object value)
set an attribute

Specified by:
setAttribute in interface FileResource

getAllAttributes

public Enumeration getAllAttributes()
Specified by:
getAllAttributes in interface FileResource

getAttribute

public Object getAttribute(String name)
get an attribute

Specified by:
getAttribute in interface FileResource