1 16 17 package org.apache.jetspeed.daemon.impl; 18 19 import org.apache.jetspeed.daemon.Daemon; 21 import org.apache.jetspeed.daemon.DaemonConfig; 22 import org.apache.jetspeed.daemon.DaemonEntry; 23 import org.apache.jetspeed.daemon.impl.util.diskcachedaemon.URLRefresher; 24 import org.apache.jetspeed.cache.disk.DiskCacheEntry; 25 import org.apache.jetspeed.cache.disk.JetspeedDiskCache; 26 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService; 27 import org.apache.jetspeed.services.logging.JetspeedLogger; 28 import org.apache.jetspeed.services.threadpool.ThreadPool; 29 30 import org.apache.turbine.util.RunData; 32 33 41 public class DiskCacheDaemon implements Daemon { 42 43 44 private int status = Daemon.STATUS_NOT_PROCESSED; 45 private int result = Daemon.RESULT_UNKNOWN; 46 private DaemonConfig config = null; 47 private DaemonEntry entry = null; 48 private RunData rundata = null; 49 50 53 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(DiskCacheDaemon.class.getName()); 54 55 58 public void run() { 59 60 logger.info("parsing out document store"); 61 this.setResult( Daemon.RESULT_PROCESSING ); 62 63 DiskCacheEntry urls[] = JetspeedDiskCache.getInstance().getEntries(); 64 65 for (int i = 0; i < urls.length; ++i) { 66 67 String url = urls[i].getSourceURL(); 68 69 if(!urls[i].isLocal()) { 72 ThreadPool.process( new URLRefresher( url ) ); 73 } 74 75 } 76 this.setResult( Daemon.RESULT_SUCCESS ); 77 } 78 79 83 public void init(DaemonConfig config, DaemonEntry entry) { 84 this.config = config; 85 this.entry = entry; 86 } 87 88 90 public DaemonConfig getDaemonConfig() { 91 return this.config; 92 } 93 94 96 public DaemonEntry getDaemonEntry() { 97 return this.entry; 98 } 99 100 107 public int getStatus() { 108 return this.status; 109 } 110 111 118 public void setStatus(int status) { 119 this.status = status; 120 } 121 122 125 public int getResult() { 126 return this.result; 127 } 128 129 132 public void setResult( int result ) { 133 this.result = result; 134 } 135 136 139 public String getMessage() { 140 return null; 141 } 142 143 } 144 | Popular Tags |