Source Code Cross Referenced for Mdl2Fsm.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » common » mdl » fsmparser » 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 » ESB » cbesb 1.2 » com.bostechcorp.cbesb.common.mdl.fsmparser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ChainBuilder ESB
003:         *          Visual Enterprise Integration
004:         * 
005:         * Copyright (C) 2006 Bostech Corporation
006:         * 
007:         * This program is free software; you can redistribute it and/or modify 
008:         * it under the terms of the GNU General Public License as published by 
009:         * the Free Software Foundation; either version 2 of the License, or 
010:         * (at your option) any later version.
011:         *
012:         * This program is distributed in the hope that it will be useful, 
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of 
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
015:         * General Public License for more details.
016:         * 
017:         * You should have received a copy of the GNU General Public License 
018:         * along with this program; if not, write to the Free Software 
019:         * Foundation, Inc.,59 Temple Place, Suite 330, Boston, MA 02111-1307 
020:         * USA
021:         *
022:         *
023:         * $Id: Mdl2Fsm.java 6617 2007-04-11 01:04:44Z zjin $
024:         */
025:
026:        package com.bostechcorp.cbesb.common.mdl.fsmparser;
027:
028:        import java.io.File;
029:
030:        import org.apache.commons.logging.Log;
031:        import org.apache.commons.logging.LogFactory;
032:        import org.apache.tools.ant.Project;
033:        import org.apache.tools.ant.ProjectHelper;
034:
035:        import com.bostechcorp.cbesb.common.mdl.IElementDefinition;
036:        import com.bostechcorp.cbesb.common.mdl.IMDLDocument;
037:        import com.bostechcorp.cbesb.common.mdl.util.FormatDefUtil;
038:
039:        public class Mdl2Fsm {
040:
041:            protected static transient Log logger = LogFactory
042:                    .getLog(Mdl2Fsm.class);
043:
044:            // private static Configuration config;
045:            //	static Configuration config = ConfigFactory.instance().getConfiguration();
046:
047:            public Mdl2Fsm() {
048:                super ();
049:            }
050:
051:            /**
052:             * To Finite State Machine - Load from MDL to generate Finite State Machine
053:             * parser
054:             * 
055:             * @param mdlFile
056:             *            File of MDL need to load for Finite State Machine
057:             * @param packageName
058:             * @param jarFileName
059:             * @param outputDir
060:             * @param targetJarDir
061:             * @param optionalClassPath
062:             */
063:            public static void mdl2JJ(File mdlFile, String packageName,
064:                    String outputDir, boolean useDefaultMdlResolver) {
065:
066:                IMDLDocument mdlDoc = FormatDefUtil.getMdlDocFromPath(mdlFile
067:                        .getAbsolutePath(), useDefaultMdlResolver);
068:
069:                if (mdlDoc == null)
070:                    return;
071:
072:                for (int i = 0; i < mdlDoc.getAllMessageDefinitions().length; i++) {
073:
074:                    IElementDefinition msgDef = mdlDoc.getMessageDefinition(
075:                            mdlDoc.getTargetNamespace(), mdlDoc
076:                                    .getAllMessageDefinitions()[i].getName());
077:
078:                    // Generate JJ File
079:                    VariableParserGenerator generator = new VariableParserGenerator(
080:                            packageName + "." + msgDef.getName(), null,
081:                            outputDir, null, null);
082:
083:                    generator.generateParser(msgDef);
084:
085:                    //			System.out.println("######Finish generate jj file######");
086:                }
087:            }
088:
089:            /**
090:             * To Finite State Machine - Load from MDL to generate Finite State Machine
091:             * parser
092:             * 
093:             * @param mdlFile
094:             *            File of MDL need to load for Finite State Machine
095:             * @param packageName
096:             * @param jarFileName
097:             * @param outputDir
098:             * @param targetJarDir
099:             * @param optionalClassPath
100:             */
101:            public static void toFsm(File mdlFile, String packageName,
102:                    String jarFileName, String outputDir, String targetJarDir,
103:                    String optionalClassPath) {
104:                IMDLDocument mdlDoc = FormatDefUtil.getMdlDocFromPath(mdlFile
105:                        .getAbsolutePath());
106:
107:                IElementDefinition msgDef = null;
108:
109:                for (int i = 0; i < mdlDoc.getAllMessageDefinitions().length; i++) {
110:                    msgDef = mdlDoc.getMessageDefinition(mdlDoc
111:                            .getTargetNamespace(), mdlDoc
112:                            .getAllMessageDefinitions()[i].getName());
113:
114:                    toFsm(msgDef, packageName, jarFileName, outputDir,
115:                            targetJarDir, optionalClassPath);
116:                }
117:
118:            }
119:
120:            /**
121:             * To Finite State Machine - Load from MDL to generate Finite State Machine
122:             * parser
123:             * 
124:             * @param elementDefinition
125:             *            Element definition need to parse to fsm parser
126:             * @param packageName
127:             * @param jarFileName
128:             * @param outputDir
129:             * @param targetJarDir
130:             * @param optionalClassPath
131:             */
132:            public static void toFsm(IElementDefinition elementDefinition,
133:                    String packageName, String jarFileName, String outputDir,
134:                    String targetJarDir, String optionalClassPath) {
135:
136:                // Generate JJ File
137:                VariableParserGenerator generator = new VariableParserGenerator(
138:                        packageName, jarFileName, outputDir, targetJarDir,
139:                        optionalClassPath);
140:                generator.generateParser(elementDefinition);
141:
142:                // build build.xml
143:                generator.generateAntScript(elementDefinition.getName());
144:
145:                //		System.out.println("######Finish generate xml ant script file######");
146:
147:                // invoke ant
148:                try {
149:                    Project ant = new Project();
150:                    ant.init();
151:
152:                    ProjectHelper.configureProject(ant, new File(outputDir
153:                            + File.separator + elementDefinition.getName()
154:                            + ".xml"));
155:
156:                    if (jarFileName == null && targetJarDir == null)
157:                        ant.executeTarget("compileOnly");
158:                    else
159:                        ant.executeTarget("compile");
160:                } catch (Exception e) {
161:                    logger.error("Exception in toFsm(): " + e.getMessage());
162:                    if (logger.isDebugEnabled()) {
163:                        logger.debug("Exception in toFsm():", e);
164:                    }
165:                }
166:            }
167:
168:            public static void main(String args[]) {
169:                try {
170:
171:                    Mdl2Fsm.mdl2JJ(new File(args[0]), args[1], args[2], Boolean
172:                            .parseBoolean(args[3]));
173:
174:                } catch (Exception e) {
175:                    e.printStackTrace();
176:                    System.exit(1);
177:                }
178:
179:            }
180:
181:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.