Source Code Cross Referenced for ProjectDesc.java in  » J2EE » JOnAS-4.8.6 » com » ibm » sigtest » 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 » J2EE » JOnAS 4.8.6 » com.ibm.sigtest 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.ibm.sigtest;
002:
003:        import java.io.BufferedReader;
004:        import java.io.File;
005:        import java.io.FileReader;
006:        import java.io.IOException;
007:        import java.util.Iterator;
008:        import java.util.List;
009:        import java.util.Vector;
010:
011:        /**
012:         * This class stores a name and a collection of class descriptions, to form a
013:         * project.
014:         * @author Matthew J. Duftler (duftler@us.ibm.com)
015:         */
016:        public class ProjectDesc {
017:
018:            private String name;
019:
020:            private List classDescs = new Vector();
021:
022:            public ProjectDesc(String name) {
023:                this .name = name;
024:            }
025:
026:            public void addClassDesc(ClassDesc classDesc) {
027:                classDescs.add(classDesc);
028:            }
029:
030:            public ClassDesc getClassDesc(String className) {
031:                Iterator iterator = classDescs.iterator();
032:
033:                while (iterator.hasNext()) {
034:                    ClassDesc classDesc = (ClassDesc) iterator.next();
035:
036:                    if (SigTestUtils.objectsEqual(classDesc.getName(),
037:                            className)) {
038:                        return classDesc;
039:                    }
040:                }
041:
042:                return null;
043:            }
044:
045:            public void setClassDescs(List classDescs) {
046:                this .classDescs = classDescs;
047:            }
048:
049:            public List getClassDescs() {
050:                return classDescs;
051:            }
052:
053:            /**
054:             * This method compares this project description to the specified one.
055:             * @param that the project description to compare this one to
056:             * @return a description of the differences, or null if they match perfectly
057:             */
058:            public String compare(ProjectDesc that) {
059:                StringBuffer strBuf = new StringBuffer();
060:                Iterator iterator = classDescs.iterator();
061:
062:                while (iterator.hasNext()) {
063:                    ClassDesc this CD = (ClassDesc) iterator.next();
064:                    ClassDesc thatCD = that.getClassDesc(this CD.getName());
065:
066:                    if (thatCD != null) {
067:                        String result = this CD.compare(thatCD);
068:
069:                        if (result != null) {
070:                            strBuf.append("\n" + result);
071:                        }
072:                    }
073:                }
074:
075:                List referenceExtras = new Vector();
076:                List candidateExtras = new Vector();
077:
078:                SigTestUtils.findExtraClasses(this , that, referenceExtras,
079:                        candidateExtras);
080:
081:                if (referenceExtras.size() > 0 || candidateExtras.size() > 0) {
082:                    strBuf
083:                            .append("\nProject '"
084:                                    + that.name
085:                                    + "'"
086:                                    + (candidateExtras.size() > 0 ? " has extraneous class"
087:                                            + (candidateExtras.size() > 1 ? "es"
088:                                                    : "")
089:                                            + " "
090:                                            + SigTestUtils
091:                                                    .getCondensedClassList(candidateExtras)
092:                                            : "")
093:                                    + (referenceExtras.size() > 0 ? (candidateExtras
094:                                            .size() > 0 ? " and" : "")
095:                                            + " is missing class"
096:                                            + (referenceExtras.size() > 1 ? "es"
097:                                                    : "")
098:                                            + " "
099:                                            + SigTestUtils
100:                                                    .getCondensedClassList(referenceExtras)
101:                                            : "") + ".");
102:                }
103:
104:                return (strBuf.length() > 0) ? strBuf.toString() : null;
105:            }
106:
107:            /**
108:             * This method compares the specified project file to the classes currently
109:             * available on the classpath.
110:             * @param file the project file to read from
111:             * @return a description of the differences, or null if they match perfectly
112:             */
113:            public static String compareProjectFile(File projectFile)
114:                    throws IOException {
115:                ProjectDesc riPD = readProjectFile("ReferenceImpl", projectFile);
116:                ProjectDesc cdPD = SigTestUtils.getProjectDesc(riPD);
117:
118:                return riPD.compare(cdPD);
119:            }
120:
121:            public String toString() {
122:                StringBuffer strBuf = new StringBuffer("Project '" + name
123:                        + "': ");
124:                int size = classDescs.size();
125:
126:                for (int i = 0; i < size; i++) {
127:                    strBuf.append((i > 0 ? ", " : "")
128:                            + ((ClassDesc) classDescs.get(i)).getName());
129:                }
130:
131:                return strBuf.toString();
132:            }
133:
134:            /**
135:             * This method reads the specified project file into memory.
136:             * @param projectName the name to be used when referring to the project in
137:             *        error messages
138:             * @param file the project file to read from
139:             * @return a model of the project
140:             */
141:            public static ProjectDesc readProjectFile(String projectName,
142:                    File file) throws IOException {
143:                ProjectDesc pd = new ProjectDesc(projectName);
144:                FileReader fileReader = new FileReader(file);
145:                BufferedReader buf = new BufferedReader(fileReader);
146:
147:                while (buf.ready()) {
148:                    pd.addClassDesc(ClassDesc.parseClassDesc(buf));
149:                }
150:
151:                buf.close();
152:                fileReader.close();
153:
154:                return pd;
155:            }
156:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.