1/*2 * Copyright 2001-2004 The Apache Software Foundation.3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */1617package org.apache.ws.scout.registry;
1819import java.io.Serializable;
20import java.util.Collection;
21import java.util.Properties;
2223import javax.xml.registry.Connection;
24import javax.xml.registry.ConnectionFactory;
25import javax.xml.registry.FederatedConnection;
26import javax.xml.registry.InvalidRequestException;
27import javax.xml.registry.JAXRException;
28import javax.xml.registry.UnsupportedCapabilityException;
2930/**31 * Our implmentation of javax.xml.registry.ConnectionFactory.32 * Also exposes the properties as JavaBean properties to ease use33 * with a managed environment such as an application server.34 *35 * @author Anil Saldhana <anil@apache.org>36 * @author Jeremy Boynes <jboynes@apache.org>37 * @author Tom Cunningham <tcunning@apache.org>38 */39publicclassConnectionFactoryImplextends ConnectionFactory implements Serializable
40 {
41privatestaticfinallong serialVersionUID = -6902106826496922256L;
42publicstaticfinal String QUERYMANAGER_PROPERTY = "javax.xml.registry.queryManagerURL";
43publicstaticfinal String LIFECYCLEMANAGER_PROPERTY = "javax.xml.registry.lifeCycleManagerURL";
44publicstaticfinal String SECURITYMANAGER_PROPERTY = "javax.xml.registry.securityManagerURL";
45publicstaticfinal String SEMANTICEQUIVALENCES_PROPERTY = "javax.xml.registry.semanticEquivalences";
46publicstaticfinal String POSTALADDRESSSCHEME_PROPERTY = "javax.xml.registry.postalAddressScheme";
47publicstaticfinal String AUTHENTICATIONMETHOD_PROPERTY = "javax.xml.registry.security.authenticationMethod";
48publicstaticfinal String MAXROWS_PROPERTY = "javax.xml.registry.uddi.maxRows";
4950publicstaticfinal String ADMIN_ENDPOINT_PROPERTY = "scout.proxy.adminURL";
51publicstaticfinal String TRANSPORT_CLASS_PROPERTY = "scout.proxy.transportClass";
52publicstaticfinal String SECURITY_PROVIDER_PROPERTY = "scout.proxy.securityProvider";
53publicstaticfinal String PROTOCOL_HANDLER_PROPERTY = "scout.proxy.protocolHandler";
54publicstaticfinal String UDDI_VERSION_PROPERTY = "scout.proxy.uddiVersion";
55publicstaticfinal String UDDI_NAMESPACE_PROPERTY = "scout.proxy.uddiNamespace";
5657private Properties properties = new Properties();
5859/**60 * Public no-arg constructor so that this ConnectionFactory can be61 * instantiated by the JAXR ConnectionFactory;62 */63publicConnectionFactoryImpl() {}
6465public Connection createConnection() throws JAXRException
66 {
67//The JAXR spec requires the queryManagerURL to be defined68 String queryManagerURL = properties.getProperty(QUERYMANAGER_PROPERTY);
69if (queryManagerURL==null) thrownew InvalidRequestException("Missing required property " + QUERYMANAGER_PROPERTY);
70returnnewConnectionImpl(properties);
71 }
7273public FederatedConnection createFederatedConnection(Collection collection) throws JAXRException
74 {
75thrownew UnsupportedCapabilityException("FederatedConnections are not supported in this release");
76 }
7778/**79 * Returns a value copy of the properties that will be used to create80 * a Connections. Operations on this Properties objects will not affect81 * this ConnectionFactory; use setProperties(Properties) to save changes.82 *83 * @return a Properties object containing the properies that will be used to create Connection84 */85public Properties getProperties()
86 {
87return properties;
88 }
8990/**91 * Update the properties used by this ConnectionFactory to obtain a connection.92 *93 * @param properties the new properties for this ConnectionFactory94 */95publicvoid setProperties(Properties properties)
96 {
97if (properties==null) properties = new Properties();
98this.properties.putAll(properties);
99 }
100101publicstatic ConnectionFactory newInstance()
102 {
103returnnewConnectionFactoryImpl();
104 }
105106 }