Source Code Cross Referenced for PoolConfig.java in  » Workflow-Engines » pegasus-2.1.0 » org » griphyn » cPlanner » classes » 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.classes 
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 at $PEGASUS_HOME/GTPL or
004:         * http://www.globus.org/toolkit/download/license.html.
005:         * This notice must appear in redistributions of this file
006:         * with or without modification.
007:         *
008:         * Redistributions of this Software, with or without modification, must reproduce
009:         * the GTPL in:
010:         * (1) the Software, or
011:         * (2) the Documentation or
012:         * some other similar material which is provided with the Software (if any).
013:         *
014:         * Copyright 1999-2004
015:         * University of Chicago and The University of Southern California.
016:         * All rights reserved.
017:         */package org.griphyn.cPlanner.classes;
018:
019:        import org.griphyn.cPlanner.common.LogManager;
020:
021:        import java.util.Map;
022:        import java.util.HashMap;
023:        import java.util.Iterator;
024:
025:        /**
026:         * A data class to store information about the various remote sites.
027:         *
028:         * @author Gaurang Mehta
029:         * @author Karan Vahi
030:         * @version $Revision: 50 $
031:         *
032:         * @see SiteInfo
033:         */
034:        public class PoolConfig {
035:
036:            /**
037:             * The map indexed by the site handle. Each value is a SiteInfo object,
038:             * containing the information about a grid site.
039:             */
040:            private HashMap mSiteCatalog;
041:
042:            /**
043:             * The handle to the logging object.
044:             */
045:            private LogManager mLogger;
046:
047:            /**
048:             * The default constructor.
049:             */
050:            public PoolConfig() {
051:                mLogger = LogManager.getInstance();
052:                mSiteCatalog = new HashMap(20);
053:            }
054:
055:            /**
056:             * Adds a SiteInfo object to the container. If an entry already exists with
057:             * the same SiteID, it is overwritten.
058:             *
059:             * @param id    the id of the site, usually the name of the site.
060:             * @param site  the <code>SiteInfo</code> object containing the information
061:             *              about the site.
062:             */
063:            public void add(String id, SiteInfo site) {
064:                mSiteCatalog.put(id, site);
065:            }
066:
067:            /**
068:             * Adds all the sites in a controlled fashion, to the existing map containing
069:             * information about the sites. If an information about a site already
070:             * exists, it is overwritten.
071:             *
072:             * @param sites      a map indexed by siteid. Each value is a SiteInfo object.
073:             */
074:            public void add(PoolConfig sites) {
075:                add(sites, true);
076:            }
077:
078:            /**
079:             * Adds all the sites in a controlled fashion, to the existing map containing
080:             * information about the sites.
081:             *
082:             * @param sites      a map indexed by siteid. Each value is a SiteInfo object.
083:             * @param overwrite  resolves intersections, in case of a site already exists.
084:             *                   If true, the orginal site information is overwritten with
085:             *                   the new one. If false original site information remains.
086:             *
087:             */
088:            public void add(PoolConfig sites, boolean overwrite) {
089:                String id;
090:                SiteInfo site;
091:                boolean contains = false;
092:                for (Iterator it = sites.getSites().entrySet().iterator(); it
093:                        .hasNext();) {
094:                    Map.Entry entry = (Map.Entry) it.next();
095:                    id = (String) entry.getKey();
096:                    site = (SiteInfo) entry.getValue();
097:                    contains = contains(id);
098:                    if (overwrite || !contains) {
099:                        add(id, site);
100:                    }
101:                }
102:            }
103:
104:            /**
105:             * Returns a boolean indicating if an entry for a Site with a particular id
106:             * exists or not.
107:             *
108:             * @param id  the id of the site, usually the name of the site.
109:             *
110:             * @return true if entry for the site exists, else false.
111:             */
112:            public boolean contains(String id) {
113:                return mSiteCatalog.containsKey(id);
114:            }
115:
116:            /**
117:             * Retrives the information about a site.
118:             *
119:             * @param siteID the id of the site, usually the name of the site.
120:             * @return <code>SiteInfo</code> containing the site layout,
121:             *         else null in case of site not existing.
122:             */
123:            public SiteInfo get(String siteID) {
124:                if (mSiteCatalog.containsKey(siteID)) {
125:                    return (SiteInfo) mSiteCatalog.get(siteID);
126:                } else {
127:                    mLogger.log("Site '" + siteID
128:                            + "' does not exist in the Site Catalog.",
129:                            LogManager.ERROR_MESSAGE_LEVEL);
130:                    return null;
131:                }
132:            }
133:
134:            /**
135:             * Returns information about all the sites.
136:             *
137:             * @return a Map indexed by the site id (name of the site). Each value is a
138:             *         <code>SiteInfo</code> object.
139:             */
140:            public Map getSites() {
141:                return mSiteCatalog;
142:            }
143:
144:            /**
145:             * Returns the textual description of the  contents of <code>PoolConfig</code>
146:             * object in the multiline format.
147:             *
148:             * @return the textual description in multiline format.
149:             */
150:            public String toMultiLine() {
151:                String output = "";
152:                for (Iterator i = mSiteCatalog.keySet().iterator(); i.hasNext();) {
153:                    String poolid = (String) i.next();
154:                    //Karan Oct 13,2005
155:                    //This is moved to SiteInfo.toMultiLine()
156:                    //output += "pool " + poolid +
157:                    output += ((SiteInfo) mSiteCatalog.get(poolid))
158:                            .toMultiLine()
159:                            + "\n";
160:                }
161:                return output;
162:            }
163:
164:            /**
165:             * Returns the XML description of the  contents of <code>PoolConfig</code>
166:             * object.
167:             *
168:             * @return the xml description.
169:             */
170:            public String toXML() {
171:                String output = "";
172:                for (Iterator i = mSiteCatalog.keySet().iterator(); i.hasNext();) {
173:                    String poolid = (String) i.next();
174:                    output += "  <site handle=\"" + poolid + "\""
175:                            + ((SiteInfo) mSiteCatalog.get(poolid)).toXML();
176:                }
177:                // System.out.println(output);
178:                return output;
179:            }
180:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.