de.unikassel.android.sdcframework.transmission
Class UploadManager

Package class diagram package UploadManager
java.lang.Object
  extended by de.unikassel.android.sdcframework.transmission.UploadManager
All Implemented Interfaces:
UpdatableTransmissionComponent<TransmissionConfiguration>

public class UploadManager
extends Object
implements UpdatableTransmissionComponent<TransmissionConfiguration>

The manager responsible to handle the file upload to a remote server.


Field Summary
protected  ConnectionStrategy connectionStrategy
          The connection strategy to prepare Internet access via URLConnection
private  Class<?> controlActivityClass
          The control activity for notification purpose.
protected  ProtocolStrategy protocolStrategy
          The strategy implementing the protocol
private  UUID uuid
          The unique device identifier created by the service
 
Constructor Summary
UploadManager(Context applicationContext, TransmissionConfiguration config, UUID uuid, Class<?> controlActivityClass)
          Constructor
 
Method Summary
 ConnectionStrategy getConnectionStrategy()
          Getter for the connectionStrategy
 ProtocolStrategy getProtocolStrategy()
          Getter for the protocolStrategy
 void updateConfiguration(Context context, TransmissionConfiguration config)
          Method to update the component by a configuration
 boolean uploadFile(String fileName)
          Does upload a file to the configured remote server using the given authentication data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connectionStrategy

protected ConnectionStrategy connectionStrategy
The connection strategy to prepare Internet access via URLConnection


protocolStrategy

protected ProtocolStrategy protocolStrategy
The strategy implementing the protocol


uuid

private final UUID uuid
The unique device identifier created by the service


controlActivityClass

private final Class<?> controlActivityClass
The control activity for notification purpose.

Constructor Detail

UploadManager

public UploadManager(Context applicationContext,
                     TransmissionConfiguration config,
                     UUID uuid,
                     Class<?> controlActivityClass)
Constructor

Parameters:
applicationContext - the application context
config - the current transmission configuration
uuid - the unique device identifier created by the service
controlActivityClass - the control activity class or null
Method Detail

getConnectionStrategy

public ConnectionStrategy getConnectionStrategy()
Getter for the connectionStrategy

Returns:
the connectionStrategy

getProtocolStrategy

public ProtocolStrategy getProtocolStrategy()
Getter for the protocolStrategy

Returns:
the protocolStrategy

updateConfiguration

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

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

uploadFile

public boolean uploadFile(String fileName)
Does upload a file to the configured remote server using the given authentication data

Parameters:
fileName - the file to upload
Returns:
true if successful, false otherwise