Source Code Cross Referenced for CmsRemovePubLocksThread.java in  » Content-Management-System » opencms » org » opencms » workplace » tools » database » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » opencms » org.opencms.workplace.tools.database 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * File   : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/database/CmsRemovePubLocksThread.java,v $
003:         * Date   : $Date: 2008-02-27 12:05:51 $
004:         * Version: $Revision: 1.5 $
005:         *
006:         * This program is part of the Alkacon OpenCms Software library.
007:         *
008:         * This license applies to all programs, pages, Java classes, parts and
009:         * modules of the Alkacon OpenCms Software library published by
010:         * Alkacon Software GmbH, unless otherwise noted.
011:         *
012:         * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
013:         *
014:         * This program is free software; you can redistribute it and/or modify
015:         * it under the terms of the GNU General Public License as published by
016:         * the Free Software Foundation; either version 2 of the License, or (at
017:         * your option) any later version.
018:         *
019:         * This program is distributed in the hope that it will be useful, but
020:         * WITHOUT ANY WARRANTY; without even the implied warranty of
021:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
022:         * General Public License for more details.
023:         * 
024:         * You should have received a copy of the GNU General Public License
025:         * along with this program; if not, write to the Free Software
026:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
027:         * 
028:         * For further information about Alkacon Software GmbH, please see the
029:         * companys website: http://www.alkacon.com.
030:         * 
031:         * For further information about OpenCms, please see the OpenCms project
032:         * website: http://www.opencms.org.
033:         * 
034:         * The names "Alkacon", "Alkacon Software GmbH" and "OpenCms" must not be used 
035:         * to endorse or promote products derived from this software without prior 
036:         * written permission. For written permission, please contact info@alkacon.com.
037:         * 
038:         * Products derived from this software may not be called "Alkacon", 
039:         * "Alkacon Software GmbH" or "OpenCms", nor may "Alkacon", "Alkacon Software GmbH" 
040:         * or "OpenCms" appear in their name, without prior written permission of 
041:         * Alkacon Software GmbH. 
042:         *
043:         * This program is also available under a commercial non-GPL license. For
044:         * pricing and ordering information, please inquire at sales@alkacon.com.
045:         */
046:
047:        package org.opencms.workplace.tools.database;
048:
049:        import org.opencms.file.CmsObject;
050:        import org.opencms.file.CmsResource;
051:        import org.opencms.file.CmsResourceFilter;
052:        import org.opencms.lock.CmsLockFilter;
053:        import org.opencms.lock.CmsLockType;
054:        import org.opencms.main.OpenCms;
055:        import org.opencms.report.A_CmsReportThread;
056:        import org.opencms.report.I_CmsReport;
057:
058:        import java.util.ArrayList;
059:        import java.util.Iterator;
060:        import java.util.List;
061:
062:        /**
063:         * Remove the publish locks.<p>
064:         * 
065:         * @author Michael Moossen 
066:         * 
067:         * @version $Revision: 1.5 $ 
068:         * 
069:         * @since 7.0.2
070:         */
071:        public class CmsRemovePubLocksThread extends A_CmsReportThread {
072:
073:            /** The last error occurred. */
074:            private Throwable m_error;
075:
076:            /** The list of resource names. */
077:            private List m_resources;
078:
079:            /**
080:             * Creates an Thread to remove the publish locks.<p>
081:             * 
082:             * @param cms the current OpenCms context object
083:             * @param resources a list of resource names
084:             */
085:            public CmsRemovePubLocksThread(CmsObject cms, List resources) {
086:
087:                super (cms, Messages.get().getBundle().key(
088:                        Messages.GUI_DB_PUBLOCKS_THREAD_NAME_0));
089:                m_resources = new ArrayList(resources);
090:                initHtmlReport(cms.getRequestContext().getLocale());
091:            }
092:
093:            /**
094:             * Returns the last error.<p>
095:             * 
096:             * @see org.opencms.report.A_CmsReportThread#getError()
097:             */
098:            public Throwable getError() {
099:
100:                return m_error;
101:            }
102:
103:            /**
104:             * Updates the report.<p>
105:             * 
106:             * @see org.opencms.report.A_CmsReportThread#getReportUpdate()
107:             */
108:            public String getReportUpdate() {
109:
110:                return getReport().getReportUpdate();
111:            }
112:
113:            /**
114:             * Starts the report thread.<p>
115:             * 
116:             * @see java.lang.Runnable#run()
117:             */
118:            public void run() {
119:
120:                try {
121:                    getReport().println(
122:                            Messages.get().container(
123:                                    Messages.RPT_DB_PUBLOCKS_BEGIN_0),
124:                            I_CmsReport.FORMAT_HEADLINE);
125:                    CmsObject cms = getCms();
126:                    CmsLockFilter filter = CmsLockFilter.FILTER_ALL;
127:                    filter = filter.filterType(CmsLockType.PUBLISH);
128:
129:                    Iterator it = m_resources.iterator();
130:                    while (it.hasNext()) {
131:                        String paramResName = (String) it.next();
132:                        getReport().println(
133:                                Messages.get().container(
134:                                        Messages.RPT_DB_PUBLOCKS_READLOCKS_1,
135:                                        paramResName), I_CmsReport.FORMAT_NOTE);
136:                        Iterator itResources = cms.getLockedResources(
137:                                paramResName, filter).iterator();
138:                        while (itResources.hasNext()) {
139:                            String resName = (String) itResources.next();
140:                            if (!cms.existsResource(resName,
141:                                    CmsResourceFilter.ALL)) {
142:                                getReport()
143:                                        .println(
144:                                                Messages
145:                                                        .get()
146:                                                        .container(
147:                                                                Messages.RPT_DB_PUBLOCKS_UNLOCKING_1,
148:                                                                resName),
149:                                                I_CmsReport.FORMAT_DEFAULT);
150:                                OpenCms.getMemoryMonitor().uncacheLock(
151:                                        cms.getRequestContext().addSiteRoot(
152:                                                resName));
153:                                continue;
154:                            }
155:                            Iterator itSiblings = cms.readSiblings(resName,
156:                                    CmsResourceFilter.ALL).iterator();
157:                            while (itSiblings.hasNext()) {
158:                                CmsResource res = (CmsResource) itSiblings
159:                                        .next();
160:                                getReport()
161:                                        .println(
162:                                                Messages
163:                                                        .get()
164:                                                        .container(
165:                                                                Messages.RPT_DB_PUBLOCKS_UNLOCKING_1,
166:                                                                cms
167:                                                                        .getSitePath(res)),
168:                                                I_CmsReport.FORMAT_DEFAULT);
169:                                OpenCms.getMemoryMonitor().uncacheLock(
170:                                        res.getRootPath());
171:                            }
172:                        }
173:                    }
174:                    getReport().println(
175:                            Messages.get().container(
176:                                    Messages.RPT_DB_PUBLOCKS_END_0),
177:                            I_CmsReport.FORMAT_HEADLINE);
178:                } catch (Throwable exc) {
179:                    getReport().println(
180:                            Messages.get().container(
181:                                    Messages.RPT_DB_PUBLOCKS_FAILED_0),
182:                            I_CmsReport.FORMAT_WARNING);
183:                    getReport().println(exc);
184:                    m_error = exc;
185:                }
186:            }
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.