org.nees.data.service.client
Class NFMSFacade

java.lang.Object
  extended byorg.nees.util.sessions.SessionFacade
      extended byorg.nees.data.service.client.NFMSFacade

public class NFMSFacade
extends SessionFacade

This class provides a set of convenience API's for uploading and downloading files to and from a repository using NFMS and GridFTP. It combines the steps of negotiating transfers and performing the transfers, so that the application does not need to use any GridFTP API's. It can also interact with an NMDS service to create metadata linked to each file.

Typical Usage:

Used instead of lower-level methods in the FileManagementService interface.

Life Cycle:

Once a FileManagementService is located, it's passed to NFMSFacade's constructor. Then, NFMSFacade methods can be used to put or get files to and from the repository. The variants of get() and put() are used to do this. In addition, an NMDS instance can be passed to setRepositoryService and then serveral NMDS-related methods can be used to create and retrieve metadata objects associated with files; see createFileObject() and getFileObject() for details.


Constructor Summary
NFMSFacade(SessionFactory factory)
           
NFMSFacade(SessionFactory factory, java.lang.String protocol)
          Create an NFMSFacade for an NFMS service.
NFMSFacade(SessionProvider provider)
           
NFMSFacade(SessionProvider provider, java.lang.String protocol)
          Create an NFMSFacade for an NFMS service.
 
Method Summary
 void append(LogicalName logicalName, java.io.File localFragment)
          Append to an existing file or create a new file if none exists.
 void append(LogicalName logicalName, java.io.File[] fileList)
           
 void appendNew(LogicalName logicalName, java.io.File localFragment)
          Appends to an existing file, throwing an exception if the file already exists on the server.
 void appendNewVersion(LogicalName logicalName, java.io.File localFragment)
          If the file is already on the server, this will version it and append.
 void appendNewVersion(LogicalName logicalName, java.io.File[] fList)
          This will append several files to a (possibly) existing one and create a new version consisting of all the files concatenated.
 void get(LogicalName logicalName, java.io.File localFile, int versionNumber)
          If the file is already on the server, this will version it and append.
 org.ietf.jgss.GSSCredential getCredential()
          Get the credential used to authenticate to the services.
 void getLatestVersion(LogicalName logicalName, java.io.File localFile)
           
 int getLatestVersionNumber(LogicalName logicalName)
           
 void put(LogicalName logicalName, java.io.File localFile)
           
 void put(LogicalName logicalName, java.io.File localFile, boolean isNew, boolean isToAppend, boolean makeNewVersion)
           
 void putNew(LogicalName logicalName, java.io.File localFile)
           
 void putNewVersion(LogicalName logicalName, java.io.File localFragment)
           
 void serverSideAppend(LogicalName tailLN, int tailVersion, LogicalName headLN, boolean makeNewVersion)
           
 void serverSideCopy(LogicalName sourceLN, int sourceVersion, LogicalName targetLN, boolean overwrite, boolean makeNewVersion)
           
 void serverSideDelete(LogicalName logicalName, int versionNumber)
           
 void setASCIITransferType()
          Set the transfer type to ASCII.
 void setBinaryTransferType()
          Set the transfer type to binary.
 
Methods inherited from class org.nees.util.sessions.SessionFacade
getSession, getSessionProvider, releaseSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NFMSFacade

public NFMSFacade(SessionFactory factory,
                  java.lang.String protocol)
           throws java.lang.Exception
Create an NFMSFacade for an NFMS service.

Throws:
java.lang.Exception - If the facade cannot be initialized.

NFMSFacade

public NFMSFacade(SessionFactory factory)
           throws java.lang.Exception

NFMSFacade

public NFMSFacade(SessionProvider provider,
                  java.lang.String protocol)
           throws java.lang.Exception
Create an NFMSFacade for an NFMS service.

Throws:
java.lang.Exception - If the facade cannot be initialized.

NFMSFacade

public NFMSFacade(SessionProvider provider)
           throws java.lang.Exception
