Source Code Cross Referenced for Hints.java in  » Workflow-Engines » pegasus-2.1.0 » org » griphyn » cPlanner » namespace » 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.cPlanner.namespace 
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.cPlanner.namespace;
017:
018:        import org.griphyn.cPlanner.classes.Profile;
019:        import org.griphyn.cPlanner.common.PegasusProperties;
020:
021:        import java.util.Map;
022:        import java.util.TreeMap;
023:        import java.util.Iterator;
024:
025:        /**
026:         * An empty mechanical implementation for the
027:         * namespace. At present we do not
028:         * know what the meaning is. The meaning is
029:         * is determined at the point of writing the
030:         * submit files.
031:         *
032:         * @author Karan Vahi
033:         * @author Gaurang Mehta
034:         * @version $Revision: 360 $
035:         */
036:
037:        public class Hints extends Namespace {
038:
039:            /**
040:             * The name of the namespace that this class implements.
041:             */
042:            public static final String NAMESPACE_NAME = Profile.HINTS;
043:
044:            /**
045:             * The jobmanager universe key.
046:             */
047:            public static final String JOBMANAGER_UNIVERSE = "jobmanager.universe";
048:
049:            /**
050:             * The name of the implementing namespace. It should be one of the valid
051:             * namespaces always.
052:             *
053:             * @see Namespace#isNamespaceValid(String)
054:             */
055:            protected String mNamespace;
056:
057:            /**
058:             * The default constructor.
059:             * Note that the map is not allocated memory at this stage. It is done so
060:             * in the overloaded construct function.
061:             */
062:            public Hints() {
063:                mProfileMap = null;
064:                mNamespace = NAMESPACE_NAME;
065:            }
066:
067:            /**
068:             * The overloaded constructor.
069:             *
070:             * @param mp  the map containing the profiles to be prepopulated with.
071:             */
072:            public Hints(Map mp) {
073:                mProfileMap = new TreeMap(mp);
074:                mNamespace = NAMESPACE_NAME;
075:            }
076:
077:            /**
078:             * Returns the name of the namespace associated with the profile implementations.
079:             *
080:             * @return the namespace name.
081:             * @see #NAMESPACE_NAME
082:             */
083:            public String namespaceName() {
084:                return mNamespace;
085:            }
086:
087:            /**
088:             * Provides an iterator to traverse the profiles by their keys.
089:             *
090:             * @return an iterator over the keys to walk the profile list.
091:             */
092:            public Iterator getProfileKeyIterator() {
093:                return (this .mProfileMap == null) ? new EmptyIterator()
094:                        : this .mProfileMap.keySet().iterator();
095:            }
096:
097:            /**
098:             * Constructs a new element of the format (key=value). It first checks if
099:             * the map has been initialised or not. If not then allocates memory first.
100:             *
101:             * @param key is the left-hand-side.
102:             * @param value is the right hand side.
103:             */
104:            public void construct(String key, String value) {
105:                if (mProfileMap == null)
106:                    mProfileMap = new TreeMap();
107:                mProfileMap.put(key, value);
108:            }
109:
110:            /**
111:             * Returns true if the namespace contains a mapping for the specified key.
112:             * More formally, returns true if and only if this map contains at a mapping
113:             * for a key k such that (key==null ? k==null : key.equals(k)).
114:             * (There can be at most one such mapping.)
115:             * It also returns false if the map does not exist.
116:             *
117:             * @param key   The key that you want to search for
118:             *              in the namespace.
119:             *
120:             * @return boolean
121:             */
122:            public boolean containsKey(Object key) {
123:                return (mProfileMap == null) ? false : mProfileMap
124:                        .containsKey(key);
125:            }
126:
127:            /**
128:             * This checks whether the key passed by the user is valid in the current
129:             * namespace or not. At present, for this namespace only a limited number of
130:             * keys have been assigned semantics.
131:             *
132:             * @param  key (left hand side)
133:             * @param  value (right hand side)
134:             *
135:             * @return Namespace.VALID_KEY
136:             * @return Namespace.NOT_PERMITTED_KEY
137:             *
138:             */
139:            public int checkKey(String key, String value) {
140:                // sanity checks first
141:                int res = 0;
142:
143:                if (key == null || key.length() < 2 || value == null
144:                        || value.length() < 2) {
145:                    res = MALFORMED_KEY;
146:                }
147:
148:                switch (key.charAt(0)) {
149:                case 'e':
150:                    if (key.compareTo("executionPool") == 0) {
151:                        res = VALID_KEY;
152:                    } else {
153:                        res = NOT_PERMITTED_KEY;
154:                    }
155:                    break;
156:
157:                case 'g':
158:                    if (key.compareTo("globusScheduler") == 0) {
159:                        res = VALID_KEY;
160:                    } else {
161:                        res = NOT_PERMITTED_KEY;
162:                    }
163:                    break;
164:
165:                case 'j':
166:                    if (key.compareTo(JOBMANAGER_UNIVERSE) == 0) {
167:                        res = VALID_KEY;
168:                    } else {
169:                        res = NOT_PERMITTED_KEY;
170:                    }
171:                    break;
172:
173:                case 'p':
174:                    if (key.compareTo("pfnHint") == 0 /*||
175:                                       key.compareTo("pfnUniverse") == 0*/) {
176:                        res = VALID_KEY;
177:                    } else {
178:                        res = NOT_PERMITTED_KEY;
179:                    }
180:                    break;
181:
182:                default:
183:                    res = NOT_PERMITTED_KEY;
184:
185:                }
186:
187:                return res;
188:            }
189:
190:            /**
191:             * It puts in the namespace specific information specified in the properties
192:             * file into the namespace. The name of the pool is also passed, as many of
193:             * the properties specified in the properties file are on a per pool basis.
194:             * An empty implementation for the timebeing.
195:             *
196:             * @param properties  the <code>PegasusProperties</code> object containing
197:             *                    all the properties that the user specified at various
198:             *                    places (like .chimerarc, properties file, command line).
199:             * @param pool        the pool name where the job is scheduled to run.
200:             */
201:            public void checkKeyInNS(PegasusProperties properties, String pool) {
202:
203:            }
204:
205:            /**
206:             * Merge the profiles in the namespace in a controlled manner.
207:             * In case of intersection, the new profile value overrides, the existing
208:             * profile value.
209:             *
210:             * @param profiles  the <code>Namespace</code> object containing the profiles.
211:             */
212:            public void merge(Namespace profiles) {
213:                //check if we are merging profiles of same type
214:                if (!(profiles instanceof  Hints)) {
215:                    //throw an error
216:                    throw new IllegalArgumentException(
217:                            "Profiles mismatch while merging");
218:                }
219:                String key;
220:                for (Iterator it = profiles.getProfileKeyIterator(); it
221:                        .hasNext();) {
222:                    //construct directly. bypassing the checks!
223:                    key = (String) it.next();
224:                    this .construct(key, (String) profiles.get(key));
225:                }
226:            }
227:
228:            /**
229:             * Converts the contents of the map into the string that can be put in the
230:             * Condor file for printing.
231:             *
232:             * @return String
233:             */
234:            public String toString() {
235:                return null;
236:
237:            }
238:
239:            /**
240:             * Returns a copy of the current namespace object.
241:             *
242:             * @return the Cloned object
243:             */
244:            public Object clone() {
245:                return (mProfileMap == null) ? new Hints() : new Hints(
246:                        this.mProfileMap);
247:            }
248:
249:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.