Package org.syncany.plugins.transfer
Class TransferSettings
- java.lang.Object
-
- org.syncany.plugins.transfer.TransferSettings
-
- Direct Known Subclasses:
LocalTransferSettings
public abstract class TransferSettings extends java.lang.Object
A connection represents the configuration settings of a storage/connection plugin. It is created through the concrete implementation of aPlugin
.Options for a plugin specific
TransferSettings
can be defined using theElement
annotation. Furthermore some Syncany-specific annotations are available.
-
-
Constructor Summary
Constructors Constructor Description TransferSettings()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
decrypt(java.lang.String encryptedHexString)
static java.lang.String
encrypt(java.lang.String decryptedPlainString)
java.lang.String
getField(java.lang.String key)
Get a setting's value.java.lang.String
getReasonForLastValidationFail()
Get the reason why the validation withisValid()
failed.java.lang.String
getType()
UserInteractionListener
getUserInteractionListener()
boolean
isValid()
Check if aTransferSettings
instance is valid i.e.void
setField(java.lang.String key, java.lang.Object value)
Set the value of a field in the settings class.void
setUserInteractionListener(UserInteractionListener userInteractionListener)
java.lang.String
toString()
void
validateRequiredFields()
Validate if all required fields are present.
-
-
-
Constructor Detail
-
TransferSettings
public TransferSettings()
-
-
Method Detail
-
getUserInteractionListener
public UserInteractionListener getUserInteractionListener()
-
setUserInteractionListener
public void setUserInteractionListener(UserInteractionListener userInteractionListener)
-
getType
public final java.lang.String getType()
-
getField
public final java.lang.String getField(java.lang.String key) throws StorageException
Get a setting's value.- Parameters:
key
- The field name as it is used in theTransferSettings
- Returns:
- The value converted to a string using
Class.toString()
- Throws:
StorageException
- Thrown if the field either does not exist or isn't accessible
-
setField
public final void setField(java.lang.String key, java.lang.Object value) throws StorageException
Set the value of a field in the settings class.- Parameters:
key
- The field name as it is used in theTransferSettings
value
- The object which should be the setting's value. The object's type must match the field type.Integer
,String
,Boolean
,File
and implementation ofTransferSettings
are converted.- Throws:
StorageException
- Thrown if the field either does not exist or isn't accessible or conversion failed due to invalid field types.
-
isValid
public final boolean isValid()
Check if aTransferSettings
instance is valid i.e. all required fields are present.TransferSettings
specific validators can be deposited by annotating a method withValidate
.- Returns:
- True if the
TransferSettings
instance is valid.
-
getReasonForLastValidationFail
public final java.lang.String getReasonForLastValidationFail()
Get the reason why the validation withisValid()
failed.- Returns:
- The first reason why the validation process failed
-
validateRequiredFields
public final void validateRequiredFields() throws StorageException
Validate if all required fields are present.- Throws:
StorageException
- Thrown if the validation failed due to missing field values.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
decrypt
public static java.lang.String decrypt(java.lang.String encryptedHexString) throws CipherException
- Throws:
CipherException
-
encrypt
public static java.lang.String encrypt(java.lang.String decryptedPlainString) throws CipherException
- Throws:
CipherException
-
-