Source Code Cross Referenced for SiteFactory.java in  » Workflow-Engines » pegasus-2.1.0 » org » griphyn » cPlanner » poolinfo » 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.poolinfo 
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.poolinfo;
017:
018:        import org.griphyn.common.util.DynamicLoader;
019:
020:        import org.griphyn.cPlanner.common.PegasusProperties;
021:
022:        /**
023:         * A factory class to load the appropriate implementation of Transformation
024:         * Catalog as specified by properties.
025:         *
026:         * @author Karan Vahi
027:         * @version $Revision: 50 $
028:         */
029:
030:        public class SiteFactory {
031:
032:            /**
033:             * The default package where all the implementations reside.
034:             */
035:            public static final String DEFAULT_PACKAGE_NAME = "org.griphyn.cPlanner.poolinfo";
036:
037:            /**
038:             * Constants to specify how to load the class, as singleton or non singleton.
039:             */
040:            public static final int SINGLETON_LOAD = 0;
041:            public static final int NON_SINGLETON_LOAD = 1;
042:
043:            /**
044:             * The name of the class that connects to an XML based Site Catalog.
045:             */
046:            public static final String XML_IMPLEMENTING_CLASS = "XML";
047:
048:            /**
049:             * The name of the class that connects to an multi line Text based Site Catalog.
050:             */
051:            public static final String TEXT_IMPLEMENTING_CLASS = "Text";
052:
053:            /**
054:             * Connects the interface with the site catalog implementation. The
055:             * choice of backend is configured through properties. This method uses
056:             * default properties from the property singleton.
057:             *
058:             * @param singleton  indicates whether to load the singleton implementation
059:             *                   to Site Catalog backend or not.
060:             *
061:             * @return handle to the Site Catalog.
062:             *
063:             * @throws SiteFactoryException that nests any error that
064:             *         might occur during the instantiation
065:             *
066:             * @see #DEFAULT_PACKAGE_NAME
067:             */
068:            //    public static PoolInfoProvider loadInstance( boolean singleton )
069:            //                             throws SiteFactoryException{
070:            //        return loadInstance( PegasusProperties.getsingletonInstance(), singleton );
071:            //    }
072:
073:            /**
074:             * Connects the interface with the site catalog implementation. The
075:             * choice of backend is configured through properties. This class is
076:             * useful for non-singleton instances that may require changing
077:             * properties.
078:             *
079:             *
080:             * @param properties is an instance of properties to use.
081:             * @param singleton  indicates whether to load the singleton implementation
082:             *                   to Site Catalog backend or not. It should be set to false
083:             *                   for portals.
084:             *
085:             * @return handle to the Site Catalog.
086:             *
087:             * @throws SiteFactoryException that nests any error that
088:             *         might occur during the instantiation
089:             *
090:             * @see #DEFAULT_PACKAGE_NAME
091:             */
092:            public static PoolInfoProvider loadInstance(
093:                    PegasusProperties properties, boolean singleton)
094:                    throws SiteFactoryException {
095:
096:                /* get the implementor from properties */
097:                String catalogImplementor = properties.getPoolMode().trim();
098:
099:                /* pick up the right value on basis of case insensitive match */
100:                if (catalogImplementor.equalsIgnoreCase(XML_IMPLEMENTING_CLASS)) {
101:                    catalogImplementor = XML_IMPLEMENTING_CLASS;
102:                } else if (catalogImplementor
103:                        .equalsIgnoreCase(TEXT_IMPLEMENTING_CLASS)) {
104:                    catalogImplementor = TEXT_IMPLEMENTING_CLASS;
105:                }
106:
107:                /* prepend the package name if required */
108:                catalogImplementor = (catalogImplementor.indexOf('.') == -1) ?
109:                //pick up from the default package
110:                DEFAULT_PACKAGE_NAME + "." + catalogImplementor
111:                        :
112:                        //load directly
113:                        catalogImplementor;
114:
115:                /* determine the method name to invoke */
116:                String methodName = (singleton) ? "singletonInstance"
117:                        : "nonSingletonInstance";
118:
119:                /* construct arguments to the method */
120:                Object args[] = new Object[2];
121:                args[0] = properties.getPoolFile();
122:                /* this should not be reqd. the Site Catalog interface should take
123:                   the properties object while being instantiated */
124:                args[1] = org.griphyn.common.util.VDSProperties.PROPERTY_FILENAME;
125:
126:                PoolInfoProvider catalog;
127:
128:                /* try loading the catalog implementation dynamically */
129:                try {
130:                    DynamicLoader dl = new DynamicLoader(catalogImplementor);
131:                    catalog = (PoolInfoProvider) dl.static_method(methodName,
132:                            args);
133:                } catch (Exception e) {
134:                    throw new SiteFactoryException(
135:                            " Unable to instantiate Site Catalog ",
136:                            catalogImplementor, e);
137:                }
138:
139:                return catalog;
140:
141:            }
142:
143:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.