Author: veithen
Date: Sun Dec 9 17:22:05 2012
New Revision: 1419023
URL: http://svn.apache.org/viewvc?rev=1419023&view=rev
Log:
Added support for the deprecated languageSpecificType attribute.
Added:
axis/axis1/java/trunk/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDExtendedMetaData.java
(with props)
axis/axis1/java/trunk/axis-model/src/test/java/org/apache/axis/model/wsdd/DeprecationTest.java
(with props)
axis/axis1/java/trunk/axis-model/src/test/resources/
axis/axis1/java/trunk/axis-model/src/test/resources/org/
axis/axis1/java/trunk/axis-model/src/test/resources/org/apache/
axis/axis1/java/trunk/axis-model/src/test/resources/org/apache/axis/
axis/axis1/java/trunk/axis-model/src/test/resources/org/apache/axis/model/
axis/axis1/java/trunk/axis-model/src/test/resources/org/apache/axis/model/wsdd/
axis/axis1/java/trunk/axis-model/src/test/resources/org/apache/axis/model/wsdd/languageSpecificType.wsdd
Modified:
axis/axis1/java/trunk/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java
Added:
axis/axis1/java/trunk/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDExtendedMetaData.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDExtendedMetaData.java?rev=1419023&view=auto
==============================================================================
---
axis/axis1/java/trunk/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDExtendedMetaData.java
(added)
+++
axis/axis1/java/trunk/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDExtendedMetaData.java
Sun Dec 9 17:22:05 2012
@@ -0,0 +1,37 @@
+/*
+ * 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.model.wsdd;
+
+import org.apache.axis.model.wsdd.impl.WSDDPackageImpl;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.BasicExtendedMetaData;
+
+final class WSDDExtendedMetaData extends BasicExtendedMetaData {
+ private static final EClass mapping =
WSDDPackageImpl.eINSTANCE.getMapping();
+
+ public EStructuralFeature getAttribute(EClass eClass, String namespace,
String name) {
+ if (mapping.isSuperTypeOf(eClass) && namespace == null &&
name.equals("languageSpecificType")) {
+ // TODO: emit warning
+ return
mapping.getEStructuralFeature(WSDDPackageImpl.MAPPING__TYPE);
+ } else {
+ return super.getAttribute(eClass, namespace, name);
+ }
+ }
+}
Propchange:
axis/axis1/java/trunk/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDExtendedMetaData.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
axis/axis1/java/trunk/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java?rev=1419023&r1=1419022&r2=1419023&view=diff
==============================================================================
---
axis/axis1/java/trunk/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java
(original)
+++
axis/axis1/java/trunk/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java
Sun Dec 9 17:22:05 2012
@@ -19,31 +19,85 @@
package org.apache.axis.model.wsdd;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
import java.io.Writer;
+import java.net.URL;
+import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
+import org.apache.axis.components.logger.LogFactory;
+import org.apache.axis.configuration.DefaultConfiguration;
import org.apache.axis.model.util.AxisXMLResource;
import org.apache.axis.model.wsdd.impl.WSDDPackageImpl;
-import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.apache.commons.logging.Log;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.ecore.xmi.util.XMLProcessor;
import org.xml.sax.InputSource;
public final class WSDDUtil {
+ private static final Log log = LogFactory.getLog(WSDDUtil.class.getName());
+
private WSDDUtil() {}
public static Deployment load(InputSource is) throws IOException {
WSDDPackageImpl.eINSTANCE.eClass();
AxisXMLResource resource = new AxisXMLResource();
Map options = new HashMap();
- options.put(XMLResource.OPTION_EXTENDED_META_DATA,
ExtendedMetaData.INSTANCE);
+ options.put(XMLResource.OPTION_EXTENDED_META_DATA, new
WSDDExtendedMetaData());
options.put(AxisXMLResource.OPTION_IGNORE_NAMESPACE_FOR_UNQUALIFIED_QNAME,
WSDDPackageImpl.eNS_URI);
resource.load(is, options);
return (Deployment)resource.getContents().get(0);
}
+ /**
+ * Load the default Axis configuration. This method implements the same
algorithm as
+ * {@link DefaultConfiguration}.
+ *
+ * @param cl
+ * the class loader to load the configuration from
+ * @param type
+ * the type of configuration (<tt>client</tt> or
<tt>server</tt>)
+ * @return the default configuration
+ * @throws IOException
+ */
+ public static Deployment buildDefaultConfiguration(ClassLoader cl, String
type) throws IOException {
+ // Load the base configuration
+ String resourceName = "org/apache/axis/" + type + "/" + type +
"-config.wsdd";
+ InputStream in = cl.getResourceAsStream(resourceName);
+ if (in == null) {
+ throw new IOException("Resource " + resourceName + " not found");
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("Loading resource " + resourceName);
+ }
+ Deployment deployment;
+ try {
+ deployment = WSDDUtil.load(new InputSource(in));
+ } finally {
+ in.close();
+ }
+
+ // Discover and load additional default configuration fragments
+ resourceName = "META-INF/axis/default-" + type + "-config.wsdd";
+ Enumeration resources = cl.getResources(resourceName);
+ while (resources.hasMoreElements()) {
+ URL url = (URL)resources.nextElement();
+ if (log.isDebugEnabled()) {
+ log.debug("Loading " + url);
+ }
+ in = url.openStream();
+ try {
+ deployment.merge(WSDDUtil.load(new InputSource(in)));
+ } finally {
+ in.close();
+ }
+ }
+
+ return deployment;
+ }
+
public static void save(Deployment deployment, OutputStream out) throws
IOException {
AxisXMLResource resource = new AxisXMLResource();
XMLProcessor processor = new XMLProcessor();
Added:
axis/axis1/java/trunk/axis-model/src/test/java/org/apache/axis/model/wsdd/DeprecationTest.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-model/src/test/java/org/apache/axis/model/wsdd/DeprecationTest.java?rev=1419023&view=auto
==============================================================================
---
axis/axis1/java/trunk/axis-model/src/test/java/org/apache/axis/model/wsdd/DeprecationTest.java
(added)
+++
axis/axis1/java/trunk/axis-model/src/test/java/org/apache/axis/model/wsdd/DeprecationTest.java
Sun Dec 9 17:22:05 2012
@@ -0,0 +1,35 @@
+/*
+ * 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.model.wsdd;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.axis.deployment.wsdd.WSDDConstants;
+import org.xml.sax.InputSource;
+
+public class DeprecationTest extends TestCase {
+ public void testLanguageSpecificType() throws Exception {
+ Deployment deployment = WSDDUtil.load(new
InputSource(DeprecationTest.class.getResource("languageSpecificType.wsdd").toString()));
+ Service service = (Service)deployment.getServices().get(0);
+ BeanMapping beanMapping =
(BeanMapping)service.getBeanMappings().get(0);
+ assertEquals(new QName(WSDDConstants.URI_WSDD_JAVA, "test.rpc.Bean"),
beanMapping.getType());
+ }
+}
Propchange:
axis/axis1/java/trunk/axis-model/src/test/java/org/apache/axis/model/wsdd/DeprecationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
axis/axis1/java/trunk/axis-model/src/test/resources/org/apache/axis/model/wsdd/languageSpecificType.wsdd
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-model/src/test/resources/org/apache/axis/model/wsdd/languageSpecificType.wsdd?rev=1419023&view=auto
==============================================================================
---
axis/axis1/java/trunk/axis-model/src/test/resources/org/apache/axis/model/wsdd/languageSpecificType.wsdd
(added)
+++
axis/axis1/java/trunk/axis-model/src/test/resources/org/apache/axis/model/wsdd/languageSpecificType.wsdd
Sun Dec 9 17:22:05 2012
@@ -0,0 +1,8 @@
+<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
+ <service name="IF3SOAP" provider="Handler">
+ <parameter name="allowedMethods"
value="getBeanById,getAllBeans,getAllCategories,getBeansByCategory,getBeansByDate,getBeansByExpression,getXMLForBean"/>
+ <parameter name="className" value="test.rpc.IF3SOAPImpl"/>
+ <parameter name="handlerClass"
value="org.apache.axis.providers.java.RPCProvider"/>
+ <beanMapping qname="myNS:Bean" xmlns:myNS="urn:IF3SOAP"
languageSpecificType="java:test.rpc.Bean"/>
+ </service>
+</deployment>
\ No newline at end of file