You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2012/11/17 11:10:47 UTC

svn commit: r1410716 - in /axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration: DelegatingWSDDEngineConfiguration.java DirProvider.java FileProvider.java

Author: veithen
Date: Sat Nov 17 10:10:45 2012
New Revision: 1410716

URL: http://svn.apache.org/viewvc?rev=1410716&view=rev
Log:
Duplicate code reduction.

Added:
    axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/DelegatingWSDDEngineConfiguration.java   (with props)
Modified:
    axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/DirProvider.java
    axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/FileProvider.java

Added: axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/DelegatingWSDDEngineConfiguration.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/DelegatingWSDDEngineConfiguration.java?rev=1410716&view=auto
==============================================================================
--- axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/DelegatingWSDDEngineConfiguration.java (added)
+++ axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/DelegatingWSDDEngineConfiguration.java Sat Nov 17 10:10:45 2012
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis.configuration;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.ConfigurationException;
+import org.apache.axis.Handler;
+import org.apache.axis.WSDDEngineConfiguration;
+import org.apache.axis.deployment.wsdd.WSDDDeployment;
+import org.apache.axis.deployment.wsdd.WSDDGlobalConfiguration;
+import org.apache.axis.encoding.TypeMappingRegistry;
+import org.apache.axis.handlers.soap.SOAPService;
+import org.apache.axis.utils.Messages;
+
+/**
+ * {@link WSDDEngineConfiguration} implementation that delegates to the {@link WSDDDeployment}
+ * returned by {@link WSDDEngineConfiguration#getDeployment()}.
+ */
+public abstract class DelegatingWSDDEngineConfiguration implements WSDDEngineConfiguration {
+    /**
+     * retrieve an instance of the named handler
+     * @param qname XXX
+     * @return XXX
+     * @throws ConfigurationException XXX
+     */
+    public final Handler getHandler(QName qname) throws ConfigurationException {
+        return getDeployment().getHandler(qname);
+    }
+
+    /**
+     * retrieve an instance of the named service
+     * @param qname XXX
+     * @return XXX
+     * @throws ConfigurationException XXX
+     */
+    public final SOAPService getService(QName qname) throws ConfigurationException {
+        SOAPService service = getDeployment().getService(qname);
+        if (service == null) {
+            throw new ConfigurationException(Messages.getMessage("noService10",
+                                                           qname.toString()));
+        }
+        return service;
+    }
+
+    /**
+     * Get a service which has been mapped to a particular namespace
+     * 
+     * @param namespace a namespace URI
+     * @return an instance of the appropriate Service, or null
+     */
+    public final SOAPService getServiceByNamespaceURI(String namespace)
+            throws ConfigurationException {
+        return getDeployment().getServiceByNamespaceURI(namespace);
+    }
+
+    /**
+     * retrieve an instance of the named transport
+     * @param qname XXX
+     * @return XXX
+     * @throws ConfigurationException XXX
+     */
+    public final Handler getTransport(QName qname) throws ConfigurationException {
+        return getDeployment().getTransport(qname);
+    }
+
+    public final TypeMappingRegistry getTypeMappingRegistry()
+        throws ConfigurationException {
+        return getDeployment().getTypeMappingRegistry();
+    }
+
+    /**
+     * Returns a global request handler.
+     */
+    public final Handler getGlobalRequest() throws ConfigurationException {
+        return getDeployment().getGlobalRequest();
+    }
+
+    /**
+     * Returns a global response handler.
+     */
+    public final Handler getGlobalResponse() throws ConfigurationException {
+        return getDeployment().getGlobalResponse();
+    }
+
+    /**
+     * Returns the global configuration options.
+     */
+    public final Hashtable getGlobalOptions() throws ConfigurationException {
+        WSDDGlobalConfiguration globalConfig
+            = getDeployment().getGlobalConfiguration();
+            
+        if (globalConfig != null)
+            return globalConfig.getParametersTable();
+
+        return null;
+    }
+
+    /**
+     * Get an enumeration of the services deployed to this engine
+     */
+    public final Iterator getDeployedServices() throws ConfigurationException {
+        return getDeployment().getDeployedServices();
+    }
+
+    /**
+     * Get a list of roles that this engine plays globally.  Services
+     * within the engine configuration may also add additional roles.
+     *
+     * @return a <code>List</code> of the roles for this engine
+     */
+    public final List getRoles() {
+        return getDeployment().getRoles();
+    }
+}

