001    package jmaster.jumploader.model.api.upload;
002    
003    import jmaster.jumploader.model.api.common.IAttributeSet;
004    import jmaster.jumploader.model.api.common.ITransferProgress;
005    import jmaster.jumploader.model.api.file.IFile;
006    
007    /**
008     * IUploadFile
009     * 
010     * @author timur
011     */
012    
013    public interface IUploadFile
014    extends IFile {
015            //---------------------------------------------------------------
016            //      constants
017            //---------------------------------------------------------------
018            /**
019             * generic file for upload
020             */
021            public static final int TYPE_FILE = 0;
022            /**
023             * a document for processing
024             */
025            public static final int TYPE_DOCUMENT = 1;
026            /**
027             * file for download
028             */
029            public static final int TYPE_DOWNLOAD = 2;
030            
031            public static final int STATUS_READY = 0;
032            public static final int STATUS_UPLOADING = 1;
033            public static final int STATUS_FINISHED = 2;
034            public static final int STATUS_FAILED = 3;
035            public static final int STATUS_PREPROCESSING = 4;
036            public static final int STATUS_DOWNLOADING = 5;
037            public static final int STATUS_EDITING = 6;
038            //---------------------------------------------------------------
039            //      business methods
040            //---------------------------------------------------------------
041            /**
042             * type retrieval, see constants
043             */
044            public int getType();
045            /**
046             * status retrieval
047             */
048            public int getStatus();
049            /**
050             * error retrieval, valid for STATUS_FAILED
051             */
052            public Exception getError();
053            /**
054             * transfer progress retrieval, valid for STATUS_UPLOADING
055             */
056            public ITransferProgress getTransferProgress();
057            /**
058             * shows whether is ready
059             */
060            public boolean isReady();
061            /**
062             * shows whether is preprocessing
063             */
064            public boolean isPreprocessing();
065            /**
066             * shows whether is server processing
067             */
068            public boolean isServerProcessing();
069            /**
070             * shows whether is uploading
071             */
072            public boolean isUploading();
073            /**
074             * shows whether is finished
075             */
076            public boolean isFinished();
077            /**
078             * shows whether is failed
079             */
080            public boolean isFailed();
081            /**
082             * file index retrieval (staring at 0)
083             */
084            public int getIndex();
085            /**
086             * shows whether this item could be removed from uploader
087             */
088            public boolean isRemovable();
089            /**
090             * shows whether this item could be retryed
091             */
092            public boolean isRetryable();
093            /**
094             * shows whether stop upload can be issued for this item
095             */
096            public boolean isStoppable();
097            /**
098             * @return the uploadedPartitionCount
099             */
100            public int getUploadedPartitionCount();
101            /**
102             * @param uploadedPartitionCount the uploadedPartitionCount to set
103             */
104            public void setUploadedPartitionCount( int uploadedPartitionCount );
105            /**
106             * shows whether file is editable image
107             */
108            public boolean isEditableImage();
109            /**
110             * server response content retrieval
111             */
112            public String getResponseContent();
113            /**
114             * server response headers retrieval
115             */
116            public IAttributeSet getResponseHeaders();
117            /**
118             * update file length
119             */
120            public void setLength( long length );
121            /**
122             * check whether file is temporary
123             */
124            public boolean isTempFile();
125            /**
126             * shows whether is downloading
127             */
128            public boolean isDownloading();
129            /**
130             * shows whether is editing
131             */
132            public boolean isEditing();
133            /**
134             * retrieve general purpose key
135             */
136            public String getKey();
137            /**
138             * store general purpose key
139             */
140            public void setKey( String key );
141            /**
142             * shows whether document file ever was locked
143             */
144            public boolean isDocumentFileWasLocked();
145            /**
146             * set document file ever was locked flag
147             */
148            public void setDocumentFileWasLocked(boolean documentFileWasLocked);
149            /**
150             * shows whether preparing file content (similar to STATUS_PREPROCESSING, but on upload phase)
151             */
152            boolean isPreparingContent();
153    }