Source Code Cross Referenced for ConnectionFactoryImpl.java in  » Web-Services » XML-Registry-JAXR » org » apache » ws » scout » registry » 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 » Web Services » XML Registry JAXR » org.apache.ws.scout.registry 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2004 The Apache Software Foundation.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.apache.ws.scout.registry;
018:
019:        import java.io.Serializable;
020:        import java.net.URI;
021:        import java.net.URISyntaxException;
022:        import java.util.Collection;
023:        import java.util.Properties;
024:
025:        import javax.xml.registry.Connection;
026:        import javax.xml.registry.ConnectionFactory;
027:        import javax.xml.registry.FederatedConnection;
028:        import javax.xml.registry.InvalidRequestException;
029:        import javax.xml.registry.JAXRException;
030:        import javax.xml.registry.UnsupportedCapabilityException;
031:
032:        /**
033:         * Our implmentation of javax.xml.registry.ConnectionFactory.
034:         * Also exposes the properties as JavaBean properties to ease use
035:         * with a managed environment such as an application server.
036:         *
037:         * @author Anil Saldhana  <anil@apache.org>
038:         * @author Jeremy Boynes  <jboynes@apache.org>
039:         */
040:        public class ConnectionFactoryImpl extends ConnectionFactory implements 
041:                Serializable {
042:            private static final long serialVersionUID = 1L;
043:            private static final String QUERYMANAGER_PROPERTY = "javax.xml.registry.queryManagerURL";
044:            private static final String LIFECYCLEMANAGER_PROPERTY = "javax.xml.registry.lifeCycleManagerURL";
045:            private static final String SEMANTICEQUIVALENCES_PROPERTY = "javax.xml.registry.semanticEquivalences";
046:            private static final String POSTALADDRESSSCHEME_PROPERTY = "javax.xml.registry.postalAddressScheme";
047:            private static final String AUTHENTICATIONMETHOD_PROPERTY = "javax.xml.registry.security.authenticationMethod";
048:            private static final String MAXROWS_PROPERTY = "javax.xml.registry.uddi.maxRows";
049:
050:            private String queryManagerURL;
051:            private String lifeCycleManagerURL;
052:            private String transportClass;
053:            private String semanticEquivalences;
054:            private String authenticationMethod;
055:            private Integer maxRows;
056:            private String postalAddressScheme;
057:
058:            /**
059:             * Public no-arg constructor so that this ConnectionFactory can be
060:             * instantiated by the JAXR ConnectionFactory;
061:             */
062:            public ConnectionFactoryImpl() {
063:            }
064:
065:            public Connection createConnection() throws JAXRException {
066:                if (queryManagerURL == null) {
067:                    throw new InvalidRequestException("queryManager is not set");
068:                }
069:                URI queryManager;
070:                URI lifeCycleManager;
071:                try {
072:                    queryManager = new URI(queryManagerURL);
073:                } catch (URISyntaxException e) {
074:                    throw new InvalidRequestException(
075:                            "Invalid queryManagerURL: " + queryManagerURL, e);
076:                }
077:                try {
078:                    lifeCycleManager = lifeCycleManagerURL == null ? queryManager
079:                            : new URI(lifeCycleManagerURL);
080:                } catch (URISyntaxException e) {
081:                    throw new InvalidRequestException(
082:                            "Invalid lifeCycleManagerURL: "
083:                                    + lifeCycleManagerURL, e);
084:                }
085:                return new ConnectionImpl(queryManager, lifeCycleManager,
086:                        transportClass, null, maxRows == null ? -1 : maxRows
087:                                .intValue());
088:            }
089:
090:            public FederatedConnection createFederatedConnection(
091:                    Collection collection) throws JAXRException {
092:                throw new UnsupportedCapabilityException(
093:                        "FederatedConnections are not supported in this release");
094:            }
095:
096:            /**
097:             * Returns a value copy of the properties that will be used to create
098:             * a Connections. Operations on this Properties objects will not affect
099:             * this ConnectionFactory; use setProperties(Properties) to save changes.
100:             *
101:             * @return a Properties object containing the properies that will be used to create Connection
102:             */
103:            public Properties getProperties() {
104:                Properties props = new Properties();
105:                if (queryManagerURL != null) {
106:                    props.put(QUERYMANAGER_PROPERTY, queryManagerURL);
107:                }
108:                if (lifeCycleManagerURL != null) {
109:                    props.put(LIFECYCLEMANAGER_PROPERTY, lifeCycleManagerURL);
110:                }
111:                if (semanticEquivalences != null) {
112:                    props.put(SEMANTICEQUIVALENCES_PROPERTY,
113:                            semanticEquivalences);
114:                }
115:                if (postalAddressScheme != null) {
116:                    props
117:                            .put(POSTALADDRESSSCHEME_PROPERTY,
118:                                    postalAddressScheme);
119:                }
120:                if (authenticationMethod != null) {
121:                    props.put(AUTHENTICATIONMETHOD_PROPERTY,
122:                            authenticationMethod);
123:                }
124:                if (maxRows != null) {
125:                    props.put(MAXROWS_PROPERTY, maxRows.toString());
126:                }
127:                return props;
128:            }
129:
130:            /**
131:             * Update the properties used by this ConnectionFactory to obtain a connection.
132:             *
133:             * @param properties the new properties for this ConnectionFactory
134:             */
135:            public void setProperties(Properties properties) {
136:                queryManagerURL = properties.getProperty(QUERYMANAGER_PROPERTY);
137:                lifeCycleManagerURL = properties
138:                        .getProperty(LIFECYCLEMANAGER_PROPERTY);
139:                transportClass = properties
140:                        .getProperty(RegistryImpl.TRANSPORT_CLASS_PROPERTY_NAME);
141:                semanticEquivalences = properties
142:                        .getProperty(SEMANTICEQUIVALENCES_PROPERTY);
143:                authenticationMethod = properties
144:                        .getProperty(AUTHENTICATIONMETHOD_PROPERTY);
145:                postalAddressScheme = properties
146:                        .getProperty(POSTALADDRESSSCHEME_PROPERTY);
147:                String val = properties.getProperty(MAXROWS_PROPERTY);
148:                maxRows = (val == null) ? null : Integer.valueOf(val);
149:            }
150:
151:            public static ConnectionFactory newInstance() {
152:                return new ConnectionFactoryImpl();
153:            }
154:
155:            public String getAuthenticationMethod() {
156:                return authenticationMethod;
157:            }
158:
159:            public void setAuthenticationMethod(String authenticationMethod) {
160:                this .authenticationMethod = authenticationMethod;
161:            }
162:
163:            public String getLifeCycleManagerURL() {
164:                return lifeCycleManagerURL;
165:            }
166:
167:            public void setLifeCycleManagerURL(String lifeCycleManagerURL) {
168:                this .lifeCycleManagerURL = lifeCycleManagerURL;
169:            }
170:
171:            public Integer getMaxRows() {
172:                return maxRows;
173:            }
174:
175:            public void setMaxRows(Integer maxRows) {
176:                this .maxRows = maxRows;
177:            }
178:
179:            public String getPostalAddressScheme() {
180:                return postalAddressScheme;
181:            }
182:
183:            public void setPostalAddressScheme(String postalAddressScheme) {
184:                this .postalAddressScheme = postalAddressScheme;
185:            }
186:
187:            public String getQueryManagerURL() {
188:                return queryManagerURL;
189:            }
190:
191:            public void setQueryManagerURL(String queryManagerURL) {
192:                this .queryManagerURL = queryManagerURL;
193:            }
194:
195:            public String getSemanticEquivalences() {
196:                return semanticEquivalences;
197:            }
198:
199:            public void setSemanticEquivalences(String semanticEquivalences) {
200:                this .semanticEquivalences = semanticEquivalences;
201:            }
202:
203:            public String getTransportClass() {
204:                return transportClass;
205:            }
206:
207:            public void setTransportClass(String transportClass) {
208:                this.transportClass = transportClass;
209:            }
210:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.