View Javadoc
1   /******************************************************************************
2    * PicManFacade.java - Primary business interface
3    * 
4    * PicMan - The BuckoSoft Picture Manager in Java
5    * Copyright(c) 2005 - Dick Balaska
6    * 
7    */
8   package com.buckosoft.PicMan.business;
9   
10  import java.awt.Dimension;
11  import java.util.LinkedList;
12  import java.util.List;
13  
14  import com.buckosoft.PicMan.business.common.PicManCommonFacade;
15  import com.buckosoft.PicMan.business.mosaic.MosaicMan;
16  import com.buckosoft.PicMan.db.DatabaseFacade;
17  import com.buckosoft.PicMan.domain.Chain;
18  import com.buckosoft.PicMan.domain.Filter;
19  import com.buckosoft.PicMan.domain.JobLogEntry;
20  import com.buckosoft.PicMan.domain.Pic;
21  import com.buckosoft.PicMan.domain.Set;
22  import com.buckosoft.PicMan.domain.SetSize;
23  import com.buckosoft.PicMan.domain.Thumbnail;
24  import com.buckosoft.PicMan.image.PicReader;
25  import com.buckosoft.PicMan.image.ThumbCache;
26  
27  /**
28   * PicMan primary business interface.
29   * @author Dick Balaska
30   * @since 2005/07/25
31   * @see <a href="http://cvs.buckosoft.com/Projects/java/PicMan/PicMan/src/com/buckosoft/PicMan/business/PicManFacade.java">PicManFacade.java</a>
32   */
33  public interface PicManFacade extends PicManCommonFacade {
34  
35  	/** Get a reference to the Database
36  	 * @return The one and only PicMan Database
37  	 */
38  	public	DatabaseFacade getDB();
39  
40  	///////////////////////////////////////////////////////////////////////////
41  	///////////////////////////////////////////////////////////////////////////
42  	/* PicReader */
43  
44  	/** Get a reference to the PicReader
45  	 * @return The one and only PicReader
46  	 */
47  	PicReader	getPicReader();
48  	
49  	/** Read the file for this pic to figure out his size
50  	 * @param pic The Pic to read
51  	 * @return width/height as a {@link java.awt.Dimension}.  (-1,-1) = error.
52  	 */
53  	Dimension determinePicSize(Pic pic);
54  
55  	///////////////////////////////////////////////////////////////////////////
56  	///////////////////////////////////////////////////////////////////////////
57  	/* ThumbNail cache */
58  	/** Get a reference to the ThumbCache Manager
59  	 * @return The one and only ThumbCache
60  	 */
61  	ThumbCache	getThumbCache();
62  	
63  	void		setupThumbCache();
64  	
65  	///////////////////////////////////////////////////////////////////////////
66  	///////////////////////////////////////////////////////////////////////////
67  	/* Mosaic ThumbNail cache */
68  	/** Initialize the mosaic thumb cache for this set at this height
69  	 * @param sid The SetID that MosaicMan is using
70  	 * @param height The height of the thumbnails
71  	 */
72  	void setupMosaicThumbCache(int sid, int height);
73  	
74  	/** Done with the mosaic cache, release it's resources.
75  	 */
76  	void releaseMosaicThumbCache();
77  	
78  	///////////////////////////////////////////////////////////////////////////
79  	///////////////////////////////////////////////////////////////////////////
80  	/* Web output */
81  	
82  	
83  	/** Return the sets/sizes as an HTML table
84  	 * @param setSizeList The sets/sizes to include in the table
85  	 * @param showUnused Show or hide the unused Sets
86  	 * @return A big honking string
87  	 */
88  	String		getSetSizeWebTable(List<SetSize> setSizeList, boolean showUnused);
89  	
90  	
91  	/** Return a String of {tr}{td} checkboxes for this chain.
92  	 * This horrible function is still used in 2011 in Chain Editing.
93  	 * @param chain Chain to filter the checkboxes on.  If null, then output all checkboxes
94  	 * @return A big String
95  	 */
96  	String		getSetSizeCheckboxesHtml(Chain chain);
97  
98  	//List<String>	getFilterColumnsAsHtml();
99  
100 	/** Create a String that represents the Sets and values for this pic. <br>
101 	 * \r\n represents newline<br>
102 	 * A Sample output is:
103 	 * <pre>   mlbG:6,6,6,6,0 mlb:6 Trains:6
104 	 *   Springfield</pre>
105 	 * @param picName
106 	 * @return A string showing the Sets and values for this pic.
107 	 */
108 	String		getFilterAsString(String picName);
109 
110 	///////////////////////////////////////////////////////////////////////////
111 	///////////////////////////////////////////////////////////////////////////
112 	/* Contact manager */
113 
114 	/** Get a reference to the instantiated <code>BatchManager</code>.
115 	 * @return The BatchManager
116 	 */
117 	BatchManager	getBatchManager();
118 
119 //	void			runBatchManager() throws Exception;
120 	
121 	/** Return a one or two word status for the engine.
122 	 * @return Most of the time, this will be "Idle".
123 	 */
124 	String			engineRunningShortStatus();
125 
126 	/** Set the Cron string used to clock the engine.&nbsp;<FONT COLOR=RED>DDS</FONT>
127 	 * @param expression The cron expression
128 	 * @see org.springframework.scheduling.quartz.CronTriggerBean
129 	 */
130 	void		setEngineCronExpression(String expression);
131 
132 	/** Get a Thumbnail from this pic at this size
133 	 * @param pic The Pic to read
134 	 * @param height How tall to make the image
135 	 * @return A Thumbnail or null if we can't make it
136 	 */
137 	Thumbnail	getThumbNail(Pic pic, int height);
138 
139 	/** Get a Thumbnail from this pic at this size
140 	 * @param pic The Pic to read
141 	 * @param height How tall to make the image
142 	 * @param label Any text (like the rating) to draw in the lower left corner of the graphic
143 	 * @return A Thumbnail or null if we can't make it
144 	 */
145 	Thumbnail	getThumbNail(Pic pic, int height, String label);
146 	
147 	/** Get a Thumbnail from this pic at this size.
148 	 * This is a little different than {@link #getThumbNail(Pic, int)} in that it uses the Mosaic ThumbCache,
149 	 * which has slightly different rules.<br/>
150 	 * The Mosaic {@link com.buckosoft.PicMan.image.ThumbCache} operates thusly:
151 	 * If a Thumbnail is requested and it doesn't exist, it is built at the MosaicThumbHeight. Then the size requested is
152 	 * derived from that and returned.
153 	 * @param pic The Pic to read
154 	 * @param height How tall to make the image
155 	 * @return A Thumbnail or null if we can't make it
156 	 */
157 	Thumbnail	getMosaicThumbNail(Pic pic, int height);
158 	
159 	
160 	Thumbnail	getTestMosaicThumbNail(Pic pic, int height, int depth);
161 
162 	/** Fetch a reference to the Mosaic Manager
163 	 * @return The one and only MosaicMan
164 	 */
165 	MosaicMan getMosaicMan();
166 	
167 	/** Given a List of Sets, return a copy of a filter with the values 0'd out 
168 	 * except for the Sets listed.
169 	 * @param sets A list of sets
170 	 * @param filter The filter to mask
171 	 * @return The new Filter
172 	 */
173 	Filter		getMaskedFilter(List<Set> sets, Filter filter);
174 
175 	SyncManager_Old getSyncManager();
176 
177 	/** Return a reference to The PosterManager
178 	 * @return The one and only PosterManager
179 	 */
180 	PosterManager	getPosterManager();
181 	
182 	///////////////////////////////////////////////////////////////////////////
183 	///////////////////////////////////////////////////////////////////////////
184 	/* Pic Importer Manager */
185 	/** Get a reference to the PicImporter
186 	 * @return The PicImporter
187 	 */
188 	PicImporter	getPicImporter();
189 
190 	/** Get the number of files in a directory
191 	 * @param rid The rootid to look under
192 	 * @param dir The subdirectory i.e. "2008/20080609"
193 	 * @return The number of files
194 	 */
195 	int getFilesInDirCount(int rid, String dir);
196 	
197 	/** Fetch a <code>List</code> of dirs in this directory.
198 	 * Note: This does not do database lookups; rather, it reads the actual directory structure.  
199 	 * Perhaps this is not a good thing as the rest of the system deals with the database.
200 	 * However, there are no real facilities for walking directories in the database.
201 	 * @param rid The root id to look under
202 	 * @param subDir Any subdirectory to check
203 	 * @return A list of nodes that are directories.
204 	 */
205 	List<String> getDirsInDir(int rid, String subDir);
206 	
207 	///////////////////////////////////////////////////////////////////////////
208 	///////////////////////////////////////////////////////////////////////////
209 	/* Job Log Manager */
210 
211 	/** Return a reference to the Job Log
212 	 * @return the jobLog
213 	 */
214 	LinkedList<JobLogEntry> getJobLog();
215 
216 	/** Get the maximum displayed job log lines in the home page.
217 	 * @return the Count
218 	 */
219 	int	getJobLogMaxCount();
220 
221 	/** Add an entry to the Job Log
222 	 * @param jle The JobLogEntry to add.
223 	 */
224 	void addJobToLog(JobLogEntry jle);
225 
226 	///////////////////////////////////////////////////////////////////////////
227 	///////////////////////////////////////////////////////////////////////////
228 	/* System Config */
229 	
230 	/** Does the User have the batch engine turned on?  Should we do work?
231 	 * @return true = ok to do work.
232 	 */
233 	boolean		isEngineOn();
234 
235 }