Coverage Report - org.apache.xmlrpc.common.XmlRpcController
 
Classes in this File Line Coverage Branch Coverage Complexity
XmlRpcController
50% 
N/A 
1
 
 1  
 /*
 2  
  * Copyright 1999,2005 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  
 package org.apache.xmlrpc.common;
 17  
 
 18  
 import org.apache.xmlrpc.XmlRpcConfig;
 19  
 
 20  
 
 21  
 /** A common base class for
 22  
  * {@link org.apache.xmlrpc.server.XmlRpcServer} and
 23  
  * {@link org.apache.xmlrpc.client.XmlRpcClient}.
 24  
  */
 25  1036
 public abstract class XmlRpcController {
 26  518
         private XmlRpcWorkerFactory workerFactory = getDefaultXmlRpcWorkerFactory();
 27  
         private int maxThreads;
 28  518
         private TypeFactory typeFactory = new TypeFactoryImpl(this);
 29  
 
 30  
         /** Creates the controllers default worker factory.
 31  
          * @return The default factory for workers.
 32  
          */
 33  
         protected abstract XmlRpcWorkerFactory getDefaultXmlRpcWorkerFactory();
 34  
 
 35  
         /** Sets the maximum number of concurrent requests. This includes
 36  
          * both synchronous and asynchronous requests.
 37  
          * @param pMaxThreads Maximum number of threads or 0 to disable
 38  
          * the limit.
 39  
          */
 40  
         public void setMaxThreads(int pMaxThreads) {
 41  0
                 maxThreads = pMaxThreads;
 42  0
         }
 43  
 
 44  
         /** Returns the maximum number of concurrent requests. This includes
 45  
          * both synchronous and asynchronous requests.
 46  
          * @return Maximum number of threads or 0 to disable
 47  
          * the limit.
 48  
          */
 49  
         public int getMaxThreads() {
 50  1333
                 return maxThreads;
 51  
         }
 52  
 
 53  
         /** Sets the clients worker factory.
 54  
          * @param pFactory The factory being used to create workers.
 55  
          */
 56  
         public void setWorkerFactory(XmlRpcWorkerFactory pFactory) {
 57  0
                 workerFactory = pFactory;
 58  0
         }
 59  
 
 60  
         /** Returns the clients worker factory.
 61  
          * @return The factory being used to create workers.
 62  
          */
 63  
         public XmlRpcWorkerFactory getWorkerFactory() {
 64  747
                 return workerFactory;
 65  
         }
 66  
 
 67  
         /** Returns the controllers default configuration.
 68  
          * @return The default configuration.
 69  
          */
 70  
         public abstract XmlRpcConfig getConfig();
 71  
 
 72  
         /** Sets the type factory.
 73  
          * @param pTypeFactory The type factory.
 74  
          */
 75  
         public void setTypeFactory(TypeFactory pTypeFactory) {
 76  0
                 typeFactory = pTypeFactory;
 77  0
         }
 78  
 
 79  
         /** Returns the type factory.
 80  
          * @return The type factory.
 81  
          */
 82  
         public TypeFactory getTypeFactory() {
 83  1228
                 return typeFactory;
 84  
         }
 85  
 }