This project has retired. For details please refer to its Attic page.
Coverage Report
Coverage Report - org.apache.ws.scout.registry.ConnectionFactoryImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
ConnectionFactoryImpl
90%
10/11
100%
4/4
1.667
 
 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 at
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * 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 and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 package org.apache.ws.scout.registry;
 18  
 
 19  
 import java.io.Serializable;
 20  
 import java.util.Collection;
 21  
 import java.util.Properties;
 22  
 
 23  
 import javax.xml.registry.Connection;
 24  
 import javax.xml.registry.ConnectionFactory;
 25  
 import javax.xml.registry.FederatedConnection;
 26  
 import javax.xml.registry.InvalidRequestException;
 27  
 import javax.xml.registry.JAXRException;
 28  
 import javax.xml.registry.UnsupportedCapabilityException;
 29  
 
 30  
 /**
 31  
  * Our implmentation of javax.xml.registry.ConnectionFactory.
 32  
  * Also exposes the properties as JavaBean properties to ease use
 33  
  * 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  
  */
 39  
 public class ConnectionFactoryImpl extends ConnectionFactory implements Serializable
 40  
 {
 41  
         private static final long serialVersionUID = -6902106826496922256L;
 42  
         public static final String QUERYMANAGER_PROPERTY         = "javax.xml.registry.queryManagerURL";
 43  
         public static final String LIFECYCLEMANAGER_PROPERTY     = "javax.xml.registry.lifeCycleManagerURL";
 44  
         public static final String SECURITYMANAGER_PROPERTY      = "javax.xml.registry.securityManagerURL";
 45  
         public static final String SEMANTICEQUIVALENCES_PROPERTY = "javax.xml.registry.semanticEquivalences";
 46  
         public static final String POSTALADDRESSSCHEME_PROPERTY  = "javax.xml.registry.postalAddressScheme";
 47  
         public static final String AUTHENTICATIONMETHOD_PROPERTY = "javax.xml.registry.security.authenticationMethod";
 48  
         public static final String MAXROWS_PROPERTY              = "javax.xml.registry.uddi.maxRows";
 49  
         
 50  
         public static final String ADMIN_ENDPOINT_PROPERTY       = "scout.proxy.adminURL";
 51  
         public static final String TRANSPORT_CLASS_PROPERTY      = "scout.proxy.transportClass";
 52  
         public static final String SECURITY_PROVIDER_PROPERTY    = "scout.proxy.securityProvider";
 53  
         public static final String PROTOCOL_HANDLER_PROPERTY     = "scout.proxy.protocolHandler";
 54  
         public static final String UDDI_VERSION_PROPERTY         = "scout.proxy.uddiVersion";
 55  
         public static final String UDDI_NAMESPACE_PROPERTY       = "scout.proxy.uddiNamespace";
 56  
         
 57  96
         private Properties properties = new Properties();
 58  
 
 59  
     /**
 60  
      * Public no-arg constructor so that this ConnectionFactory can be
 61  
      * instantiated by the JAXR ConnectionFactory;
 62  
      */
 63  192
     public ConnectionFactoryImpl() {}
 64  
 
 65  
     public Connection createConnection() throws JAXRException
 66  
     {
 67  
         //The JAXR spec requires the queryManagerURL to be defined
 68  118
         String queryManagerURL = properties.getProperty(QUERYMANAGER_PROPERTY);
 69  118
         if (queryManagerURL==null) throw new InvalidRequestException("Missing required property " + QUERYMANAGER_PROPERTY);
 70  116
         return new ConnectionImpl(properties);
 71  
     }
 72  
 
 73  
     public FederatedConnection createFederatedConnection(Collection collection) throws JAXRException
 74  
     {
 75  2
         throw new UnsupportedCapabilityException("FederatedConnections are not supported in this release");
 76  
     }
 77  
 
 78  
     /**
 79  
      * Returns a value copy of the properties that will be used to create
 80  
      * a Connections. Operations on this Properties objects will not affect
 81  
      * this ConnectionFactory; use setProperties(Properties) to save changes.
 82  
      *
 83  
      * @return a Properties object containing the properies that will be used to create Connection
 84  
      */
 85  
     public Properties getProperties()
 86  
     {
 87  24
         return properties;
 88  
     }
 89  
 
 90  
     /**
 91  
      * Update the properties used by this ConnectionFactory to obtain a connection.
 92  
      *
 93  
      * @param properties the new properties for this ConnectionFactory
 94  
      */
 95  
     public void setProperties(Properties properties)
 96  
     {
 97  84
         if (properties==null) properties = new Properties();
 98  84
         this.properties.putAll(properties);
 99  84
     }
 100  
 
 101  
     public static ConnectionFactory newInstance()
 102  
     {
 103  0
         return new ConnectionFactoryImpl();
 104  
     }
 105  
 
 106  
 }