1/*2 * Copyright 2000-2001,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.daemon.impl.util.diskcachedaemon;
1819//jetspeed stuff20import org.apache.jetspeed.om.registry.PortletEntry;
21import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
22import org.apache.jetspeed.services.logging.JetspeedLogger;
23import org.apache.jetspeed.services.Registry;
24import org.apache.jetspeed.services.PortletFactory;
25import org.apache.jetspeed.services.urlmanager.URLManager;
2627//turbine stuff28import org.apache.jetspeed.services.resources.JetspeedResources;
2930/***31<p>32PortletRefresher updates a Entry within the Portlet registry with content33that has been updating on disk.34</p>3536@author <A HREF="mailto:burton@apache.org">Kevin A. Burton</A>37@version $Id: PortletRefresher.java,v 1.17 2004/02/23 02:47:00 jford Exp $38*/39publicclassPortletRefresher implements Runnable {
4041privatePortletEntry entry = null;
4243/***44 * Static initialization of the logger for this class45 */46privatestaticfinalJetspeedLogger logger = JetspeedLogFactoryService.getLogger(PortletRefresher.class.getName());
4748/***49 Given an Entry and RunData, create a PortletRefresher50 */51publicPortletRefresher( PortletEntry entry ) {
52this.entry = entry;
53 }
5455/***56 */57publicvoid run() {
5859/* Code to avoid putting it in cache if it not required... */60try {
61if ( JetspeedResources.getBoolean( JetspeedResources.AUTOCREATE_PORTLETS_KEY ) ) {
6263 PortletFactory.getPortlet( this.entry.getName(), "0" );
6465 }
6667 } catch ( Throwable t ) {
68 logger.error("Error getting portlet", t);
6970 URLManager.register( this.entry.getURL(), URLManager.STATUS_BAD, t.toString() );
71 Registry.removeEntry( Registry.PORTLET, this.entry.getName() );
7273 }
7475 }
7677 }
78