001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software GmbH & Co. KG, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.workplace.threads; 029 030import org.opencms.file.CmsObject; 031import org.opencms.main.CmsLog; 032import org.opencms.report.A_CmsReportThread; 033import org.opencms.util.CmsUUID; 034 035import org.apache.commons.logging.Log; 036 037/** 038 * Deletes a project.<p> 039 * 040 * @since 6.0.0 041 */ 042public class CmsProjectDeleteThread extends A_CmsReportThread { 043 044 /** The log object for this class. */ 045 private static final Log LOG = CmsLog.getLog(CmsProjectDeleteThread.class); 046 047 /** The throwable. */ 048 private Throwable m_error; 049 050 /** The project id. */ 051 private CmsUUID m_projectId; 052 053 /** 054 * Creates the project delete thread.<p> 055 * 056 * @param cms the current OpenCms context object 057 * @param projectId the project id to delete 058 */ 059 public CmsProjectDeleteThread(CmsObject cms, CmsUUID projectId) { 060 061 super(cms, Messages.get().getBundle().key(Messages.GUI_DELETE_PROJECT_THREAD_NAME_1, projectId)); 062 m_projectId = projectId; 063 } 064 065 /** 066 * @see org.opencms.report.A_CmsReportThread#getError() 067 */ 068 @Override 069 public Throwable getError() { 070 071 return m_error; 072 } 073 074 /** 075 * @see org.opencms.report.A_CmsReportThread#getReportUpdate() 076 */ 077 @Override 078 public String getReportUpdate() { 079 080 return ""; 081 } 082 083 /** 084 * @see java.lang.Runnable#run() 085 */ 086 @Override 087 public void run() { 088 089 try { 090 getCms().deleteProject(m_projectId); 091 } catch (Throwable e) { 092 m_error = e; 093 LOG.warn(Messages.get().getBundle().key(Messages.LOG_PROJECT_DELETE_FAILED_1, m_projectId), e); 094 } 095 } 096}