1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.portal.expire;
18
19
20 import org.apache.jetspeed.portal.Portlet;
21 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
22 import org.apache.jetspeed.services.logging.JetspeedLogger;
23 import org.apache.jetspeed.util.JetspeedException;
24
25 /***
26 Handles content expiration
27
28 @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
29 @version $Id: ExpireFactory.java,v 1.6 2004/02/23 03:24:40 jford Exp $
30 */
31 public class ExpireFactory
32 {
33
34 /***
35 * Static initialization of the logger for this class
36 */
37 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(ExpireFactory.class.getName());
38
39 public static final String FILE_WATCH_EXPIRE
40 = "org.apache.jetspeed.portal.expire.FileWatchExpire";
41
42 public static final String NO_EXPIRE
43 = "org.apache.jetspeed.portal.expire.NoExpire";
44
45
46 /***
47 Since this object essentially does nothing. Only use one instance for
48 performance
49 */
50 public static Expire noExpire = new NoExpire();
51
52
53 /***
54 Create a new Expire object with the specified Portlet and classname.
55
56 @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
57 @version $Id: ExpireFactory.java,v 1.6 2004/02/23 03:24:40 jford Exp $
58 */
59 public static Expire getExpire( Portlet portlet,
60 String classname ) throws JetspeedException {
61
62 if ( classname.equals( NO_EXPIRE ) ) {
63 return noExpire;
64 }
65
66 try {
67 Expire expire = (Expire)Class.forName( classname ).newInstance();
68 expire.init();
69 expire.setPortlet( portlet );
70 expire.setExpired( false );
71
72 return expire;
73 } catch ( Throwable t ) {
74 logger.error("Throwable", t );
75 throw new JetspeedException( t.getMessage() );
76 }
77 }
78
79 }
80