Source Code Cross Referenced for Mapper.java in  » Workflow-Engines » pegasus-2.1.0 » org » griphyn » common » catalog » transformation » 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.common.catalog.transformation 
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.common.catalog.transformation;
017:
018:        import org.griphyn.cPlanner.classes.TCMap;
019:        import org.griphyn.cPlanner.common.LogManager;
020:        import org.griphyn.cPlanner.common.PegasusProperties;
021:        import org.griphyn.cPlanner.poolinfo.PoolInfoProvider;
022:        import org.griphyn.cPlanner.poolinfo.PoolMode;
023:        import org.griphyn.common.catalog.TransformationCatalog;
024:        import org.griphyn.common.util.DynamicLoader;
025:        import org.griphyn.common.util.Separator;
026:
027:        import java.util.ArrayList;
028:        import java.util.List;
029:        import java.util.Map;
030:
031:        /**
032:         * This is an interface for generating valid TC maps which will be used for
033:         * executable staging. The interface sort of access as an accessor for Pegasus
034:         * to the transformation catalog. The map ends up being built as and when the
035:         * query for a particular lfn is made to it.
036:         *
037:         * @author Gaurang Mehta
038:         * @version $Revision: 50 $
039:         */
040:        public abstract class Mapper {
041:
042:            /**
043:             * The name of the package where the implementing classes reside.
044:             */
045:            public static final String PACKAGE_NAME = "org.griphyn.common.catalog.transformation.mapper";
046:
047:            /**
048:             * The handle to the tranformation catalog.
049:             */
050:            protected TransformationCatalog mTCHandle;
051:
052:            /**
053:             * The handle to the RIC.
054:             */
055:            protected PoolInfoProvider mPoolHandle;
056:
057:            /**
058:             * Handle to Pegasus Properties
059:             */
060:            protected PegasusProperties mProps;
061:
062:            /**
063:             * Handle to the TCMap
064:             */
065:            protected TCMap mTCMap = null;
066:
067:            /**
068:             * Handle to the logger.
069:             */
070:            protected LogManager mLogger;
071:
072:            /**
073:             * Loads the implementing class corresponding to the mode specified by the user
074:             * at runtime in the properties file.
075:             *
076:             * @param className  The name of the class that implements the mode. It is the
077:             *                   name of the class, not the complete name with package. That
078:             *                   is added by itself.
079:             *
080:             * @return Mapper
081:             */
082:            public static Mapper loadTCMapper(String className) {
083:
084:                //prepend the package name
085:                className = PACKAGE_NAME + "." + className;
086:
087:                //try loading the class dynamically
088:                Mapper ss = null;
089:                DynamicLoader dl = new DynamicLoader(className);
090:                try {
091:                    Object argList[] = new Object[0];
092:                    ss = (Mapper) dl.instantiate(argList);
093:                } catch (Exception e) {
094:                    System.err.println(dl.convertException(e));
095:                    System.exit(1);
096:                }
097:
098:                return ss;
099:            }
100:
101:            /**
102:             * The private constructor.
103:             */
104:            protected Mapper() {
105:                mLogger = LogManager.getInstance();
106:                mTCHandle = TCMode.loadInstance();
107:                mProps = PegasusProperties.getInstance();
108:                mTCMap = new TCMap();
109:                String mPoolClass = PoolMode.getImplementingClass(mProps
110:                        .getPoolMode());
111:                String mPoolFile = mProps.getPoolFile();
112:                mPoolHandle = PoolMode.loadPoolInstance(mPoolClass, mPoolFile,
113:                        PoolMode.SINGLETON_LOAD);
114:
115:            }
116:
117:            /**
118:             * This method returns a Map of compute sites to List of
119:             * TransformationCatalogEntry objects that are valid for that site.
120:             *
121:             * @param namespace  the namespace of the transformation.
122:             * @param name       the name of the transformation.
123:             * @param version    the version of the transformation.
124:             * @param siteids    the sites for which you want the map.
125:             *
126:             * @return Map Key=String SiteId , Values = List of TransformationCatalogEntry
127:             * object. Returns null if no entries are found.
128:             */
129:            public abstract Map getSiteMap(String namespace, String name,
130:                    String version, List siteids);
131:
132:            /**
133:             * Returns the TCMapper Mode.
134:             *
135:             * @return String
136:             */
137:            public abstract String getMode();
138:
139:            /**
140:             * This method returns a List of TransformationCatalog Objects valid for a
141:             * particular transformation and for a particular compute site
142:             *
143:             * @param namespace  the namespace of the transformation.
144:             * @param name       the name of the transformation.
145:             * @param version    the version of the transformation.
146:             * @param siteid     the compute site for which you want the List.
147:             * @return List Returns null if no entries are found.
148:             */
149:            public List getTCList(String namespace, String name,
150:                    String version, String siteid) {
151:                List siteids = new ArrayList(1);
152:                List tcentries = null;
153:                String lfn = Separator.combine(namespace, name, version);
154:                siteids.add(siteid);
155:
156:                if (getSiteMap(namespace, name, version, siteids) != null) {
157:                    tcentries = mTCMap.getSiteTCEntries(lfn, siteid);
158:                }
159:                return tcentries;
160:            }
161:
162:            /**
163:             * Returns a list of sites that are valid sites for a given lfn and a list of sites.
164:             *
165:             * @param namespace  the namespace of the transformation.
166:             * @param name       the name of the transformation.
167:             * @param version    the version of the transformation.
168:             * @param siteids    the list of sites on which the transformation is to be checked.
169:             *
170:             * @return List
171:             */
172:            public List getSiteList(String namespace, String name,
173:                    String version, List siteids) {
174:                List sites = null;
175:                String lfn = Separator.combine(namespace, name, version);
176:                if (getSiteMap(namespace, name, version, siteids) != null) {
177:                    sites = mTCMap.getSiteList(lfn, siteids);
178:                }
179:                return sites;
180:            }
181:
182:            /**
183:             * Checks if a give site is valid for a given transformation.
184:             *
185:             * @param namespace  the namespace of the transformation.
186:             * @param name       the name of the transformation.
187:             * @param version    the version of the transformation.
188:             * @param siteid     the site that needs to be checked.
189:             *
190:             * @return boolean
191:             */
192:            public boolean isSiteValid(String namespace, String name,
193:                    String version, String siteid) {
194:                List siteids = new ArrayList(1);
195:                siteids.add(siteid);
196:                Map m = getSiteMap(namespace, name, version, siteids);
197:                return (m == null || m.isEmpty()) ? false : true;
198:
199:            }
200:
201:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.