Source Code Cross Referenced for GridFTPServer.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 java.util.ArrayList;
020:        import java.util.List;
021:
022:        /**
023:         * This is a data class that is used to store information about a grid ftp server.
024:         * <p>
025:         * The various attributes that can be associated with the the server are
026:         * displayed in the following table.
027:         *
028:         * <p>
029:         * <table border="1">
030:         * <tr align="left"><th>Attribute Name</th><th>Attribute Description</th></tr>
031:         * <tr align="left"><th>url</th>
032:         *  <td>the url string pointing to gridftp server, consisting of the host and
033:         *      the port.</td>
034:         * </tr>
035:         * <tr align="left"><th>globus version</th>
036:         *  <td>the version of the Globus Toolkit that was used to install the server.</td>
037:         * </tr>
038:         * <tr align="left"><th>storage mount point</th>
039:         *  <td>the storage mount point for the server.</td>
040:         * </tr>
041:         * <tr align="left"><th>total size</th>
042:         *  <td>the total storage space at the grid ftp server.</td>
043:         * </tr>
044:         * <tr align="left"><th>free size</th>
045:         *  <td>the free space at the grid ftp server.</td>
046:         * </tr>
047:         * </table>
048:         *
049:         * @author Gaurang Mehta gmehta@isi.edu
050:         * @author Karan Vahi vahi@isi.edu
051:         *
052:         * @version $Revision: 50 $
053:         */
054:        public class GridFTPServer {
055:
056:            /**
057:             * Array storing the names of the attributes that are stored with the
058:             * grid ftp server.
059:             */
060:            public static final String GRIDFTPINFO[] = { "url", "storage",
061:                    "globus-version", "total-size", "free-size" };
062:
063:            /**
064:             * The constant to be passed to the accessor functions to get or set the url.
065:             */
066:            public static final int GRIDFTP_URL = 0;
067:
068:            /**
069:             * The constant to be passed to the accessor functions to get or set the
070:             * storage directory of the grid ftp server.
071:             */
072:            public static final int STORAGE_DIR = 1;
073:
074:            /**
075:             * The constant to be passed to the accessor functions to get or set the
076:             * globus version of the grid ftp server.
077:             */
078:            public static final int GLOBUS_VERSION = 2;
079:
080:            /**
081:             * The constant to be passed to the accessor functions to get or set the
082:             * total size.
083:             */
084:            public static final int TOTAL_SIZE = 3;
085:
086:            /**
087:             * The constant to be passed to the accessor functions to get or set the
088:             * free size.
089:             */
090:            public static final int FREE_SIZE = 4;
091:
092:            /**
093:             * The url string of the gridftp that contains the host and the port.
094:             */
095:            private String mURL;
096:
097:            /**
098:             * The storage mount point for the grid ftp server. This is the absolute
099:             * path on the file system being accessed through the grid ftp server.
100:             */
101:            private String mStorageDir;
102:
103:            /**
104:             * The version of Globus Toolkit that was used to install the grid ftp server.
105:             */
106:            private String mGlobusVersion;
107:
108:            /**
109:             * The total storage space at the grid ftp server.
110:             * In what units??
111:             */
112:            private String mTotalSize;
113:
114:            /**
115:             * The free space at the grid ftp server.
116:             * In what units??
117:             */
118:            private String mFreeSize;
119:
120:            /**
121:             *
122:             */
123:            private List mBandWidths;
124:
125:            /**
126:             * The default constructor.
127:             */
128:            public GridFTPServer() {
129:                mGlobusVersion = null;
130:                mFreeSize = null;
131:                mStorageDir = null;
132:                mTotalSize = null;
133:                mURL = null;
134:                // sk initialised gridftp_bandwidths HashMap
135:                mBandWidths = new ArrayList();
136:            }
137:
138:            /**
139:             * Checks if an object is similar to the one referred to by this class.
140:             * We compare the primary key to determine if it is the same or not.
141:             *
142:             * @param o Object
143:             * @return true if the primary key (universe,jobmanager-type,pool) match.
144:             *         else false.
145:             */
146:            public boolean equals(Object o) {
147:                GridFTPServer server = (GridFTPServer) o;
148:
149:                if (this .mURL.equals(server.mURL)) {
150:                    return true;
151:                }
152:                return false;
153:            }
154:
155:            /**
156:             * Sets an attribute associated with the grid ftp server.
157:             *
158:             * @param key  the attribute key, which is one of the predefined keys.
159:             * @param value value of the attribute.
160:             *
161:             * @throws Exception if illegal key defined.
162:             */
163:            public void setInfo(int key, String value) throws Exception {
164:                switch (key) {
165:                case 0:
166:                    mURL = value == null ? null : new String(value);
167:                    break;
168:
169:                case 1:
170:                    mStorageDir = value == null ? null : new String(value);
171:                    break;
172:
173:                case 2:
174:                    mGlobusVersion = value == null ? null : new String(
175:                            (new GlobusVersion(value)).getGlobusVersion());
176:                    break;
177:
178:                case 3:
179:                    mTotalSize = value == null ? null : new String(value);
180:                    break;
181:
182:                case 4:
183:                    mFreeSize = value == null ? null : new String(value);
184:                    break;
185:
186:                default:
187:                    throw new Exception(
188:                            "Wrong key = "
189:                                    + key
190:                                    + " specified. key must be one of the predefined types");
191:
192:                }
193:            }
194:
195:            /**
196:             * It fills information in the mBandWidths ArrayList.
197:             *
198:             * @param bandwidth  the object that is stored in the hash, containing the
199:             *                   information about the gridftp bandwidth between the host
200:             *                   and the destination.
201:             *
202:             * @throws Exception
203:             */
204:            public void setGridFTPBandwidthInfo(GridFTPBandwidth bandwidth)
205:                    throws Exception {
206:                mBandWidths.add(bandwidth);
207:            }
208:
209:            /**
210:             * Returns a list of <code>GridFTPBandwidth</code> objects that contain the
211:             * bandwidths by which a site is connected to other sites.
212:             *
213:             * @return list of <code>GridFTPBandwidth</code> objects.
214:             *
215:             * @throws Exception
216:             */
217:            public List getGridFTPBandwidthInfo() throws Exception {
218:                return mBandWidths;
219:            }
220:
221:            /**
222:             * Returns the attribute value of a particular attribute of the server.
223:             *
224:             * @param key the key/attribute name.
225:             *
226:             * @return the attribute value
227:             * @throws RuntimeException if illegal key defined.
228:             */
229:            public String getInfo(int key) {
230:                switch (key) {
231:
232:                case 0:
233:                    return mURL;
234:
235:                case 1:
236:                    return mStorageDir;
237:
238:                case 2:
239:                    return mGlobusVersion;
240:
241:                case 3:
242:                    return mTotalSize;
243:
244:                case 4:
245:                    return mFreeSize;
246:
247:                default:
248:                    throw new RuntimeException(
249:                            "Wrong key = "
250:                                    + key
251:                                    + " specified. key must be one of the predefined types");
252:
253:                }
254:            }
255:
256:            /**
257:             * Returns the textual description of the  contents of <code>GridFTPServer</code>
258:             * object in the multiline format.
259:             *
260:             * @return the textual description in multiline format.
261:             */
262:            public String toMultiLine() {
263:                String output = "gridftp";
264:                if (mURL != null) {
265:                    output += " \"" + mURL + mStorageDir + "\"";
266:                }
267:                if (mGlobusVersion != null) {
268:                    output += " \"" + mGlobusVersion + "\"";
269:                }
270:
271:                return output;
272:            }
273:
274:            /**
275:             * Returns the textual description of the  contents of <code>LRC</code>
276:             * object.
277:             *
278:             * @return the textual description.
279:             */
280:            public String toString() {
281:                String output = "gridftp";
282:                if (mURL != null) {
283:                    output += " \"" + mURL + mStorageDir + "\"";
284:                }
285:                if (mURL != null) {
286:                    output += " " + GRIDFTPINFO[GRIDFTP_URL] + "=" + mURL;
287:                }
288:                if (mStorageDir != null) {
289:                    output += " " + GRIDFTPINFO[STORAGE_DIR] + "="
290:                            + mStorageDir;
291:                }
292:                if (mGlobusVersion != null) {
293:                    output += " " + GRIDFTPINFO[GLOBUS_VERSION] + "="
294:                            + mGlobusVersion;
295:                }
296:                if (mTotalSize != null) {
297:                    output += " " + GRIDFTPINFO[TOTAL_SIZE] + "=" + mTotalSize;
298:                }
299:                if (mFreeSize != null) {
300:                    output += " " + GRIDFTPINFO[FREE_SIZE] + "=" + mFreeSize;
301:                }
302:                output += " )";
303:                // System.out.println(output);
304:                return output;
305:            }
306:
307:            /**
308:             * Returns the XML description of the  contents of <code>LRC</code>
309:             * object.
310:             *
311:             * @return the xml description.
312:             */
313:            public String toXML() {
314:
315:                String output = "<gridftp ";
316:                if (mURL != null) {
317:                    output += " " + GRIDFTPINFO[GRIDFTP_URL] + "=\"" + mURL
318:                            + "\"";
319:                }
320:                if (mStorageDir != null) {
321:                    output += " " + GRIDFTPINFO[STORAGE_DIR] + "=\""
322:                            + mStorageDir + "\"";
323:                }
324:                if (mGlobusVersion != null) {
325:                    GlobusVersion gv = new GlobusVersion(mGlobusVersion);
326:                    output += " major=\""
327:                            + gv.getGlobusVersion(GlobusVersion.MAJOR) + "\""
328:                            + " minor=\""
329:                            + gv.getGlobusVersion(GlobusVersion.MINOR) + "\""
330:                            + " patch=\""
331:                            + gv.getGlobusVersion(GlobusVersion.PATCH) + "\"";
332:                }
333:                if (mTotalSize != null) {
334:                    output += " " + GRIDFTPINFO[TOTAL_SIZE] + "=\""
335:                            + mTotalSize + "\"";
336:                }
337:                if (mFreeSize != null) {
338:                    output += " " + GRIDFTPINFO[FREE_SIZE] + "=\"" + mFreeSize
339:                            + "\"";
340:                }
341:
342:                output += "> \n";
343:
344:                /**
345:                 * Saurabh added code which picks up elements from gridftp_bandwidth
346:                 * and prints them out as XML.
347:                 */
348:                for (int len = 0; len < mBandWidths.size(); len++) {
349:                    GridFTPBandwidth gf = (GridFTPBandwidth) mBandWidths
350:                            .get(len);
351:
352:                    output += gf.toXML();
353:
354:                }
355:                output += "    </gridftp>";
356:
357:                return output;
358:
359:            }
360:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.