org.nees.data.store.backend
Class MySqlNFMSBackend

java.lang.Object
  extended byorg.nees.data.store.backend.MySqlNFMSBackend
All Implemented Interfaces:
InstantiationContractInterface, NFMSBackendInterface, NFMSConstants

public class MySqlNFMSBackend
extends java.lang.Object
implements NFMSBackendInterface, NFMSConstants

Author:
Jeff Gaynor

Field Summary
static java.lang.String MYSQL_DRIVER_KEY
           
static java.lang.String MYSQL_PASSWORD_KEY
           
static java.lang.String MYSQL_URL_KEY
           
static java.lang.String MYSQL_USER_NAME_KEY
           
static java.lang.String MYSQL_XF_TABLE_NAME_KEY
           
 
Fields inherited from interface org.nees.data.store.backend.NFMSBackendInterface
__CLASS_KEY, __IO_KEY
 
Fields inherited from interface org.nees.data.service.impl.NFMSConstants
FILE_VERSION_UNAVAILABLE, LATEST_FILE_VERSION, NFMS_DEFAULT_EXPIRATION_TIMEOUT, NFMS_EXPIRATION_TIMEOUT_KEY, NONEXISTENT_FILE_VERSION, PROTOCOL_FILE, PROTOCOL_FTP, PROTOCOL_GRIDFTP, PROTOCOL_HTTP
 
Constructor Summary
MySqlNFMSBackend()
           
 
Method Summary
protected  java.net.URI checkURI(java.lang.String rawURI)
          Checks that we don't do something goofy with a returned value from an SQL query
protected  void cleanupRS(java.sql.Statement stmt, java.sql.ResultSet rs)
           
 DownloadRequestRecord createDownloadRequest(LogicalName logicalName, DownloadOptions dOptions)
           
protected  TransferRequestRecord createTransferRequest(LogicalName logicalName, TransferOptions tOptions, int xfTypeCode)
          This does the grunt work of creating a transfer request.
 UploadRequestRecord createUploadRequest(LogicalName logicalName, UploadOptions uOptions)
           
 long getExpirationTimeout()
           
protected  MySqlNFMSBackendIO getInitObject()
           
 NMDSAdapter getNMDS()
           
 java.lang.String getXFTableName()
           
 void initialize(java.util.Properties p, InitializationObjectInterface ioi)
           
 boolean removeExpiredRequests()
          This will try to remove the given token.
 boolean removeRequest(int xfToken)
          This will try to remove the given token.
 DownloadRequestRecord retrieveDownloadRequest(int xfToken)
          This will get the pending download request.
 UploadRequestRecord retrieveUploadRequest(int xfToken)
          This will get the pending upload request.
protected  TransferRequestRecord retrieveXFRequest(int xfToken, int xfTypeCode)
          This will get the record for the user and position the cursor at the first record.
protected  void setExpirationTimeout(long expirationTimeout)
           
protected  void setXFTableName(java.lang.String xfTableName)
           
 java.lang.String toString()
          A report on this object.
 void updatePermanentLocationURI(TransferRequestRecord trr)
           
 void updateRequestURI(TransferRequestRecord trr)
          After a request is made.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MYSQL_DRIVER_KEY

public static java.lang.String MYSQL_DRIVER_KEY

MYSQL_URL_KEY

public static java.lang.String MYSQL_URL_KEY

MYSQL_USER_NAME_KEY

public static java.lang.String MYSQL_USER_NAME_KEY

MYSQL_PASSWORD_KEY

public static java.lang.String MYSQL_PASSWORD_KEY

MYSQL_XF_TABLE_NAME_KEY

public static java.lang.String MYSQL_XF_TABLE_NAME_KEY
Constructor Detail

MySqlNFMSBackend

public MySqlNFMSBackend()
Method Detail

getInitObject

protected MySqlNFMSBackendIO getInitObject()

toString

public java.lang.String toString()
A report on this object.


createDownloadRequest