Method Detail

setASCIITransferType

public void setASCIITransferType()
Set the transfer type to ASCII. Use this if you are transmitting text files encoded in ASCII.


setBinaryTransferType

public void setBinaryTransferType()
Set the transfer type to binary. Use this for non-text files, or text files encoded in an encoding other than ASCII.


getCredential

public org.ietf.jgss.GSSCredential getCredential()
                                          throws java.lang.Exception
Get the credential used to authenticate to the services.

Returns:
the credential used to authenticate to the services.
Throws:
java.lang.Exception - If the credential cannot be loaded.

append

public void append(LogicalName logicalName,
                   java.io.File localFragment)
            throws java.lang.Exception
Append to an existing file or create a new file if none exists. Uses the default credential.

Parameters:
logicalName - The logical name for the file
localFragment - The local file to be appended.
Throws:
java.lang.Exception - If an error prevents completion.

append

public void append(LogicalName logicalName,
                   java.io.File[] fileList)
            throws java.lang.Exception
Throws:
java.lang.Exception

appendNewVersion

public void appendNewVersion(LogicalName logicalName,
                             java.io.File[] fList)
                      throws java.lang.Exception
This will append several files to a (possibly) existing one and create a new version consisting of all the files concatenated.

Throws:
java.lang.Exception

appendNew

public void appendNew(LogicalName logicalName,
                      java.io.File localFragment)
               throws java.lang.Exception
Appends to an existing file, throwing an exception if the file already exists on the server. Uses the default credential.

Parameters:
logicalName - The logical name of the file.
localFragment - The name of the local file
Throws:
java.lang.Exception - Thrown if the given logical name is already in use on the server.

appendNewVersion

public void appendNewVersion(LogicalName logicalName,
                             java.io.File localFragment)
                      throws java.lang.Exception
If the file is already on the server, this will version it and append. If the file does not exists, it will be created. Uses the default credential.

Parameters:
logicalName -
localFragment -
Throws:
java.lang.Exception

get

public void get(LogicalName logicalName,
                java.io.File localFile,
                int versionNumber)
         throws java.lang.Exception
If the file is already on the server, this will version it and append. If the file does not exists, it will be created. Uses the supplied credential.

Parameters:
logicalName -
Throws:
java.lang.Exception

getLatestVersion

public void getLatestVersion(LogicalName logicalName,
                             java.io.File localFile)
                      throws java.lang.Exception
Throws:
java.lang.Exception

getLatestVersionNumber

public int getLatestVersionNumber(LogicalName logicalName)
                           throws java.lang.Exception
Throws:
java.lang.Exception

put

public void put(LogicalName logicalName,
                java.io.File localFile)
         throws java.lang.Exception
Throws:
java.lang.Exception

put

public void put(LogicalName logicalName,
                java.io.File localFile,
                boolean isNew,
                boolean isToAppend,
                boolean makeNewVersion)
         throws java.lang.Exception
Throws:
java.lang.Exception

putNew

public void putNew(LogicalName logicalName,
                   java.io.File localFile)
            throws java.lang.Exception
Throws:
java.lang.Exception

putNewVersion

public void putNewVersion(LogicalName logicalName,
                          java.io.File localFragment)
                   throws java.lang.Exception
Throws:
java.lang.Exception

serverSideCopy

public void serverSideCopy(LogicalName sourceLN,
                           int sourceVersion,
                           LogicalName targetLN,
                           boolean overwrite,
                           boolean makeNewVersion)
                    throws java.lang.Exception
Throws:
java.lang.Exception

serverSideAppend

public void serverSideAppend(LogicalName tailLN,
                             int tailVersion,
                             LogicalName headLN,
                             boolean makeNewVersion)
                      throws java.lang.Exception
Throws:
java.lang.Exception

serverSideDelete

public void serverSideDelete(LogicalName logicalName,
                             int versionNumber)
                      throws java.lang.Exception
Throws:
java.lang.Exception