KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opencms > workplace > CmsAdminVfsLinkManagement


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/workplace/CmsAdminVfsLinkManagement.java,v $
3  * Date : $Date: 2005/06/22 10:38:24 $
4  * Version: $Revision: 1.2 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (C) 2002 Alkacon Software (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package com.opencms.workplace;
33
34 import org.opencms.file.CmsObject;
35 import org.opencms.main.CmsException;
36
37 import com.opencms.core.I_CmsSession;
38 import com.opencms.legacy.CmsXmlTemplateLoader;
39
40 import java.util.Hashtable JavaDoc;
41
42 /**
43  * Workplace class for the Check Project / Check Filesystem Links backoffice item.
44  *
45  * @author Thomas Weckert
46  * @version $Revision: 1.2 $
47  *
48  * @deprecated Will not be supported past the OpenCms 6 release.
49  */

50 public final class CmsAdminVfsLinkManagement extends CmsWorkplaceDefault {
51     
52     /** Debugging flag, this is also used in other classes for the VFS link check */
53     public static final boolean DEBUG = false;
54
55     private static final String JavaDoc C_LINKCHECK_VFS_THREAD = "C_LINKCHECK_VFS_THREAD";
56
57     public byte[] getContent(CmsObject cms, String JavaDoc templateFile, String JavaDoc elementName, Hashtable JavaDoc parameters, String JavaDoc templateSelector) throws CmsException {
58         
59         CmsXmlWpTemplateFile templateDocument = (CmsXmlWpTemplateFile) this.getOwnTemplateFile(cms, templateFile, elementName, parameters, templateSelector);
60         I_CmsSession session = CmsXmlTemplateLoader.getSession(cms.getRequestContext(), true);
61         String JavaDoc action = (String JavaDoc) parameters.get("action");
62         CmsLinkVfsManagementThread vfsLinkManagementThread = null;
63         CmsXmlLanguageFile lang = templateDocument.getLanguageFile();
64
65         String JavaDoc text = lang.getLanguageValue("linkmanagement.label.text1")
66                         + cms.getRequestContext().currentProject().getName()
67                         + lang.getLanguageValue("linkmanagement.label.text3");
68                         
69         if ("start".equals(action)) {
70             // first call - start checking
71
vfsLinkManagementThread = new CmsLinkVfsManagementThread(cms);
72             vfsLinkManagementThread.start();
73             session.putValue(C_LINKCHECK_VFS_THREAD, vfsLinkManagementThread);
74
75             templateDocument.setData("text", text);
76             templateDocument.setData("data", "");
77             templateDocument.setData("endMethod", "");
78         } else if ("working".equals(action)) {
79             vfsLinkManagementThread = (CmsLinkVfsManagementThread)session.getValue(C_LINKCHECK_VFS_THREAD);
80
81             if (vfsLinkManagementThread.isAlive()) {
82                 templateDocument.setData("endMethod", "");
83             } else {
84                 text += "<br>" + lang.getLanguageValue("linkmanagement.label.textende");
85                 
86                 templateDocument.setData("autoUpdate", "");
87                 templateDocument.setData("text", text);
88
89                 session.removeValue(CmsAdminVfsLinkManagement.C_LINKCHECK_VFS_THREAD);
90             }
91             templateDocument.setData("data", vfsLinkManagementThread.getReportUpdate());
92         }
93         // now load the template file and start the processing
94
return startProcessing(cms, templateDocument, elementName, parameters, templateSelector);
95     }
96
97 }
98
Free Books   Free Magazines  
Popular Tags