Source Code Cross Referenced for VizDAX2.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:
016:        package org.griphyn.vdl.toolkit;
017:
018:        import java.io.*;
019:        import java.util.*;
020:        import org.griphyn.common.util.Version;
021:        import org.griphyn.vdl.dax.*;
022:        import org.griphyn.vdl.parser.DAXParser;
023:        import org.griphyn.vdl.util.Logging;
024:        import org.griphyn.vdl.util.DAX2CoG;
025:        import org.griphyn.vdl.util.ChimeraProperties;
026:        import gnu.getopt.*;
027:
028:        /**
029:         * This class generates CoG XML from a DAX.
030:         *
031:         * @author Jens-S. Vöckler
032:         * @author Yong Zhao
033:         * @version $Revision: 50 $
034:         *
035:         */
036:        public class VizDAX2 extends Toolkit {
037:            /**
038:             * ctor: Constructs a new instance object with the given application name.
039:             */
040:            public VizDAX2(String appName) {
041:                super (appName);
042:            }
043:
044:            /**
045:             * Implements printing the usage string onto stdout.
046:             */
047:            public void showUsage() {
048:                String linefeed = System.getProperty("line.separator", "\r\n");
049:
050:                System.out
051:                        .println("$Id: VizDAX2.java 50 2007-05-19 00:48:32Z gmehta $"
052:                                + linefeed
053:                                + "VDS version "
054:                                + Version.instance().toString() + linefeed);
055:
056:                System.out.println("Usage: " + this .m_application
057:                        + " [general] [-o cog] [dax]");
058:
059:                System.out
060:                        .println(linefeed
061:                                + " -V|--version      print version information and exit."
062:                                + linefeed
063:                                + " -v|--verbose      increases the verbosity level."
064:                                + linefeed
065:                                + " -o|--output cog   put the output into the file cog, defaults to stdout."
066:                                + linefeed
067:                                + " dax               reads the specified dax file; if absent, uses stdin."
068:                                + linefeed);
069:            }
070:
071:            /**
072:             * Creates a set of options.
073:             * @return the long option set.
074:             */
075:            protected LongOpt[] generateValidOptions() {
076:                LongOpt[] lo = new LongOpt[4];
077:
078:                lo[0] = new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h');
079:                lo[1] = new LongOpt("version", LongOpt.NO_ARGUMENT, null, 'V');
080:                lo[2] = new LongOpt("verbose", LongOpt.NO_ARGUMENT, null, 'v');
081:
082:                lo[3] = new LongOpt("output", LongOpt.REQUIRED_ARGUMENT, null,
083:                        'o');
084:
085:                return lo;
086:            }
087:
088:            /**
089:             * Get the DAX and generate shell scripts in the designated directory.
090:             */
091:            public static void main(String[] args) {
092:                int result = 0;
093:
094:                try {
095:                    VizDAX2 me = new VizDAX2("dax2cog");
096:                    // get the commandline options
097:                    Getopt opts = new Getopt(me.m_application, args, "ho:V", me
098:                            .generateValidOptions());
099:                    opts.setOpterr(false);
100:                    String arg = null;
101:                    String dot = null;
102:
103:                    int option = 0;
104:                    while ((option = opts.getopt()) != -1) {
105:                        switch (option) {
106:                        case 'V':
107:                            System.out
108:                                    .println("$Id: VizDAX2.java 50 2007-05-19 00:48:32Z gmehta $");
109:                            System.out.println("VDS version "
110:                                    + Version.instance().toString());
111:                            return;
112:
113:                        case 'o':
114:                            arg = opts.getOptarg();
115:                            if (arg != null && arg.length() > 0)
116:                                dot = arg;
117:                            break;
118:
119:                        case 'v':
120:                            me.increaseVerbosity();
121:                            break;
122:
123:                        case 'h':
124:                        default:
125:                            me.showUsage();
126:                            return;
127:                        }
128:                    }
129:
130:                    // there is exactly one mandatory argument
131:                    String daxfn = (opts.getOptind() < args.length ? args[opts
132:                            .getOptind()] : null);
133:
134:                    BufferedInputStream input = null;
135:                    if (daxfn == null || daxfn.equals("-")) {
136:                        input = new BufferedInputStream(System.in);
137:                        System.err.println("# reminder: reading from stdin");
138:                    } else {
139:                        input = new BufferedInputStream(new FileInputStream(
140:                                daxfn));
141:                    }
142:
143:                    BufferedWriter output = new BufferedWriter(dot == null
144:                            || dot.equals("-") ? new OutputStreamWriter(
145:                            System.out) : // convert stream to writer
146:                            new FileWriter(dot));
147:
148:                    // start the DAX parser
149:                    me.m_logger.log("app", 2, "Initializing DAX parser");
150:                    DAXParser daxparser = new DAXParser(ChimeraProperties
151:                            .instance().getDAXSchemaLocation());
152:
153:                    // parse the file
154:                    me.m_logger.log("app", 1, "Parsing the DAX file " + daxfn);
155:                    ADAG adag = daxparser.parse(input);
156:                    if (adag == null) {
157:                        // unable to parse
158:                        throw new RuntimeException(
159:                                "Unable to parse the DAX file " + daxfn);
160:                    }
161:
162:                    me.m_logger.log("app", 1, "dumping XML output");
163:                    DAX2CoG.toString(output, adag);
164:
165:                    output.flush();
166:                    if (dot != null)
167:                        output.close();
168:
169:                } catch (RuntimeException rte) {
170:                    System.err.println("ERROR: " + rte.getMessage());
171:                    result = 1;
172:
173:                } catch (IOException ioe) {
174:                    System.err.println("ERROR: " + ioe.getMessage());
175:                    result = 1;
176:
177:                } catch (Exception e) {
178:                    e.printStackTrace();
179:                    System.err.println("FATAL: " + e.getMessage());
180:                    result = 2;
181:                }
182:
183:                if (result != 0)
184:                    System.exit(result);
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.