KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > daemon > impl > util > diskcachedaemon > PortletRefresher


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 at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * 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 and
14  * limitations under the License.
15  */

16
17 package org.apache.jetspeed.daemon.impl.util.diskcachedaemon;
18
19 //jetspeed stuff
20
import org.apache.jetspeed.om.registry.PortletEntry;
21 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
22 import org.apache.jetspeed.services.logging.JetspeedLogger;
23 import org.apache.jetspeed.services.Registry;
24 import org.apache.jetspeed.services.PortletFactory;
25 import org.apache.jetspeed.services.urlmanager.URLManager;
26
27 //turbine stuff
28
import org.apache.jetspeed.services.resources.JetspeedResources;
29
30 /**
31 <p>
32 PortletRefresher updates a Entry within the Portlet registry with content
33 that has been updating on disk.
34 </p>
35
36 @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 */

39 public class PortletRefresher implements Runnable JavaDoc {
40    
41     private PortletEntry entry = null;
42    
43     /**
44      * Static initialization of the logger for this class
45      */

46     private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(PortletRefresher.class.getName());
47     
48     /**
49     Given an Entry and RunData, create a PortletRefresher
50     */

51     public PortletRefresher( PortletEntry entry ) {
52         this.entry = entry;
53     }
54    
55     /**
56     */

57     public void run() {
58        
59         /* Code to avoid putting it in cache if it not required... */
60         try {
61             if ( JetspeedResources.getBoolean( JetspeedResources.AUTOCREATE_PORTLETS_KEY ) ) {
62        
63                 PortletFactory.getPortlet( this.entry.getName(), "0" );
64  
65             }
66             
67         } catch ( Throwable JavaDoc t ) {
68             logger.error("Error getting portlet", t);
69
70             URLManager.register( this.entry.getURL(), URLManager.STATUS_BAD, t.toString() );
71             Registry.removeEntry( Registry.PORTLET, this.entry.getName() );
72            
73         }
74        
75     }
76     
77 }
78
79
Popular Tags