|
|||||||||||||||||||
| This license of Clover is provided to support the development of Flock only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| FlockTapestryServlet.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
package net.sf.flock.webapp; |
|
| 2 |
|
|
| 3 |
import java.io.File; |
|
| 4 |
|
|
| 5 |
import javax.servlet.ServletConfig; |
|
| 6 |
import javax.servlet.ServletContext; |
|
| 7 |
import javax.servlet.ServletException; |
|
| 8 |
|
|
| 9 |
import net.sf.flock.FlockResourceException; |
|
| 10 |
import net.sf.flock.SubscriptionManagerI; |
|
| 11 |
import net.sf.flock.impl.PersistentSubscriptionManager; |
|
| 12 |
import net.sf.flock.util.SchedulerThread; |
|
| 13 |
import net.sf.tapestry.ApplicationServlet; |
|
| 14 |
import org.apache.log4j.LogManager; |
|
| 15 |
import org.apache.log4j.Logger; |
|
| 16 |
|
|
| 17 |
public class FlockTapestryServlet extends ApplicationServlet {
|
|
| 18 |
|
|
| 19 |
private final static Logger LOGGER = LogManager.getLogger(FlockTapestryServlet.class); |
|
| 20 |
|
|
| 21 | 0 |
protected String getApplicationSpecificationPath() {
|
| 22 | 0 |
return "/net/sf/flock/webapp/Flock.application"; |
| 23 |
} |
|
| 24 |
|
|
| 25 |
/** |
|
| 26 |
* @see javax.servlet.Servlet#init(javax.servlet.ServletConfig) |
|
| 27 |
*/ |
|
| 28 | 0 |
public void init(ServletConfig config) throws ServletException {
|
| 29 | 0 |
super.init(config); |
| 30 |
|
|
| 31 | 0 |
String home = System.getProperty("flock.home", System.getProperty("user.home"));
|
| 32 | 0 |
File storeDirectory = new File( home, ".flock" ); |
| 33 |
|
|
| 34 | 0 |
final SubscriptionManagerI subscriptionManager; |
| 35 | 0 |
LOGGER.info("Initializing Flock");
|
| 36 | 0 |
try {
|
| 37 | 0 |
subscriptionManager = new PersistentSubscriptionManager(storeDirectory); |
| 38 |
} catch (FlockResourceException e) {
|
|
| 39 | 0 |
throw new ServletException("Error creating subscription manager", e);
|
| 40 |
} |
|
| 41 |
|
|
| 42 | 0 |
new SchedulerThread(15, new Runnable() {
|
| 43 | 0 |
public void run() {
|
| 44 | 0 |
subscriptionManager.refreshAll(); |
| 45 |
} |
|
| 46 |
}).start(); |
|
| 47 |
|
|
| 48 | 0 |
ServletContext ctx = this.getServletContext(); |
| 49 | 0 |
ctx.setAttribute("flock.subscriptionManager", subscriptionManager);
|
| 50 | 0 |
FlockContext.setSubscriptionManager( subscriptionManager ); |
| 51 |
|
|
| 52 | 0 |
LOGGER.info("Flock initialized");
|
| 53 |
} |
|
| 54 |
|
|
| 55 |
} |
|
| 56 |
|
|
| 57 |
|
|
||||||||||