de.unikassel.android.sdcframework.transmission
Class FailSafeProtocol

Package class diagram package FailSafeProtocol
java.lang.Object
  extended by de.unikassel.android.sdcframework.transmission.FailSafeProtocol
All Implemented Interfaces:
ProtocolStrategy, UpdatableTransmissionComponent<TransmissionProtocolConfiguration>

public class FailSafeProtocol
extends Object
implements ProtocolStrategy

Implementation of a protocol which does never fail, to be used for test purpose.


Field Summary
private  Context context
          The context
 
Constructor Summary
FailSafeProtocol(Context context)
          Constructor
 
Method Summary
 Context getContext()
          Getter for the application context
 String getFileName()
          Getter for name of the file to upload
 String getHost()
          Getter for the host
 String getLastError()
          Getter for the last error
 URL getURL()
          Getter for the URL
 void setFileName(String fileName)
          Setter for the file to upload
 void setLastError(String lastError)
          Setter for the last error
 void updateConfiguration(Context context, TransmissionProtocolConfiguration config)
          Method to update the component by a configuration
 boolean uploadFile()
          Does upload the current file set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

private final Context context
The context

Constructor Detail

FailSafeProtocol

public FailSafeProtocol(Context context)
Constructor

Parameters:
context - the application context
Method Detail

updateConfiguration

public void updateConfiguration(Context context,
                                TransmissionProtocolConfiguration config)
Description copied from interface: UpdatableTransmissionComponent
Method to update the component by a configuration

Specified by:
updateConfiguration in interface UpdatableTransmissionComponent<TransmissionProtocolConfiguration>
Parameters:
context - the application context
config - the configuration to update from

uploadFile

public boolean uploadFile()
Description copied from interface: ProtocolStrategy
Does upload the current file set

Specified by:
uploadFile in interface ProtocolStrategy
Returns:
true if successful, flase otherwise

getContext

public Context getContext()
Description copied from interface: ProtocolStrategy
Getter for the application context

Specified by:
getContext in interface ProtocolStrategy
Returns:
the application context

getURL

public URL getURL()
Description copied from interface: ProtocolStrategy
Getter for the URL

Specified by:
getURL in interface ProtocolStrategy
Returns:
the URL

getLastError

public String getLastError()
Description copied from interface: ProtocolStrategy
Getter for the last error

Specified by:
getLastError in interface ProtocolStrategy
Returns:
the last error description or null if no error did occur

setLastError

public void setLastError(String lastError)
Description copied from interface: ProtocolStrategy
Setter for the last error

Specified by:
setLastError in interface ProtocolStrategy
Parameters:
lastError - the laste error to set

setFileName

public void setFileName(String fileName)
Description copied from interface: ProtocolStrategy
Setter for the file to upload

Specified by:
setFileName in interface ProtocolStrategy
Parameters:
fileName - the name of the file to upload

getFileName

public String getFileName()
Description copied from interface: ProtocolStrategy
Getter for name of the file to upload

Specified by:
getFileName in interface ProtocolStrategy
Returns:
the file to upload

getHost

public String getHost()
Description copied from interface: ProtocolStrategy
Getter for the host

Specified by:
getHost in interface ProtocolStrategy
Returns:
the host if url is valid, otherwise null