Source Code Cross Referenced for AuthenticateEngine.java in  » Workflow-Engines » pegasus-2.1.0 » org » griphyn » cPlanner » engine » 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.engine 
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.engine;
018:
019:        import org.griphyn.cPlanner.classes.AuthenticateRequest;
020:        import org.griphyn.cPlanner.classes.GridFTPServer;
021:        import org.griphyn.cPlanner.classes.JobManager;
022:
023:        import org.griphyn.cPlanner.common.LogManager;
024:        import org.griphyn.cPlanner.common.PegasusProperties;
025:
026:        import java.util.HashSet;
027:        import java.util.Iterator;
028:        import java.util.List;
029:        import java.util.Set;
030:
031:        /**
032:         * It authenticates the user with the sites, that the user specifies at the
033:         * execution time. It spawns out a thread for each pool that authenticates
034:         * against the jobmanager for the vanilla universe as specified in the pool
035:         * configuration file.
036:         *
037:         * @author Karan Vahi
038:         * @version $Revision: 50 $
039:         */
040:        public class AuthenticateEngine extends Engine {
041:
042:            /**
043:             * The Set of pools that need to be authenticated against.
044:             */
045:            private Set mExecPools;
046:
047:            /**
048:             * The overloaded constructor.
049:             *
050:             * @param props  the <code>PegasusProperties</code> to be used.
051:             * @param pools  The set of pools against which you want to authenticate the
052:             *               user.
053:             */
054:            public AuthenticateEngine(PegasusProperties props, Set pools) {
055:                super (props);
056:                mExecPools = pools;
057:
058:            }
059:
060:            /**
061:             * It returns a set of pools against which the user can authenticate to.
062:             *
063:             * @return  the set of authenticated pools.
064:             */
065:            public Set authenticate() {
066:                Iterator it = mExecPools.iterator();
067:                ThreadPool manager = new ThreadPool(mProps, mExecPools);
068:                String pool;
069:                JobManager jm;
070:                GridFTPServer gserv;
071:                String contact;
072:
073:                //we need synchronization to ensure that an threads are started only
074:                //when all the requests have been sent to the threadpool, as this
075:                //failure to authenticate against a pool leads to it's removal from
076:                //this set.
077:                synchronized (mExecPools) {
078:                    while (it.hasNext()) {
079:                        pool = (String) it.next();
080:
081:                        List jmList = mPoolHandle.getJobmanagers(pool);
082:                        Iterator it1 = jmList.iterator();
083:                        while (it1.hasNext()) {
084:                            jm = (JobManager) it1.next();
085:                            contact = jm.getInfo(JobManager.URL);
086:                            AuthenticateRequest ar = new AuthenticateRequest(
087:                                    'j', pool, contact);
088:                            manager.acceptRequest(ar);
089:                        }
090:
091:                        List gridFtpList = mPoolHandle.getGridFTPServers(pool);
092:                        it1 = gridFtpList.iterator();
093:                        while (it1.hasNext()) {
094:                            gserv = (GridFTPServer) it1.next();
095:                            contact = gserv.getInfo(GridFTPServer.GRIDFTP_URL);
096:                            AuthenticateRequest ar = new AuthenticateRequest(
097:                                    'g', pool, contact);
098:                            manager.acceptRequest(ar);
099:
100:                        }
101:                    }
102:                }
103:                manager.shutdown();
104:                purgePools();
105:
106:                return mExecPools;
107:            }
108:
109:            /**
110:             * It removies from the list of pools the pool that was not authenticated
111:             * against. It queries the soft state of the pool config to see if there
112:             * are at least one jobmanager and gridftp server on the pool.
113:             * Due to the authentication the unauthenticated jobmanagers and servers
114:             * would have been removed from the soft state of the pool config.
115:             */
116:            private synchronized void purgePools() {
117:                Iterator it = mExecPools.iterator();
118:                String pool;
119:                List l;
120:
121:                while (it.hasNext()) {
122:                    pool = (String) it.next();
123:                    l = mPoolHandle.getGridFTPServers(pool);
124:                    if (l == null || l.isEmpty()) {
125:                        mLogger.log("Removing Exec pool " + pool
126:                                + "  as no authenticated gridftp server",
127:                                LogManager.DEBUG_MESSAGE_LEVEL);
128:                        it.remove();
129:                        continue;
130:                    }
131:
132:                    l = mPoolHandle.getJobmanagers(pool, "vanilla");
133:                    List l1 = mPoolHandle.getJobmanagers(pool, "transfer");
134:                    if ((l == null || l.isEmpty())
135:                            || (l1 == null || l1.isEmpty())) {
136:                        //we have no jobmanagers for universe vanilla or transfer universe
137:                        mLogger.log("Removing Exec pool " + pool
138:                                + " as no authenticated jobmanager",
139:                                LogManager.DEBUG_MESSAGE_LEVEL);
140:                        it.remove();
141:                        continue;
142:                    }
143:
144:                }
145:
146:            }
147:
148:            /**
149:             * The main testing method.
150:             *
151:             */
152:            public static void main(String[] args) {
153:                Set s = new HashSet();
154:                //s.add("isi_condor");
155:                s.add("isi_lsf");
156:
157:                AuthenticateEngine a = new AuthenticateEngine(PegasusProperties
158:                        .getInstance(), s);
159:                a.mLogger.setLevel(1);
160:
161:                a.authenticate();
162:
163:                System.out.println("Authentication Done!!");
164:                System.out.println(a.mPoolHandle.getGridFTPServers("isi_lsf"));
165:                a.mLogger.log("Vanilla JMS "
166:                        + a.mPoolHandle.getJobmanagers("isi_lsf"),
167:                        LogManager.DEBUG_MESSAGE_LEVEL);
168:
169:            }
170:
171:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.