Source Code Cross Referenced for TestProps.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.*;
021:        import gnu.getopt.*;
022:
023:        /**
024:         * This class deletes annotations for definition's and lfn's
025:         *
026:         * @author Jens-S. Vöckler
027:         * @author Yong Zhao
028:         * @version $Revision: 50 $
029:         *
030:         */
031:        public class TestProps extends Toolkit {
032:            /**
033:             * String for usage
034:             */
035:            public static String m_usage = "";
036:
037:            /**
038:             * Constructor
039:             */
040:            public TestProps(String appName) {
041:                super (appName);
042:            }
043:
044:            /**
045:             * Print the usage string 
046:             */
047:            public void showUsage() {
048:                String linefeed = System.getProperty("line.separator", "\r\n");
049:
050:                System.out
051:                        .println("$Id: TestProps.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:                        + " [-c] [-u] | [-V]");
058:                System.out
059:                        .println(linefeed
060:                                + "Options: "
061:                                + linefeed
062:                                + " -V|--version    print version information and exit."
063:                                + linefeed
064:                                + " -h|--help       print this message."
065:                                + linefeed
066:                                + "    --verbose    increases the verbosity level."
067:                                + linefeed
068:                                + " -c|--concise    print in concise format instead of filling in blanks."
069:                                + linefeed
070:                                + " -u|--unsorted   print in no particular sorting order."
071:                                + linefeed);
072:            }
073:
074:            /**
075:             * Creates a set of options.
076:             */
077:            protected LongOpt[] generateValidOptions() {
078:                LongOpt[] lo = new LongOpt[5];
079:
080:                lo[0] = new LongOpt("version", LongOpt.NO_ARGUMENT, null, 'V');
081:                lo[1] = new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h');
082:                lo[2] = new LongOpt("verbose", LongOpt.NO_ARGUMENT, null, 1);
083:
084:                lo[3] = new LongOpt("unsorted", LongOpt.NO_ARGUMENT, null, 'u');
085:                lo[4] = new LongOpt("concise", LongOpt.NO_ARGUMENT, null, 'c');
086:
087:                return lo;
088:            }
089:
090:            /**
091:             * dump the properties after VDSProperties had parsed them.
092:             */
093:            public static void main(String[] args) {
094:                int max = Integer.MIN_VALUE;
095:                int min = Integer.MAX_VALUE;
096:                boolean unsorted = false;
097:                boolean concise = false;
098:
099:                try {
100:                    // create an instance
101:                    TestProps me = new TestProps("show-properties");
102:
103:                    // parse CLI options
104:                    Getopt opts = new Getopt(me.m_application, args, "chuV", me
105:                            .generateValidOptions());
106:                    opts.setOpterr(false);
107:                    int option = 0;
108:                    while ((option = opts.getopt()) != -1) {
109:                        switch (option) {
110:                        case 1:
111:                            me.increaseVerbosity();
112:                            break;
113:
114:                        case 'V':
115:                            System.out
116:                                    .println("$Id: TestProps.java 50 2007-05-19 00:48:32Z gmehta $");
117:                            System.out.println("VDS version "
118:                                    + Version.instance().toString());
119:                            return;
120:
121:                        case 'c':
122:                            concise = true;
123:                            break;
124:
125:                        case 'u':
126:                            unsorted = true;
127:                            break;
128:
129:                        default:
130:                        case 'h':
131:                            me.showUsage();
132:                            return;
133:                        }
134:                    }
135:
136:                    // create and read all properties
137:                    VDSProperties v = VDSProperties.instance();
138:
139:                    // sort property keys into a tree set (sorted set)
140:                    // while obtaining minimum and maximum key lengths
141:                    Collection keys = null;
142:                    if (unsorted)
143:                        keys = new ArrayList();
144:                    else
145:                        keys = new TreeSet();
146:
147:                    for (Enumeration e = v.propertyNames(); e.hasMoreElements();) {
148:                        String key = (String) e.nextElement();
149:                        int len = key.length();
150:                        if (len > max)
151:                            max = len;
152:                        if (len < min)
153:                            min = len;
154:                        keys.add(key);
155:                    }
156:
157:                    // create sufficient spaces to accomodate the smallest key
158:                    StringBuffer space = new StringBuffer(max - min + 1);
159:                    for (int i = min; i <= max; ++i)
160:                        space.append(' ');
161:
162:                    // print all keys
163:                    for (Iterator i = keys.iterator(); i.hasNext();) {
164:                        String key = (String) i.next();
165:                        if (concise)
166:                            System.out.println(key + "=" + v.getProperty(key));
167:                        else
168:                            System.out.println(key
169:                                    + space.substring(0, max - key.length())
170:                                    + " " + v.getProperty(key));
171:                    }
172:                } catch (Exception e) {
173:                    e.printStackTrace();
174:                }
175:            }
176:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.