Author: veithen
Date: Thu Dec 6 22:46:35 2012
New Revision: 1418120
URL: http://svn.apache.org/viewvc?rev=1418120&view=rev
Log:
Fixed WSDD serialization.
Modified:
axis/axis1/java/branches/EMF/axis-model/model/wsdd.ecore
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/util/AxisXMLHelper.java
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/util/AxisXMLResource.java
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/DeployableItem.java
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/Deployment.java
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/impl/WSDDPackageImpl.java
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/xml/impl/XmlFactoryImpl.java
Modified: axis/axis1/java/branches/EMF/axis-model/model/wsdd.ecore
URL:
http://svn.apache.org/viewvc/axis/axis1/java/branches/EMF/axis-model/model/wsdd.ecore?rev=1418120&r1=1418119&r2=1418120&view=diff
==============================================================================
--- axis/axis1/java/branches/EMF/axis-model/model/wsdd.ecore (original)
+++ axis/axis1/java/branches/EMF/axis-model/model/wsdd.ecore Thu Dec 6
22:46:35 2012
@@ -97,9 +97,21 @@
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DeployableItem" abstract="true"
eSuperTypes="#//Parameterizable">
<eStructuralFeatures xsi:type="ecore:EReference" name="requestFlow"
eType="#//Flow"
- containment="true"/>
+ containment="true">
+ <eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="requestFlow"/>
+ <details key="namespace" value="##targetNamespace"/>
+ </eAnnotations>
+ </eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="responseFlow"
eType="#//Flow"
- containment="true"/>
+ containment="true">
+ <eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="responseFlow"/>
+ <details key="namespace" value="##targetNamespace"/>
+ </eAnnotations>
+ </eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="GlobalConfiguration"
eSuperTypes="#//DeployableItem"/>
<eClassifiers xsi:type="ecore:EClass" name="Transport"
eSuperTypes="#//DeployableItem">
@@ -162,7 +174,13 @@
</eOperations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference"
name="globalConfiguration" eType="#//GlobalConfiguration"
- containment="true"/>
+ containment="true">
+ <eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="globalConfiguration"/>
+ <details key="namespace" value="##targetNamespace"/>
+ </eAnnotations>
+ </eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="handlers"
upperBound="-1"
eType="#//Handler" containment="true">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
Modified:
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/util/AxisXMLHelper.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/util/AxisXMLHelper.java?rev=1418120&r1=1418119&r2=1418120&view=diff
==============================================================================
---
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/util/AxisXMLHelper.java
(original)
+++
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/util/AxisXMLHelper.java
Thu Dec 6 22:46:35 2012
@@ -18,8 +18,11 @@
*/
package org.apache.axis.model.util;
+import java.util.Map;
+
import javax.xml.namespace.QName;
+import org.apache.axis.model.xml.impl.XmlPackageImpl;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EFactory;
import org.eclipse.emf.ecore.EPackage;
@@ -37,10 +40,48 @@ import org.eclipse.emf.ecore.xmi.impl.XM
*/
// TODO: this is actually not entirely correct; Axis may generate QNames that
are not strictly valid (such as "ns:>fault") and they should be represented
using a specific class
public class AxisXMLHelper extends XMLHelperImpl {
+ private String ignoreNamespaceForUnqualifiedQName;
+
public AxisXMLHelper(XMLResource resource) {
super(resource);
}
+ public void setOptions(Map options) {
+ super.setOptions(options);
+ ignoreNamespaceForUnqualifiedQName =
(String)options.get(AxisXMLResource.OPTION_IGNORE_NAMESPACE_FOR_UNQUALIFIED_QNAME);
+ }
+
+ protected Object createFromString(EFactory eFactory, EDataType eDataType,
String value) {
+ if (eDataType == XmlPackageImpl.eINSTANCE.getQName()) {
+ String prefix;
+ String localName;
+ int idx = value.indexOf(':');
+ if (idx == -1) {
+ prefix = "";
+ localName = value;
+ } else {
+ prefix = value.substring(0, idx);
+ localName = value.substring(idx+1);
+ }
+ String namespaceURI = getURI(prefix);
+ if (namespaceURI == null) {
+ if (prefix.length() == 0) {
+ namespaceURI = "";
+ } else {
+ throw new IllegalArgumentException("The prefix '" + prefix
+ "' is not declared for the QName '" + value + "'");
+ }
+ }
+ if (prefix.length() == 0 &&
namespaceURI.equals(ignoreNamespaceForUnqualifiedQName)) {
+ // TODO: emit warning here
+ // TODO: add unit test for this case
+ namespaceURI = "";
+ }
+ return new QName(namespaceURI, localName, prefix);
+ } else {
+ return super.createFromString(eFactory, eDataType, value);
+ }
+ }
+
protected String updateQNamePrefix(EFactory factory, EDataType dataType,
Object value, boolean list) {
if (!list && value instanceof QName) {
QName qname = (QName)value;
Modified:
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/util/AxisXMLResource.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/util/AxisXMLResource.java?rev=1418120&r1=1418119&r2=1418120&view=diff
==============================================================================
---
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/util/AxisXMLResource.java
(original)
+++
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/util/AxisXMLResource.java
Thu Dec 6 22:46:35 2012
@@ -27,6 +27,40 @@ import org.eclipse.emf.ecore.xmi.impl.XM
* @author Andreas Veithen
*/
public class AxisXMLResource extends XMLResourceImpl {
+ /**
+ * Option to specify a namespace that will be ignored if it is used in an
unqualified
+ * <tt>xsd:QName</tt> literal.
+ * <p>
+ * Axis 1.4 incorrectly assumes that <tt>xsd:QName</tt> literals that have
no prefix don't
+ * belong to any namespace. This is incorrect: values of type
<tt>xsd:QName</tt> are resolved in
+ * the same way as element names. An unqualified literal therefore belongs
to the default
+ * namespace in scope where the <tt>xsd:QName</tt> appears.
+ * <p>
+ * Consider the following example:
+ *
+ * <pre>
+ * <deployment xmlns="http://xml.apache.org/axis/wsdd/"
+ * xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
+ * <transport name="http">
+ * <requestFlow>
+ * <handler type="URLMapper"/>
+ * <handler
type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
+ * </requestFlow>
+ * </transport>
+ * </deployment>
+ * </pre>
+ *
+ * If the <tt>type</tt> attribute is assumed to be of type
<tt>xsd:QName</tt>, then the
+ * <tt>URLMapper</tt> literal actually resolves to
+ * <tt>{http://xml.apache.org/axis/wsdd/}URLMapper</tt>. However, Axis 1.4
incorrectly assumes
+ * that it has no namespace because it is unprefixed.
+ * <p>
+ * This option allows to preserve compatibility with Axis 1.4 by
specifying a namespace that
+ * will be ignored if it is encountered in the resolution of a
<tt>xsd:QName</tt> literal
+ * without prefix.
+ */
+ public static final String OPTION_IGNORE_NAMESPACE_FOR_UNQUALIFIED_QNAME =
"IGNORE_NAMESPACE_FOR_UNQUALIFIED_QNAME";
+
protected XMLHelper createXMLHelper() {
return new AxisXMLHelper(this);
}
Modified:
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/DeployableItem.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/DeployableItem.java?rev=1418120&r1=1418119&r2=1418120&view=diff
==============================================================================
---
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/DeployableItem.java
(original)
+++
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/DeployableItem.java
Thu Dec 6 22:46:35 2012
@@ -34,6 +34,7 @@ public interface DeployableItem extends
* @return the value of the '<em>Request Flow</em>' containment reference.
* @see #setRequestFlow(Flow)
* @model containment="true"
+ * extendedMetaData="kind='element' name='requestFlow'
namespace='##targetNamespace'"
* @generated
*/
Flow getRequestFlow();
@@ -59,6 +60,7 @@ public interface DeployableItem extends
* @return the value of the '<em>Response Flow</em>' containment reference.
* @see #setResponseFlow(Flow)
* @model containment="true"
+ * extendedMetaData="kind='element' name='responseFlow'
namespace='##targetNamespace'"
* @generated
*/
Flow getResponseFlow();
Modified:
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/Deployment.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/Deployment.java?rev=1418120&r1=1418119&r2=1418120&view=diff
==============================================================================
---
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/Deployment.java
(original)
+++
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/Deployment.java
Thu Dec 6 22:46:35 2012
@@ -64,6 +64,7 @@ public interface Deployment {
* @return the value of the '<em>Global Configuration</em>' containment
reference.
* @see #setGlobalConfiguration(GlobalConfiguration)
* @model containment="true"
+ * extendedMetaData="kind='element' name='globalConfiguration'
namespace='##targetNamespace'"
* @generated
*/
GlobalConfiguration getGlobalConfiguration();
Modified:
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java?rev=1418120&r1=1418119&r2=1418120&view=diff
==============================================================================
---
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java
(original)
+++
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/WSDDUtil.java
Thu Dec 6 22:46:35 2012
@@ -39,6 +39,7 @@ public final class WSDDUtil {
AxisXMLResource resource = new AxisXMLResource();
Map options = new HashMap();
options.put(XMLResource.OPTION_EXTENDED_META_DATA,
ExtendedMetaData.INSTANCE);
+
options.put(AxisXMLResource.OPTION_IGNORE_NAMESPACE_FOR_UNQUALIFIED_QNAME,
WSDDPackageImpl.eNS_URI);
resource.load(is, options);
return (Deployment)resource.getContents().get(0);
}
Modified:
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/impl/WSDDPackageImpl.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/impl/WSDDPackageImpl.java?rev=1418120&r1=1418119&r2=1418120&view=diff
==============================================================================
---
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/impl/WSDDPackageImpl.java
(original)
+++
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/wsdd/impl/WSDDPackageImpl.java
Thu Dec 6 22:46:35 2012
@@ -2410,6 +2410,22 @@ public class WSDDPackageImpl extends EPa
"namespace", "##targetNamespace"
});
addAnnotation
+ (getDeployableItem_RequestFlow(),
+ source,
+ new String[] {
+ "kind", "element",
+ "name", "requestFlow",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getDeployableItem_ResponseFlow(),
+ source,
+ new String[] {
+ "kind", "element",
+ "name", "responseFlow",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
(getService_Namespaces(),
source,
new String[] {
@@ -2457,6 +2473,14 @@ public class WSDDPackageImpl extends EPa
"kind", "element"
});
addAnnotation
+ (getDeployment_GlobalConfiguration(),
+ source,
+ new String[] {
+ "kind", "element",
+ "name", "globalConfiguration",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
(getDeployment_Handlers(),
source,
new String[] {
Modified:
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/xml/impl/XmlFactoryImpl.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/xml/impl/XmlFactoryImpl.java?rev=1418120&r1=1418119&r2=1418120&view=diff
==============================================================================
---
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/xml/impl/XmlFactoryImpl.java
(original)
+++
axis/axis1/java/branches/EMF/axis-model/src/main/java/org/apache/axis/model/xml/impl/XmlFactoryImpl.java
Thu Dec 6 22:46:35 2012
@@ -8,6 +8,7 @@ package org.apache.axis.model.xml.impl;
import javax.xml.namespace.QName;
+import org.apache.axis.model.util.AxisXMLResource;
import org.apache.axis.model.xml.*;
import org.eclipse.emf.ecore.EClass;
@@ -103,22 +104,12 @@ public class XmlFactoryImpl extends EFac
}
}
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
public QName createQNameFromString(EDataType eDataType, String
initialValue) {
- return (QName)super.createFromString(eDataType, initialValue);
+ throw new UnsupportedOperationException("Please use " +
AxisXMLResource.class.getName() + " to load the model from XML");
}
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
public String convertQNameToString(EDataType eDataType, Object
instanceValue) {
- return super.convertToString(eDataType, instanceValue);
+ throw new UnsupportedOperationException("Please use " +
AxisXMLResource.class.getName() + " to save the model to XML");
}
/**