Source Code Cross Referenced for ImplementationValidator.java in  » Workflow-Engines » osbl-1_0 » newprocess » validation » 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 » Workflow Engines » osbl 1_0 » newprocess.validation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * 
003:         */package newprocess.validation;
004:
005:        import newprocess.Actor;
006:        import newprocess.AsyncActivity;
007:        import newprocess.Conclusion;
008:        import newprocess.Condition;
009:        import newprocess.Element;
010:        import newprocess.Event;
011:        import newprocess.Expansion;
012:        import newprocess.Globals;
013:        import newprocess.Listener;
014:        import newprocess.Loader;
015:        import newprocess.SyncActivity;
016:
017:        import org.eclipse.emf.ecore.EObject;
018:        import org.eclipse.jdt.core.JavaConventions;
019:
020:        /**
021:         * this validator is used by other validators to determinate the correctness of
022:         * implementation properties
023:         * 
024:         * a implementation must be fully qualified if there is no valid namespace set in process.
025:         * otherwise a implementation can be a simple identifier.
026:         * @author sh
027:         * 
028:         */
029:        public class ImplementationValidator {
030:
031:            // singleton
032:            public static final ImplementationValidator INSTANCE = new ImplementationValidator();
033:
034:            /**
035:             * takes any object of following types: Process, Actor, 
036:             * Conditions and Activities
037:             * 
038:             */
039:            public boolean validate(EObject obj) {
040:                newprocess.Process proc = getProcess(obj);
041:                if (proc == null)
042:                    return false;
043:                String impl = getImplementation(obj);
044:                if (impl == null || impl == "")
045:                    return false;
046:                if (!JavaConventions.validatePackageName(impl, null, null)
047:                        .isOK())
048:                    return false;
049:                if (qualifiedRequired(proc) && !isQualified(impl))
050:                    return false;
051:                return true;
052:            }
053:
054:            /**
055:             * get the process object.
056:             * @param obj
057:             * @return
058:             */
059:            private newprocess.Process getProcess(EObject obj) {
060:                if (obj instanceof  newprocess.Process)
061:                    return (newprocess.Process) obj;
062:                if (obj instanceof  Actor || obj instanceof  SyncActivity
063:                        || obj instanceof  AsyncActivity || obj instanceof  Event
064:                        || obj instanceof  Listener || obj instanceof  Conclusion
065:                        || obj instanceof  Expansion)
066:                    return (newprocess.Process) obj.eContainer();
067:                if (obj instanceof  Condition)
068:                    return (newprocess.Process) ((Globals) ((Condition) obj)
069:                            .eContainer()).eContainer();
070:                if (obj instanceof  Loader)
071:                    return (newprocess.Process) ((Globals) ((Loader) obj)
072:                            .eContainer()).eContainer();
073:                return null;
074:            }
075:
076:            /**
077:             * get the tmplementation property as string
078:             * @param obj
079:             * @return
080:             */
081:            private String getImplementation(EObject obj) {
082:                if (obj instanceof  newprocess.Process)
083:                    return ((Element) obj).getImplementation();
084:                if (obj instanceof  Actor)
085:                    return ((Element) obj).getImplementation();
086:                if (obj instanceof  SyncActivity)
087:                    return ((Element) obj).getImplementation();
088:                if (obj instanceof  AsyncActivity)
089:                    return ((Element) obj).getImplementation();
090:                if (obj instanceof  Event)
091:                    return ((Element) obj).getImplementation();
092:                if (obj instanceof  Listener)
093:                    return ((Element) obj).getImplementation();
094:                if (obj instanceof  Conclusion)
095:                    return ((Element) obj).getImplementation();
096:                if (obj instanceof  Expansion)
097:                    return ((Element) obj).getImplementation();
098:                if (obj instanceof  Condition)
099:                    return ((Element) obj).getImplementation();
100:                if (obj instanceof  Loader)
101:                    return ((Element) obj).getImplementation();
102:                return null;
103:            }
104:
105:            /**
106:             * finds out if a String has a qualfied syntax by looking if there is a "." in it.
107:             * @param identifier
108:             * @return
109:             */
110:            private boolean isQualified(String identifier) {
111:                return identifier.contains(".");
112:            }
113:
114:            /**
115:             * Qualified Identifiers are required, if there is a valid namespace
116:             * @param proc
117:             * @return
118:             */
119:            private boolean qualifiedRequired(newprocess.Process proc) {
120:                String name = proc.getNamespace();
121:                return (name != null && name != "" && ProcessValidatorImpl.INSTANCE
122:                        .validateNamespace(proc));
123:            }
124:
125:        } // ImplementationValidator
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.