Source Code Cross Referenced for DAX2CDAG.java in  » Workflow-Engines » pegasus-2.1.0 » org » griphyn » cPlanner » parser » dax » 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.parser.dax 
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.parser.dax;
017:
018:        import org.griphyn.cPlanner.classes.ADag;
019:        import org.griphyn.cPlanner.classes.DagInfo;
020:        import org.griphyn.cPlanner.classes.PCRelation;
021:        import org.griphyn.cPlanner.classes.PegasusFile;
022:        import org.griphyn.cPlanner.classes.SubInfo;
023:
024:        import org.griphyn.cPlanner.common.LogManager;
025:        import org.griphyn.cPlanner.common.PegasusProperties;
026:
027:        import java.util.HashMap;
028:        import java.util.Iterator;
029:        import java.util.List;
030:        import java.util.Map;
031:        import java.util.Vector;
032:
033:        /**
034:         * This creates a dag corresponding to one particular partition of the whole
035:         * abstract plan. The partition can be as big as the whole abstract graph or can
036:         * be as small as a single job. The partitions are determined by the Partitioner.
037:         *
038:         * @author Karan Vahi
039:         * @version $Revision: 314 $
040:         */
041:        public class DAX2CDAG implements  Callback {
042:
043:            /**
044:             * The DAGInfo object which contains information corresponding to the ADag in
045:             * the XML file.
046:             */
047:            private DagInfo mDagInfo;
048:
049:            /**
050:             * Contains SubInfo objects. One per submit file.
051:             */
052:            private Vector mVSubInfo;
053:
054:            /**
055:             * The mapping of the idrefs of a job to the job name.
056:             */
057:            private Map mJobMap;
058:
059:            /**
060:             * The handle to the properties object.
061:             */
062:            private PegasusProperties mProps;
063:
064:            /**
065:             * A flag to specify whether the graph has been generated for the partition
066:             * or not.
067:             */
068:            private boolean mDone;
069:
070:            /**
071:             * The overloaded constructor.
072:             *
073:             * @param properties  the properties passed to the planner.
074:             * @param dax         the path to the DAX file.
075:             */
076:            public DAX2CDAG(PegasusProperties properties, String dax) {
077:                //        mDAXPath      = dax;
078:                mDagInfo = new DagInfo();
079:                mVSubInfo = new Vector();
080:                mJobMap = new HashMap();
081:                mProps = properties;
082:                mDone = false;
083:            }
084:
085:            /**
086:             * Callback when the opening tag was parsed. This contains all
087:             * attributes and their raw values within a map. It ends up storing
088:             * the attributes with the adag element in the internal memory structure.
089:             *
090:             * @param attributes is a map of attribute key to attribute value
091:             */
092:            public void cbDocument(Map attributes) {
093:                mDagInfo.count = (String) attributes.get("count");
094:                mDagInfo.index = (String) attributes.get("index");
095:                mDagInfo.setLabel((String) attributes.get("name"));
096:            }
097:
098:            /**
099:             * Callback for the job from section 2 jobs. These jobs are completely
100:             * assembled, but each is passed separately.
101:             *
102:             * @param job  the <code>SubInfo</code> object storing the job information
103:             *             gotten from parser.
104:             */
105:            public void cbJob(SubInfo job) {
106:                mJobMap.put(job.logicalId, job.jobName);
107:                mVSubInfo.add(job);
108:                mDagInfo.addNewJob(job);
109:
110:                //put the input files in the map
111:                Iterator it = job.inputFiles.iterator();
112:                String lfn;
113:                while (it.hasNext()) {
114:                    lfn = ((PegasusFile) it.next()).getLFN();
115:                    mDagInfo.updateLFNMap(lfn, "i");
116:                }
117:
118:                it = job.outputFiles.iterator();
119:                while (it.hasNext()) {
120:                    lfn = ((PegasusFile) it.next()).getLFN();
121:                    mDagInfo.updateLFNMap(lfn, "o");
122:                }
123:
124:            }
125:
126:            /**
127:             * Callback for child and parent relationships from section 3.
128:             *
129:             * @param child is the IDREF of the child element.
130:             * @param parents is a list of IDREFs of the included parents.
131:             */
132:            public void cbParents(String child, List parents) {
133:                PCRelation relation;
134:
135:                child = (String) mJobMap.get(child);
136:                String parent;
137:
138:                for (Iterator it = parents.iterator(); it.hasNext();) {
139:                    parent = (String) mJobMap.get((String) it.next());
140:                    if (parent == null) {
141:                        //this actually means dax is generated wrong.
142:                        //probably some one tinkered with it by hand.
143:                        throw new RuntimeException(
144:                                "Cannot find parent for job " + child);
145:                    }
146:                    mDagInfo.addNewRelation(parent, child);
147:                }
148:
149:            }
150:
151:            /**
152:             * Callback when the parsing of the document is done. It sets the flag
153:             * that the parsing has been done, that is used to determine whether the
154:             * ADag object has been fully generated or not.
155:             */
156:            public void cbDone() {
157:                mDone = true;
158:            }
159:
160:            /**
161:             * Returns an ADag object corresponding to the abstract plan it has generated.
162:             * It throws a runtime exception if the method is called before the object
163:             * has been created fully.
164:             *
165:             * @return  ADag object containing the abstract plan referred in the dax.
166:             */
167:            public Object getConstructedObject() {
168:                if (!mDone)
169:                    throw new RuntimeException(
170:                            "Method called before the abstract dag "
171:                                    + " for the partition was fully generated");
172:
173:                return new ADag(mDagInfo, mVSubInfo);
174:            }
175:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.