Source Code Cross Referenced for MainWizard.java in  » Web-Framework » roma-webwizard » org » romaframework » wizard » 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 » Web Framework » roma webwizard » org.romaframework.wizard 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006-2007 Luca Garulli (luca.garulli@assetdata.it)
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.romaframework.wizard;
018:
019:        import java.io.File;
020:
021:        import org.romaframework.core.Utility;
022:        import org.romaframework.core.command.CommandIO;
023:        import org.romaframework.core.resource.ResourceResolver;
024:        import org.romaframework.wizard.command.WizardCommand;
025:        import org.romaframework.wizard.command.WizardCommandManager;
026:        import org.romaframework.wizard.command.project.impl.ProjectCreateWizard;
027:
028:        /**
029:         * Main class executed on roma.bat and roma.sh shell command. It load the selected wizard and execute it. Wizards reside under
030:         * command package.
031:         * 
032:         * @author Luca Garulli (luca.garulli@assetdata.it)
033:         */
034:        public class MainWizard {
035:
036:            private static CommandIO iO = new CommandIO();
037:            private static final String ROMA_HOME = "roma.home";
038:            private static ResourceResolver resourceResolver;
039:            private static WizardResourceResolver wizard;
040:
041:            public static void main(String[] iArgs) {
042:                init();
043:
044:                resourceResolver
045:                        .addClassPath("${roma.home}/wizards/wizard-main/lib/roma-*.jar");
046:                resourceResolver
047:                        .addClassPath("${roma.home}/wizards/wizard-crud/lib/roma-*.jar");
048:
049:                resourceResolver.loadResources("");
050:
051:                if (iArgs.length == 0) {
052:                    help();
053:                    return;
054:                }
055:
056:                // EXECUTE THE BUILDER
057:                WizardCommand wizardInstance = getWizardClass(iArgs[0]);
058:                wizardInstance.execute(iArgs);
059:            }
060:
061:            private static void init() {
062:                // ASSURE ROMA HOME ENVIRONMENT VARIABLE IS SETTED FIRST OF ALL
063:                getRomaHome();
064:
065:                wizard = new WizardResourceResolver();
066:                resourceResolver = new ResourceResolver();
067:            }
068:
069:            private static WizardCommand getWizardClass(String iWizardName) {
070:                WizardCommand wizardInstance = WizardCommandManager
071:                        .getInstance().getConfiguration(iWizardName);
072:
073:                if (wizardInstance == null) {
074:                    getIO()
075:                            .getError()
076:                            .println(
077:                                    "Wizard '"
078:                                            + iWizardName
079:                                            + "' not found. Type 'roma' without arguments to know installed wizards.");
080:                    MainWizard.stop(1);
081:                }
082:
083:                return wizardInstance;
084:            }
085:
086:            public static void help() {
087:                getIO().getOutput().println(WizardConstants.HEADER);
088:                getIO()
089:                        .getOutput()
090:                        .println(
091:                                "\nPlease specify the wizard to use between the following wizards discovered in the classpath:\n");
092:
093:                for (WizardCommand wiz : WizardCommandManager.getInstance()
094:                        .getConfigurationValues()) {
095:                    getIO().getOutput().println(
096:                            "- " + wiz.getName() + " " + wiz.getParameters());
097:                }
098:                getIO().getOutput().println(
099:                        "\nExample: roma " + ProjectCreateWizard.NAME
100:                                + " web blog org.test.blog C:/temp");
101:
102:                String prjName = ProjectManager.getInstance()
103:                        .getCurrentProjectName();
104:                String prjPath = ProjectManager.getInstance().getProjectPath(
105:                        prjName);
106:
107:                if (prjName != null) {
108:                    getIO().getOutput().println(
109:                            "\nCurrent project: <" + prjName + "> in <"
110:                                    + prjPath + ">");
111:                } else {
112:                    getIO()
113:                            .getOutput()
114:                            .println(
115:                                    "\nNo current project setted. Use the 'switch' command to set it.");
116:                }
117:            }
118:
119:            public static String getRomaHome() {
120:                String home = System.getProperty(ROMA_HOME);
121:
122:                if (home == null) {
123:                    getIO().getError().println(
124:                            "System property '" + ROMA_HOME + "' not setted!");
125:                    getIO().getError().println(
126:                            "Assure to run the wizard using -D" + ROMA_HOME
127:                                    + "=<roma-path>");
128:                    MainWizard.stop(1);
129:                }
130:
131:                if (!home.endsWith(File.separator))
132:                    home += File.separator;
133:
134:                return Utility.getUniversalResourcePath(home);
135:            }
136:
137:            public static CommandIO getIO() {
138:                return iO;
139:            }
140:
141:            public static void setIO(CommandIO io) {
142:                iO = io;
143:            }
144:
145:            public static void stop(int iResult) {
146:                System.exit(iResult);
147:            }
148:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.