Source Code Cross Referenced for VDLtConv.java in  » Workflow-Engines » pegasus-2.1.0 » org » griphyn » vdl » toolkit » 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 » Workflow Engines » pegasus 2.1.0 » org.griphyn.vdl.toolkit 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file or a portion of this file is licensed under the terms of
003:         * the Globus Toolkit Public License, found in file GTPL, or at
004:         * http://www.globus.org/toolkit/download/license.html. This notice must
005:         * appear in redistributions of this file, with or without modification.
006:         *
007:         * Redistributions of this Software, with or without modification, must
008:         * reproduce the GTPL in: (1) the Software, or (2) the Documentation or
009:         * some other similar material which is provided with the Software (if
010:         * any).
011:         *
012:         * Copyright 1999-2004 University of Chicago and The University of
013:         * Southern California. All rights reserved.
014:         */
015:        package org.griphyn.vdl.toolkit;
016:
017:        import org.griphyn.common.util.Currently;
018:        import org.griphyn.common.util.Version;
019:        import org.griphyn.vdl.parser.*;
020:        import org.griphyn.vdl.classes.*;
021:        import org.griphyn.vdl.util.Logging;
022:        import org.griphyn.vdl.directive.VDLtConvert;
023:
024:        import java.io.Reader;
025:        import java.io.Writer;
026:        import java.io.InputStreamReader;
027:        import java.io.OutputStreamWriter;
028:        import java.io.FileReader;
029:        import java.io.FileWriter;
030:        import java.io.BufferedReader;
031:        import java.io.BufferedWriter;
032:        import java.io.IOException;
033:        import gnu.getopt.*;
034:
035:        /**
036:         * Test calls to parse the a given filename and produce XML from it.
037:         *
038:         * @see org.griphyn.vdl.parser.VDLtParser
039:         */
040:        public class VDLtConv extends Toolkit {
041:            /**
042:             * module local constructor for a toolkit application.
043:             * @param appName is the name of the application to be displayed
044:             */
045:            VDLtConv(String appName) {
046:                super (appName);
047:            }
048:
049:            public void showUsage() {
050:                String linefeed = System.getProperty("line.separator", "\r\n");
051:
052:                System.out
053:                        .println("$Id: VDLtConv.java 50 2007-05-19 00:48:32Z gmehta $"
054:                                + linefeed
055:                                + "VDS version "
056:                                + Version.instance().toString() + linefeed);
057:
058:                System.out.println("Usage: " + this .m_application
059:                        + " [-n vdlns] [-v vdlvs] VDLt VDLx" + linefeed
060:                        + "   or: " + this .m_application
061:                        + " [-n vdlns] [-v vdlvs] VDLt > VDLx" + linefeed
062:                        + "   or: " + this .m_application
063:                        + " [-n vdlns] [-v vdlvs] < VDLt > VDLx");
064:
065:                System.out
066:                        .println(linefeed
067:                                + "Generic options: "
068:                                + linefeed
069:                                + " -V|--version     print version information and exit."
070:                                + linefeed
071:                                + "    --verbose     increases the verbosity level."
072:                                + linefeed
073:                                + " -n|--vdlns ns    generates default namespace ns, default is none."
074:                                + linefeed
075:                                + " -v|--vdlvs vs    geneartes default version vs, default is none."
076:                                + linefeed);
077:            }
078:
079:            /**
080:             * Creates a set of long options.
081:             */
082:            protected LongOpt[] generateValidOptions() {
083:                LongOpt[] lo = new LongOpt[7];
084:
085:                lo[0] = new LongOpt("version", LongOpt.NO_ARGUMENT, null, 'V');
086:                lo[1] = new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h');
087:                lo[2] = new LongOpt("verbose", LongOpt.NO_ARGUMENT, null, 1);
088:
089:                lo[3] = new LongOpt("vdlvs", LongOpt.REQUIRED_ARGUMENT, null,
090:                        'v');
091:                lo[4] = new LongOpt("vdlns", LongOpt.REQUIRED_ARGUMENT, null,
092:                        'n');
093:                lo[5] = new LongOpt("namespace", LongOpt.REQUIRED_ARGUMENT,
094:                        null, 'n');
095:                lo[6] = new LongOpt("ns", LongOpt.REQUIRED_ARGUMENT, null, 'n');
096:
097:                return lo;
098:            }
099:
100:            public static void main(String args[]) {
101:                String vdlns = null;
102:                String vdlvs = null;
103:                org.griphyn.vdl.toolkit.VDLtConv me = new org.griphyn.vdl.toolkit.VDLtConv(
104:                        "vdlt2vdlx");
105:
106:                try {
107:                    // obtain commandline options first -- we may need the database stuff
108:                    Getopt opts = new Getopt(me.m_application, args, "hn:v:V",
109:                            me.generateValidOptions());
110:                    opts.setOpterr(false);
111:                    int option = 0;
112:                    while ((option = opts.getopt()) != -1) {
113:                        switch (option) {
114:                        case 1:
115:                            me.increaseVerbosity();
116:                            break;
117:
118:                        case 'V':
119:                            System.out
120:                                    .println("$Id: VDLtConv.java 50 2007-05-19 00:48:32Z gmehta $");
121:                            System.out.println("VDS version "
122:                                    + Version.instance().toString());
123:                            return;
124:
125:                        case 'n':
126:                            // default namespace option
127:                            vdlns = opts.getOptarg();
128:                            break;
129:
130:                        case 'v':
131:                            // default version option
132:                            vdlvs = opts.getOptarg();
133:                            break;
134:
135:                        case '?':
136:                            System.out.println("Invalid option '"
137:                                    + (char) opts.getOptopt() + "'");
138:                        default:
139:                        case 'h':
140:                            me.showUsage();
141:                            return;
142:                        }
143:                    }
144:
145:                    Reader rd = null;
146:                    Writer wr = null;
147:                    int where = opts.getOptind();
148:                    switch (args.length - where) {
149:                    case 2:
150:                        wr = new BufferedWriter(new FileWriter(args[where + 1]));
151:                        rd = new BufferedReader(new FileReader(args[where + 0]));
152:                        break;
153:                    case 1:
154:                        wr = new OutputStreamWriter(System.out);
155:                        rd = new BufferedReader(new FileReader(args[where]));
156:                        break;
157:                    case 0:
158:                        System.err.println("# reminder: reading from stdin");
159:                        wr = new OutputStreamWriter(System.out);
160:                        rd = new InputStreamReader(System.in);
161:                        break;
162:                    default:
163:                        me.showUsage();
164:                        throw new RuntimeException(
165:                                "Illegal number of non-option arguments");
166:                    }
167:
168:                    VDLtConvert convert = new VDLtConvert();
169:                    convert.VDLt2VDLx(rd, wr, vdlns, vdlvs);
170:                    rd.close();
171:                    wr.flush();
172:                    wr.close();
173:
174:                } catch (VDLtParserException e) {
175:                    me.m_logger.log("default", 0, "syntactical error");
176:                    System.err.println(e.getMessage());
177:                    System.exit(1);
178:                } catch (VDLtScannerException e) {
179:                    me.m_logger.log("default", 0, "lexical error");
180:                    System.err.println(e.getMessage());
181:                    System.exit(1);
182:                } catch (IOException e) {
183:                    me.m_logger.log("default", 0, "I/O error");
184:                    System.err.println(e.getMessage());
185:                    System.exit(1);
186:                } catch (RuntimeException rte) {
187:                    me.m_logger.log("default", 0, "runtime error");
188:                    System.err.println(rte.getMessage());
189:                    System.exit(1);
190:                } catch (Exception e) {
191:                    me.m_logger.log("default", 0, "unspecified error ");
192:                    System.err.println(e.getMessage());
193:                    e.printStackTrace(System.err);
194:                    System.exit(1);
195:                }
196:            }
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.