| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| System |
|
| 1.0;1 |
| 1 | /****************************************************************************** | |
| 2 | * System.java - The system config bean | |
| 3 | * | |
| 4 | * PicMan - The BuckoSoft Picture Manager in Java | |
| 5 | * Copyright(c) 2005 - Dick Balaska | |
| 6 | * | |
| 7 | */ | |
| 8 | package com.buckosoft.PicMan.domain; | |
| 9 | ||
| 10 | import java.io.Serializable; | |
| 11 | import java.text.DecimalFormat; | |
| 12 | import java.util.List; | |
| 13 | import java.util.LinkedList; | |
| 14 | ||
| 15 | /** System Config bean. | |
| 16 | * This is where system wide user configurable attributes live. | |
| 17 | * @author Dick Balaska | |
| 18 | * @since 2005/07/27 | |
| 19 | */ | |
| 20 | public class System implements Serializable { | |
| 21 | ||
| 22 | private static final long serialVersionUID = 1L; | |
| 23 | ||
| 24 | // private LinkedList<String> roots = new LinkedList<String>(); | |
| 25 | 0 | private LinkedList<String> picExtensions = new LinkedList<String>(); |
| 26 | 0 | private int thumbHeight = 75; |
| 27 | 0 | private boolean useThumbCache = false; |
| 28 | 0 | private String thumbCacheDirectory = ""; |
| 29 | 0 | private int thumbCacheSize = 2000; |
| 30 | 0 | private String importDirectory = ""; |
| 31 | 0 | private int importsToDo = 5; |
| 32 | 0 | private int virginsToDo = 10; |
| 33 | 0 | private boolean engineOn = false; |
| 34 | 0 | private boolean engineRunOnce = false; |
| 35 | 0 | private boolean skipXThumbs = false; |
| 36 | 0 | private boolean showRateOnPics = false; |
| 37 | 0 | private boolean jobLogSummaryOnly = false; |
| 38 | 0 | private String engineCronExpression = "0 */5 * * * ?"; |
| 39 | 0 | private boolean updatePicSize = false; |
| 40 | 0 | private boolean updateMlbFilters = false; |
| 41 | 0 | private boolean updateMD5s = false; |
| 42 | 0 | private boolean calcMosaicVectors = false; |
| 43 | 0 | private boolean buildMosaicPic = false; |
| 44 | 0 | private int mosaicDepth = 3; // a 3x3 square mosaic is calculated for pics |
| 45 | 0 | private int mosaicThumbHeight = 50; |
| 46 | 0 | private int mosaicPicsPerPage = 14; |
| 47 | 0 | private String mosaicThumbCacheDir = ""; |
| 48 | 0 | private int mosaicThumbCacheHeight = 600; |
| 49 | 0 | private boolean syncEnable = false; |
| 50 | 0 | private String syncUrl = "http://localhost:8081"; |
| 51 | ||
| 52 | 0 | public System() {} |
| 53 | ||
| 54 | // public List<String> getRoots() { return(roots); } | |
| 55 | // public void setRoots(LinkedList<String> roots) { this.roots = roots; } | |
| 56 | // public String getRoot(int i) { return((String)roots.get(i)); } | |
| 57 | // public void addRoot(String root) {this.roots.add(root); } | |
| 58 | ||
| 59 | 0 | public List<String> getPicExtensions() { return(picExtensions); } |
| 60 | 0 | public void setPicExtensions(LinkedList<String> ll) { this.picExtensions = ll; } |
| 61 | 0 | public void addPicExtension(String pe) { this.picExtensions.add((pe)); } |
| 62 | ||
| 63 | 0 | public int getThumbHeight() { return(thumbHeight); } |
| 64 | 0 | public void setThumbHeight(int c) { thumbHeight = c; } |
| 65 | 0 | public boolean isUseThumbCache() { return(useThumbCache); } |
| 66 | 0 | public void setUseThumbCache(boolean b) { useThumbCache = b; } |
| 67 | 0 | public String getThumbCacheDirectory() { return(thumbCacheDirectory); } |
| 68 | 0 | public void setThumbCacheDirectory(String s) { thumbCacheDirectory = s; } |
| 69 | ||
| 70 | 0 | public int getVirginsToDo() { return virginsToDo; } |
| 71 | 0 | public void setVirginsToDo(int virginsToDo) { this.virginsToDo = virginsToDo; } |
| 72 | ||
| 73 | 0 | public int getImportsToDo() { return importsToDo; } |
| 74 | 0 | public void setImportsToDo(int importsToDo) { this.importsToDo = importsToDo; } |
| 75 | ||
| 76 | 0 | public boolean isEngineOn() { return engineOn; } |
| 77 | 0 | public void setEngineOn(boolean engineOn) { this.engineOn = engineOn; } |
| 78 | 0 | public boolean isEngineRunOnce() { return engineRunOnce; } |
| 79 | 0 | public void setEngineRunOnce(boolean engineRunOnce) { this.engineRunOnce = engineRunOnce; } |
| 80 | ||
| 81 | 0 | public String getEngineCronExpression() { return(engineCronExpression); } |
| 82 | 0 | public void setEngineCronExpression(String s) { engineCronExpression = s; } |
| 83 | ||
| 84 | 0 | public int getMosaicDepth() { return(mosaicDepth); } |
| 85 | 0 | public void setMosaicDepth(int mosaicDepth) { this.mosaicDepth = mosaicDepth; } |
| 86 | ||
| 87 | ||
| 88 | ||
| 89 | /** Fetch the max number of files (thumbs) to put in each thumb cache subdirectory. | |
| 90 | * @return the maximum number of entries in a thumb cache | |
| 91 | */ | |
| 92 | public int getThumbCacheSize() { | |
| 93 | 0 | return thumbCacheSize; |
| 94 | } | |
| 95 | ||
| 96 | /** The thumbCache is segregated into subdirectories beneath the main thumbCacheDirectory. | |
| 97 | * This attribute says how many pics to put in each cache subdirectory. | |
| 98 | * @param thumbCacheSize the thumbCacheSize to set | |
| 99 | */ | |
| 100 | public void setThumbCacheSize(int thumbCacheSize) { | |
| 101 | 0 | this.thumbCacheSize = thumbCacheSize; |
| 102 | 0 | } |
| 103 | ||
| 104 | /** | |
| 105 | * @return the mosaicThumbHeight | |
| 106 | */ | |
| 107 | public int getMosaicThumbHeight() { | |
| 108 | 0 | return mosaicThumbHeight; |
| 109 | } | |
| 110 | ||
| 111 | /** | |
| 112 | * @param mosaicThumbHeight the mosaicThumbHeight to set | |
| 113 | */ | |
| 114 | public void setMosaicThumbHeight(int mosaicThumbHeight) { | |
| 115 | 0 | this.mosaicThumbHeight = mosaicThumbHeight; |
| 116 | 0 | } |
| 117 | ||
| 118 | /** | |
| 119 | * @return the mosaicPicsPerPage | |
| 120 | */ | |
| 121 | public int getMosaicPicsPerPage() { | |
| 122 | 0 | return mosaicPicsPerPage; |
| 123 | } | |
| 124 | ||
| 125 | /** | |
| 126 | * @param mosaicPicsPerPage the mosaicPicsPerPage to set | |
| 127 | */ | |
| 128 | public void setMosaicPicsPerPage(int mosaicPicsPerPage) { | |
| 129 | 0 | this.mosaicPicsPerPage = mosaicPicsPerPage; |
| 130 | 0 | } |
| 131 | ||
| 132 | /** | |
| 133 | * @return the mosaicThumbCacheDir | |
| 134 | */ | |
| 135 | public String getMosaicThumbCacheDir() { | |
| 136 | 0 | return mosaicThumbCacheDir; |
| 137 | } | |
| 138 | ||
| 139 | /** | |
| 140 | * @param mosaicThumbCacheDir the mosaicThumbCacheDir to set | |
| 141 | */ | |
| 142 | public void setMosaicThumbCacheDir(String mosaicThumbCacheDir) { | |
| 143 | 0 | this.mosaicThumbCacheDir = mosaicThumbCacheDir; |
| 144 | 0 | } |
| 145 | ||
| 146 | /** | |
| 147 | * @return the mosaicThumbCacheHeight | |
| 148 | */ | |
| 149 | public int getMosaicThumbCacheHeight() { | |
| 150 | 0 | return mosaicThumbCacheHeight; |
| 151 | } | |
| 152 | ||
| 153 | /** | |
| 154 | * @param mosaicThumbCacheHeight the mosaicThumbCacheHeight to set | |
| 155 | */ | |
| 156 | public void setMosaicThumbCacheHeight(int mosaicThumbCacheHeight) { | |
| 157 | 0 | this.mosaicThumbCacheHeight = mosaicThumbCacheHeight; |
| 158 | 0 | } |
| 159 | ||
| 160 | /** Return the directory to look for new pics in (like from the camera n:/blah) | |
| 161 | * @return the importDirectory | |
| 162 | */ | |
| 163 | public String getImportDirectory() { | |
| 164 | 0 | return importDirectory; |
| 165 | } | |
| 166 | ||
| 167 | /** | |
| 168 | * @param importDirectory the importDirectory to set | |
| 169 | */ | |
| 170 | public void setImportDirectory(String importDirectory) { | |
| 171 | 0 | this.importDirectory = importDirectory; |
| 172 | 0 | } |
| 173 | ||
| 174 | /** | |
| 175 | * @return Returns the skipXThumbs attribute. If false, then include broken thumbnails in contact making. | |
| 176 | */ | |
| 177 | public boolean isSkipXThumbs() { | |
| 178 | 0 | return skipXThumbs; |
| 179 | } | |
| 180 | ||
| 181 | /** | |
| 182 | * @param skipXThumbs The skipXThumbs to set. | |
| 183 | */ | |
| 184 | public void setSkipXThumbs(boolean skipXThumbs) { | |
| 185 | 0 | this.skipXThumbs = skipXThumbs; |
| 186 | 0 | } |
| 187 | ||
| 188 | ||
| 189 | /** | |
| 190 | * @return the showRateOnPics | |
| 191 | */ | |
| 192 | public boolean isShowRateOnPics() { | |
| 193 | 0 | return showRateOnPics; |
| 194 | } | |
| 195 | ||
| 196 | /** | |
| 197 | * @param showRateOnPics the showRateOnPics to set | |
| 198 | */ | |
| 199 | public void setShowRateOnPics(boolean showRateOnPics) { | |
| 200 | 0 | this.showRateOnPics = showRateOnPics; |
| 201 | 0 | } |
| 202 | ||
| 203 | /** Do we only want a summary of jobs in the log? | |
| 204 | * @return the jobLogSummaryOnly | |
| 205 | */ | |
| 206 | public boolean isJobLogSummaryOnly() { | |
| 207 | 0 | return jobLogSummaryOnly; |
| 208 | } | |
| 209 | ||
| 210 | /** | |
| 211 | * @param jobLogSummaryOnly the jobLogSummaryOnly to set | |
| 212 | */ | |
| 213 | public void setJobLogSummaryOnly(boolean jobLogSummaryOnly) { | |
| 214 | 0 | this.jobLogSummaryOnly = jobLogSummaryOnly; |
| 215 | 0 | } |
| 216 | ||
| 217 | /** Should we / are we building a Mosaic? | |
| 218 | * @return the buildMosaicPic | |
| 219 | */ | |
| 220 | public boolean isBuildMosaicPic() { | |
| 221 | 0 | return buildMosaicPic; |
| 222 | } | |
| 223 | ||
| 224 | /** | |
| 225 | * @param buildMosaicPic the buildMosaicPic to set | |
| 226 | */ | |
| 227 | public void setBuildMosaicPic(boolean buildMosaicPic) { | |
| 228 | 0 | this.buildMosaicPic = buildMosaicPic; |
| 229 | 0 | } |
| 230 | ||
| 231 | /** Are we / should we build the Mosaic vectors? | |
| 232 | * @return the calcMosaicVectors | |
| 233 | */ | |
| 234 | public boolean isCalcMosaicVectors() { | |
| 235 | 0 | return calcMosaicVectors; |
| 236 | } | |
| 237 | ||
| 238 | /** | |
| 239 | * @param calcMosaicVectors the calcMosaicVectors to set | |
| 240 | */ | |
| 241 | public void setCalcMosaicVectors(boolean calcMosaicVectors) { | |
| 242 | 0 | this.calcMosaicVectors = calcMosaicVectors; |
| 243 | 0 | } |
| 244 | ||
| 245 | ||
| 246 | public boolean isSyncEnable() { | |
| 247 | 0 | return syncEnable; |
| 248 | } | |
| 249 | ||
| 250 | public void setSyncEnable(boolean syncEnable) { | |
| 251 | 0 | this.syncEnable = syncEnable; |
| 252 | 0 | } |
| 253 | ||
| 254 | public String getSyncUrl() { | |
| 255 | 0 | return syncUrl; |
| 256 | } | |
| 257 | ||
| 258 | public void setSyncUrl(String syncUrl) { | |
| 259 | 0 | this.syncUrl = syncUrl; |
| 260 | 0 | } |
| 261 | ||
| 262 | /** Are we / should we update the Pic sizes in the database? | |
| 263 | * The first 12702 pictures went into the database with a 0/0 size. | |
| 264 | * @return the updatePicSize | |
| 265 | */ | |
| 266 | public boolean isUpdatePicSize() { | |
| 267 | 0 | return updatePicSize; |
| 268 | } | |
| 269 | ||
| 270 | /** | |
| 271 | * @param updatePicSize the updatePicSize to set | |
| 272 | */ | |
| 273 | public void setUpdatePicSize(boolean updatePicSize) { | |
| 274 | 0 | this.updatePicSize = updatePicSize; |
| 275 | 0 | } |
| 276 | ||
| 277 | /** Should we run the MlbFilterFixer? | |
| 278 | * @return the updateMlbFilters | |
| 279 | */ | |
| 280 | public boolean isUpdateMlbFilters() { | |
| 281 | 0 | return updateMlbFilters; |
| 282 | } | |
| 283 | ||
| 284 | /** | |
| 285 | * @param updateMlbFilters the updateMlbFilters to set | |
| 286 | */ | |
| 287 | public void setUpdateMlbFilters(boolean updateMlbFilters) { | |
| 288 | 0 | this.updateMlbFilters = updateMlbFilters; |
| 289 | 0 | } |
| 290 | ||
| 291 | /** Are we / should we update the MD5 signatures for the pics? | |
| 292 | * The first 20374 pictures went into the database with no MD5 signature. | |
| 293 | * @return | |
| 294 | */ | |
| 295 | public boolean isUpdateMD5Sums() { | |
| 296 | 0 | return updateMD5s; |
| 297 | } | |
| 298 | ||
| 299 | /** Update the MD5 signatures. | |
| 300 | * @param updateMD5s yes or no. | |
| 301 | */ | |
| 302 | public void setUpdateMD5Sums(boolean updateMD5s) { | |
| 303 | 0 | this.updateMD5s = updateMD5s; |
| 304 | 0 | } |
| 305 | ||
| 306 | /** Return a String which is the Uuid of a set/size/item combo */ | |
| 307 | public static String getUuid(String setName, int size, int item) { | |
| 308 | 0 | DecimalFormat df2 = new DecimalFormat("00"); |
| 309 | 0 | DecimalFormat df3 = new DecimalFormat("000"); |
| 310 | 0 | return(new String(setName |
| 311 | 0 | + "-" + df3.format(size) |
| 312 | 0 | + "-" + df2.format(item))); |
| 313 | } | |
| 314 | /** Return a String which is the Uuid of a set/size combo. | |
| 315 | * Not so much a Uuid, per se. because the item is unknown */ | |
| 316 | public static String getUuid(String set, int size) { | |
| 317 | 0 | DecimalFormat df3 = new DecimalFormat("000"); |
| 318 | 0 | return(new String(set |
| 319 | 0 | + "-" + df3.format(size))); |
| 320 | } | |
| 321 | /** Return the jdbc Uid string (uses _ instead of -) */ | |
| 322 | public static String getDUid(String setName, int size) { | |
| 323 | 0 | return(setName + "_" + size); |
| 324 | } | |
| 325 | } |