Source Code Cross Referenced for WorkflowMetrics.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 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.classes;
017:
018:        /**
019:         * A Workflow metrics class that stores the metrics about the workflow.
020:         *
021:         * @author Karan Vahi
022:         * @version $Revision: 319 $
023:         */
024:        public class WorkflowMetrics extends Data {
025:
026:            /**
027:             * The total number of  jobs in the executable workflow.
028:             */
029:            private int mNumTotalJobs;
030:
031:            /**
032:             * The number of compute jobs.
033:             */
034:            private int mNumComputeJobs;
035:
036:            /**
037:             * The number of stage in transfer jobs.
038:             */
039:            private int mNumSITxJobs;
040:
041:            /**
042:             * The number of stage-out transfer jobs.
043:             */
044:            private int mNumSOTxJobs;
045:
046:            /**
047:             * The number of inter-site transfer jobs.
048:             */
049:            private int mNumInterTxJobs;
050:
051:            /**
052:             * The number of registration jobs.
053:             */
054:            private int mNumRegJobs;
055:
056:            /**
057:             * The number of cleanup jobs.
058:             */
059:            private int mNumCleanupJobs;
060:
061:            /**
062:             * The label of the dax.
063:             */
064:            private String mDAXLabel;
065:
066:            /**
067:             * The default constructor.
068:             */
069:            public WorkflowMetrics() {
070:                reset();
071:            }
072:
073:            /**
074:             * Resets the internal counters to zero.
075:             */
076:            public void reset() {
077:                mNumTotalJobs = 0;
078:                mNumComputeJobs = 0;
079:                mNumSITxJobs = 0;
080:                mNumSOTxJobs = 0;
081:                mNumInterTxJobs = 0;
082:                mNumRegJobs = 0;
083:                mNumCleanupJobs = 0;
084:            }
085:
086:            /**
087:             * Sets the DAXlabel.
088:             *
089:             * @param label  the dax label
090:             */
091:            public void setLabel(String label) {
092:                mDAXLabel = label;
093:            }
094:
095:            /**
096:             * Returns the DAXlabel.
097:             *
098:             * @return the dax label
099:             */
100:            public String getLabel() {
101:                return mDAXLabel;
102:            }
103:
104:            /**
105:             * Increment the metrics when on the basis of type of job.
106:             *
107:             * @param job  the job being added.
108:             */
109:            public void increment(SubInfo job) {
110:                //sanity check
111:                if (job == null) {
112:                    return;
113:                }
114:
115:                //increment the total
116:                mNumTotalJobs++;
117:
118:                //increment on basis of type of job
119:                int type = job.getJobType();
120:                switch (type) {
121:
122:                //treating compute and staged compute as same
123:                case SubInfo.COMPUTE_JOB:
124:                case SubInfo.STAGED_COMPUTE_JOB:
125:                    mNumComputeJobs++;
126:                    break;
127:
128:                case SubInfo.STAGE_IN_JOB:
129:                    mNumSITxJobs++;
130:                    break;
131:
132:                case SubInfo.STAGE_OUT_JOB:
133:                    mNumSOTxJobs++;
134:                    break;
135:
136:                case SubInfo.INTER_POOL_JOB:
137:                    mNumInterTxJobs++;
138:                    break;
139:
140:                case SubInfo.REPLICA_REG_JOB:
141:                    mNumRegJobs++;
142:                    break;
143:
144:                case SubInfo.CLEANUP_JOB:
145:                    mNumCleanupJobs++;
146:                    break;
147:                }
148:
149:            }
150:
151:            /**
152:             * Decrement the metrics when on the basis of type of job.
153:             *
154:             * @param job  the job being removed.
155:             */
156:            public void decrement(SubInfo job) {
157:                //sanity check
158:                if (job == null) {
159:                    return;
160:                }
161:
162:                //increment the total
163:                mNumTotalJobs--;
164:
165:                //increment on basis of type of job
166:                int type = job.getJobType();
167:                switch (type) {
168:
169:                //treating compute and staged compute as same
170:                case SubInfo.COMPUTE_JOB:
171:                case SubInfo.STAGED_COMPUTE_JOB:
172:                    mNumComputeJobs--;
173:                    break;
174:
175:                case SubInfo.STAGE_IN_JOB:
176:                    mNumSITxJobs--;
177:                    break;
178:
179:                case SubInfo.STAGE_OUT_JOB:
180:                    mNumSOTxJobs--;
181:                    break;
182:
183:                case SubInfo.INTER_POOL_JOB:
184:                    mNumInterTxJobs--;
185:                    break;
186:
187:                case SubInfo.REPLICA_REG_JOB:
188:                    mNumRegJobs--;
189:                    break;
190:
191:                case SubInfo.CLEANUP_JOB:
192:                    mNumCleanupJobs--;
193:                    break;
194:
195:                }
196:
197:            }
198:
199:            /**
200:             * Returns a textual description of the object.
201:             *
202:             * @return Object
203:             */
204:            public String toString() {
205:                StringBuffer sb = new StringBuffer();
206:
207:                append(sb, "dax-label", this .mDAXLabel);
208:                append(sb, "compute-jobs.count", this .mNumComputeJobs);
209:                append(sb, "si-jobs.count", this .mNumSITxJobs);
210:                append(sb, "so-jobs.count", this .mNumSOTxJobs);
211:                append(sb, "inter-jobs.count", this .mNumInterTxJobs);
212:                append(sb, "reg-jobs.count", this .mNumRegJobs);
213:                append(sb, "cleanup-jobs.count", this .mNumCleanupJobs);
214:                append(sb, "total-jobs.count", this .mNumTotalJobs);
215:
216:                return sb.toString();
217:            }
218:
219:            /**
220:             * Appends a key=value pair to the StringBuffer.
221:             *
222:             * @param buffer    the StringBuffer that is to be appended to.
223:             * @param key   the key.
224:             * @param value the value.
225:             */
226:            protected void append(StringBuffer buffer, String key, String value) {
227:                buffer.append(key).append(" = ").append(value).append("\n");
228:            }
229:
230:            /**
231:             * Appends a key=value pair to the StringBuffer.
232:             *
233:             * @param buffer    the StringBuffer that is to be appended to.
234:             * @param key   the key.
235:             * @param value the value.
236:             */
237:            protected void append(StringBuffer buffer, String key, int value) {
238:                buffer.append(key).append(" = ").append(value).append("\n");
239:            }
240:
241:            /**
242:             * Returns the clone of the object.
243:             *
244:             * @return the clone
245:             */
246:            public Object clone() {
247:                WorkflowMetrics wm;
248:                try {
249:                    wm = (WorkflowMetrics) super .clone();
250:                } catch (CloneNotSupportedException e) {
251:                    //somewhere in the hierarch chain clone is not implemented
252:                    throw new RuntimeException(
253:                            "Clone not implemented in the base class of "
254:                                    + this.getClass().getName(), e);
255:                }
256:
257:                wm.mNumCleanupJobs = this.mNumCleanupJobs;
258:                wm.mNumComputeJobs = this.mNumComputeJobs;
259:                wm.mNumInterTxJobs = this.mNumInterTxJobs;
260:                wm.mNumRegJobs = this.mNumRegJobs;
261:                wm.mNumSITxJobs = this.mNumSITxJobs;
262:                wm.mNumSOTxJobs = this.mNumSOTxJobs;
263:                wm.mNumTotalJobs = this.mNumTotalJobs;
264:                wm.mDAXLabel = this.mDAXLabel;
265:
266:                return wm;
267:            }
268:
269:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.