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
TransferSettingscan be defined using theElementannotation. 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.Stringdecrypt(java.lang.String encryptedHexString)static java.lang.Stringencrypt(java.lang.String decryptedPlainString)java.lang.StringgetField(java.lang.String key)Get a setting's value.java.lang.StringgetReasonForLastValidationFail()Get the reason why the validation withisValid()failed.java.lang.StringgetType()UserInteractionListenergetUserInteractionListener()booleanisValid()Check if aTransferSettingsinstance is valid i.e.voidsetField(java.lang.String key, java.lang.Object value)Set the value of a field in the settings class.voidsetUserInteractionListener(UserInteractionListener userInteractionListener)java.lang.StringtoString()voidvalidateRequiredFields()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 theTransferSettingsvalue- The object which should be the setting's value. The object's type must match the field type.Integer,String,Boolean,Fileand implementation ofTransferSettingsare 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 aTransferSettingsinstance is valid i.e. all required fields are present.TransferSettingsspecific validators can be deposited by annotating a method withValidate.- Returns:
- True if the
TransferSettingsinstance 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:
toStringin 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
-
-