com.mmoui.manager.services
Interface Uploadable

All Superinterfaces:
UpdateElement

public interface Uploadable
extends UpdateElement

Defines a single, definable, upload component to update. This type of UpdateElement is used primarily by datamining-type applications where a user may wish to upload data to a server consistently. The Uploadable component fits in seamlessly with other UpdateElement objects and operates very similarly. Its primary difference is that it does not have a version check and always has the option to run (with user permission first, where necessary).

All UpdateElement objects are run in their own thread, so the callee need not attempt to yield the thread. The dispatcher will manage the threads appropriately so that updates occur in a reasonable fashion.

The update/upload process is four-stage. The dispatcher will follow the following algorithm to perform the update:

Implementation of the prepare() method is dependent upon the Uploadable's use case. Some modules will not need the method and can simply return true in all situations. Others may need to gather information or decide to update only in certain situations, in which case the method should be implemented fully.

When logging information about this Uploadable, its toString() method will be called, so this method should be overridden reasonably (such as with the name of the item being uploaded) so relevant log information can be obtained.

Since:
2.2.0
Version:
$Id: Uploadable.java 200 2009-05-11 06:45:38Z mpdelbuono $
Author:
Matthew P. Del Buono

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.mmoui.manager.services.UpdateElement
UpdateElement.PopupOption, UpdateElement.UpdateCancelledException
 
Method Summary
 boolean prepare()
          Prepares this Uploadable object for being updated.
 
Methods inherited from interface com.mmoui.manager.services.UpdateElement
cleanup, getName, getPopupOptions, initialize, interrupt, update
 

Method Detail

prepare

boolean prepare()
                throws java.io.IOException

Prepares this Uploadable object for being updated. This method is called before any user confirmation occurs, and as such should only be used to collect information which will assist in determining if an upload is required. The upload should not start at this point.

The necessity of this method is implementation-dependent. Some modules may not find a need to collect information ahead of time and may always wish to request the upload. Such modules should implement the method simply by always returning true.

Returns:
true if the process should proceed to the user confirmation step, or false if nothing needs to be uploaded and thus this process should be skipped
Throws:
java.io.IOException - if an I/O error occurs during preparation