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


001:        package org.andromda.andromdapp;
002:
003:        import java.io.IOException;
004:        import java.io.InputStream;
005:
006:        import java.net.URL;
007:
008:        import java.util.ArrayList;
009:        import java.util.Iterator;
010:        import java.util.LinkedHashMap;
011:        import java.util.List;
012:        import java.util.Map;
013:        import java.util.Properties;
014:
015:        import org.andromda.core.common.ResourceUtils;
016:
017:        /**
018:         * Represents the configuration of an AndroMDAppType.
019:         *
020:         * @author Chad Brandon
021:         * @see AndroMDAppType
022:         */
023:        public class Configuration {
024:            /**
025:             * Stores any properties defined in this configuration.
026:             */
027:            private final Map properties = new LinkedHashMap();
028:
029:            /**
030:             * Adds a property with the name and value to the current properties
031:             * map.
032:             *
033:             * @param name the name of the property to add.
034:             * @param value the value of the property.
035:             */
036:            public void addProperty(final String name, final String value) {
037:                this .properties.put(name, value);
038:            }
039:
040:            /**
041:             * Stores any locations to property files.
042:             */
043:            private final List locations = new ArrayList();
044:
045:            /**
046:             * Adds a location to this configuration.
047:             *
048:             * @param location the path of the location.
049:             */
050:            public void addLocation(final String location) {
051:                this .locations.add(location);
052:            }
053:
054:            /**
055:             * The patterns to use for the locations
056:             */
057:            private static final String[] LOCATION_PATTERNS = new String[] { "**/*.properties" };
058:
059:            /**
060:             * Retrieves all properties including all those found in the given locations.
061:             *
062:             * @return the map containing all properties
063:             */
064:            public Map getAllProperties() {
065:                final Map allProperties = new LinkedHashMap();
066:                for (final Iterator iterator = this .locations.iterator(); iterator
067:                        .hasNext();) {
068:                    final String location = (String) iterator.next();
069:                    final List resources = ResourceUtils.getDirectoryContents(
070:                            ResourceUtils.toURL(location), true,
071:                            LOCATION_PATTERNS);
072:                    if (resources != null) {
073:                        for (final Iterator resourceIterator = resources
074:                                .iterator(); resourceIterator.hasNext();) {
075:                            final String path = (String) resourceIterator
076:                                    .next();
077:                            final URL resource = ResourceUtils.toURL(path);
078:                            final Properties properties = new Properties();
079:                            InputStream stream = null;
080:                            try {
081:                                stream = resource.openStream();
082:                                properties.load(stream);
083:                                allProperties.putAll(properties);
084:                            } catch (final Exception exception) {
085:                                // - ignore
086:                            } finally {
087:                                try {
088:                                    stream.close();
089:                                    stream = null;
090:                                } catch (IOException exception) {
091:                                    // - ignore 
092:                                }
093:                            }
094:                        }
095:                    }
096:                }
097:                allProperties.putAll(this .properties);
098:                return allProperties;
099:            }
100:
101:            /**
102:             * Stores whether or not the application should be overwritten if it previously existed.
103:             */
104:            private boolean ovewrite;
105:
106:            /**
107:             * Whether or not the application should be overwritten if it already exits.
108:             * 
109:             * @return true/false
110:             */
111:            public boolean isOverwrite() {
112:                return this .ovewrite;
113:            }
114:
115:            /**
116:             * Sets whether or not the application should be overwritten if it previously existed.
117:             * 
118:             * @param overwrite true/false
119:             */
120:            public void setOverwrite(final boolean overwrite) {
121:                this.ovewrite = overwrite;
122:            }
123:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.