001/* 002 * File : 003 * Date : 004 * Version: 005 * 006 * This library is part of OpenCms - 007 * the Open Source Content Management System 008 * 009 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 010 * 011 * This library is free software; you can redistribute it and/or 012 * modify it under the terms of the GNU Lesser General Public 013 * License as published by the Free Software Foundation; either 014 * version 2.1 of the License, or (at your option) any later version. 015 * 016 * This library is distributed in the hope that it will be useful, 017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 019 * Lesser General Public License for more details. 020 * 021 * For further information about Alkacon Software GmbH & Co. KG, please see the 022 * company website: http://www.alkacon.com 023 * 024 * For further information about OpenCms, please see the 025 * project website: http://www.opencms.org 026 * 027 * You should have received a copy of the GNU Lesser General Public 028 * License along with this library; if not, write to the Free Software 029 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 030 */ 031 032package org.opencms.workplace.tools.content.check; 033 034import org.opencms.file.CmsObject; 035import org.opencms.main.CmsLog; 036import org.opencms.report.A_CmsReportThread; 037 038import org.apache.commons.logging.Log; 039 040/** 041 * Thread for content checks. <p> 042 * 043 * @since 6.1.2 044 */ 045public class CmsContentCheckThread extends A_CmsReportThread { 046 047 /** The log object for this class. */ 048 private static final Log LOG = CmsLog.getLog(CmsContentCheckThread.class); 049 050 /** the CmsObject to use. */ 051 private CmsObject m_cms; 052 053 /** reference to the CmsContentCheckObject. */ 054 private CmsContentCheck m_contentCheck; 055 056 /** 057 * Constructor, creates a new CmsContentCheckThread.<p> 058 * 059 * @param cms the current CmsObject 060 * @param contentCheck the CmsContentCheck objectt 061 */ 062 public CmsContentCheckThread(CmsObject cms, CmsContentCheck contentCheck) { 063 064 super(cms, "contentcheck"); 065 initHtmlReport(cms.getRequestContext().getLocale()); 066 m_cms = cms; 067 m_cms.getRequestContext().setUpdateSessionEnabled(false); 068 m_contentCheck = contentCheck; 069 } 070 071 /** 072 * @see org.opencms.report.A_CmsReportThread#getReportUpdate() 073 */ 074 @Override 075 public String getReportUpdate() { 076 077 return getReport().getReportUpdate(); 078 } 079 080 /** 081 * The run method which starts the import process.<p> 082 */ 083 @Override 084 public void run() { 085 086 try { 087 // do the content check 088 m_contentCheck.startContentCheck(m_cms, getReport()); 089 } catch (Exception e) { 090 getReport().println(e); 091 if (LOG.isErrorEnabled()) { 092 LOG.error(e.getLocalizedMessage()); 093 } 094 } 095 } 096}