Source Code Cross Referenced for ClassPresenceCheck.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » tools » checks » 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 » Portal » uPortal_rel 2 6 1 GA » org.jasig.portal.tools.checks 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright 2005 The JA-SIG Collaborative.  All rights reserved.
002:         *  See license distributed with this file and
003:         *  available online at http://www.uportal.org/license.html
004:         */
005:
006:        package org.jasig.portal.tools.checks;
007:
008:        import org.apache.commons.logging.Log;
009:        import org.apache.commons.logging.LogFactory;
010:
011:        /**
012:         * Checks that a class named as a constructor argument is present.
013:         * 
014:         * @version $Revision: 35837 $ $Date: 2005-05-20 12:01:34 -0700 (Fri, 20 May 2005) $
015:         * @since uPortal 2.5
016:         */
017:        public class ClassPresenceCheck implements  ICheck {
018:
019:            protected final Log log = LogFactory.getLog(getClass());
020:
021:            /**
022:             * The class we will be looking for.
023:             */
024:            private final String targetClass;
025:
026:            /**
027:             * The CheckResult we will return if our target class is present.
028:             * We populate this field with a default at construction and allow it to be
029:             * overridden via a setter method.
030:             */
031:            private CheckResult successResult;
032:
033:            /**
034:             * The CheckResult we will return if our target class is not present.
035:             * We populate this field with a default at costruction and allow it to be
036:             * overridden via a setter method.
037:             */
038:            private CheckResult failureResult;
039:
040:            /**
041:             * A String describing this check.
042:             * We populate this field with a default at construction and allow it to be
043:             * overridden via a setter method.
044:             */
045:            private String checkDescription;
046:
047:            /**
048:             * Each instance of ClassPresenceCheck exists to test for the presence of
049:             * exactly one class.  That class must be specified as the single required
050:             * constructor argument, which must be a non-null String representing the
051:             * fully qualified name of the class.
052:             * 
053:             * @param targetClass fully qualified name of the target class
054:             * @throws IllegalArgumentException if targetClass is null
055:             */
056:            public ClassPresenceCheck(String targetClass) {
057:                if (targetClass == null) {
058:                    throw new IllegalArgumentException(
059:                            "The constructor argument to the "
060:                                    + "ClassPresenceCheck constructor was illegally null.");
061:                }
062:                this .targetClass = targetClass;
063:
064:                // generate default description success and failure results
065:
066:                this .checkDescription = "Checks for the presence of class "
067:                        + targetClass;
068:
069:                this .successResult = CheckResult
070:                        .createSuccess("Successfully touched class "
071:                                + targetClass);
072:
073:                this .failureResult = CheckResult.createFailure(
074:                        "Failed to touch class " + targetClass,
075:                        "Is a required .jar missing from the /WEB-INF/lib directory or from "
076:                                + "the JRE endorsed directory or from "
077:                                + "the Tomcat endorsed directory?");
078:
079:            }
080:
081:            public CheckResult doCheck() {
082:                try {
083:                    getClass().getClassLoader().loadClass(this .targetClass);
084:                } catch (ClassNotFoundException e) {
085:                    return this .failureResult;
086:                }
087:                return this .successResult;
088:            }
089:
090:            public String getDescription() {
091:                return this .checkDescription;
092:            }
093:
094:            /**
095:             * Set the check description which we will return for on calls to 
096:             * the getDescription() method we're implementing as part of being an 
097:             * {@link ICheck}.
098:             * @param description
099:             */
100:            public void setDescription(String description) {
101:                if (description == null) {
102:                    throw new IllegalArgumentException(
103:                            "Cannot set description to null.");
104:                }
105:                this .checkDescription = description;
106:            }
107:
108:            /**
109:             * Get the CheckResult we will return when we fail to touch our
110:             * configured targetClass.
111:             * @return CheckResult we will return on failure
112:             */
113:            CheckResult getFailureResult() {
114:                return this .failureResult;
115:            }
116:
117:            /**
118:             * Set the CheckResult we will return when we fail to touch our
119:             * configured targetClass.
120:             * @param failureResult desired CheckResult on failure
121:             */
122:            void setFailureResult(CheckResult failureResult) {
123:                this .failureResult = failureResult;
124:            }
125:
126:            /**
127:             * Get the CheckResult we will return when we succeed in touching 
128:             * our configured targetClass.
129:             * @return CheckResult we will return on success.
130:             */
131:            CheckResult getSuccessResult() {
132:                return this .successResult;
133:            }
134:
135:            /**
136:             * Set the CheckResult we will return when we succeed in touching 
137:             * our configured targetClass.
138:             * @param successResult desired CheckResult on success.
139:             */
140:            void setSuccessResult(CheckResult successResult) {
141:                this .successResult = successResult;
142:            }
143:
144:            /**
145:             * Get the name of the class for which we check.
146:             * @return the fully qualified name of the class for which we check.
147:             */
148:            String getTargetClass() {
149:                return this.targetClass;
150:            }
151:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.