Propchange: axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/DelegatingWSDDEngineConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/DirProvider.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/DirProvider.java?rev=1410716&r1=1410715&r2=1410716&view=diff
==============================================================================
--- axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/DirProvider.java (original)
+++ axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/DirProvider.java Sat Nov 17 10:10:45 2012
@@ -22,27 +22,19 @@ import java.io.InputStream;
 import java.io.FileFilter;
 import java.io.IOException;
 import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
 
 import org.apache.axis.AxisEngine;
 import org.apache.axis.ConfigurationException;
-import org.apache.axis.Handler;
-import org.apache.axis.WSDDEngineConfiguration;
 import org.apache.axis.deployment.wsdd.WSDDDeployment;
 import org.apache.axis.deployment.wsdd.WSDDDocument;
 import org.apache.axis.deployment.wsdd.WSDDGlobalConfiguration;
-import org.apache.axis.encoding.TypeMappingRegistry;
-import org.apache.axis.handlers.soap.SOAPService;
 import org.apache.axis.utils.Messages;
 import org.apache.axis.utils.XMLUtils;
 
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.Log;
 
-public class DirProvider implements WSDDEngineConfiguration {
+public class DirProvider extends DelegatingWSDDEngineConfiguration {
 
     protected static Log log =
         LogFactory.getLog(DirProvider.class.getName());
@@ -133,99 +125,4 @@ public class DirProvider implements WSDD
         throws ConfigurationException {
         // this is not implemented
     }
-
-    /**
-     * retrieve an instance of the named handler
-     * @param qname XXX
-     * @return XXX
-     * @throws ConfigurationException XXX
-     */
-    public Handler getHandler(QName qname) throws ConfigurationException {
-        return this.deployment.getHandler(qname);
-    }
-
-    /**
-     * retrieve an instance of the named service
-     * @param qname XXX
-     * @return XXX
-     * @throws ConfigurationException XXX
-     */
-    public SOAPService getService(QName qname) throws ConfigurationException {
-        SOAPService service = this.deployment.getService(qname);
-        if (service == null) {
-            throw new ConfigurationException(Messages.getMessage("noService10",
-                                                           qname.toString()));
-        }
-        return service;
-    }
-
-    /**
-     * Get a service which has been mapped to a particular namespace
-     * 
-     * @param namespace a namespace URI
-     * @return an instance of the appropriate Service, or null
-     */
-    public SOAPService getServiceByNamespaceURI(String namespace)
-            throws ConfigurationException {
-        return this.deployment.getServiceByNamespaceURI(namespace);
-    }
-
-    /**
-     * retrieve an instance of the named transport
-     * @param qname XXX
-     * @return XXX
-     * @throws ConfigurationException XXX
-     */
-    public Handler getTransport(QName qname) throws ConfigurationException {
-        return this.deployment.getTransport(qname);
-    }
-
-    public TypeMappingRegistry getTypeMappingRegistry()
-        throws ConfigurationException {
-        return this.deployment.getTypeMappingRegistry();
-    }
-
-    /**
-     * Returns a global request handler.
-     */
-    public Handler getGlobalRequest() throws ConfigurationException {
-        return this.deployment.getGlobalRequest();
-    }
-
-    /**
-     * Returns a global response handler.
-     */
-    public Handler getGlobalResponse() throws ConfigurationException {
-        return this.deployment.getGlobalResponse();
-    }
-
-    /**
-     * Returns the global configuration options.
-     */
-    public Hashtable getGlobalOptions() throws ConfigurationException {
-        WSDDGlobalConfiguration globalConfig
-            = this.deployment.getGlobalConfiguration();
-            
-        if (globalConfig != null)
-            return globalConfig.getParametersTable();
-
-        return null;
-    }
-
-    /**
-     * Get an enumeration of the services deployed to this engine
-     */
-    public Iterator getDeployedServices() throws ConfigurationException {
-        return this.deployment.getDeployedServices();
-    }
-
-    /**
-     * Get a list of roles that this engine plays globally.  Services
-     * within the engine configuration may also add additional roles.
-     *
-     * @return a <code>List</code> of the roles for this engine
-     */
-    public List getRoles() {
-        return this.deployment.getRoles();
-    }
 }

Modified: axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/FileProvider.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/FileProvider.java?rev=1410716&r1=1410715&r2=1410716&view=diff
==============================================================================
--- axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/FileProvider.java (original)
+++ axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/configuration/FileProvider.java Sat Nov 17 10:10:45 2012
@@ -24,22 +24,12 @@ import java.io.InputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.Writer;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
 
 import org.apache.axis.AxisEngine;
 import org.apache.axis.ConfigurationException;
-import org.apache.axis.Handler;
-import org.apache.axis.WSDDEngineConfiguration;
 import org.apache.axis.components.logger.LogFactory;
 import org.apache.axis.deployment.wsdd.WSDDDeployment;
 import org.apache.axis.deployment.wsdd.WSDDDocument;
-import org.apache.axis.deployment.wsdd.WSDDGlobalConfiguration;
-import org.apache.axis.encoding.TypeMappingRegistry;
-import org.apache.axis.handlers.soap.SOAPService;
 import org.apache.axis.utils.Admin;
 import org.apache.axis.utils.ClassUtils;
 import org.apache.axis.utils.Messages;
@@ -54,7 +44,7 @@ import org.w3c.dom.Document;
  * @author Glen Daniels (gdaniels@apache.org)
  * @author Glyn Normington (glyn@apache.org)
  */
-public class FileProvider implements WSDDEngineConfiguration {
+public class FileProvider extends DelegatingWSDDEngineConfiguration {
     protected static Log log =
         LogFactory.getLog(FileProvider.class.getName());
 
@@ -210,99 +200,4 @@ public class FileProvider implements WSD
             }
         }
     }
