org.android.activityminer.logic.util
Class FileCopyThread

Package class diagram package FileCopyThread
java.lang.Object
  extended by java.lang.Thread
      extended by de.unikassel.android.sdcframework.util.AbstractWorkerThread
          extended by org.android.activityminer.app.util.ObservableWorkerThreadWithProgressNotification
              extended by org.android.activityminer.logic.util.FileCopyThread
All Implemented Interfaces:
ObservableEventSource<TaskFinishedEvent>, ObserverRegistration<TaskFinishedEvent>, WorkerThread, Runnable
Direct Known Subclasses:
DatabaseExportThread, DatabaseImportThread, ModelFileExportThread

public class FileCopyThread
extends ObservableWorkerThreadWithProgressNotification

The file copy thread.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  Context context
          The context.
private  File destFile
          The destination file.
private static int FILE_COPY_NOTIFICATION_ID
          the file copy notification identifier
private  String lastError
          The last error
private  File srcFile
          The source file.
private  boolean succeeded
          The success state flag
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected FileCopyThread(Context context, File srcFile, File destFile, Class<? extends Activity> intentReceiver)
          Constructor
 
Method Summary
static ObservableWorkerThreadWithProgressNotification createAndRun(Context context, File srcFile, File destFile, EventObserver<TaskFinishedEvent> finishedObserver, Class<? extends Activity> intentReceiver)
          Does create and execute a file copy thread.
protected  void doWork()
           
protected  Context getContext()
          Getter for the context
protected  String getDestFileName()
          Getter for the destination file name
protected  String getDestFilePath()
          Getter for the destination file path
 String getErrorNotificationMsg()
          Getter for the error notification message
 int getNotificationId()
          Getter for the notification identifier
 String getResultNotificationMsg()
          Getter for the result notification message
protected  String getSrcFileName()
          Getter for the source file name
 boolean hasSucceeded()
          Test method for success in case of termination
 
Methods inherited from class org.android.activityminer.app.util.ObservableWorkerThreadWithProgressNotification
broadcastProgress, doCleanUp, getApplicationContext, getFinalResult, getMaxProgress, getNotification, getTaskTitle, hasObservers, incrementAndNotifyProgress, incrementAndNotifyProgress, notify, notifyProgress, notifyProgress, registerEventObserver, removeAllObservers, setMaxProgress, unregisterEventObserver
 
Methods inherited from class de.unikassel.android.sdcframework.util.AbstractWorkerThread
doTerminate, hasTerminated, isLogging, isWorking, logMessage, run, setLogging, start, startWork, stopWork
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FILE_COPY_NOTIFICATION_ID

private static final int FILE_COPY_NOTIFICATION_ID
the file copy notification identifier

See Also:
Constant Field Values

srcFile

private final File srcFile
The source file.


destFile

private final File destFile
The destination file.


succeeded

private boolean succeeded
The success state flag


lastError

private String lastError
The last error


context

private final Context context
The context.

Constructor Detail

FileCopyThread

protected FileCopyThread(Context context,
                         File srcFile,
                         File destFile,
                         Class<? extends Activity> intentReceiver)
Constructor

Parameters:
context - the application context
srcFile - the source file
destFile - the destination file
intentReceiver - the intent receiver class
Method Detail

getContext

protected Context getContext()
Getter for the context

Returns:
the context

getSrcFileName

protected final String getSrcFileName()
Getter for the source file name

Returns:
the source file name

getDestFileName

protected final String getDestFileName()
Getter for the destination file name

Returns:
the destination file name

getDestFilePath

protected final String getDestFilePath()
Getter for the destination file path

Returns:
the destination file path

getErrorNotificationMsg

public final String getErrorNotificationMsg()
Description copied from class: ObservableWorkerThreadWithProgressNotification
Getter for the error notification message

Specified by:
getErrorNotificationMsg in class ObservableWorkerThreadWithProgressNotification
Returns:
the error notification message

getResultNotificationMsg

public String getResultNotificationMsg()
Description copied from class: ObservableWorkerThreadWithProgressNotification
Getter for the result notification message

Specified by:
getResultNotificationMsg in class ObservableWorkerThreadWithProgressNotification
Returns:
the result notification message

getNotificationId

public final int getNotificationId()
Description copied from class: ObservableWorkerThreadWithProgressNotification
Getter for the notification identifier

Specified by:
getNotificationId in class ObservableWorkerThreadWithProgressNotification
Returns:
the notification identifier

hasSucceeded

public final boolean hasSucceeded()
Description copied from class: ObservableWorkerThreadWithProgressNotification
Test method for success in case of termination

Specified by:
hasSucceeded in class ObservableWorkerThreadWithProgressNotification
Returns:
true if thread has successfully finished it's task, false in case of errors

doWork

protected final void doWork()
Specified by:
doWork in class AbstractWorkerThread

createAndRun

public static ObservableWorkerThreadWithProgressNotification createAndRun(Context context,
                                                                          File srcFile,
                                                                          File destFile,
                                                                          EventObserver<TaskFinishedEvent> finishedObserver,
                                                                          Class<? extends Activity> intentReceiver)
Does create and execute a file copy thread.

Parameters:
context - the context of the caller
srcFile - the source file
destFile - the destination file
finishedObserver - the finished event observer
intentReceiver - the intent receiver class
Returns:
the created file copy thread