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//java stuff20import java.io.IOException;
2122// Jetspeed classes23import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
24import org.apache.jetspeed.services.logging.JetspeedLogger;
2526/***27Handles expiration mechanisms that expire when the file changes.2829@author <a href="mailto:burton@apache.org">Kevin A. Burton</a>30@version $Id: FileWatchExpire.java,v 1.10 2004/02/23 03:24:40 jford Exp $31*/32publicclassFileWatchExpireextendsBaseExpire33 {
3435/***36 * Static initialization of the logger for this class37 */38privatestaticfinalJetspeedLogger logger = JetspeedLogFactoryService.getLogger(FileWatchExpire.class.getName());
3940FileWatcher fw = null;
4142/***43 @see Expire#isExpired4445 @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>46 @version $Id: FileWatchExpire.java,v 1.10 2004/02/23 03:24:40 jford Exp $47 */48publicboolean isExpired() {
4950if ( this.fw != null ) {
51returnthis.fw.hasChanged();
52 } else {
53return false;
54 }
555657 }
5859/***60 Set the url on which this depends. It is required that you call this 61 method before you use it.62 */63publicvoid setURL( String url ) {
64try {
65this.fw = newFileWatcher( url, this.getPortlet().getName() );
66 } catch ( IOException e ) {
67 logger.error("Exception", e);
68 }
69 }
707172 }