Source Code Cross Referenced for CmsContentCheckResource.java in  » Content-Management-System » opencms » org » opencms » workplace » tools » content » check » 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.content.check 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * File   : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/content/check/CmsContentCheckResource.java,v $
003:         * Date   : $Date: 2008-02-27 12:05:42 $
004:         * Version: $Revision: 1.5 $
005:         *
006:         * This library is part of OpenCms -
007:         * the Open Source Content Management System
008:         *
009:         * Copyright (c) 2002 - 2008 Alkacon Software GmbH (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, 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:
032:        package org.opencms.workplace.tools.content.check;
033:
034:        import org.opencms.file.CmsFile;
035:        import org.opencms.file.CmsObject;
036:        import org.opencms.file.CmsResource;
037:        import org.opencms.main.CmsException;
038:        import org.opencms.xml.content.CmsXmlContent;
039:        import org.opencms.xml.content.CmsXmlContentFactory;
040:
041:        import java.util.ArrayList;
042:        import java.util.List;
043:
044:        /**
045:         * This object encapuslates a CmsResource, its content and unmarshalled xml content
046:         * for processing in the content check plugins.<p>
047:         * 
048:         *
049:         * @author  Michael Emmerich
050:         * 
051:         * @version $Revision: 1.5 $ 
052:         * 
053:         * @since 6.1.2 
054:         */
055:        public class CmsContentCheckResource {
056:
057:            /** Encapsulated content array. */
058:            private byte[] m_content;
059:
060:            /** List of errors found during content check. */
061:            private List m_errors;
062:
063:            /** Encapsulated CmsResource. */
064:            private CmsResource m_resource;
065:
066:            /** List of warnings found during content check. */
067:            private List m_warnings;
068:
069:            /** Encapsulated unmashalled xml content. */
070:            private CmsXmlContent m_xmlcontent;
071:
072:            /**
073:             * Constructor, creates an CmsContentCheckResource object.<p>
074:             * 
075:             * @param res the CmsResource to encapsulate in the CmsContentCheckResource.
076:             */
077:            public CmsContentCheckResource(CmsResource res) {
078:
079:                m_resource = res;
080:                m_content = null;
081:                m_xmlcontent = null;
082:                m_errors = new ArrayList();
083:                m_warnings = new ArrayList();
084:            }
085:
086:            /** Adds a new error to the list of errors for this resource.<p>
087:             * 
088:             * @param error the error message to be added
089:             */
090:            public void addError(String error) {
091:
092:                m_errors.add(error);
093:            }
094:
095:            /** Adds a list of errors to the list of errors for this resource.<p>
096:             *  
097:             * @param errors the error messages to be added
098:             */
099:            public void addErrors(List errors) {
100:
101:                m_errors.addAll(errors);
102:            }
103:
104:            /** Adds a new warning to the list of warnings for this resource.<p>
105:             * 
106:             * @param warning the warning message to be added
107:             */
108:            public void addWarning(String warning) {
109:
110:                m_warnings.add(warning);
111:            }
112:
113:            /** Adds a list of warnings to the list of warnings for this resource.<p>
114:             *  
115:             * @param warnings the error messages to be added
116:             */
117:            public void addWarnings(List warnings) {
118:
119:                m_warnings.addAll(warnings);
120:            }
121:
122:            /**
123:             * Gets the encapuslated file content.<p>
124:             * 
125:             * @return the byte array holding the file content
126:             */
127:            public byte[] getContent() {
128:
129:                return m_content;
130:            }
131:
132:            /**
133:             * Gets the list of all errors found during the content checks for this resource.<p>
134:             * @return List of erros, delivered as strings
135:             */
136:            public List getErrors() {
137:
138:                return m_errors;
139:            }
140:
141:            /**
142:             * Gets the encapsulated CmsResource.<p>
143:             * 
144:             * @return the CmsResource
145:             */
146:            public CmsResource getResource() {
147:
148:                return m_resource;
149:            }
150:
151:            /**
152:             * Gets the root path of the encapsulated CmsResource.<p>
153:             * 
154:             * @return root path of the encapsulated CmsResource
155:             */
156:            public String getResourceName() {
157:
158:                return m_resource.getRootPath();
159:            }
160:
161:            /**
162:             * Gets the list of all warnings found during the content checks for this resource.<p>
163:             * @return List of warnings, delivered as strings
164:             */
165:            public List getWarnings() {
166:
167:                return m_warnings;
168:            }
169:
170:            /**
171:             * Gets the encapuslated and unmarshalled xml content.<p>
172:             * 
173:             * @return the unmarshalled xml content
174:             */
175:            public CmsXmlContent getXmlContent() {
176:
177:                return m_xmlcontent;
178:            }
179:
180:            /**
181:             * Loads the content of the encapsulated CmsResource and stores it within the 
182:             * CmsContentCheckResource. If the content is already existing, it is not loaded
183:             * again.<p>
184:             * 
185:             * @param cms the CmsObject
186:             * @throws CmsException if loading of the content fails
187:             */
188:            public void upgradeContent(CmsObject cms) throws CmsException {
189:
190:                if (m_content == null) {
191:                    m_content = cms.readFile(m_resource).getContents();
192:                }
193:            }
194:
195:            /**
196:             * Unmarshalls the content of the encapsulated CmsResource and stores it within the 
197:             * CmsContentCheckResource. If the xmlcontent is already existing, it is not unmarshalled
198:             * again.<p>
199:             * 
200:             * @param cms the CmsObject
201:             * @throws CmsException if loading of the content fails
202:             */
203:            public void upgradeXmlContent(CmsObject cms) throws CmsException {
204:
205:                if (m_xmlcontent == null) {
206:                    CmsFile file = cms.readFile(m_resource);
207:                    m_xmlcontent = CmsXmlContentFactory.unmarshal(cms, file);
208:                }
209:            }
210:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.