KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > cofax > cms > CofaxToolsLifeCycleThread


1 /*
2  * CofaxToolsLifeCycleThread is part of the Cofax content management system library.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Please see http://www.cofax.org for contact information and other related informaion.
19  *
20  * $Header: /cvsroot/cofax/cofax/src/org/cofax/cms/CofaxToolsLifeCycleThread.java,v 1.5.2.1 2006/12/11 16:28:24 fxrobin Exp $
21  */

22 package org.cofax.cms;
23
24 import org.cofax.*;
25
26 /**
27  * CofaxToolsLifeCycleThread: Update the publications with articles to publish
28  * or to unpublishp calls to Cofax Servlet Server to clear article cache or
29  * template cache. Expects the complete URl -
30  *
31  * @author Badr Chentouf
32  *
33  */

34
35 public class CofaxToolsLifeCycleThread extends Thread JavaDoc {
36
37     DataStore db;
38
39     public String JavaDoc logFile = "";
40
41     int i = 0;
42
43     public void setDataStore(DataStore db) {
44         this.db = db;
45     }
46
47     public void setLogFile(String JavaDoc logFile) {
48         this.logFile = logFile;
49     }
50
51     public void run() {
52         while (true) {
53             try {
54                 i++;
55                 CofaxToolsLifeCycle lf = new CofaxToolsLifeCycle();
56                 lf.setLogFile(logFile);
57                 boolean ret = lf.updateAllPublications(db);
58             } catch (Exception JavaDoc ex) {
59                 System.err.println("CofaxToolsLifeCycleThread : exception " + ex);
60             } finally {
61                 try {
62                     sleep(3600000 * 12); // (3600000*12)ms=12 hours
63
} catch (Exception JavaDoc e) {
64                     System.err.println("CofaxToolsLifeCycleThread : sleep ERROR: " + e);
65                 }
66             }
67         }
68
69     }
70
71 }
72
Popular Tags