Source Code Cross Referenced for Environment.java in  » Workflow-Engines » pegasus-2.1.0 » org » griphyn » vdl » invocation » 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.invocation 
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.invocation;
016:
017:        import java.util.*;
018:        import java.io.Writer;
019:        import java.io.IOException;
020:
021:        /**
022:         * This class maintains the application that was run, and the
023:         * arguments to the commandline that were actually passed on to
024:         * the application.
025:         *
026:         * @author Jens-S. Vöckler
027:         * @author Yong Zhao
028:         * @version $Revision: 50 $
029:         * @see Job
030:         */
031:        public class Environment extends Invocation {
032:            /**
033:             * Mappings of keys to values
034:             */
035:            private Map m_environment;
036:
037:            /**
038:             * Default c'tor: Construct a hollow shell and allow further
039:             * information to be added later.
040:             */
041:            public Environment() {
042:                m_environment = new HashMap();
043:            }
044:
045:            /**
046:             * Adds an environment entry, effectively a key value pair, to the
047:             * current environment settings.
048:             *
049:             * @param entry is the environment entry to add
050:             * @return the old entry including <code>null</code>. 
051:             * @see #addEntry( String, String )
052:             */
053:            public String addEntry(EnvEntry entry) {
054:                String key = entry.getKey();
055:                if (key != null) {
056:                    String value = entry.getValue();
057:                    if (value == null)
058:                        value = new String();
059:                    return (String) m_environment.put(entry.getKey(), entry
060:                            .getValue());
061:                } else {
062:                    return null; // evil!
063:                }
064:            }
065:
066:            /**
067:             * Adds an environment entry, effectively a key value pair, to the
068:             * current environment settings.
069:             *
070:             * @param key is the identifier for the environment setting.
071:             * @param value is the value associated with the key.
072:             * @return the old entry including <code>null</code>. 
073:             * @see #addEntry( EnvEntry )
074:             */
075:            public String addEntry(String key, String value) {
076:                if (key != null) {
077:                    if (value == null)
078:                        value = new String();
079:                    return (String) m_environment.put(key, value);
080:                } else {
081:                    return null;
082:                }
083:            }
084:
085:            /**
086:             * Retrieves the value for a given key 
087:             *
088:             * @param key is the identifier in the map to retrieve the key for 
089:             * @return the value for the given, which may include <code>null</code>.
090:             */
091:            public String get(String key) {
092:                return (String) m_environment.get(key);
093:            }
094:
095:            /**
096:             * Creates a sorted iterator
097:             *
098:             * @return an iterator over sorted keys
099:             */
100:            public Iterator iterator() {
101:                Set result = new TreeSet(m_environment.keySet());
102:                return result.iterator();
103:            }
104:
105:            /**
106:             * Converts the active state into something meant for human consumption.
107:             * The method will be called when recursively traversing the instance
108:             * tree. 
109:             *
110:             * @param stream is a stream opened and ready for writing. This can also
111:             * be a string stream for efficient output.
112:             */
113:            public void toString(Writer stream) throws IOException {
114:                throw new IOException(
115:                        "method not implemented, please contact vds-support@griphyn.org");
116:            }
117:
118:            /**
119:             * Dump the state of the current element as XML output. This function
120:             * traverses all sibling classes as necessary, and converts the data
121:             * into pretty-printed XML output. The stream interface should be able
122:             * to handle large output efficiently.
123:             *
124:             * @param stream is a stream opened and ready for writing. This can also
125:             * be a string stream for efficient output.
126:             * @param indent is a <code>String</code> of spaces used for pretty
127:             * printing. The initial amount of spaces should be an empty string.
128:             * The parameter is used internally for the recursive traversal.
129:             * If a <code>null</code> value is specified, no indentation nor
130:             * linefeeds will be generated. 
131:             * @param namespace is the XML schema namespace prefix. If neither
132:             * empty nor null, each element will be prefixed with this prefix,
133:             * and the root element will map the XML namespace. 
134:             * @exception IOException if something fishy happens to the stream.
135:             */
136:            public void toXML(Writer stream, String indent, String namespace)
137:                    throws IOException {
138:                String newline = System.getProperty("line.separator", "\r\n");
139:                String tag = (namespace != null && namespace.length() > 0) ? namespace
140:                        + ":environment"
141:                        : "environment";
142:
143:                // open tag
144:                if (indent != null && indent.length() > 0)
145:                    stream.write(indent);
146:                stream.write('<');
147:                stream.write(tag);
148:                if (m_environment.size() == 0) {
149:                    // no content
150:                    stream.write("/>");
151:                    if (indent != null)
152:                        stream.write(newline);
153:                } else {
154:                    // yes, content
155:                    String newindent = (indent == null) ? null : indent + "  ";
156:                    String envtag = (namespace != null && namespace.length() > 0) ? namespace
157:                            + ":env"
158:                            : "env";
159:                    stream.write('>');
160:                    if (indent != null)
161:                        stream.write(newline);
162:
163:                    for (Iterator i = this .iterator(); i.hasNext();) {
164:                        String key = (String) i.next();
165:                        String value = this .get(key);
166:
167:                        if (newindent != null && newindent.length() > 0)
168:                            stream.write(newindent);
169:                        stream.write('<');
170:                        stream.write(envtag);
171:                        writeAttribute(stream, " key=\"", key);
172:                        stream.write('>');
173:
174:                        if (value != null)
175:                            stream.write(quote(value, false));
176:
177:                        stream.write("</");
178:                        stream.write(envtag);
179:                        stream.write('>');
180:                        if (indent != null)
181:                            stream.write(newline);
182:                    }
183:
184:                    stream.write("</");
185:                    stream.write(tag);
186:                    stream.write('>');
187:                }
188:                if (indent != null)
189:                    stream.write(newline);
190:            }
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.