001 package hirondelle.web4j;
002
003 import javax.servlet.ServletConfig;
004 import hirondelle.web4j.model.AppException;
005
006 /**
007 Perform startup tasks.
008
009 <P>See {@link hirondelle.web4j.BuildImpl} for important information on how this item is configured.
010 {@link hirondelle.web4j.BuildImpl#forStartupTasks()}
011 returns the configured implementation of this interface.
012
013 <P>Allows the application programmer to perform any needed initialization tasks.
014
015 <P>These tasks are performed only once, upon startup. For example, the application
016 may need to place items into application scope. Here is an example
017 <a href="http://www.javapractices.com/apps/fish/javadoc/src-html/hirondelle/web4j/config/Startup.html">implementation</a>
018 taken from the WEB4J example application.
019
020 <P>These startup tasks are called only after the data layer has successfully initialized.
021 See {@link hirondelle.web4j.database.ConnectionSource#init(ServletConfig)}, for startup
022 tasks related to database connections.
023 */
024 public interface StartupTasks {
025
026 /**
027 Perform any startup tasks needed by the application.
028 <P>Possible tasks include :
029 <ul>
030 <li>disseminate values configured in <tt>web.xml</tt>
031 <li>place items into application scope, such as code tables read from the database
032 <li>set the default {@link java.util.TimeZone}
033 </ul>
034
035 <P>This method is called by WEB4J near the end of startup processing, <em>after</em>
036 the data layer has been initialized. Thus, your implementation or this method can access
037 the database in the normal way.
038 */
039 void startApplication(ServletConfig aConfig) throws AppException;
040
041 }