Source Code Cross Referenced for NamespaceRegistry.java in  » UML » AndroMDA-3.2 » org » andromda » core » namespace » 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 » UML » AndroMDA 3.2 » org.andromda.core.namespace 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.andromda.core.namespace;
002:
003:        import java.net.URL;
004:        import java.util.ArrayList;
005:        import java.util.LinkedHashMap;
006:        import java.util.List;
007:        import java.util.Map;
008:
009:        /**
010:         * Represents a namespace registry.  This is where
011:         * all components within a namespace are registered.
012:         *
013:         * @author Chad Brandon
014:         */
015:        public class NamespaceRegistry {
016:            /**
017:             * The name of the namespace registry
018:             */
019:            private String name;
020:
021:            /**
022:             * Gets the name of the namespace registry.
023:             *
024:             * @return Returns the name.
025:             */
026:            public String getName() {
027:                return this .name;
028:            }
029:
030:            /**
031:             * SEts the name of the namespace registry.
032:             *
033:             * @param name The name to set.
034:             */
035:            public void setName(String name) {
036:                this .name = name;
037:            }
038:
039:            /**
040:             * Whether or not this is a shared namespace.
041:             */
042:            private boolean shared = false;
043:
044:            /**
045:             * Gets whether or not the namespace defined by this registry
046:             * is shared. By default namespaces are <strong>NOT </strong> shared.
047:             *
048:             * @return Returns the shared.
049:             */
050:            public boolean isShared() {
051:                return shared;
052:            }
053:
054:            /**
055:             * Sets whether or not the namespace defined by this registry is shared.
056:             *
057:             * @param shared The shared to set.
058:             */
059:            public void setShared(final boolean shared) {
060:                this .shared = shared;
061:            }
062:
063:            /**
064:             * Stores the names of the components registered
065:             * within this namespace registry and the paths from which
066:             * they can be initialized.
067:             */
068:            private final Map components = new LinkedHashMap();
069:
070:            /**
071:             * Registers the component with the
072:             * give name in this registry.
073:             *
074:             * @param component the component of the registry.
075:             */
076:            public void registerComponent(final Component component) {
077:                if (component != null) {
078:                    this .components.put(component.getName(), component
079:                            .getPaths());
080:                }
081:            }
082:
083:            /**
084:             * Gets the names registered components.
085:             *
086:             * @return the names of the registered components.
087:             */
088:            public String[] getRegisteredComponents() {
089:                return (String[]) this .components.keySet().toArray(
090:                        new String[0]);
091:            }
092:
093:            /**
094:             * Gets the initialization paths for the given component name.
095:             *
096:             * @param name the name of the component.
097:             * @return the paths or null if none are found.
098:             */
099:            public String[] getPaths(final String name) {
100:                return (String[]) this .components.get(name);
101:            }
102:
103:            /**
104:             * Stores the property definitions.
105:             */
106:            private final Map definitions = new LinkedHashMap();
107:
108:            /**
109:             * Attempts to retrieve the property definition for the given
110:             * <code>name</code>.
111:             *
112:             * @return the property definition or null if one could not be found.
113:             */
114:            public PropertyDefinition getPropertyDefinition(final String name) {
115:                return (PropertyDefinition) this .definitions.get(name);
116:            }
117:
118:            /**
119:             * Adds all property definitions to the current property definitions.
120:             *
121:             * @param propertyDefinitions the collection of property definitions.
122:             */
123:            public void addPropertyDefinitions(
124:                    final PropertyDefinition[] propertyDefinitions) {
125:                for (int ctr = 0; ctr < propertyDefinitions.length; ctr++) {
126:                    this .addPropertyDefinition(propertyDefinitions[ctr]);
127:                }
128:            }
129:
130:            /**
131:             * Copies all contents from the <code>registry</code>
132:             * to this instance.
133:             * 
134:             * @param registry the registry to copy.
135:             */
136:            final void copy(final NamespaceRegistry registry) {
137:                if (registry != null) {
138:                    this .addPropertyDefinitions(registry
139:                            .getPropertyDefinitions());
140:                    this .components.putAll(registry.components);
141:                    if (registry.isShared()) {
142:                        this .shared = registry.isShared();
143:                    }
144:                    this .resourceRoots.addAll(registry.resourceRoots);
145:                }
146:            }
147:
148:            /**
149:             * Gets all property definitions belonging to this registry.
150:             *
151:             * @return all property definitions.
152:             */
153:            public PropertyDefinition[] getPropertyDefinitions() {
154:                return (PropertyDefinition[]) this .definitions.values()
155:                        .toArray(new PropertyDefinition[0]);
156:            }
157:
158:            /**
159:             * Adds a property definition to the group of defintions.
160:             *
161:             * @param propertyDefinition the property definition.
162:             */
163:            public void addPropertyDefinition(
164:                    final PropertyDefinition propertyDefinition) {
165:                if (propertyDefinition != null) {
166:                    this .definitions.put(propertyDefinition.getName(),
167:                            propertyDefinition);
168:                }
169:            }
170:
171:            /**
172:             * The root of this namespace which stores all resources.
173:             */
174:            private List resourceRoots = new ArrayList();
175:
176:            /**
177:             * Gets the resource root of this namespace.
178:             *
179:             * @return Returns the resource.
180:             */
181:            public URL[] getResourceRoots() {
182:                return (URL[]) this .resourceRoots.toArray(new URL[0]);
183:            }
184:
185:            /**
186:             * Adds a resource root to this namespace (since a namespace can consist of multiple
187:             * locations)
188:             *
189:             * @param resourceRoot The resource root to set.
190:             */
191:            final void addResourceRoot(final URL resourceRoot) {
192:                this .resourceRoots.add(resourceRoot);
193:            }
194:
195:            /**
196:             * @see java.lang.Object#toString()
197:             */
198:            public String toString() {
199:                return super .toString() + "[" + this .getName() + "]";
200:            }
201:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.