|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tranche.commons.Debuggable
org.tranche.add.AddFileTool
public class AddFileTool
A helper utility that adds single files or directories (a.k.a. "data sets" or "projects") of files to the repository.
| Field Summary | |
|---|---|
static boolean |
DEFAULT_CHECK_EXISTING_CHUNKS
|
static boolean |
DEFAULT_COMPRESS
|
static boolean |
DEFAULT_DATA_ONLY
|
static int |
DEFAULT_DATA_QUEUE_SIZE
|
static boolean |
DEFAULT_EMAIL_ON_FAILURE
|
static boolean |
DEFAULT_EXPLODE_BEFORE_UPLOAD
|
static int |
DEFAULT_META_DATA_QUEUE_SIZE
|
static int |
DEFAULT_MINIMUM_THREADS
|
static boolean |
DEFAULT_SHOW_META_DATA_IF_ENCRYPTED
|
static boolean |
DEFAULT_SHOW_SUMMARY
|
static int |
DEFAULT_SIZE_FILE_ENCODING_BUFFER
|
static int |
DEFAULT_THREADS
Default parameters |
static boolean |
DEFAULT_USE_PERFORMANCE_LOG
|
static boolean |
DEFAULT_USE_UNSPECIFIED_SERVERS
|
| Constructor Summary | |
|---|---|
AddFileTool()
|
|
| Method Summary | |
|---|---|
boolean |
addConfirmationEmail(java.lang.String email)
Adds |
boolean |
addConfirmationEmails(java.util.Collection<java.lang.String> emails)
|
boolean |
addListener(AddFileToolListener l)
Adds a listener. |
void |
addMetaDataAnnotation(MetaDataAnnotation annotation)
Adds the given meta data annotation to the meta data annotations. |
boolean |
addServersToUse(java.util.Collection<java.lang.String> serverHostNames)
Adds a collection of server host names to be used during upload. |
boolean |
addServerToUse(java.lang.String serverHostName)
Adds the host name of a server to be used during upload. |
boolean |
addStickyServer(java.lang.String serverHostName)
Adds the host name of a server to which data should be stuck. |
boolean |
addStickyServers(java.util.Collection<java.lang.String> serverHostNames)
Adds a collection of server host names to which data should be stuck. |
void |
clearMetaDataAnnotations()
Clears the meta data annotations. |
void |
clearPassphrase()
Unsets the passphrase -- the upload will not be encrypted. |
AddFileToolReport |
execute()
|
AddFileToolReport |
execute(long startTimestamp)
|
long |
getBytesToUpload()
Gets the number of bytes that are being uploaded. |
long |
getBytesUploaded()
Gets the number of bytes that have been uploaded. |
java.util.Collection<java.lang.String> |
getConfirmationEmails()
|
protected java.util.Collection<java.lang.String> |
getCoreServersToUploadTo(BigHash hash)
Gets a collection of hosts of core writable servers to which a chunk with the given hash should be uploaded. |
java.lang.String |
getDescription()
Gets the description of the upload. |
java.io.File |
getFile()
|
int |
getFileCount()
|
License |
getLicense()
Gets the license to be attached to the upload. |
java.util.Collection<AddFileToolListener> |
getListeners()
|
java.util.Collection<MetaDataAnnotation> |
getMetaDataAnnotations()
Gets the meta data annotations to be added to the data set's project file meta data. |
protected java.util.Collection<java.lang.String> |
getNonCoreServersToUploadTo(BigHash hash)
Gets a collection of hosts of non-core writable servers to which one should upload a chunk with the given hash. |
java.lang.String |
getPassphrase()
Gets the passphrase that will be used to encrypt the data. |
java.util.Collection<java.lang.String> |
getServersToUse()
Gets the collection of server host names to be used. |
long |
getSize()
|
java.util.Collection<java.lang.String> |
getStickyServers()
Gets the collection of server host names to which data should be stuck. |
int |
getThreadCount()
Gets the number of threads to be used. |
TimeEstimator |
getTimeEstimator()
Gets the time to upload object. |
java.lang.String |
getTitle()
Gets the title of the upload. |
java.security.cert.X509Certificate |
getUserCertificate()
Gets the certificate for the uploading user. |
java.security.PrivateKey |
getUserPrivateKey()
Gets the private key for the uploading user. |
boolean |
isCompress()
Gets whether the files should be compressed before upload. |
boolean |
isDataOnly()
Gets whether only the data chunks will be uploaded. |
boolean |
isEmailOnFailure()
|
boolean |
isExecuting()
|
boolean |
isExplodeBeforeUpload()
Gets whether to try to decompress/unpack a compressed or bundled archive before uploading it. |
boolean |
isLocked()
|
boolean |
isPaused()
Gets whether the upload is paused. |
boolean |
isSendPerformanceInfo()
|
boolean |
isShowMetaDataIfEncrypted()
|
boolean |
isStopped()
|
boolean |
isUsingUnspecifiedServers()
Whether servers other than the ones specified should be used. |
static void |
main(java.lang.String[] args)
Command-line interface to tool. |
boolean |
removeConfirmationEmail(java.lang.String email)
|
boolean |
removeConfirmationEmails(java.util.Collection<java.lang.String> emails)
|
boolean |
removeListener(AddFileToolListener l)
Removes a listener. |
boolean |
removeServersToUse(java.util.Collection<java.lang.String> serverHostNames)
Removes a collection of host names from the list of servers to be used. |
boolean |
removeServerToUse(java.lang.String serverHostName)
Removes the server host name from the list of servers to be used. |
boolean |
removeStickyServer(java.lang.String serverHostName)
Removes the server host name from the list of sticky servers. |
boolean |
removeStickyServers(java.util.Collection<java.lang.String> serverHostNames)
Removes a collection of host names from the list of sticky servers. |
void |
setCompress(boolean compress)
Sets whether the files should be compressed before upload. |
void |
setDataOnly(boolean dataOnly)
Sets whether only the data chunks will be uploaded. |
void |
setDescription(java.lang.String description)
Sets the description of the upload. |
void |
setEmailOnFailure(boolean emailOnFailure)
|
void |
setExplodeBeforeUpload(boolean explodeBeforeUpload)
Sets whether to try to decompress/unpack a compressed or bundled archive before uploading it. |
void |
setFile(java.io.File file)
|
void |
setLicense(License license)
Sets the license to be attached to the upload. |
void |
setMetaDataAnnotations(java.util.Collection<MetaDataAnnotation> annotations)
Sets the meta data annotations to be added to the data set's project file meta data. |
void |
setPassphrase(java.lang.String passphrase)
Sets the passphrase with which to encrypt the data. |
void |
setPause(boolean paused)
Set whether the upload is paused. |
void |
setSendPerformanceInfo(boolean sendPerformanceInfo)
|
boolean |
setServersToUse(java.util.Collection<java.lang.String> serverHostNames)
|
void |
setShowMetaDataIfEncrypted(boolean showMetaDataIfEncrypted)
|
boolean |
setStickyServers(java.util.Collection<java.lang.String> serverHostNames)
|
void |
setThreadCount(int threadCount)
Sets the number of threads to be used. |
void |
setTitle(java.lang.String title)
Sets the title of the upload. |
protected void |
setUpConnections()
Used internally to establish and lock connections with servers that will be used. |
void |
setUserCertificate(java.security.cert.X509Certificate userCertificate)
Sets the certificate for the uploading user. |
void |
setUserPrivateKey(java.security.PrivateKey userPrivateKey)
Sets the private key for the uploading user. |
void |
setUseUnspecifiedServers(boolean useUnspecifiedServers)
Sets whether servers other than the ones specified should be used. |
void |
stop()
Stops the upload. |
protected void |
tearDownConnections()
Used internally to unlock connections made during set-up. |
void |
throwExceptionIfLocked()
|
| Methods inherited from class org.tranche.commons.Debuggable |
|---|
debugErr, debugErr, debugOut, isDebug, setDebug |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static int DEFAULT_THREADS
public static int DEFAULT_MINIMUM_THREADS
public static int DEFAULT_DATA_QUEUE_SIZE
public static int DEFAULT_META_DATA_QUEUE_SIZE
public static int DEFAULT_SIZE_FILE_ENCODING_BUFFER
public static boolean DEFAULT_CHECK_EXISTING_CHUNKS
public static boolean DEFAULT_USE_UNSPECIFIED_SERVERS
public static boolean DEFAULT_EXPLODE_BEFORE_UPLOAD
public static boolean DEFAULT_COMPRESS
public static boolean DEFAULT_DATA_ONLY
public static boolean DEFAULT_SHOW_SUMMARY
public static boolean DEFAULT_SHOW_META_DATA_IF_ENCRYPTED
public static boolean DEFAULT_EMAIL_ON_FAILURE
public static boolean DEFAULT_USE_PERFORMANCE_LOG
| Constructor Detail |
|---|
public AddFileTool()
| Method Detail |
|---|
public boolean isExecuting()
public boolean isLocked()
public void throwExceptionIfLocked()
public void setCompress(boolean compress)
Sets whether the files should be compressed before upload.
compress - Whether the files should be compressed before upload.public boolean isCompress()
Gets whether the files should be compressed before upload.
public void setExplodeBeforeUpload(boolean explodeBeforeUpload)
Sets whether to try to decompress/unpack a compressed or bundled archive before uploading it.
explodeBeforeUpload - Whether to try to decompress/unpack a compressed or bundled archive before uploading it.public boolean isExplodeBeforeUpload()
Gets whether to try to decompress/unpack a compressed or bundled archive before uploading it.
public void setDataOnly(boolean dataOnly)
Sets whether only the data chunks will be uploaded.
dataOnly - Whether only the data chunks will be uploaded.public boolean isDataOnly()
Gets whether only the data chunks will be uploaded.
public void setEmailOnFailure(boolean emailOnFailure)
emailOnFailure - public boolean isEmailOnFailure()
public void setShowMetaDataIfEncrypted(boolean showMetaDataIfEncrypted)
showMetaDataIfEncrypted - public boolean isShowMetaDataIfEncrypted()
public void setLicense(License license)
Sets the license to be attached to the upload.
license - The license to be attached to the upload.public License getLicense()
Gets the license to be attached to the upload.
public void setUserCertificate(java.security.cert.X509Certificate userCertificate)
Sets the certificate for the uploading user.
userCertificate - The certificate for the uploading user.public java.security.cert.X509Certificate getUserCertificate()
Gets the certificate for the uploading user.
public void setUserPrivateKey(java.security.PrivateKey userPrivateKey)
Sets the private key for the uploading user.
userPrivateKey - The private key for the uploading user.public java.security.PrivateKey getUserPrivateKey()
Gets the private key for the uploading user.
public void setTitle(java.lang.String title)
Sets the title of the upload.
title - The title of the upload.public java.lang.String getTitle()
Gets the title of the upload.
public void setDescription(java.lang.String description)
Sets the description of the upload.
description - The description of the upload.public java.lang.String getDescription()
Gets the description of the upload.
public void setPassphrase(java.lang.String passphrase)
Sets the passphrase with which to encrypt the data.
passphrase - The passphrase with which to encrypt the data.public void clearPassphrase()
Unsets the passphrase -- the upload will not be encrypted.
public java.lang.String getPassphrase()
Gets the passphrase that will be used to encrypt the data.
public void setMetaDataAnnotations(java.util.Collection<MetaDataAnnotation> annotations)
Sets the meta data annotations to be added to the data set's project file meta data.
annotations - The meta data annotations.public void addMetaDataAnnotation(MetaDataAnnotation annotation)
Adds the given meta data annotation to the meta data annotations.
annotation - A meta data annotation.public void clearMetaDataAnnotations()
Clears the meta data annotations.
public java.util.Collection<MetaDataAnnotation> getMetaDataAnnotations()
Gets the meta data annotations to be added to the data set's project file meta data.
public boolean addConfirmationEmail(java.lang.String email)
Adds
email -
public boolean addConfirmationEmails(java.util.Collection<java.lang.String> emails)
emails -
public boolean removeConfirmationEmail(java.lang.String email)
email -
public boolean removeConfirmationEmails(java.util.Collection<java.lang.String> emails)
emails -
public java.util.Collection<java.lang.String> getConfirmationEmails()
public boolean addStickyServer(java.lang.String serverHostName)
Adds the host name of a server to which data should be stuck.
serverHostName - The host name of a server.
public boolean addStickyServers(java.util.Collection<java.lang.String> serverHostNames)
Adds a collection of server host names to which data should be stuck.
serverHostNames - A collection of host names.
public boolean removeStickyServer(java.lang.String serverHostName)
Removes the server host name from the list of sticky servers.
serverHostName - The host name of a server.
public boolean removeStickyServers(java.util.Collection<java.lang.String> serverHostNames)
Removes a collection of host names from the list of sticky servers.
serverHostNames - A collection of server host names.
public java.util.Collection<java.lang.String> getStickyServers()
Gets the collection of server host names to which data should be stuck.
public boolean setStickyServers(java.util.Collection<java.lang.String> serverHostNames)
serverHostNames -
public boolean addServerToUse(java.lang.String serverHostName)
Adds the host name of a server to be used during upload.
serverHostName - The host name of a server.
public boolean addServersToUse(java.util.Collection<java.lang.String> serverHostNames)
Adds a collection of server host names to be used during upload.
serverHostNames - A collection of host names to be used during upload.
public boolean setServersToUse(java.util.Collection<java.lang.String> serverHostNames)
serverHostNames -
public boolean removeServerToUse(java.lang.String serverHostName)
Removes the server host name from the list of servers to be used.
serverHostName - The host name of a server.
public boolean removeServersToUse(java.util.Collection<java.lang.String> serverHostNames)
Removes a collection of host names from the list of servers to be used.
serverHostNames - A collection of server host names.
public java.util.Collection<java.lang.String> getServersToUse()
Gets the collection of server host names to be used.
public void setUseUnspecifiedServers(boolean useUnspecifiedServers)
Sets whether servers other than the ones specified should be used.
useUnspecifiedServers - Whether servers other than the ones specified should be used.public boolean isUsingUnspecifiedServers()
Whether servers other than the ones specified should be used.
public void setSendPerformanceInfo(boolean sendPerformanceInfo)
sendPerformanceInfo - public boolean isSendPerformanceInfo()
public void setPause(boolean paused)
Set whether the upload is paused.
paused - Whether the upload is paused.public boolean isPaused()
Gets whether the upload is paused.
public void stop()
Stops the upload.
public boolean isStopped()
public boolean addListener(AddFileToolListener l)
Adds a listener.
l - A listener.
public boolean removeListener(AddFileToolListener l)
Removes a listener.
l - A listener.
public java.util.Collection<AddFileToolListener> getListeners()
public long getBytesToUpload()
Gets the number of bytes that are being uploaded.
public long getBytesUploaded()
Gets the number of bytes that have been uploaded.
public TimeEstimator getTimeEstimator()
Gets the time to upload object.
public void setThreadCount(int threadCount)
Sets the number of threads to be used.
threadCount - The number of threads to be used.public int getThreadCount()
Gets the number of threads to be used.
public java.io.File getFile()
public int getFileCount()
public long getSize()
public void setFile(java.io.File file)
file -
protected void setUpConnections()
throws java.lang.Exception
Used internally to establish and lock connections with servers that will be used.
java.lang.Exceptionprotected void tearDownConnections()
Used internally to unlock connections made during set-up.
protected java.util.Collection<java.lang.String> getCoreServersToUploadTo(BigHash hash)
Gets a collection of hosts of core writable servers to which a chunk with the given hash should be uploaded.
hash -
protected java.util.Collection<java.lang.String> getNonCoreServersToUploadTo(BigHash hash)
Gets a collection of hosts of non-core writable servers to which one should upload a chunk with the given hash.
hash -
public AddFileToolReport execute()
public AddFileToolReport execute(long startTimestamp)
startTimestamp -
public static void main(java.lang.String[] args)
throws java.lang.Exception
Command-line interface to tool. Use -h or --help to see usage.
args - The set of arguments to be used when parsing the program.
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||