001    package jmaster.jumploader.model.api.config;
002    
003    import java.util.ArrayList;
004    import java.util.List;
005    import java.util.MissingResourceException;
006    import java.util.StringTokenizer;
007    
008    import jmaster.jumploader.model.api.IModel;
009    import jmaster.jumploader.model.impl.image.WatermarkConfig;
010    import jmaster.util.lang.StringHelper;
011    import jmaster.util.property.Property;
012    import jmaster.util.property.PropertyFactory;
013    import jmaster.util.property.PropertyHelper;
014    
015    
016    /**
017     * UploaderConfig
018     * 
019     * @author timur
020     */
021    
022    public class UploaderConfig {
023            //---------------------------------------------------------------
024            //      constants
025            //---------------------------------------------------------------
026            /**
027             * property file
028             */
029            private static final String PROPERTY = "UploaderConfig.properties";
030            /**
031             * error response token
032             */
033            public static final String ERROR_RESPONSE_PREFIX = "Error:";
034            /**
035             * file id parameter name
036             */
037            public static final String PARAM_FILE_ID = "fileId";
038            /**
039             * file length parameter name
040             */
041            public static final String PARAM_FILE_LENGTH = "fileLength";
042            /**
043             * file name parameter name
044             */
045            public static final String PARAM_FILE_NAME = "fileName";
046            /**
047             * file path parameter name
048             */
049            public static final String PARAM_FILE_PATH = "filePath";
050            /**
051             * partition index parameter name
052             */
053            public static final String PARAM_PARTITION_INDEX = "partitionIndex";
054            /**
055             * partition count
056             */
057            public static final String PARAM_PARTITION_COUNT = "partitionCount";
058            /**
059             * MD5
060             */
061            public static final String PARAM_MD5 = "md5";
062            /**
063             * partition MD5
064             */
065            public static final String PARAM_PARTITION_MD5 = "partitionMd5";
066            /**
067             * zip file will be created for each file added to the queue
068             */
069            public static final String COMPRESSION_MODE_ZIP_ON_ADD = "zipOnAdd";
070            /**
071             * default http uploader class name
072             */
073            private static final String DEFAULT_HTTP_UPLOADER_CLASS_NAME = "jmaster.util.http.UrlConnectionHttpUploader";
074            /**
075             * image scale dimension modifier to fit scaled image in the box 
076             */
077            public static final String IMAGE_SCALE_MODIFIER_FIT = "fit";
078            /**
079             * image scale dimension modifier to rotate image so it's orientation will match box orientation  
080             */
081            public static final String IMAGE_SCALE_MODIFIER_ROTATE = "rotate";
082            /**
083             * image scale dimension modifier to cover the box with scaled image 
084             */
085            public static final String IMAGE_SCALE_MODIFIER_COVER = "cover";
086            /**
087             * image scale dimension callback specifier prefix, if dimension starts with it,
088             * then remainder specifies JS function name to execute to retrieve proper dimension for image scaling.
089             * callback should accept 2 parameters: IUploadFile (file being scaled) and String (scaled instance name)   
090             */
091            public static final String IMAGE_SCALE_CALLBACK = "callback:";
092            /**
093             * Deprecated
094             * image scale dimension modifier same as fit, 
095             * but before scaling image will be rotated so it's orientation will match box orientation  
096             */
097            public static final String IMAGE_SCALE_MODIFIER_FIT_ROTATE = "fitRotate";
098            /**
099             * Deprecated
100             * image scale dimension modified same as crop,
101             * but before scaling image will be rotated so it's orientation will match box orientation
102             */
103            public static final String IMAGE_SCALE_MODIFIER_CROP_ROTATE = "cropRotate";
104            /**
105             * Deprecated
106             * image scale dimension modifier same as cover, 
107             * but before scaling image will be rotated so it's orientation will match box orientation  
108             */
109            public static final String IMAGE_SCALE_MODIFIER_COVER_ROTATE = "coverRotate";
110            /**
111             * image scale prefix for callback function   
112             */
113            public static final String IMAGE_SCALE_MODIFIER_CROP = "crop";
114            /**
115             * original image mimetype parameter
116             */
117            public static final String PARAM_ORIGINAL_IMAGE_MIMETYPE = "originalImageMimetype";
118            /**
119             * file data flavor
120             */
121            public static final String DATA_FLAVOR_FILE = "file";
122            /**
123             * image data flavor
124             */
125            public static final String DATA_FLAVOR_IMAGE = "image";
126            /**
127             * ftp REST command
128             */
129            public static final String FTP_REST = "REST";
130            /**
131             * ftp APPE command
132             */
133            public static final String FTP_APPE = "APPE";
134            //---------------------------------------------------------------
135            //      properties
136            //---------------------------------------------------------------
137            /**
138             * instance
139             */
140            private static UploaderConfig instance;
141            /**
142             * upload thread count
143             */
144            private int uploadThreadCount = 1;
145            /**
146             * upload url
147             */
148            private String uploadUrl = null;
149            /**
150             * max files in a list, -1 if unlimited
151             */
152            private int maxFiles = -1;
153            /**
154             * max file length allowed (per file), -1 if unlimited
155             */
156            private long maxFileLength = -1;
157            /**
158             * max files length allowed (total), -1 if unlimited 
159             */
160            private long maxLength = -1;
161            /**
162             * allowed file name (not path) regex pattern, null for all
163             */
164            private String fileNamePattern = null;
165            /**
166             * file name pattern description (appears in open file dialog)
167             */
168            private String fileNamePatternDescription = null;
169            /**
170             * shows whether folder addition enabled (will expand and add all files)
171             */
172            private boolean directoriesEnabled = false;
173            /**
174             * duplicate files enabled
175             */
176            private boolean duplicateFileEnabled = false;
177            /**
178             * file parameter name (for POST request)
179             */
180            private String fileParameterName = "file";
181            /**
182             * partitionLength
183             */
184            private long partitionLength = -1;
185            /**
186             * user agent
187             */
188            private String userAgent = null;
189            /**
190             * cookie
191             */
192            private String cookie = null;
193            /**
194             * use MD5 hash, if true, MD5 value will be send with
195             * last partition upload request
196             */
197            private boolean useMd5 = false;
198            /**
199             * use MD5 hash for each partition, if true, MD5 value for current partition
200             * will be send with each partition upload request
201             */
202            private boolean usePartitionMd5 = false;
203            /**
204             * min files in a list, -1 if unlimited
205             */
206            private int minFiles = -1;
207            /**
208             * min file length allowed (per file), -1 if unlimited
209             */
210            private long minFileLength = -1;
211            /**
212             * shows whether scaled images should be uploaded.
213             * if true, uploaded file would be ZIP archive where entries are scaled images of original,
214             * entry count and names will match scaled instance names.
215             */
216            private boolean uploadScaledImages;
217            /**
218             * Subsampling factor (SF) for loading images.
219             * Subsampling (S) (for both x and y axis) calculated with formula S = 1 + MPX / SF,
220             * where MPX is number of image megapixels (rounded).  
221             * read here about image subsampling: http://java.sun.com/j2se/1.4.2/docs/api/javax/imageio/IIOParam.html#setSourceSubsampling(int, int, int, int)
222             * Subsampling allows to read large images using reasonable amount of memory.   
223             */
224            private int imageSubsamplingFactor = 7;
225            /**
226             * shows whether scaled images should be uploaded not zipped (multiple files on one request).
227             * in this case file parameter name will match scaled instance name 
228             */
229            private boolean uploadScaledImagesNoZip;
230            /**
231             * shows whether can resize smaller  images to bigger dimension
232             */
233            private boolean stretchImages = false;
234            /**
235             * shows whether original image should be uploaded along with scaled images (valid if uploadScaledImages=true),
236             * or if image was transformed with image editor (original file will be posted with "originalImage" file)
237             */
238            private boolean uploadOriginalImage;
239            /**
240             * scaled instance names (comma separated, e.g. "small,medium,large")
241             */
242            private String scaledInstanceNames;
243            /**
244             * scaled instance target box dimensions (comma separated, for example "100x100xcrop,200x200xmin,400x400xmax").
245             * each dimension also accepts scaling modifier, which could be:
246             * max (default) - image will be scaled to maximum size that fits in the box
247             * min - image will be scaled to minimum size that covers the box
248             * crop - image will be scaled to minimum size that covers the box, then cropped to fit in the box
249             */
250            private String scaledInstanceDimensions;
251            /**
252             * scaled instance quality factors (0-worse quality, 1000-best),
253             * (comma spearated, fo example, "900,800,700");
254             */
255            private String scaledInstanceQualityFactors;
256            /**
257             * if image was not transformed, just recompress that and compare file size to original,
258             * then upload smaller file (original or recompressed)  
259             */
260            private boolean scaledInstanceRecompressAndUploadSmaller;
261            /**
262             * scaled instance watermark names to apply, use null for skip
263             * (comma spearated, fo example, "null,mediumWatermark,null");
264             */
265            private String scaledInstanceWatermarkNames;
266            /**
267             * initialized watermarks
268             */
269            private List scaledInstanceWatermarks;
270            /**
271             * send original image mimetype (valid if using image scaling) with "originalImageMimetype" parameter
272             */
273            private boolean sendOriginalImageMimetype;
274            /**
275             * preserve metadata for scaled images, this could be one or multiple (comma separated) value(s), true or false
276             */
277            private String scaledInstancePreserveMetadata = "false";
278            /**
279             * scale mode for scaled images, this could be one or multiple (comma separated) value(s) from list:
280             * smooth, fast, bilinear, lanczos (default)
281             */
282            private String scaledInstanceScaleMode = "lanczos";
283            /**
284             * shows whether main file should be used
285             */
286            private boolean useMainFile = false;
287            /**
288             * shows whether images only allowed
289             */
290            private boolean addImagesOnly = false;
291            /**
292             * minimum image size allowed ({width}x{height})
293             */
294            private String minimumImageDimension;
295            /**
296             * maximum image size allowed ({width}x{height})
297             */
298            private String maximumImageDimension;
299            /**
300             * shows whether image editor is enabled
301             */
302            private boolean imageEditorEnabled = true;
303            /**
304             * shows whether image rotate is enabled
305             */
306            private boolean imageRotateEnabled = false;
307            /**
308             * resume check url
309             */
310            private String resumeCheckUrl;
311            /**
312             * shows whether filename parameters sent to server should be urlencoded
313             */
314            private boolean urlEncodeParameters;
315            /**
316             * shows whether lastModified attribute should be send for a file
317             */
318            private boolean sendFileLastModified = true;
319            /**
320             * compression mode, see constants
321             */
322            private String compressionMode = null;
323            /**
324             * prevent zipping single files that match pattern.
325             * Sample pattern for common archive files: ^.+\.(?i)((zip)|(rar)|(tar)|(gz))$
326             */
327            private String skipZippingFilesPattern = null;
328            /**
329             * add directory as zip flag
330             */
331            private boolean zipDirectoriesOnAdd = false;
332            /**
333             * send file path
334             */
335            private boolean sendFilePath = false;
336            /**
337             * maximum transfer rate (bytes/sec)
338             */
339            private long maxTransferRate = -1;
340            /**
341             * http uploader class name 
342             */
343            private String httpUploaderClassName = DEFAULT_HTTP_UPLOADER_CLASS_NAME;
344            /**
345             * shows whether upload queue reardering allowed (false by default)
346             */
347            private boolean uploadQueueReorderingAllowed = false;
348            /**
349             * request encoding to use (UTF-8 by default)
350             */
351            private String requestEncoding = "UTF-8";
352            /**
353             * send image metadata data as xml (use file attribute named "imageMetadataXml").
354             * XML format is:
355             * [?xml version="1.0" encoding="UTF-8"?]
356             * [metadata]
357             *   [directory name="Exif"]
358             *       [tag type="0x010f" name="Make" desc="Canon"/]
359             *       ... [more tags]
360             *   [/directory]
361             *   ... [more directories]
362             * [/metadata]
363             */
364            private boolean sendImageMetadata = false;
365            /**
366             * shows whether file relative path should be preserved as "relativePath" attribute value
367             * when adding directory in explode mode (i.e. not zipping folder content, 
368             * but adding all the files in that directory recursively).
369             * For example, if adding directory c:/temp/d with files f1, f2,
370             * then file "relativePath" attribute values will be "d/f1" and ""d/f2"
371             */
372            private boolean preserveRelativePath;
373            /**
374             * metadata enabled flag
375             */
376            private boolean useMetadata;
377            /**
378             * metadata descriptor url
379             */
380            private String metadataDescriptorUrl;
381            /**
382             * disable upload if required metadata fields not filled
383             */
384            private boolean metadataCheckRequiredFields = true;
385            /**
386             * allowed file mime type regex pattern to apply for files, null for all
387             */
388            private String mimeTypePattern = null;
389            /**
390             * shows whether jmimemagic should be used for file mimetype retrieval,
391             * (false by default)
392             */
393            private boolean useJMimeMagic = false;
394            /**
395             * jmimemagic, whether or not to use extension to optimize order of content tests,
396             * (true by default)
397             */
398            private boolean jmmExtensionHints = true;
399            /**
400             * jmimemagic, only try to get mime type, no submatches are processed when true,
401             * (false by default)
402             */
403            private boolean jmmOnlyMimeMatch = false;
404            /**
405             * number of autoretries for a file in case of IOException (network error)
406             */
407            private int autoRetryCount = 0;
408            /**
409             * shows whether it is necessary to use lossless jpeg transfromations whenever possible
410             */
411            private boolean useLosslessJpegTransformations = false;
412            /**
413             * general purpose check parameter name for upload files, if not null, 
414             * each upload file will contain checkbox
415             * with tooltip message specified by generalPurposeCheckboxTooltip,
416             * applet will post parameter with value "true" or "false" (no value is same as false)
417             * corresponding to checkbox state. 
418             */
419            private String generalPurposeCheckParamName = null;
420            /**
421             * use general purpose checkbox tooltip
422             */
423            private String generalPurposeCheckboxTooltip = null;
424            /**
425             * comma separated list of class names, that implements IUploaderListener interface.
426             * these will be instantited and added to uploader on init
427             */
428            private String uploaderListeners = null;
429            /**
430             * maximum allowed image megapixels to add
431             */
432            private double imageMaxMpx = 0;
433            /**
434             * form name, which values to POST with each upload request
435             */
436            private String uploadFormName = null;
437            /**
438             * shows whether image format should be preserved if possible (gif, png supported),
439             * otherwise all transformed image encoded to jpeg 
440             */
441            private boolean preserveImageFormat = false;
442            /**
443             * shows whether image transformations made in the image editor
444             * should be saved and send to the server as xml
445             * Possible elements include:
446             * <resize width="int" height="int"/>
447             * <rotate clockwise="boolean"/>
448             * <crop left="int" top="int" right="int" bottom="int"/>
449             * <grayscale/>
450             * <sepia/>
451             * <blur radius="int"/>
452             * <contrast contrast="float" brightness="float"/>
453             */
454            private boolean saveImageTransformations = false;
455            /**
456             * shows whether individual partitions should be zipped before upload
457             * If partition zipped, upload parameter will be posted: zippedPartition=true.
458             */
459            private boolean zipPartitions = false;
460            /**
461             * shows whether uploaded files should be removed
462             */
463            private boolean removeUploadedFiles = false;
464            /**
465             * the maximum size of image to load
466             */
467            private int imageLoadPixelsMax = 7000000;
468            /**
469             * the maximum size of region to use for image scaling by regions
470             */
471            private int regionPixelsMax = 3000000;
472            /**
473             * shows whether adding image from clipboard enabled (default true) 
474             */
475            private boolean clipboardImageEnabled = true;
476            /**
477             * image format to use when adding image from clipboard, supported formats are:
478             * jpg (default), png
479             */
480            private String clipboardImageFormat = "jpg";
481            /**
482             * image file name patten to give when adding image from clipboard,
483             * see http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html
484             * default: "paste 0", this will result with files named sequentally: "paste 1", "paste 2" and so on.
485             */
486            private String clipboardImageNameFormat = "paste 0";
487            /**
488             * upload request properties (headers)
489             * Multiple properties should be separated by '|' character, key/value should be separated by '=',
490             * special characters should be escaped by '\\uXXXX', for example '='=\\u003d
491             */
492            private String requestProperties;
493            /**
494             * shows if errors occured during directory add should be silently ignored
495             * (true by default) 
496             */
497            private boolean ignoreFileAddErrors = true;
498            /**
499             * preferred paste data flavor for adding file from clipboard data.
500             * Acceptable values are "file" (default) and "image". 
501             * For example, when image copied with Internet Explorer both data flavors added to cipboard -
502             * file reference and bitmap image data. This parameter defines preferred data to be added for uploading.
503             */
504            private String preferredPasteDataFlavor = DATA_FLAVOR_FILE;
505            /**
506             * preferred ftp resume command,
507             * acceptable values are "REST" (default) and "APPE". 
508             */
509            private String ftpResumeCommand = FTP_REST;
510            /**
511             * shows if temp files should be deleted as they remove from uploader
512             * (true by default) 
513             */
514            private boolean deleteTempFilesOnRemove = true;
515            //---------------------------------------------------------------
516            //      constructors
517            //---------------------------------------------------------------
518            /**
519             * with model 
520             */
521            public UploaderConfig( IModel model ) {
522                    super();
523                    instance = this;
524                    //
525                    //      inject properties, if present
526                    try {
527                            PropertyFactory pf = PropertyFactory.getInstance();
528                            Property pr = pf.getProperty( PROPERTY );
529                            PropertyHelper ph = PropertyHelper.getInstance();
530                            ph.injectProperties( this, pr, null );
531                            //
532                            //      init watermarks
533                            UploaderConfig uc = this;
534                            if( uc.getScaledInstanceWatermarkNames() != null ) {
535                                    StringTokenizer st = new StringTokenizer( uc.getScaledInstanceWatermarkNames(), "," );
536                                    int n = st.countTokens();
537                                    List watermarks = new ArrayList();
538                                    for( int i = 0; i < n; i++ ) {
539                                            String wmname = st.nextToken();
540                                            if( !"null".equals( wmname ) ) {
541                                                    String wmprops = pr.getProperty( wmname );
542                                                    WatermarkConfig wmc = new WatermarkConfig(); 
543                                                    Property pr2 = PropertyHelper.makeProperty( wmprops, ";" );
544                                                    PropertyHelper.getInstance().injectProperties( wmc, pr2, null );
545                                                    watermarks.add( wmc );
546                                            } else {
547                                                    watermarks.add( null );
548                                            }
549                                    }
550                                    uc.setScaledInstanceWatermarks( watermarks );
551                            }
552                    } catch( MissingResourceException ignore ) {
553                    }
554            }
555            /**
556             * instance retrieval
557             */
558            public static UploaderConfig getInstance() {
559                    return instance;
560            }
561            //---------------------------------------------------------------
562            //      property accessors
563            //---------------------------------------------------------------
564            /**
565             * toString
566             */
567            public String toString() {
568                    return "" +
569                            "uploadThreadCount=" + uploadThreadCount + "\r\n" +
570                            "uploadUrl=" + uploadUrl + "\r\n" +
571                            "maxFiles=" + maxFiles + "\r\n" +
572                            "maxFileLength=" + maxFileLength + "\r\n" +
573                            "maxLength=" + maxLength + "\r\n" +
574                            "fileNamePattern=" + fileNamePattern + "\r\n" +
575                            "fileNamePatternDescription=" + fileNamePatternDescription + "\r\n" +                   
576                            "directoriesEnabled=" + directoriesEnabled + "\r\n" +
577                            "duplicateFileEnabled=" + duplicateFileEnabled + "\r\n" +
578                            "fileParameterName=" + fileParameterName + "\r\n" +
579                            "partitionLength=" + partitionLength + "\r\n" +
580                            "userAgent=" + userAgent + "\r\n" +
581                            "cookie=" + cookie + "\r\n" +
582                            "useMd5=" + useMd5 + "\r\n" +
583                            "usePartitionMd5=" + usePartitionMd5 + "\r\n" +
584                            "minFiles=" + minFiles + "\r\n" +
585                            "minFileLength=" + minFileLength + "\r\n" +
586                            "uploadScaledImages=" + uploadScaledImages + "\r\n" +
587                            "uploadScaledImagesNoZip=" + uploadScaledImagesNoZip + "\r\n" +
588                            "stretchImages=" + stretchImages + "\r\n" +
589                            "uploadOriginalImage=" + uploadOriginalImage + "\r\n" +
590                            "scaledInstanceNames=" + scaledInstanceNames + "\r\n" +
591                            "scaledInstanceDimensions=" + scaledInstanceDimensions + "\r\n" +
592                            "scaledInstanceQualityFactors=" + scaledInstanceQualityFactors + "\r\n" +
593                            "scaledInstanceRecompressAndUploadSmaller=" + scaledInstanceRecompressAndUploadSmaller + "\r\n" + 
594                            "scaledInstanceWatermarkNames=" + scaledInstanceWatermarkNames + "\r\n" +
595                            "scaledInstancePreserveMetadata=" + scaledInstancePreserveMetadata + "\r\n" +
596                            "scaledInstanceScaleMode=" + scaledInstanceScaleMode + "\r\n" +
597                            "sendOriginalImageMimetype=" + sendOriginalImageMimetype + "\r\n" +
598                            "imageSubsamplingFactor=" + imageSubsamplingFactor + "\r\n" +
599                            "useMainFile=" + useMainFile + "\r\n" +
600                            "addImagesOnly=" + addImagesOnly + "\r\n" +
601                            "minimumImageDimension=" + minimumImageDimension + "\r\n" +
602                            "maximumImageDimension=" + minimumImageDimension + "\r\n" +
603                            "imageEditorEnabled=" + imageEditorEnabled + "\r\n" +
604                            "imageRotateEnabled=" + imageRotateEnabled + "\r\n" +
605                            "resumeCheckUrl=" + resumeCheckUrl + "\r\n" +
606                            "urlEncodeParameters=" + urlEncodeParameters + "\r\n" +
607                            "sendFileLastModified=" + sendFileLastModified + "\r\n" +
608                            "compressionMode=" + compressionMode + "\r\n" +
609                            "zipDirectoriesOnAdd=" + zipDirectoriesOnAdd + "\r\n" +                 
610                            "sendFilePath=" + sendFilePath + "\r\n" +
611                            "maxTransferRate=" + maxTransferRate + "\r\n" +
612                            "httpUploaderClassName=" + httpUploaderClassName + "\r\n" +
613                            "uploadQueueReorderingAllowed=" + uploadQueueReorderingAllowed + "\r\n" +
614                            "requestEncoding=" + requestEncoding + "\r\n" +
615                            "sendImageMetadata=" + sendImageMetadata + "\r\n" +
616                            "preserveRelativePath=" + preserveRelativePath + "\r\n" +
617                            "useMetadata=" + useMetadata + "\r\n" +
618                            "metadataDescriptorUrl=" + metadataDescriptorUrl + "\r\n" +
619                            "metadataCheckRequiredFields=" + metadataCheckRequiredFields + "\r\n" +
620                            "mimeTypePattern=" + mimeTypePattern + "\r\n" +
621                            "useJMimeMagic=" + useJMimeMagic + "\r\n" +
622                            "jmmExtensionHints=" + jmmExtensionHints + "\r\n" +
623                            "jmmOnlyMimeMatch=" + jmmOnlyMimeMatch + "\r\n" +
624                            "autoRetryCount=" + autoRetryCount + "\r\n" +
625                            "useLosslessJpegTransformations=" + useLosslessJpegTransformations + "\r\n" +
626                            "generalPurposeCheckParamName=" + generalPurposeCheckParamName + "\r\n" +
627                            "generalPurposeCheckboxTooltip=" + generalPurposeCheckboxTooltip + "\r\n" +
628                            "uploaderListeners=" + uploaderListeners + "\r\n" +
629                            "imageMaxMpx=" + imageMaxMpx + "\r\n" +
630                            "uploadFormName=" + uploadFormName + "\r\n" +
631                            "preserveImageFormat=" + preserveImageFormat + "\r\n" +
632                            "saveImageTransformations=" + saveImageTransformations + "\r\n" +
633                            "zipPartitions=" + zipPartitions + "\r\n" +
634                            "removeUploadedFiles=" + removeUploadedFiles + "\r\n" +
635                            "imageLoadPixelsMax=" + imageLoadPixelsMax + "\r\n" +
636                            "regionPixelsMax=" + regionPixelsMax + "\r\n" +
637                            "clipboardImageEnabled=" + clipboardImageEnabled + "\r\n" +
638                            "clipboardImageFormat=" + clipboardImageFormat + "\r\n" +
639                            "clipboardImageNameFormat=" + clipboardImageNameFormat + "\r\n" +
640                            "requestProperties=" + requestProperties + "\r\n" +
641                            "ignoreFileAddErrors=" + ignoreFileAddErrors + "\r\n" +
642                            "preferredPasteDataFlavor=" + preferredPasteDataFlavor + "\r\n" +
643                            "ftpResumeCommand=" + ftpResumeCommand + "\r\n" +
644                            "deleteTempFilesOnRemove=" + deleteTempFilesOnRemove + "\r\n" +
645                    "";
646            }
647            public String getCompressionMode() {
648                    return compressionMode;
649            }
650            public void setCompressionMode(String compressionMode) {
651                    this.compressionMode = compressionMode;
652            }
653            public boolean isDirectoriesEnabled() {
654                    return directoriesEnabled; 
655            }
656            public void setDirectoriesEnabled(boolean directoriesEnabled) {
657                    this.directoriesEnabled = directoriesEnabled;
658            }
659            public boolean isDuplicateFileEnabled() {
660                    return duplicateFileEnabled;
661            }
662            public void setDuplicateFileEnabled(boolean duplicateFileEnabled) {
663                    this.duplicateFileEnabled = duplicateFileEnabled;
664            }
665            public String getFileNamePattern() {
666                    return fileNamePattern;
667            }
668            public void setFileNamePattern(String fileNamePattern) {
669                    this.fileNamePattern = StringHelper.isEmpty( fileNamePattern ) ? 
670                                    null : fileNamePattern;
671            }
672            public long getMaxFileLength() {
673                    return maxFileLength;
674            }
675            public void setMaxFileLength(long maxFileLength) {
676                    this.maxFileLength = maxFileLength;
677            }
678            public int getMaxFiles() {
679                    return maxFiles;
680            }
681            public void setMaxFiles(int maxFiles) {
682                    this.maxFiles = maxFiles;
683            }
684            public long getMaxLength() {
685                    return maxLength;
686            }
687            public void setMaxLength(long maxLength) {
688                    this.maxLength = maxLength;
689            }
690            public int getUploadThreadCount() {
691                    return uploadThreadCount;
692            }
693            public void setUploadThreadCount(int uploadThreadCount) {
694                    this.uploadThreadCount = uploadThreadCount;
695            }
696            public String getUploadUrl() {
697                    return uploadUrl;
698            }
699            public void setUploadUrl(String uploadUrl) {
700                    this.uploadUrl = uploadUrl;
701            }
702            public String getFileParameterName() {
703                    return fileParameterName;
704            }
705            public void setFileParameterName(String fileParameterName) {
706                    this.fileParameterName = fileParameterName;
707            }
708            public long getPartitionLength() {
709                    return partitionLength;
710            }
711            public void setPartitionLength(long partitionLength) {
712                    this.partitionLength = partitionLength;
713            }
714            public String getUserAgent() {
715                    return userAgent;
716            }
717            public void setUserAgent(String userAgent) {
718                    this.userAgent = userAgent;
719            }
720            public boolean isUseMd5() {
721                    return useMd5;
722            }
723            public void setUseMd5(boolean useMd5) {
724                    this.useMd5 = useMd5;
725            }
726            public int getMinFiles() {
727                    return minFiles;
728            }
729            public void setMinFiles(int minFiles) {
730                    this.minFiles = minFiles;
731            }
732            public String getScaledInstanceDimensions() {
733                    return scaledInstanceDimensions;
734            }
735            public void setScaledInstanceDimensions(String scaledInstanceDimensions) {
736                    this.scaledInstanceDimensions = scaledInstanceDimensions;
737            }
738            public String getScaledInstanceNames() {
739                    return scaledInstanceNames;
740            }
741            public void setScaledInstanceNames(String scaledInstanceNames) {
742                    this.scaledInstanceNames = scaledInstanceNames;
743            }
744            public String getScaledInstanceQualityFactors() {
745                    return scaledInstanceQualityFactors;
746            }
747            public void setScaledInstanceQualityFactors(String scaledInstanceQualityFactors) {
748                    this.scaledInstanceQualityFactors = scaledInstanceQualityFactors;
749            }
750            public boolean isUploadScaledImages() {
751                    return uploadScaledImages;
752            }
753            public void setUploadScaledImages(boolean uploadScaledImages) {
754                    this.uploadScaledImages = uploadScaledImages;
755            }
756            public long getMinFileLength() {
757                    return minFileLength;
758            }
759            public void setMinFileLength(long minFileLength) {
760                    this.minFileLength = minFileLength;
761            }
762            public boolean isUseMainFile() {
763                    return useMainFile;
764            }
765            public void setUseMainFile(boolean useMainFile) {
766                    this.useMainFile = useMainFile;
767            }
768            public boolean isAddImagesOnly() {
769                    return addImagesOnly;
770            }
771            public void setAddImagesOnly(boolean addImagesOnly) {
772                    this.addImagesOnly = addImagesOnly;
773            }
774            public String getMinimumImageDimension() {
775                    return minimumImageDimension;
776            }
777            public void setMinimumImageDimension(String minimumImageDimension) {
778                    this.minimumImageDimension = minimumImageDimension;
779            }
780            public String getMaximumImageDimension() {
781                    return maximumImageDimension;
782            }
783            public void setMaximumImageDimension(String maximumImageDimension) {
784                    this.maximumImageDimension = maximumImageDimension;
785            }
786            public boolean isImageEditorEnabled() {
787                    return imageEditorEnabled;
788            }
789            public void setImageEditorEnabled(boolean imageEditorEnabled) {
790                    this.imageEditorEnabled = imageEditorEnabled;
791            }
792            public String getResumeCheckUrl() {
793                    return resumeCheckUrl;
794            }
795            public void setResumeCheckUrl(String resumeCheckUrl) {
796                    this.resumeCheckUrl = resumeCheckUrl;
797            }
798            public boolean isUsePartitionMd5() {
799                    return usePartitionMd5;
800            }
801            public void setUsePartitionMd5(boolean usePartitionMd5) {
802                    this.usePartitionMd5 = usePartitionMd5;
803            }
804            public boolean isUploadOriginalImage() {
805                    return uploadOriginalImage;
806            }
807            public void setUploadOriginalImage(boolean uploadOriginalImage) {
808                    this.uploadOriginalImage = uploadOriginalImage;
809            }
810            public boolean isStretchImages() {
811                    return stretchImages;
812            }
813            public void setStretchImages(boolean stretchImages) {
814                    this.stretchImages = stretchImages;
815            }
816            public boolean isUrlEncodeParameters() {
817                    return urlEncodeParameters;
818            }
819            public void setUrlEncodeParameters(boolean urlEncodeParameters) {
820                    this.urlEncodeParameters = urlEncodeParameters;
821            }
822            public boolean isSendFileLastModified() {
823                    return sendFileLastModified;
824            }
825            public void setSendFileLastModified(boolean sendFileLastModified) {
826                    this.sendFileLastModified = sendFileLastModified;
827            }
828            public boolean isZipDirectoriesOnAdd() {
829                    return zipDirectoriesOnAdd;
830            }
831            public void setZipDirectoriesOnAdd(boolean zipDirectoriesOnAdd) {
832                    this.zipDirectoriesOnAdd = zipDirectoriesOnAdd;
833            }
834            public boolean isSendFilePath() {
835                    return sendFilePath;
836            }
837            public void setSendFilePath(boolean sendFilePath) {
838                    this.sendFilePath = sendFilePath;
839            }
840            public long getMaxTransferRate() {
841                    return maxTransferRate;
842            }
843            public void setMaxTransferRate(long maxTransferRate) {
844                    this.maxTransferRate = maxTransferRate;
845            }
846            public String getCookie() {
847                    return cookie;
848            }
849            public void setCookie(String cookie) {
850                    this.cookie = cookie;
851            }
852            public String getHttpUploaderClassName() {
853                    return httpUploaderClassName;
854            }
855            public void setHttpUploaderClassName(String httpUploaderClassName) {
856                    this.httpUploaderClassName = httpUploaderClassName;
857            }
858            public boolean isUploadQueueReorderingAllowed() {
859                    return uploadQueueReorderingAllowed;
860            }
861            public void setUploadQueueReorderingAllowed(boolean uploadQueueReorderingAllowed) {
862                    this.uploadQueueReorderingAllowed = uploadQueueReorderingAllowed;
863            }
864            public String getRequestEncoding() {
865                    return requestEncoding;
866            }
867            public void setRequestEncoding(String requestEncoding) {
868                    this.requestEncoding = requestEncoding;
869            }
870            public String getScaledInstanceWatermarkNames() {
871                    return scaledInstanceWatermarkNames;
872            }
873            public void setScaledInstanceWatermarkNames(String scaledInstanceWatermarkNames) {
874                    this.scaledInstanceWatermarkNames = scaledInstanceWatermarkNames;
875            }
876            public List getScaledInstanceWatermarks() {
877                    return scaledInstanceWatermarks;
878            }
879            public void setScaledInstanceWatermarks(List scaledInstanceWatermarks) {
880                    this.scaledInstanceWatermarks = scaledInstanceWatermarks;
881            }
882            public boolean isPreserveRelativePath() {
883                    return preserveRelativePath;
884            }
885            public void setPreserveRelativePath(boolean preserveRelativePath) {
886                    this.preserveRelativePath = preserveRelativePath;
887            }
888            public boolean isUploadScaledImagesNoZip() {
889                    return uploadScaledImagesNoZip;
890            }
891            public void setUploadScaledImagesNoZip(boolean uploadScaledImagesNoZip) {
892                    this.uploadScaledImagesNoZip = uploadScaledImagesNoZip;
893            }
894            public int getImageSubsamplingFactor() {
895                    return imageSubsamplingFactor;
896            }
897            public void setImageSubsamplingFactor(int imageSubsamplingFactor) {
898                    this.imageSubsamplingFactor = imageSubsamplingFactor;
899            }
900            public boolean isUseMetadata() {
901                    return useMetadata;
902            }
903            public void setUseMetadata(boolean useMetadata) {
904                    this.useMetadata = useMetadata;
905            }
906            public String getMetadataDescriptorUrl() {
907                    return metadataDescriptorUrl;
908            }
909            public void setMetadataDescriptorUrl(String metadataDescriptorUrl) {
910                    this.metadataDescriptorUrl = metadataDescriptorUrl;
911            }
912            public String getMimeTypePattern() {
913                    return mimeTypePattern;
914            }
915            public void setMimeTypePattern(String mimeTypePattern) {
916                    this.mimeTypePattern = mimeTypePattern;
917            }
918            public boolean isUseJMimeMagic() {
919                    return useJMimeMagic;
920            }
921            public void setUseJMimeMagic(boolean useJMimeMagic) {
922                    this.useJMimeMagic = useJMimeMagic;
923            }
924            public boolean isJmmExtensionHints() {
925                    return jmmExtensionHints;
926            }
927            public void setJmmExtensionHints(boolean jmmExtensionHints) {
928                    this.jmmExtensionHints = jmmExtensionHints;
929            }
930            public boolean isJmmOnlyMimeMatch() {
931                    return jmmOnlyMimeMatch;
932            }
933            public void setJmmOnlyMimeMatch(boolean jmmOnlyMimeMatch) {
934                    this.jmmOnlyMimeMatch = jmmOnlyMimeMatch;
935            }
936            public boolean isImageRotateEnabled() {
937                    return imageRotateEnabled;
938            }
939            public void setImageRotateEnabled(boolean imageRotateEnabled) {
940                    this.imageRotateEnabled = imageRotateEnabled;
941            }
942            public boolean isMetadataCheckRequiredFields() {
943                    return metadataCheckRequiredFields;
944            }
945            public void setMetadataCheckRequiredFields(boolean metadataCheckRequiredFields) {
946                    this.metadataCheckRequiredFields = metadataCheckRequiredFields;
947            }
948            public boolean isSendImageMetadata() {
949                    return sendImageMetadata;
950            }
951            public void setSendImageMetadata(boolean sendImageMetadata) {
952                    this.sendImageMetadata = sendImageMetadata;
953            }
954            public int getAutoRetryCount() {
955                    return autoRetryCount;
956            }
957            public void setAutoRetryCount(int autoRetryCount) {
958                    this.autoRetryCount = autoRetryCount;
959            }
960            public boolean isUseLosslessJpegTransformations() {
961                    return useLosslessJpegTransformations;
962            }
963            public void setUseLosslessJpegTransformations(
964                            boolean useLosslessJpegTransformations) {
965                    this.useLosslessJpegTransformations = useLosslessJpegTransformations;
966            }
967            public String getGeneralPurposeCheckParamName() {
968                    return generalPurposeCheckParamName;
969            }
970            public void setGeneralPurposeCheckParamName(String generalPurposeCheckParamName) {
971                    this.generalPurposeCheckParamName = generalPurposeCheckParamName;
972            }
973            public String getGeneralPurposeCheckboxTooltip() {
974                    return generalPurposeCheckboxTooltip;
975            }
976            public void setGeneralPurposeCheckboxTooltip(
977                            String generalPurposeCheckboxTooltip) {
978                    this.generalPurposeCheckboxTooltip = generalPurposeCheckboxTooltip;
979            }
980            public String getUploaderListeners() {
981                    return uploaderListeners;
982            }
983            public void setUploaderListeners(String uploaderListeners) {
984                    this.uploaderListeners = uploaderListeners;
985            }
986            public double getImageMaxMpx() {
987                    return imageMaxMpx;
988            }
989            public void setImageMaxMpx(double imageMaxMpx) {
990                    this.imageMaxMpx = imageMaxMpx;
991            }
992            public String getUploadFormName() {
993                    return uploadFormName;
994            }
995            public void setUploadFormName(String uploadFormName) {
996                    this.uploadFormName = uploadFormName;
997            }
998            public boolean isPreserveImageFormat() {
999                    return preserveImageFormat;
1000            }
1001            public void setPreserveImageFormat(boolean preserveImageFormat) {
1002                    this.preserveImageFormat = preserveImageFormat;
1003            }
1004            public String getFileNamePatternDescription() {
1005                    return fileNamePatternDescription;
1006            }
1007            public void setFileNamePatternDescription(String fileNamePatternDescription) {
1008                    this.fileNamePatternDescription = fileNamePatternDescription;
1009            }
1010            public String getSkipZippingFilesPattern() {
1011                    return skipZippingFilesPattern;
1012            }
1013            public void setSkipZippingFilesPattern(String skipZippingFilesPattern) {
1014                    this.skipZippingFilesPattern = skipZippingFilesPattern;
1015            }
1016            public boolean isScaledInstanceRecompressAndUploadSmaller() {
1017                    return scaledInstanceRecompressAndUploadSmaller;
1018            }
1019            public void setScaledInstanceRecompressAndUploadSmaller(
1020                            boolean scaledInstanceRecompressAndUploadSmaller) {
1021                    this.scaledInstanceRecompressAndUploadSmaller = scaledInstanceRecompressAndUploadSmaller;
1022            }
1023            public boolean isSendOriginalImageMimetype() {
1024                    return sendOriginalImageMimetype;
1025            }
1026            public void setSendOriginalImageMimetype(boolean sendOriginalImageMimetype) {
1027                    this.sendOriginalImageMimetype = sendOriginalImageMimetype;
1028            }
1029            public boolean isSaveImageTransformations() {
1030                    return saveImageTransformations;
1031            }
1032            public void setSaveImageTransformations(boolean saveImageTransformations) {
1033                    this.saveImageTransformations = saveImageTransformations;
1034            }
1035            public boolean isZipPartitions() {
1036                    return zipPartitions;
1037            }
1038            public void setZipPartitions(boolean zipPartitions) {
1039                    this.zipPartitions = zipPartitions;
1040            }
1041            public boolean isRemoveUploadedFiles() {
1042                    return removeUploadedFiles;
1043            }
1044            public void setRemoveUploadedFiles(boolean removeUploadedFiles) {
1045                    this.removeUploadedFiles = removeUploadedFiles;
1046            }
1047            public int getRegionPixelsMax() {
1048                    return regionPixelsMax;
1049            }
1050            public void setRegionPixelsMax(int regionPixelsMax) {
1051                    this.regionPixelsMax = regionPixelsMax;
1052            }
1053            public int getImageLoadPixelsMax() {
1054                    return imageLoadPixelsMax;
1055            }
1056            public void setImageLoadPixelsMax(int imageLoadPixelsMax) {
1057                    this.imageLoadPixelsMax = imageLoadPixelsMax;
1058            }
1059            public String getScaledInstancePreserveMetadata() {
1060                    return scaledInstancePreserveMetadata;
1061            }
1062            public void setScaledInstancePreserveMetadata(
1063                            String scaledInstancePreserveMetadata) {
1064                    this.scaledInstancePreserveMetadata = scaledInstancePreserveMetadata;
1065            }
1066            public String getScaledInstanceScaleMode() {
1067                    return scaledInstanceScaleMode;
1068            }
1069            public void setScaledInstanceScaleMode(String scaledInstanceScaleMode) {
1070                    this.scaledInstanceScaleMode = scaledInstanceScaleMode;
1071            }
1072            public boolean isClipboardImageEnabled() {
1073                    return clipboardImageEnabled;
1074            }
1075            public void setClipboardImageEnabled(boolean clipboardImageEnabled) {
1076                    this.clipboardImageEnabled = clipboardImageEnabled;
1077            }
1078            public String getClipboardImageFormat() {
1079                    return clipboardImageFormat;
1080            }
1081            public void setClipboardImageFormat(String clipboardImageFormat) {
1082                    this.clipboardImageFormat = clipboardImageFormat;
1083            }
1084            public String getClipboardImageNameFormat() {
1085                    return clipboardImageNameFormat;
1086            }
1087            public void setClipboardImageNameFormat(String clipboardImageNameFormat) {
1088                    this.clipboardImageNameFormat = clipboardImageNameFormat;
1089            }
1090            public String getRequestProperties() {
1091                    return requestProperties;
1092            }
1093            public void setRequestProperties(String requestProperties) {
1094                    this.requestProperties = requestProperties;
1095            }
1096            public boolean isIgnoreFileAddErrors() {
1097                    return ignoreFileAddErrors;
1098            }
1099            public void setIgnoreFileAddErrors(boolean ignoreFileAddErrors) {
1100                    this.ignoreFileAddErrors = ignoreFileAddErrors;
1101            }
1102            public String getPreferredPasteDataFlavor() {
1103                    return preferredPasteDataFlavor;
1104            }
1105            public void setPreferredPasteDataFlavor(String preferredPasteDataFlavor) {
1106                    this.preferredPasteDataFlavor = preferredPasteDataFlavor;
1107            }
1108            public String getFtpResumeCommand() {
1109                    return ftpResumeCommand;
1110            }
1111            public void setFtpResumeCommand(String ftpResumeCommand) {
1112                    this.ftpResumeCommand = ftpResumeCommand;
1113            }
1114            public boolean isDeleteTempFilesOnRemove() {
1115                    return deleteTempFilesOnRemove;
1116            }
1117            public void setDeleteTempFilesOnRemove(boolean deleteTempFilesOnRemove) {
1118                    this.deleteTempFilesOnRemove = deleteTempFilesOnRemove;
1119            }
1120    }