public DownloadRequestRecord createDownloadRequest(LogicalName logicalName,
                                                   DownloadOptions dOptions)
                                            throws NFMSException
Specified by:
createDownloadRequest in interface NFMSBackendInterface
Throws:
NFMSException

createUploadRequest

public UploadRequestRecord createUploadRequest(LogicalName logicalName,
                                               UploadOptions uOptions)
                                        throws NFMSException
Specified by:
createUploadRequest in interface NFMSBackendInterface
Throws:
NFMSException

createTransferRequest

protected TransferRequestRecord createTransferRequest(LogicalName logicalName,
                                                      TransferOptions tOptions,
                                                      int xfTypeCode)
                                               throws NFMSException
This does the grunt work of creating a transfer request. The two types are quite similar up to a few fields.

Throws:
NFMSException

removeRequest

public boolean removeRequest(int xfToken)
                      throws NFMSException
This will try to remove the given token. Note that we can't ensure that the request is still in the store, since there should be some garbage collection happening. Therefore, this will return true if the delete suceeded and false otherwise.

Specified by:
removeRequest in interface NFMSBackendInterface
Throws:
NFMSException

removeExpiredRequests

public boolean removeExpiredRequests()
                              throws NFMSException
This will try to remove the given token. Note that we can't ensure that the request is still in the store, since there should be some garbage collection happening. Therefore, this will return true if the delete suceeded and false otherwise.

Throws:
NFMSException

retrieveDownloadRequest

public DownloadRequestRecord retrieveDownloadRequest(int xfToken)
                                              throws NFMSException
This will get the pending download request. Note that this will throw an exception if the client that made the initial request is not the same as the current client.

Specified by:
retrieveDownloadRequest in interface NFMSBackendInterface
Throws:
NFMSException

retrieveUploadRequest

public UploadRequestRecord retrieveUploadRequest(int xfToken)
                                          throws NFMSException
This will get the pending upload request. Note that this will throw an exception if the client that made the initial request is not the same as the current client. If the request is not found, this throw an exception.

Specified by:
retrieveUploadRequest in interface NFMSBackendInterface
Throws:
NFMSException

cleanupRS

protected void cleanupRS(java.sql.Statement stmt,
                         java.sql.ResultSet rs)
                  throws NFMSException
Throws:
NFMSException

retrieveXFRequest

protected TransferRequestRecord retrieveXFRequest(int xfToken,
                                                  int xfTypeCode)
                                           throws NFMSException
This will get the record for the user and position the cursor at the first record. It will also check that the user that is requesting the operation is the correct one

Throws:
NFMSException

checkURI

protected java.net.URI checkURI(java.lang.String rawURI)
                         throws java.net.URISyntaxException
Checks that we don't do something goofy with a returned value from an SQL query

Throws:
java.net.URISyntaxException

initialize

public void initialize(java.util.Properties p,
                       InitializationObjectInterface ioi)
                throws InstantiationContractException,
                       NFMSException
Specified by:
initialize in interface InstantiationContractInterface
Throws:
InstantiationContractException
NFMSException

updateRequestURI

public void updateRequestURI(TransferRequestRecord trr)
                      throws NFMSException
Description copied from interface: NFMSBackendInterface
After a request is made. the only operations allowed are changing its URIs or deleting it.

Specified by:
updateRequestURI in interface NFMSBackendInterface
Throws:
NFMSException

updatePermanentLocationURI

public void updatePermanentLocationURI(TransferRequestRecord trr)
                                throws NFMSException
Specified by:
updatePermanentLocationURI in interface NFMSBackendInterface
Throws:
NFMSException

getXFTableName

public java.lang.String getXFTableName()

setXFTableName

protected void setXFTableName(java.lang.String xfTableName)

getExpirationTimeout

public long getExpirationTimeout()

setExpirationTimeout

protected void setExpirationTimeout(long expirationTimeout)

getNMDS

public NMDSAdapter getNMDS()
                    throws NFMSException
Throws:
NFMSException