-
-    /**
-     * retrieve an instance of the named handler
-     * @param qname XXX
-     * @return XXX
-     * @throws ConfigurationException XXX
-     */
-    public Handler getHandler(QName qname) throws ConfigurationException {
-        return deployment.getHandler(qname);
-    }
-
-    /**
-     * retrieve an instance of the named service
-     * @param qname XXX
-     * @return XXX
-     * @throws ConfigurationException XXX
-     */
-    public SOAPService getService(QName qname) throws ConfigurationException {
-        SOAPService service = deployment.getService(qname);
-        if (service == null) {
-            throw new ConfigurationException(Messages.getMessage("noService10",
-                                                           qname.toString()));
-        }
-        return service;
-    }
-
-    /**
-     * Get a service which has been mapped to a particular namespace
-     * 
-     * @param namespace a namespace URI
-     * @return an instance of the appropriate Service, or null
-     */
-    public SOAPService getServiceByNamespaceURI(String namespace)
-            throws ConfigurationException {
-        return deployment.getServiceByNamespaceURI(namespace);
-    }
-
-    /**
-     * retrieve an instance of the named transport
-     * @param qname XXX
-     * @return XXX
-     * @throws ConfigurationException XXX
-     */
-    public Handler getTransport(QName qname) throws ConfigurationException {
-        return deployment.getTransport(qname);
-    }
-
-    public TypeMappingRegistry getTypeMappingRegistry()
-        throws ConfigurationException {
-        return deployment.getTypeMappingRegistry();
-    }
-
-    /**
-     * Returns a global request handler.
-     */
-    public Handler getGlobalRequest() throws ConfigurationException {
-        return deployment.getGlobalRequest();
-    }
-
-    /**
-     * Returns a global response handler.
-     */
-    public Handler getGlobalResponse() throws ConfigurationException {
-        return deployment.getGlobalResponse();
-    }
-
-    /**
-     * Returns the global configuration options.
-     */
-    public Hashtable getGlobalOptions() throws ConfigurationException {
-        WSDDGlobalConfiguration globalConfig
-            = deployment.getGlobalConfiguration();
-            
-        if (globalConfig != null)
-            return globalConfig.getParametersTable();
-
-        return null;
-    }
-
-    /**
-     * Get an enumeration of the services deployed to this engine
-     */
-    public Iterator getDeployedServices() throws ConfigurationException {
-        return deployment.getDeployedServices();
-    }
-
-    /**
-     * Get a list of roles that this engine plays globally.  Services
-     * within the engine configuration may also add additional roles.
-     *
-     * @return a <code>List</code> of the roles for this engine
-     */
-    public List getRoles() {
-        return deployment.getRoles();
-    }
 }