View Javadoc
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  	private	LinkedList<String>	picExtensions		= new LinkedList<String>();
26  	private	int			thumbHeight				= 75;
27  	private	boolean		useThumbCache			= false;
28  	private	String		thumbCacheDirectory 	= "";
29  	private	int			thumbCacheSize			= 2000;
30  	private	String		importDirectory			= "";
31  	private int			importsToDo				= 5;
32  	private int			virginsToDo				= 10;
33  	private	boolean		engineOn				= false;
34  	private	boolean		engineRunOnce			= false;
35  	private boolean		skipXThumbs				= false;
36  	private	boolean		showRateOnPics			= false;
37  	private	boolean		jobLogSummaryOnly		= false;
38  	private	String		engineCronExpression	= "0 */5 * * * ?";
39  	private	boolean		updatePicSize			= false;
40  	private	boolean		updateMlbFilters		= false;
41  	private	boolean		updateMD5s				= false;
42  	private	boolean		calcMosaicVectors		= false;
43  	private	boolean		buildMosaicPic			= false;
44  	private	int			mosaicDepth				= 3;		// a 3x3 square mosaic is calculated for pics
45  	private	int			mosaicThumbHeight		= 50;
46  	private	int			mosaicPicsPerPage		= 14;
47  	private	String		mosaicThumbCacheDir		= "";
48  	private	int			mosaicThumbCacheHeight	= 600;
49  	private	boolean		syncEnable				= false;
50  	private	String		syncUrl					= "http://localhost:8081";
51  	
52  	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  	public	List<String>	getPicExtensions() { return(picExtensions); }
60  	public	void			setPicExtensions(LinkedList<String> ll) { this.picExtensions = ll; }
61  	public	void			addPicExtension(String pe) { this.picExtensions.add((pe)); }
62  
63  	public	int				getThumbHeight() { return(thumbHeight); }
64  	public	void			setThumbHeight(int c) { thumbHeight = c; }
65  	public	boolean			isUseThumbCache() { return(useThumbCache); }
66  	public	void			setUseThumbCache(boolean b) { useThumbCache = b; }
67  	public	String			getThumbCacheDirectory() { return(thumbCacheDirectory); }
68  	public	void			setThumbCacheDirectory(String s) { thumbCacheDirectory = s; }
69  
70  	public	int				getVirginsToDo() { return virginsToDo; }
71  	public	void			setVirginsToDo(int virginsToDo) { this.virginsToDo = virginsToDo; }
72  
73  	public	int				getImportsToDo() { return importsToDo; }
74  	public	void			setImportsToDo(int importsToDo) { this.importsToDo = importsToDo; }
75  
76  	public	boolean			isEngineOn() { return engineOn; }
77  	public	void			setEngineOn(boolean engineOn) { this.engineOn = engineOn; }
78  	public	boolean			isEngineRunOnce() { return engineRunOnce; }
79  	public	void			setEngineRunOnce(boolean engineRunOnce) { this.engineRunOnce = engineRunOnce; }
80  
81  	public	String			getEngineCronExpression() { return(engineCronExpression); }
82  	public	void			setEngineCronExpression(String s) { engineCronExpression = s; }
83  	
84  	public	int				getMosaicDepth() { return(mosaicDepth); }
85  	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  		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 		this.thumbCacheSize = thumbCacheSize;
102 	}
103 
104 	/**
105 	 * @return the mosaicThumbHeight
106 	 */
107 	public int getMosaicThumbHeight() {
108 		return mosaicThumbHeight;
109 	}
110 
111 	/**
112 	 * @param mosaicThumbHeight the mosaicThumbHeight to set
113 	 */
114 	public void setMosaicThumbHeight(int mosaicThumbHeight) {
115 		this.mosaicThumbHeight = mosaicThumbHeight;
116 	}
117 
118 	/**
119 	 * @return the mosaicPicsPerPage
120 	 */
121 	public int getMosaicPicsPerPage() {
122 		return mosaicPicsPerPage;
123 	}
124 
125 	/**
126 	 * @param mosaicPicsPerPage the mosaicPicsPerPage to set
127 	 */
128 	public void setMosaicPicsPerPage(int mosaicPicsPerPage) {
129 		this.mosaicPicsPerPage = mosaicPicsPerPage;
130 	}
131 
132 	/**
133 	 * @return the mosaicThumbCacheDir
134 	 */
135 	public String getMosaicThumbCacheDir() {
136 		return mosaicThumbCacheDir;
137 	}
138 
139 	/**
140 	 * @param mosaicThumbCacheDir the mosaicThumbCacheDir to set
141 	 */
142 	public void setMosaicThumbCacheDir(String mosaicThumbCacheDir) {
143 		this.mosaicThumbCacheDir = mosaicThumbCacheDir;
144 	}
145 
146 	/**
147 	 * @return the mosaicThumbCacheHeight
148 	 */
149 	public int getMosaicThumbCacheHeight() {
150 		return mosaicThumbCacheHeight;
151 	}
152 
153 	/**
154 	 * @param mosaicThumbCacheHeight the mosaicThumbCacheHeight to set
155 	 */
156 	public void setMosaicThumbCacheHeight(int mosaicThumbCacheHeight) {
157 		this.mosaicThumbCacheHeight = mosaicThumbCacheHeight;
158 	}
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 		return importDirectory;
165 	}
166 
167 	/**
168 	 * @param importDirectory the importDirectory to set
169 	 */
170 	public void setImportDirectory(String importDirectory) {
171 		this.importDirectory = importDirectory;
172 	}
173 
174 	/**
175 	 * @return Returns the skipXThumbs attribute.  If false, then include broken thumbnails in contact making.
176 	 */
177 	public boolean isSkipXThumbs() {
178 		return skipXThumbs;
179 	}
180 
181 	/**
182 	 * @param skipXThumbs The skipXThumbs to set.
183 	 */
184 	public void setSkipXThumbs(boolean skipXThumbs) {
185 		this.skipXThumbs = skipXThumbs;
186 	}
187 
188 
189 	/**
190 	 * @return the showRateOnPics
191 	 */
192 	public boolean isShowRateOnPics() {
193 		return showRateOnPics;
194 	}
195 
196 	/**
197 	 * @param showRateOnPics the showRateOnPics to set
198 	 */
199 	public void setShowRateOnPics(boolean showRateOnPics) {
200 		this.showRateOnPics = showRateOnPics;
201 	}
202 
203 	/** Do we only want a summary of jobs in the log?
204 	 * @return the jobLogSummaryOnly
205 	 */
206 	public boolean isJobLogSummaryOnly() {
207 		return jobLogSummaryOnly;
208 	}
209 
210 	/**
211 	 * @param jobLogSummaryOnly the jobLogSummaryOnly to set
212 	 */
213 	public void setJobLogSummaryOnly(boolean jobLogSummaryOnly) {
214 		this.jobLogSummaryOnly = jobLogSummaryOnly;
215 	}
216 
217 	/** Should we / are we building a Mosaic?
218 	 * @return the buildMosaicPic
219 	 */
220 	public boolean isBuildMosaicPic() {
221 		return buildMosaicPic;
222 	}
223 
224 	/**
225 	 * @param buildMosaicPic the buildMosaicPic to set
226 	 */
227 	public void setBuildMosaicPic(boolean buildMosaicPic) {
228 		this.buildMosaicPic = buildMosaicPic;
229 	}
230 
231 	/** Are we / should we build the Mosaic vectors?
232 	 * @return the calcMosaicVectors
233 	 */
234 	public boolean isCalcMosaicVectors() {
235 		return calcMosaicVectors;
236 	}
237 
238 	/**
239 	 * @param calcMosaicVectors the calcMosaicVectors to set
240 	 */
241 	public void setCalcMosaicVectors(boolean calcMosaicVectors) {
242 		this.calcMosaicVectors = calcMosaicVectors;
243 	}
244 
245 
246 	public boolean isSyncEnable() {
247 		return syncEnable;
248 	}
249 
250 	public void setSyncEnable(boolean syncEnable) {
251 		this.syncEnable = syncEnable;
252 	}
253 
254 	public String getSyncUrl() {
255 		return syncUrl;
256 	}
257 
258 	public void setSyncUrl(String syncUrl) {
259 		this.syncUrl = syncUrl;
260 	}
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 		return updatePicSize;
268 	}
269 
270 	/**
271 	 * @param updatePicSize the updatePicSize to set
272 	 */
273 	public void setUpdatePicSize(boolean updatePicSize) {
274 		this.updatePicSize = updatePicSize;
275 	}
276 
277 	/** Should we run the MlbFilterFixer?
278 	 * @return the updateMlbFilters
279 	 */
280 	public boolean isUpdateMlbFilters() {
281 		return updateMlbFilters;
282 	}
283 
284 	/**
285 	 * @param updateMlbFilters the updateMlbFilters to set
286 	 */
287 	public void setUpdateMlbFilters(boolean updateMlbFilters) {
288 		this.updateMlbFilters = updateMlbFilters;
289 	}
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 		return updateMD5s;
297 	}
298 
299 	/** Update the MD5 signatures.
300 	 * @param updateMD5s yes or no.
301 	 */
302 	public void setUpdateMD5Sums(boolean updateMD5s) {
303 		this.updateMD5s = updateMD5s;
304 	}
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 		DecimalFormat df2 = new DecimalFormat("00");
309 		DecimalFormat df3 = new DecimalFormat("000");
310 		return(new String(setName
311 							+ "-" + df3.format(size) 
312 							+ "-" + 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 		DecimalFormat df3 = new DecimalFormat("000");
318 		return(new String(set 
319 							+ "-" + df3.format(size)));
320 	}
321 	/** Return the jdbc Uid string (uses _ instead of -) */
322 	public	static	String	getDUid(String setName, int size) {
323 		return(setName + "_" + size);
324 	}
325 }