Source Code Cross Referenced for WsdlFactory.java in  » ESB » open-esb » com » sun » jbi » wsdl2 » impl » 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 » ESB » open esb » com.sun.jbi.wsdl2.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BEGIN_HEADER - DO NOT EDIT
003:         *
004:         * The contents of this file are subject to the terms
005:         * of the Common Development and Distribution License
006:         * (the "License").  You may not use this file except
007:         * in compliance with the License.
008:         *
009:         * You can obtain a copy of the license at
010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011:         * See the License for the specific language governing
012:         * permissions and limitations under the License.
013:         *
014:         * When distributing Covered Code, include this CDDL
015:         * HEADER in each file and include the License file at
016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017:         * If applicable add the following below this CDDL HEADER,
018:         * with the fields enclosed by brackets "[]" replaced with
019:         * your own identifying information: Portions Copyright
020:         * [year] [name of copyright owner]
021:         */
022:
023:        /*
024:         * @(#)WsdlFactory.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.jbi.wsdl2.impl;
030:
031:        import com.sun.jbi.wsdl2.WsdlException;
032:
033:        import java.io.File;
034:        import java.io.FileInputStream;
035:        import java.io.IOException;
036:
037:        import java.util.Properties;
038:
039:        /**
040:         * This class is the default WSDL factory. This supplies a factory for the
041:         * default versions of the top-level WSDL component and ancillary classes
042:         * for reading and writing WSDL.
043:         * <p>
044:         * This class is public, for the sake of the JBI framework. The framework
045:         * makes available, through the environment context, the WsdlFactory. Other
046:         * components, such as the WSDL registry, can then use it. Such client
047:         * components only use the interfaces exposed in the base service, plus, of
048:         * course, the ever-popular WsdlException.
049:         * 
050:         * @author Sun Microsystems, Inc.
051:         */
052:        public class WsdlFactory implements  com.sun.jbi.wsdl2.WsdlFactory {
053:            /** The property name for the WSDL factory */
054:            private static final String PROPERTY_NAME = Constants.ROOT_PUBLIC_NAME
055:                    + ".WsdlFactory";
056:
057:            /** The file name for the WSDL2 properties */
058:            private static final String PROPERTY_FILE_NAME = "jbi.wsdl2.properties";
059:
060:            /** The default factory class for use by clients */
061:            private static final String DEFAULT_FACTORY_IMPL_NAME = Constants.ROOT_PRIVATE_NAME
062:                    + ".WsdlFactory";
063:
064:            /** The full path/name of the property file */
065:            private static String sFullPropertyFileName = null;
066:
067:            /**
068:             * Create a new instance of a WSDL reader object. This can be used to
069:             * create WSDL definitions components based on XML sources.
070:             * 
071:             * @return A WSDL 2.0 reader object.
072:             */
073:            public com.sun.jbi.wsdl2.WsdlReader newWsdlReader() {
074:                return new WsdlReader();
075:            }
076:
077:            /**
078:             * Create a new instance of a WSDL writer.
079:             * 
080:             * @return A new instance of a WSDL 2.0 writer.
081:             */
082:            public com.sun.jbi.wsdl2.WsdlWriter newWsdlWriter() {
083:                return new WsdlWriter();
084:            }
085:
086:            /**
087:             * Create a new instance of a WSDL Description component. This is for
088:             * programmatic creation of service descriptions.
089:             * 
090:             * @param tns Target name space for the new component.
091:             * @return A new, empty WSDL Description component.
092:             */
093:            public com.sun.jbi.wsdl2.Description newDescription(String tns) {
094:                com.sun.jbi.wsdl2.Description result = DescriptionImpl.Factory
095:                        .newInstance("");
096:
097:                if (tns != null) {
098:                    result.setTargetNamespace(tns);
099:                }
100:
101:                return result;
102:            }
103:
104:            /**
105:             * Create a new instance of a WSDL Description component. This is for
106:             * programmatic creation of service descriptions.
107:             *
108:             * @deprecated - replaced by newDescription(String tns)
109:             * @param tns Target name space for the new component.
110:             * @return A new, empty WSDL Description component.
111:             */
112:            public com.sun.jbi.wsdl2.Definitions newDefinitions(String tns) {
113:                return (com.sun.jbi.wsdl2.Definitions) newDescription(tns);
114:            }
115:
116:            /**
117:             * Get a new instance of a WsdlFactory. This method
118:             * follows (almost) the same basic sequence of steps that JAXP
119:             * follows to determine the fully-qualified class name of the
120:             * class which implements WsdlFactory. The steps (in order)
121:             * are:
122:             *<ol>
123:             *  <li>Check the com.sun.jbi.wsdl2.WsdlFactory system property.</li>
124:             *  <li>Check the lib/jbi.wsdl2.properties file in the JRE directory. The key
125:             * will have the same name as the above system property.</li>
126:             *  <li>Use the default value.</li>
127:             *</ol>
128:             * Once an instance of a WsdlFactory is obtained, invoke
129:             * newDescription(), newWsdlReader(), or newWsdlWriter(), to create
130:             * the desired instances.
131:             * 
132:             * @return An instance of a WsdlFactory.
133:             * @exception WsdlException if the factory cannot be instantiated.
134:             */
135:            public static WsdlFactory newInstance() throws WsdlException {
136:                String factoryImplName = findFactoryImplName();
137:
138:                return newInstance(factoryImplName);
139:            }
140:
141:            /**
142:             * Get a new instance of a WsdlFactory. This method returns an instance 
143:             * of the class factoryImplName. Once an instance of a WsdlFactory is 
144:             * obtained, invoke newWSDLReader() (and other factory methods in future)
145:             * to create the desired instances.
146:             *
147:             * @param factoryImplName The fully-qualified class name of the
148:             *                        class which provides a concrete implementation 
149:             *                        of the abstract class WsdlFactory.
150:             * @return An instance of a WsdlFactory.
151:             * @exception WsdlException if the factory cannot be instantiated.
152:             */
153:            public static WsdlFactory newInstance(String factoryImplName)
154:                    throws WsdlException {
155:                if (factoryImplName != null) {
156:                    try {
157:                        Class cl = Class.forName(factoryImplName);
158:
159:                        return (WsdlFactory) cl.newInstance();
160:                    } catch (Exception ex) {
161:                        throw new WsdlException(
162:                                "Cannot instantiate WsdlFactory implementation\n"
163:                                        + "\tclass name = {0}\n"
164:                                        + "\terror      = {2}: {1}\n",
165:                                new Object[] { factoryImplName,
166:                                        ex.getMessage(),
167:                                        ex.getClass().getName(), });
168:                    }
169:                } else {
170:                    throw new WsdlException(
171:                            "Unable to find name of WsdlFactory implementation.");
172:                }
173:            }
174:
175:            /**
176:             * Find the class name of the WSDL factory implementation, using
177:             * the search rules enumerated in newInstance().
178:             * 
179:             * @return Fully qualified name of the WSDL factory to use.
180:             * @see #newInstance()
181:             */
182:            private static String findFactoryImplName() {
183:                String factoryImplName = null;
184:
185:                // First, check the system property.
186:                try {
187:                    factoryImplName = System.getProperty(PROPERTY_NAME);
188:
189:                    if (factoryImplName != null) {
190:                        return factoryImplName;
191:                    }
192:                } catch (SecurityException e) {
193:                    //  We aren't allowed to get system properties, so we fall 
194:                    //  back to plan 'B'.
195:                    ;
196:                }
197:
198:                // Second, check the properties file.
199:                String propFileName = getFullPropertyFileName();
200:
201:                if (propFileName != null) {
202:                    try {
203:                        Properties properties = new Properties();
204:                        File propFile = new File(propFileName);
205:                        FileInputStream fis = new FileInputStream(propFile);
206:
207:                        properties.load(fis);
208:                        fis.close();
209:
210:                        factoryImplName = properties.getProperty(PROPERTY_NAME);
211:
212:                        if (factoryImplName != null) {
213:                            return factoryImplName;
214:                        }
215:                    } catch (IOException e) {
216:                        //  It appears that the properties file doesn't exist, 
217:                        //  or is malformed.
218:                        ;
219:                    }
220:                }
221:
222:                // Third, return the default.
223:                return DEFAULT_FACTORY_IMPL_NAME;
224:            }
225:
226:            /**
227:             * Get the full path / name of the property file.
228:             * 
229:             * @return The full path/name of the property file; null if security
230:             *         settings disallow reading system properties.
231:             */
232:            private static String getFullPropertyFileName() {
233:                if (sFullPropertyFileName == null) {
234:                    try {
235:                        String javaHome = System.getProperty("java.home");
236:
237:                        sFullPropertyFileName = javaHome + File.separator
238:                                + "lib" + File.separator + PROPERTY_FILE_NAME;
239:                    } catch (SecurityException e) {
240:                        //  Security settings are such that we can't read System 
241:                        //  properties.
242:                        ;
243:                    }
244:                }
245:
246:                return sFullPropertyFileName;
247:            }
248:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.