View Javadoc
1   /******************************************************************************
2    * HomePageController.java - The Spring controller for the main page
3    * 
4    * PicMan - The BuckoSoft Picture Manager in Java
5    * Copyright(c) 2005 - Dick Balaska
6    * 
7    */
8   package com.buckosoft.PicMan.web;
9   
10  import java.io.IOException;
11  import java.util.HashMap;
12  import java.util.Map;
13  
14  import javax.servlet.ServletException;
15  import javax.servlet.http.HttpServletRequest;
16  import javax.servlet.http.HttpServletResponse;
17  
18  import org.apache.commons.logging.Log;
19  import org.apache.commons.logging.LogFactory;
20  import org.springframework.web.servlet.ModelAndView;
21  
22  import com.buckosoft.BSAccount.web.BSAccountHomePageController;
23  import com.buckosoft.PicMan.business.PicManFacade;
24  import com.buckosoft.PicMan.db.DatabaseFacade;
25  
26  /** The Spring controller for the main (home) page.
27   * @author Dick Balaska
28   * @since 2005/07/25
29   * @version $Revision: 1.1 $ <br> $Date: 2013/12/26 01:25:31 $
30   *
31   */
32  public class HomePageController extends BSAccountHomePageController {
33  	
34  //	private final static boolean DEBUG = false;
35  	protected final Log logger = LogFactory.getLog(getClass());
36  	
37  	private PicManFacade	pmf;
38  	private DatabaseFacade	dbf;
39  	
40  	/** Set the reference to the PicMan API
41  	 * @param pmf The PicManFacade
42  	 */
43  	public void setPicMan(PicManFacade pmf) { this.pmf = pmf; }
44  	/** bean getter so Spring AOP can determine the type
45  	 * @return The PicManFacade
46  	 */
47  	public PicManFacade getPicMan() { return(pmf); }
48  
49  	/** Set the reference to the PicMan database
50  	 * @param dbf The DatabaseFacade
51  	 */
52  	public void setDatabase(DatabaseFacade dbf) { this.dbf = dbf; }
53  	/** bean getter so Spring AOP can determine the type
54  	 * @return The DatabaseFacade
55  	 */
56  	public DatabaseFacade getDatabase() { return(dbf); }
57  
58  	/** Build the model that spring outputs to the browser
59  	 * @param request The http request
60  	 * @param response The http response
61  	 */
62  	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
63  			throws ServletException, IOException {
64  
65  		Map<String, Object> myModel = new HashMap<String, Object>();
66  		myModel.put("picMan", pmf);
67  		myModel.put("database", dbf);
68  		myModel.put("refreshDelay", 2);
69  		//myModel.put("engineRunningText", pmf.engineRunningShortStatus());
70  		return(super.handleRequest(request, response, myModel));
71  	}
72  }