1/*2 * Copyright 2000-2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.portal.expire;
1819//jetspeed stuff20import org.apache.jetspeed.portal.Portlet;
21import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
22import org.apache.jetspeed.services.logging.JetspeedLogger;
23import org.apache.jetspeed.util.JetspeedException;
2425/***26Handles content expiration2728@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*/31publicclassExpireFactory32 {
3334/***35 * Static initialization of the logger for this class36 */37privatestaticfinalJetspeedLogger logger = JetspeedLogFactoryService.getLogger(ExpireFactory.class.getName());
3839publicstaticfinal String FILE_WATCH_EXPIRE
40 = "org.apache.jetspeed.portal.expire.FileWatchExpire";
4142publicstaticfinal String NO_EXPIRE
43 = "org.apache.jetspeed.portal.expire.NoExpire";
444546/***47 Since this object essentially does nothing. Only use one instance for48 performance49 */50publicstaticExpire noExpire = newNoExpire();
515253/***54 Create a new Expire object with the specified Portlet and classname.5556 @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 */59publicstaticExpire getExpire( Portlet portlet,
60 String classname ) throws JetspeedException {
6162if ( classname.equals( NO_EXPIRE ) ) {
63return noExpire;
64 }
6566try {
67Expire expire = (Expire)Class.forName( classname ).newInstance();
68 expire.init();
69 expire.setPortlet( portlet );
70 expire.setExpired( false );
7172return expire;
73 } catch ( Throwable t ) {
74 logger.error("Throwable", t );
75thrownewJetspeedException( t.getMessage() );
76 }
77 }
7879 }
80