org.nees.data.service.impl
Class FileLocationManagerImpl

java.lang.Object
  extended byorg.nees.data.service.impl.FileLocationManagerImpl
All Implemented Interfaces:
FileLocationManager, InstantiationContractInterface

public class FileLocationManagerImpl
extends java.lang.Object
implements FileLocationManager

Created on March 25, 2004, 10:35 AM

Author:
Jeff Gaynor

Field Summary
 
Fields inherited from interface org.nees.data.service.impl.FileLocationManager
__CLASS_KEY, __IO_KEY, EXTERNAL_TEMP_URI_INDEX, INTERNAL_TEMP_URI_INDEX, SECRET_STAGING_DIR_DEFAULT, SECRET_STAGING_DIR_KEY
 
Constructor Summary
FileLocationManagerImpl()
          Creates a new instance of FileLocationManagerImpl
 
Method Summary
 boolean abortDownload(java.net.URI internalTempURI)
           
 boolean abortUpload(java.net.URI internalTempURI)
          Removes the file from the temporary staging area.
 void finishDownload(DownloadRequestRecord drr)
          When a client informs NFMS that the download is complete, this method is invoked to do any clean up (such as removing the file from the staging area.)
 java.net.URI finishUpload(UploadRequestRecord urr)
          Copies uploaded file to final destination and removes staging files as well.
protected  NMDSAdapter getNMDS()
           
protected  java.util.Properties getProperties()
           
protected  ProtocolHandler getProtocolHandler(java.lang.String protocol)
           
protected  PermanentStorageInterface getPStore()
           
 void initialize(java.util.Properties p, InitializationObjectInterface io)
           
 void isLogicalNameValid(LogicalName logicalName)
           
 java.net.URI[] startDownload(DownloadRequestRecord drr)
          Once a request to download a file is made, this method is invoked to copy the file to the staging area and create the appropriate download URI for the requesting client.
 java.net.URI[] startUpload(UploadRequestRecord urr)
          Gives a new physical location for file to be put in the repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileLocationManagerImpl

public FileLocationManagerImpl()
Creates a new instance of FileLocationManagerImpl

Method Detail

abortDownload

public boolean abortDownload(java.net.URI internalTempURI)
                      throws NFMSException
Specified by:
abortDownload in interface FileLocationManager
Returns:
boolean which is true if the abort worked. Note, an exception is thrown only if there is a bona fide error. In this way, this is a safe method to invoke and will work if the file was already downloaded (important, if the client is not sure and wants to try the entire operation again).
Throws:
NFMSException

abortUpload

public boolean abortUpload(java.net.URI internalTempURI)
                    throws NFMSException
Description copied from interface: FileLocationManager
Removes the file from the temporary staging area.

Specified by:
abortUpload in interface FileLocationManager
Returns:
boolean which is true if the abort worked. Note, an exception is thrown only if there is a bona fide error. In this way, this is a safe method to invoke and will work if the file did not get uploaded (important, if the client is not sure and wants to try the entire operation again).
Throws:
NFMSException

finishDownload

public void finishDownload(DownloadRequestRecord drr)
                    throws NFMSException
Description copied from interface: FileLocationManager
When a client informs NFMS that the download is complete, this method is invoked to do any clean up (such as removing the file from the staging area.)

Specified by:
finishDownload in interface FileLocationManager
Throws:
NFMSException

finishUpload

public java.net.URI finishUpload(UploadRequestRecord urr)
                          throws NFMSException
Description copied from interface: FileLocationManager
Copies uploaded file to final destination and removes staging files as well. This is called after upload process is complete.

Specified by:
finishUpload in interface FileLocationManager
Returns:
TransferCompleteReturnObject whose name says it all.
Throws:
NFMSException

getPStore

protected PermanentStorageInterface getPStore()
                                       throws NFMSException
Throws:
NFMSException

getNMDS

protected NMDSAdapter getNMDS()

getProperties

protected java.util.Properties getProperties()

initialize

public void initialize(java.util.Properties p,
                       InitializationObjectInterface io)
                throws java.lang.Exception
Specified by:
initialize in interface InstantiationContractInterface
Throws:
java.lang.Exception

startDownload

public java.net.URI[] startDownload(DownloadRequestRecord drr)
                             throws NFMSException
Description copied from interface: FileLocationManager
Once a request to download a file is made, this method is invoked to copy the file to the staging area and create the appropriate download URI for the requesting client.

Specified by:
startDownload in interface FileLocationManager
Parameters:
drr - the system infromation for this operation.
Returns:
java.net.URI the location where the client may retrieve the file.
Throws:
NFMSException

startUpload

public java.net.URI[] startUpload(UploadRequestRecord urr)
                           throws NFMSException
Description copied from interface: FileLocationManager
Gives a new physical location for file to be put in the repository. Called by NFMS to establish repository target for upload.

Specified by:
startUpload in interface FileLocationManager
Parameters:
urr - the system information for this operation.
Throws:
NFMSException

getProtocolHandler

protected ProtocolHandler getProtocolHandler(java.lang.String protocol)
                                      throws NFMSException
Throws:
NFMSException

isLogicalNameValid

public void isLogicalNameValid(LogicalName logicalName)
                        throws NFMSException
Specified by:
isLogicalNameValid in interface FileLocationManager
Throws:
NFMSException