Source Code Cross Referenced for Mdl2JJTask.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » tools » ant » 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.tools.ant 
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 it 
008:         * under the terms of the GNU General Public License as published by the 
009:         * Free Software Foundation; either version 2 of the License, or (at your option) 
010:         * 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 MERCHANTABILITY 
014:         * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
015:         * for more details.
016:         * 
017:         * You should have received a copy of the GNU General Public License along with 
018:         * this program; if not, write to the Free Software Foundation, Inc., 
019:         * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020:         *
021:         *
022:         * $Id: Mdl2JJTask.java 6318 2007-03-26 06:13:03Z lzheng $
023:         */
024:        package com.bostechcorp.cbesb.tools.ant;
025:
026:        import java.io.File;
027:        import java.util.ArrayList;
028:        import java.util.LinkedList;
029:        import java.util.List;
030:
031:        import org.apache.tools.ant.BuildException;
032:        import org.apache.tools.ant.Task;
033:        import org.apache.tools.ant.taskdefs.Java;
034:        import org.apache.tools.ant.types.Path;
035:        import org.apache.tools.ant.types.Reference;
036:
037:        import com.bostechcorp.cbesb.common.mdl.fsmparser.Mdl2Fsm;
038:
039:        /**
040:         * @author elu
041:         *
042:         */
043:        public class Mdl2JJTask extends Task {
044:            static public String DEFAULT_FSM_PACKAGE_NAME = "com.bostechcorp.cbesb.fsmparser";
045:
046:            private boolean failOnError = true;
047:            private String taggedMdl;
048:            private String destDir;
049:            private String projName;
050:            private boolean useZip = true;
051:            private boolean fork = true;
052:            private Path classpath = null;
053:
054:            private List<File> mdlFiles;
055:            private LinkedList argslist;
056:
057:            /**
058:             * @return the destDir
059:             */
060:            public String getDestDir() {
061:                return destDir;
062:            }
063:
064:            /**
065:             * @param destDir the destDir to set
066:             */
067:            public void setDestDir(String destDir) {
068:                this .destDir = destDir;
069:            }
070:
071:            /**
072:             * @return the taggedMdl
073:             */
074:            public String getTaggedMdl() {
075:                return taggedMdl;
076:            }
077:
078:            /**
079:             * @param taggedMdl the taggedMdl to set
080:             */
081:            public void setTaggedMdl(String taggedMdl) {
082:                this .taggedMdl = taggedMdl;
083:            }
084:
085:            /**
086:             * @return the projName
087:             */
088:            public String getProjName() {
089:                return projName;
090:            }
091:
092:            /**
093:             * @param projName the projName to set
094:             */
095:            public void setProjName(String projName) {
096:                this .projName = projName;
097:            }
098:
099:            public boolean isUseZip() {
100:                return useZip;
101:            }
102:
103:            public void setUseZip(boolean useZip) {
104:                this .useZip = useZip;
105:            }
106:
107:            /**
108:             * 
109:             */
110:            public Mdl2JJTask() {
111:                mdlFiles = new ArrayList<File>();
112:            }
113:
114:            /**
115:             * execute the task
116:             * 
117:             * @throws BuildException
118:             */
119:            public void execute() {
120:                try {
121:                    //    		System.out.println("TaggedMdl:"+taggedMdl);
122:                    TaggedFileList tfl = new TaggedFileList(taggedMdl);
123:
124:                    mdlFiles = tfl.load();
125:                    //	String zipFile=null;
126:                    for (File f : mdlFiles) {
127:                        System.out.println(f.getAbsolutePath());
128:                        boolean useDefaultMdlResolver = true;
129:                        if (isUseZip()) {
130:                            if (f.getAbsolutePath().indexOf(
131:                                    File.separatorChar + "src"
132:                                            + File.separatorChar +
133:
134:                                            "formats" + File.separatorChar
135:                                            + "x12") > -1) {
136:                                //    				System.out.println("x12");
137:                                //    				System.out.println("projectName:"+projName);
138:                                //      			   String path=f.getPath();
139:                                //      			   int pos=path.indexOf(File.separator+"x12"+File.separator);
140:                                //      			   String varName=path.substring(pos+5,path.indexOf(File.separator, pos+5));
141:                                //      			   
142:                                //    		 		zipFile=ProjectUtil.geX12ZipPathForServer(projName)+File.separatorChar+varName+".zip";
143:                                //    		 		System.out.println(zipFile);
144:
145:                                useDefaultMdlResolver = false;
146:                            } else if (f.getAbsolutePath().indexOf(
147:                                    File.separatorChar + "src"
148:                                            + File.separatorChar + "formats"
149:                                            + File.separatorChar + "hl7") > -1) {
150:                                //    				System.out.println("x12");
151:                                //    				System.out.println("projectName:"+projName);
152:                                //      			   String path=f.getPath();
153:                                //      			   int pos=path.indexOf(File.separator+"hl7"+File.separator);
154:                                //      			   String varName=path.substring(pos+5,path.indexOf(File.separator, pos+5));
155:                                //      			   
156:                                //    		 		zipFile=ProjectUtil.get.geX12ZipPathForServer(projName)+File.separatorChar+varName+".zip";
157:                                //    		 		System.out.println(zipFile);
158:                                useDefaultMdlResolver = false;
159:
160:                            }
161:                        }
162:                        Mdl2Fsm.mdl2JJ(f, DEFAULT_FSM_PACKAGE_NAME
163:                                + tfl.extraJavaPackageName(projName, f),
164:                                destDir, useDefaultMdlResolver);
165:
166:                    }
167:                } catch (Exception ex) {
168:                    ex.printStackTrace();
169:                }
170:            }
171:
172:            private void executeInForkedVM(String[] args) {
173:                try {
174:                    // Create an instance of the compiler, redirecting output to
175:                    // the project log
176:                    Java java = (Java) (getProject().createTask("java"));
177:                    //            getProject().log("using classpath: " + classpath,
178:                    //                    Project.MSG_DEBUG);
179:                    System.err.println("using classpath: " + classpath);
180:                    java.setClasspath(classpath);
181:                    java
182:                            .setClassname("com.bostechcorp.cbesb.tools.ant.mdl.Mdl2Fsm1");
183:                    for (int i = 0; i < args.length; i++) {
184:                        java.createArg().setValue(args[i]);
185:                    }
186:                    java.setFailonerror(failOnError);
187:                    //we are forking here to be sure that if AdminClient calls
188:                    //System.exit() it doesn't halt the build
189:                    java.setFork(true);
190:                    java.setTaskName("Mdl2JJ");
191:                    java.execute();
192:                } catch (BuildException e) {
193:                    //rethrow these
194:                    throw e;
195:                } catch (Exception e) {
196:                    throw new BuildException("Exception in " + getTaskName(), e);
197:                }
198:            }
199:
200:            /**
201:             * add one arg
202:             *
203:             * @param argument
204:             */
205:            protected void addArg(String argument) {
206:                argslist.add(argument);
207:            }
208:
209:            /**
210:             * add one arg
211:             *
212:             * @param argument
213:             */
214:            protected void addArg(String argument, boolean test) {
215:                if (test) {
216:                    argslist.add(argument);
217:                }
218:            }
219:
220:            /**
221:             * add an arg pair
222:             *
223:             * @param argument
224:             * @param param
225:             */
226:            protected void addArgs(String argument, String param) {
227:                addArg(argument);
228:                addArg(param);
229:            }
230:
231:            /**
232:             * add an arg pair if the test is true
233:             *
234:             * @param argument first arg
235:             * @param param    param to accompany
236:             * @param test     test to trigger argument add
237:             */
238:            protected void addArgs(String argument, String param, boolean test) {
239:                if (test) {
240:                    addArg(argument);
241:                    addArg(param);
242:                }
243:            }
244:
245:            /**
246:             * Set the optional classpath 
247:             *
248:             * @param classpath the classpath to use when loading class
249:             */
250:            public void setClasspath(Path classpath) {
251:                createClasspath().append(classpath);
252:            }
253:
254:            /**
255:             * Set the optional classpath 
256:             *
257:             * @return a path instance to be configured by the Ant core.
258:             */
259:            public Path createClasspath() {
260:                if (classpath == null) {
261:                    classpath = new Path(getProject());
262:                }
263:                return classpath.createPath();
264:            }
265:
266:            /**
267:             * Set the reference to an optional classpath 
268:             *
269:             * @param r the id of the Ant path instance to act as the classpath
270:             */
271:            public void setClasspathRef(Reference r) {
272:                createClasspath().setRefid(r);
273:            }
274:
275:            /**
276:             * @return the failOnError
277:             */
278:            public boolean isFailOnError() {
279:                return failOnError;
280:            }
281:
282:            /**
283:             * @param failOnError the failOnError to set
284:             */
285:            public void setFailOnError(boolean failOnError) {
286:                this .failOnError = failOnError;
287:            }
288:
289:            /**
290:             * @return the fork
291:             */
292:            public boolean isFork() {
293:                return fork;
294:            }
295:
296:            /**
297:             * @param fork the fork to set
298:             */
299:            public void setFork(boolean fork) {
300:                this.fork = fork;
301:            }
302:
303:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.