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


001:        package org.andromda.core;
002:
003:        import java.io.InputStream;
004:
005:        import java.net.ConnectException;
006:        import java.net.URL;
007:
008:        import org.andromda.core.common.AndroMDALogger;
009:        import org.andromda.core.common.ComponentContainer;
010:        import org.andromda.core.common.ExceptionUtils;
011:        import org.andromda.core.configuration.Configuration;
012:        import org.andromda.core.engine.Engine;
013:        import org.andromda.core.metafacade.ModelValidationMessage;
014:        import org.andromda.core.server.Client;
015:        import org.apache.log4j.Logger;
016:
017:        /**
018:         * The main entry point to the framework. Handles the processing of models.
019:         * Facilitates Model Driven Architecture by enabling the generation of source
020:         * code, configuration files, and other such artifacts from a single or multiple
021:         * models.
022:         *
023:         * @see Engine
024:         * @author Chad Brandon
025:         */
026:        public class AndroMDA {
027:            /**
028:             * The logger instance.
029:             */
030:            private static final Logger logger = Logger
031:                    .getLogger(AndroMDA.class);
032:
033:            /**
034:             * The AndroMDA engine instance.
035:             */
036:            private Engine engine;
037:
038:            /**
039:             * Gets a new instance of AndroMDA.
040:             *
041:             * @return the new instance of AndroMDA.
042:             */
043:            public static AndroMDA newInstance() {
044:                return new AndroMDA();
045:            }
046:
047:            /**
048:             * Hidden constructor.
049:             */
050:            private AndroMDA() {
051:                AndroMDALogger.initialize();
052:                this .engine = Engine.newInstance();
053:            }
054:
055:            /**
056:             * Runs AndroMDA with the given configuration.
057:             *
058:             * @param configurationUri the URI to the configuration file that configures
059:             *        AndroMDA.
060:             */
061:            public void run(final URL configurationUri) {
062:                ExceptionUtils.checkNull("configurationUri", configurationUri);
063:                this .run(Configuration.getInstance(configurationUri));
064:            }
065:
066:            /**
067:             * Runs AndroMDA with the given configuration.
068:             *
069:             * @param configurationStream the InputStream that contains the
070:             *        configuration contents for configuring AndroMDA.
071:             */
072:            public void run(final InputStream configurationStream) {
073:                ExceptionUtils.checkNull("configurationStream",
074:                        configurationStream);
075:                this .run(Configuration.getInstance(configurationStream));
076:            }
077:
078:            /**
079:             * Runs AndroMDA with the given configuration.
080:             *
081:             * @param configuration the String that contains the configuration contents
082:             *        for configuring AndroMDA.
083:             */
084:            public void run(final String configuration) {
085:                ExceptionUtils.checkEmpty("configuration", configuration);
086:                this .run(Configuration.getInstance(configuration));
087:            }
088:
089:            /**
090:             * Initializes AndroMDA without running the engine.
091:             *
092:             * @param configuration the configuration from which to initialize AndroMDA
093:             */
094:            public void initialize(final Configuration configuration) {
095:                ExceptionUtils.checkNull("configuration", configuration);
096:                this .engine.initialize(configuration);
097:            }
098:
099:            /**
100:             * Initializes AndroMDA without running the engine.
101:             *
102:             * @param configurationStream the InputStream that contains the
103:             *        configuration contents for configuring AndroMDA.
104:             */
105:            public void initialize(final InputStream configurationStream) {
106:                ExceptionUtils.checkNull("configurationStream",
107:                        configurationStream);
108:                this .engine.initialize(Configuration
109:                        .getInstance(configurationStream));
110:            }
111:
112:            /**
113:             * Initializes AndroMDA without running the engine.
114:             *
115:             * @param configuration the String that contains the configuration contents
116:             *        for configuring AndroMDA.
117:             */
118:            public void initialize(final String configuration) {
119:                ExceptionUtils.checkEmpty("configuration", configuration);
120:                this .engine
121:                        .initialize(Configuration.getInstance(configuration));
122:            }
123:
124:            /**
125:             * Initializes AndroMDA without running the engine.
126:             *
127:             * @param configurationUri the URI to the configuration file that configures
128:             *        AndroMDA.
129:             */
130:            public void initialize(final URL configurationUri) {
131:                ExceptionUtils.checkNull("configurationUri", configurationUri);
132:                this .run(Configuration.getInstance(configurationUri));
133:            }
134:
135:            /**
136:             * Runs AndroMDA with the given configuration. Determines whether or not
137:             * AndroMDA should be run in client/server mode (if the client can contact
138:             * the AndroMDA server), or just stand-alone mode if the server can NOT be
139:             * contacted.
140:             *
141:             * @param configuration the configuration instance that configures AndroMDA.
142:             * @return an array of model validation messages (if there have been any collected
143:             *         during AndroMDA execution).
144:             */
145:            public ModelValidationMessage[] run(
146:                    final Configuration configuration) {
147:                ModelValidationMessage[] messages = null;
148:                if (configuration != null) {
149:                    final Client serverClient = (Client) ComponentContainer
150:                            .instance().findRequiredComponent(Client.class);
151:                    boolean client = true;
152:
153:                    // only attempt to run with the client, if they
154:                    // have a server defined in their configuration
155:                    if (configuration.getServer() != null) {
156:                        try {
157:                            serverClient.start(configuration);
158:                        } catch (final ConnectException exception) {
159:                            // - if we can't connect to the server, it means
160:                            //   we aren't running in client mode
161:                            client = false;
162:                        }
163:                    } else {
164:                        client = false;
165:                    }
166:
167:                    // - since we aren't running in 'client' mode, run the engine as usual
168:                    if (!client) {
169:                        this .engine.initialize(configuration);
170:                        messages = this .engine.run(configuration);
171:                    }
172:                } else {
173:                    logger
174:                            .warn("AndroMDA could not run because no configuration was defined");
175:                }
176:                return messages == null ? new ModelValidationMessage[0]
177:                        : messages;
178:            }
179:
180:            /**
181:             * Shuts down AndroMDA.
182:             */
183:            public void shutdown() {
184:                this.engine.shutdown();
185:            }
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.