Source Code Cross Referenced for ComponentRegistry.java in  » J2EE » Jaffa » org » jaffa » tools » patternmetaengine » 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 » Jaffa » org.jaffa.tools.patternmetaengine 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /*
02:         * ComponentRegistry.java
03:         *
04:         * Created on April 18, 2003, 1:01 PM
05:         */
06:
07:        package org.jaffa.tools.patternmetaengine;
08:
09:        import java.util.Iterator;
10:        import java.util.List;
11:        import java.util.ArrayList;
12:        import org.apache.log4j.Logger;
13:
14:        /** This class holds all the generated components (ie their builders). It is used
15:         * to keep a registry of all components across the multiple phases of the build.
16:         * It also provides some convienance methods for accessing components from the
17:         * repository
18:         *
19:         * @version 1.0
20:         * @author  PaulE
21:         */
22:        public class ComponentRegistry {
23:
24:            /** Set up Logging for Log4J */
25:            private static Logger log = Logger.getLogger(AppBuilder.class);
26:
27:            private List allComponents = new ArrayList();
28:
29:            /** Add a new component (IBuilder) to the registry
30:             * @param comp New component to be added
31:             */
32:            public void addComponent(IBuilder comp) {
33:                allComponents.add(comp);
34:            }
35:
36:            /** Iterator for all components in registry
37:             * @return a interator of IBuiler objects
38:             */
39:            public Iterator iterator() {
40:                return allComponents.iterator();
41:            }
42:
43:            /** Iterator for all components in registry of a given type
44:             * @param type Type of component (Finder, Viewer, etc)
45:             * @return a interator of IBuiler objects
46:             */
47:            public Iterator iterateByType(String type) {
48:                return findComponents(type, null).iterator();
49:            }
50:
51:            /** Iterator for all components in registry for a given
52:             * domain object
53:             * @param domain full class name (including package) of domain object
54:             * @return a interator of IBuiler objects
55:             */
56:            public Iterator iterateByDomain(String domain) {
57:                return findComponents(null, domain).iterator();
58:            }
59:
60:            /** Find a given component. Assumes there is only one instance of
61:             * a given component type per domain object. If multiple are found
62:             * the first one is returned.
63:             * @param domain full class name (including package) of domain object
64:             * @param type Type of component (Finder, Viewer, etc)
65:             * @return the located component, null of no component is found
66:             */
67:            public IBuilder findComponent(String domain, String type) {
68:                List l = findComponents(type, domain);
69:                if (l.size() == 0)
70:                    return null;
71:                if (l.size() != 1) {
72:                    log.error("Mutiple Components For " + type + "/" + domain);
73:                    // we'll just return the first one though
74:                    return null;
75:                }
76:                return (IBuilder) l.get(0);
77:            }
78:
79:            private List findComponents(String type, String domain) {
80:                List results = new ArrayList();
81:                for (Iterator i = allComponents.iterator(); i.hasNext();) {
82:                    IBuilder c = (IBuilder) i.next();
83:                    if ((type == null || type.equals(c.getComponentType()))
84:                            && (domain == null || domain.equals(c.getDomain())))
85:                        results.add(c);
86:                }
87:                return results;
88:            }
89:
90:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.