cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1490344 - in /cxf/branches/dkulp-nowsdl4j: api/src/main/java/org/apache/cxf/common/util/ api/src/main/resources/schemas/wsdl/ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/ rt/wsdl/src/main/java/org/apache/cxf/ws/addressing/ws...
Date Thu, 06 Jun 2013 16:32:23 GMT
Author: dkulp
Date: Thu Jun  6 16:32:23 2013
New Revision: 1490344

URL: http://svn.apache.org/r1490344
Log:
Bunch more work to reduce some usage of wsdl4j.
Fix a split package issue.

Removed:
    cxf/branches/dkulp-nowsdl4j/rt/wsdl/src/main/java/org/apache/cxf/ws/addressing/wsdl/UsingAddressing.java
    cxf/branches/dkulp-nowsdl4j/rt/wsdl/src/main/java/org/apache/cxf/ws/addressing/wsdl/jaxb.index
Modified:
    cxf/branches/dkulp-nowsdl4j/api/src/main/java/org/apache/cxf/common/util/ASMHelper.java
    cxf/branches/dkulp-nowsdl4j/api/src/main/resources/schemas/wsdl/ws-addr-wsdl.xjb
    cxf/branches/dkulp-nowsdl4j/api/src/main/resources/schemas/wsdl/ws-addr-wsdl.xsd
    cxf/branches/dkulp-nowsdl4j/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingWSDLExtensionLoader.java
    cxf/branches/dkulp-nowsdl4j/rt/wsdl/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java

Modified: cxf/branches/dkulp-nowsdl4j/api/src/main/java/org/apache/cxf/common/util/ASMHelper.java
URL: http://svn.apache.org/viewvc/cxf/branches/dkulp-nowsdl4j/api/src/main/java/org/apache/cxf/common/util/ASMHelper.java?rev=1490344&r1=1490343&r2=1490344&view=diff
==============================================================================
--- cxf/branches/dkulp-nowsdl4j/api/src/main/java/org/apache/cxf/common/util/ASMHelper.java
(original)
+++ cxf/branches/dkulp-nowsdl4j/api/src/main/java/org/apache/cxf/common/util/ASMHelper.java
Thu Jun  6 16:32:23 2013
@@ -104,17 +104,25 @@ public class ASMHelper {
         public static int CHECKCAST = 0;
         public static int INVOKEINTERFACE = 0;
         public static int GETFIELD = 0;
+        public static int GETSTATIC = 0;
         public static int ASTORE = 0;
         public static int PUTFIELD = 0;
+        public static int PUTSTATIC = 0;
         public static int RETURN = 0;
+        public static int F_APPEND = 0;
+        public static int F_SAME = 0;
+        public static int F_SAME1 = 0;
         public static int INVOKESPECIAL = 0;
         public static int ACC_PUBLIC = 0;
         public static int ACC_FINAL = 0;
         public static int ACC_SUPER = 0;
         public static int ACC_PRIVATE = 0;
+        public static int ACC_STATIC = 0;
         public static int V1_5 = 0;
+        public static int V1_6 = 0;
         public static int ACC_ABSTRACT = 0;
         public static int ACC_INTERFACE = 0;
+        public static int ACC_SYNTHETIC = 0;
         public static int ILOAD = 0;
         public static int IRETURN = 0;
         public static int NEW = 0;
@@ -433,6 +441,7 @@ public class ASMHelper {
         void visitFieldInsn(int getfield, String periodToSlashes,
                             String string, String string2);
         void visitJumpInsn(int ifnonnull, @UnwrapParam(typeMethodName = "realType") Label
nonNullLabel);
+        void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack);
         
         @WrapReturn(AnnotationVisitor.class)
         AnnotationVisitor visitAnnotation(String cls, boolean b);

Modified: cxf/branches/dkulp-nowsdl4j/api/src/main/resources/schemas/wsdl/ws-addr-wsdl.xjb
URL: http://svn.apache.org/viewvc/cxf/branches/dkulp-nowsdl4j/api/src/main/resources/schemas/wsdl/ws-addr-wsdl.xjb?rev=1490344&r1=1490343&r2=1490344&view=diff
==============================================================================
--- cxf/branches/dkulp-nowsdl4j/api/src/main/resources/schemas/wsdl/ws-addr-wsdl.xjb (original)
+++ cxf/branches/dkulp-nowsdl4j/api/src/main/resources/schemas/wsdl/ws-addr-wsdl.xjb Thu Jun
 6 16:32:23 2013
@@ -27,7 +27,4 @@
             <jaxb:package name="org.apache.cxf.ws.addressing.wsdl"/>
         </jaxb:schemaBindings>
     </jaxb:bindings>
-    <jaxb:bindings schemaLocation="ws-addr-wsdl.xsd" node="/xs:schema/xs:element[@name='UsingAddressing']">
-      <jaxb:class ref="org.apache.cxf.ws.addressing.wsdl.UsingAddressing"/>
-    </jaxb:bindings>
 </jaxb:bindings>

Modified: cxf/branches/dkulp-nowsdl4j/api/src/main/resources/schemas/wsdl/ws-addr-wsdl.xsd
URL: http://svn.apache.org/viewvc/cxf/branches/dkulp-nowsdl4j/api/src/main/resources/schemas/wsdl/ws-addr-wsdl.xsd?rev=1490344&r1=1490343&r2=1490344&view=diff
==============================================================================
--- cxf/branches/dkulp-nowsdl4j/api/src/main/resources/schemas/wsdl/ws-addr-wsdl.xsd (original)
+++ cxf/branches/dkulp-nowsdl4j/api/src/main/resources/schemas/wsdl/ws-addr-wsdl.xsd Thu Jun
 6 16:32:23 2013
@@ -41,11 +41,11 @@
     
     <xs:attribute name="Action" type="xs:anyURI"/>
     
-    <xs:element name="UsingAddressing">
-        <xs:complexType>
-            <xs:anyAttribute namespace="##other" processContents="lax"/>
-        </xs:complexType>
-    </xs:element>
+    <xs:element name="UsingAddressing" type="tns:UsingAddressing"/>
+    <xs:complexType name="UsingAddressing">
+        <xs:sequence/>
+        <xs:anyAttribute namespace="##other" processContents="lax"/>
+    </xs:complexType>
     
     <xs:simpleType name="AnonymousType">
         <xs:restriction base="xs:token">

Modified: cxf/branches/dkulp-nowsdl4j/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingWSDLExtensionLoader.java
URL: http://svn.apache.org/viewvc/cxf/branches/dkulp-nowsdl4j/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingWSDLExtensionLoader.java?rev=1490344&r1=1490343&r2=1490344&view=diff
==============================================================================
--- cxf/branches/dkulp-nowsdl4j/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingWSDLExtensionLoader.java
(original)
+++ cxf/branches/dkulp-nowsdl4j/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingWSDLExtensionLoader.java
Thu Jun  6 16:32:23 2013
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.ws.addressing.impl;
 
-import javax.wsdl.extensions.ExtensibilityElement;
 import javax.xml.bind.JAXBException;
 
 import org.apache.cxf.Bus;
@@ -42,7 +41,7 @@ public final class AddressingWSDLExtensi
     }
     public void createExtensor(WSDLManager manager,
                                 Class<?> parentType,
-                                Class<? extends ExtensibilityElement> elementType)
{
+                                Class<?> elementType) {
         try {
             JAXBExtensionHelper.addExtensions(manager.getExtensionRegistry(),
                                               parentType, 

Modified: cxf/branches/dkulp-nowsdl4j/rt/wsdl/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java
URL: http://svn.apache.org/viewvc/cxf/branches/dkulp-nowsdl4j/rt/wsdl/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java?rev=1490344&r1=1490343&r2=1490344&view=diff
==============================================================================
--- cxf/branches/dkulp-nowsdl4j/rt/wsdl/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java
(original)
+++ cxf/branches/dkulp-nowsdl4j/rt/wsdl/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java
Thu Jun  6 16:32:23 2013
@@ -77,7 +77,8 @@ public class JAXBExtensionHelper impleme
     Class<?> extensionClass;
     String jaxbNamespace;
 
-    private JAXBContext context;
+    private JAXBContext marshalContext;
+    private JAXBContext unmarshalContext;
     private Set<Class<?>> classes;
 
       
@@ -202,20 +203,31 @@ public class JAXBExtensionHelper impleme
         }
     }
 
-
-
-    private synchronized JAXBContext getContext() throws JAXBException {
-        if (context == null || classes == null) {
+    private synchronized Unmarshaller createUnmarshaller() throws JAXBException {
+        if (unmarshalContext == null || classes == null) {
             try {
                 CachedContextAndSchemas ccs 
-                    = JAXBContextCache.getCachedContextAndSchemas(typeClass, extensionClass);
+                    = JAXBContextCache.getCachedContextAndSchemas(extensionClass);
                 classes = ccs.getClasses();
-                context = ccs.getContext();
+                unmarshalContext = ccs.getContext();
             } catch (JAXBException e) {
                 throw new RuntimeException(e);
             }
         }
-        return context;
+        return unmarshalContext.createUnmarshaller();
+    }
+    private synchronized Marshaller createMarshaller() throws JAXBException {
+        if (marshalContext == null || classes == null) {
+            try {
+                CachedContextAndSchemas ccs 
+                    = JAXBContextCache.getCachedContextAndSchemas(typeClass);
+                classes = ccs.getClasses();
+                marshalContext = ccs.getContext();
+            } catch (JAXBException e) {
+                throw new RuntimeException(e);
+            }
+        }
+        return marshalContext.createMarshaller();
     }
     
     /* (non-Javadoc)
@@ -228,7 +240,7 @@ public class JAXBExtensionHelper impleme
                          final Definition wsdl, ExtensionRegistry registry) throws WSDLException
{
         // TODO Auto-generated method stub
         try {
-            Marshaller u = getContext().createMarshaller();
+            Marshaller u = createMarshaller();
             u.setProperty("jaxb.encoding", "UTF-8");
             u.setProperty("jaxb.fragment", Boolean.TRUE);
             u.setProperty("jaxb.formatted.output", Boolean.TRUE);
@@ -246,7 +258,7 @@ public class JAXBExtensionHelper impleme
                     mObj = method.invoke(objectFactory.newInstance(), new Object[] {obj});
                 }
             }
-
+            
             javax.xml.stream.XMLOutputFactory fact = javax.xml.stream.XMLOutputFactory.newInstance();
             XMLStreamWriter writer =
                 new PrettyPrintXMLStreamWriter(fact.createXMLStreamWriter(pw), parent);
@@ -300,7 +312,7 @@ public class JAXBExtensionHelper impleme
                                            ExtensionRegistry registry) throws WSDLException
{
         XMLStreamReader reader = null;
         try {
-            Unmarshaller u = getContext().createUnmarshaller();
+            Unmarshaller u = createUnmarshaller();
         
             Object o = null;
             if (namespace == null) {
@@ -415,15 +427,50 @@ public class JAXBExtensionHelper impleme
         MethodVisitor mv;
         AnnotationVisitor av0;
         
-        cw.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER, 
+        cw.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER + Opcodes.ACC_SYNTHETIC,

                  className + "Extensibility", null, 
                  className, 
                  new String[] {"javax/wsdl/extensions/ExtensibilityElement"});
 
         cw.visitSource(cls.getSimpleName() + "Extensibility.java", null);
-        fv = cw.visitField(0, "qn", "Ljavax/xml/namespace/QName;", null, null);
-        fv.visitEnd();
+        
+        fv = cw.visitField(Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC,
+                           "WSDL_REQUIRED", "Ljavax/xml/namespace/QName;", null, null);
+        fv.visitEnd();        
+        
 
+        boolean hasAttributes = false;
+        try {
+            Method m = cls.getDeclaredMethod("getOtherAttributes");
+            if (m != null && m.getReturnType() == Map.class){
+                hasAttributes = true;
+            }
+        } catch (Throwable t) {
+            //ignore 
+        }
+        if (hasAttributes) {
+            fv = cw.visitField(0, "qn", "Ljavax/xml/namespace/QName;", null, null);
+            fv.visitEnd();
+            
+            mv = cw.visitMethod(Opcodes.ACC_STATIC, "<clinit>", "()V", null, null);
+            mv.visitCode();
+            Label l0 = helper.createLabel();
+            mv.visitLabel(l0);
+            mv.visitLineNumber(64, l0);
+            mv.visitTypeInsn(Opcodes.NEW, "javax/xml/namespace/QName");
+            mv.visitInsn(Opcodes.DUP);
+            mv.visitLdcInsn("http://schemas.xmlsoap.org/wsdl/");
+            mv.visitLdcInsn("required");
+            mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "javax/xml/namespace/QName", "<init>",
"(Ljava/lang/String;Ljava/lang/String;)V");
+            mv.visitFieldInsn(Opcodes.PUTSTATIC, className + "Extensibility", "WSDL_REQUIRED",
"Ljavax/xml/namespace/QName;");
+            mv.visitInsn(Opcodes.RETURN);
+            mv.visitMaxs(4, 0);
+            mv.visitEnd();
+        } else {
+            fv = cw.visitField(Opcodes.ACC_PRIVATE, "required", "Ljava/lang/Boolean;", null,
null);
+            fv.visitEnd();
+        }
+        
         mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
         mv.visitCode();
         Label l0 = helper.createLabel();
@@ -491,35 +538,118 @@ public class JAXBExtensionHelper impleme
         mv.visitMaxs(1, 1);
         mv.visitEnd();
 
-        mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "setRequired", "(Ljava/lang/Boolean;)V",
null, null);
-        mv.visitCode();
-        l0 = helper.createLabel();
-        mv.visitLabel(l0);
-        mv.visitLineNumber(44, l0);
-        mv.visitInsn(Opcodes.RETURN);
-        l1 = helper.createLabel();
-        mv.visitLabel(l1);
-        mv.visitLocalVariable("this", "L" + className + "Extensibility;", null, l0, l1, 0);
-        mv.visitLocalVariable("required", "Ljava/lang/Boolean;", null, l0, l1, 1);
-        mv.visitMaxs(0, 2);
-        mv.visitEnd();
-
-        mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "getRequired", "()Ljava/lang/Boolean;", null,
null);
-        av0 = mv.visitAnnotation("Ljavax/xml/bind/annotation/XmlAttribute;", true);
-        av0.visit("name", "required");
-        av0.visit("namespace", "http://schemas.xmlsoap.org/wsdl/required");
-        av0.visitEnd();
-        mv.visitCode();
-        l0 = helper.createLabel();
-        mv.visitLabel(l0);
-        mv.visitLineNumber(46, l0);
-        mv.visitInsn(Opcodes.ACONST_NULL);
-        mv.visitInsn(Opcodes.ARETURN);
-        l1 = helper.createLabel();
-        mv.visitLabel(l1);
-        mv.visitLocalVariable("this", "L" + className + "Extensibility;", null, l0, l1, 0);
-        mv.visitMaxs(1, 1);
-        mv.visitEnd();
+        if (hasAttributes) {
+            mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "getRequired", "()Ljava/lang/Boolean;",
null, null);
+            mv.visitCode();
+            l0 = helper.createLabel();
+            mv.visitLabel(l0);
+            mv.visitLineNumber(66, l0);
+            mv.visitVarInsn(Opcodes.ALOAD, 0);
+            mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, className + "Extensibility", "getOtherAttributes",
"()Ljava/util/Map;");
+            mv.visitFieldInsn(Opcodes.GETSTATIC, className + "Extensibility", "WSDL_REQUIRED",
"Ljavax/xml/namespace/QName;");
+            mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/Map", "get", "(Ljava/lang/Object;)Ljava/lang/Object;");
+            mv.visitTypeInsn(Opcodes.CHECKCAST, "java/lang/String");
+            mv.visitVarInsn(Opcodes.ASTORE, 1);
+            l1 = helper.createLabel();
+            mv.visitLabel(l1);
+            mv.visitLineNumber(67, l1);
+            mv.visitVarInsn(Opcodes.ALOAD, 1);
+            l2 = helper.createLabel();
+            mv.visitJumpInsn(Opcodes.IFNONNULL, l2);
+            mv.visitInsn(Opcodes.ACONST_NULL);
+            l3 = helper.createLabel();
+            mv.visitJumpInsn(Opcodes.GOTO, l3);
+            mv.visitLabel(l2);
+            mv.visitFrame(Opcodes.F_APPEND,1, new Object[] {"java/lang/String"}, 0, null);
+            mv.visitVarInsn(Opcodes.ALOAD, 1);
+            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Ljava/lang/String;)Ljava/lang/Boolean;");
+            mv.visitLabel(l3);
+            mv.visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] {"java/lang/Boolean"});
+            mv.visitInsn(Opcodes.ARETURN);
+            Label l4 = helper.createLabel();
+            mv.visitLabel(l4);
+            mv.visitLocalVariable("this", "L" + className + "Extensibility;", null, l0, l4,
0);
+            mv.visitLocalVariable("s", "Ljava/lang/String;", null, l1, l4, 1);
+            mv.visitMaxs(2, 2);
+            mv.visitEnd();
+            
+            
+            
+            mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "setRequired", "(Ljava/lang/Boolean;)V",
null, null);
+            mv.visitCode();
+            l0 = helper.createLabel();
+            mv.visitLabel(l0);
+            mv.visitLineNumber(76, l0);
+            mv.visitVarInsn(Opcodes.ALOAD, 1);
+            l1 = helper.createLabel();
+            mv.visitJumpInsn(Opcodes.IFNONNULL, l1);
+            l2 = helper.createLabel();
+            mv.visitLabel(l2);
+            mv.visitLineNumber(77, l2);
+            mv.visitVarInsn(Opcodes.ALOAD, 0);
+            mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, className + "Extensibility", "getOtherAttributes",
"()Ljava/util/Map;");
+            mv.visitFieldInsn(Opcodes.GETSTATIC, className + "Extensibility", "WSDL_REQUIRED",
"Ljavax/xml/namespace/QName;");
+            mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/Map", "remove", "(Ljava/lang/Object;)Ljava/lang/Object;");
+            mv.visitInsn(Opcodes.POP);
+            l3 = helper.createLabel();
+            mv.visitLabel(l3);
+            mv.visitLineNumber(78, l3);
+            l4 = helper.createLabel();
+            mv.visitJumpInsn(Opcodes.GOTO, l4);
+            mv.visitLabel(l1);
+            mv.visitLineNumber(79, l1);
+            mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
+            mv.visitVarInsn(Opcodes.ALOAD, 0);
+            mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, className + "Extensibility", "getOtherAttributes",
"()Ljava/util/Map;");
+            mv.visitFieldInsn(Opcodes.GETSTATIC, className + "Extensibility", "WSDL_REQUIRED",
"Ljavax/xml/namespace/QName;");
+            mv.visitVarInsn(Opcodes.ALOAD, 1);
+            mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Boolean", "toString", "()Ljava/lang/String;");
+            mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/Map", "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
+            mv.visitInsn(Opcodes.POP);
+            mv.visitLabel(l4);
+            mv.visitLineNumber(81, l4);
+            mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
+            mv.visitInsn(Opcodes.RETURN);
+            Label l5 = helper.createLabel();
+            mv.visitLabel(l5);
+            mv.visitLocalVariable("this", "L" + className + "Extensibility;", null, l0, l5,
0);
+            mv.visitLocalVariable("b", "Ljava/lang/Boolean;", null, l0, l5, 1);
+            mv.visitMaxs(3, 2);
+            mv.visitEnd();            
+        } else {
+            mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "getRequired", "()Ljava/lang/Boolean;",
null, null);
+            mv.visitCode();
+            l0 = helper.createLabel();
+            mv.visitLabel(l0);
+            mv.visitLineNumber(68, l0);
+            mv.visitVarInsn(Opcodes.ALOAD, 0);
+            mv.visitFieldInsn(Opcodes.GETFIELD, className + "Extensibility", "required",
"Ljava/lang/Boolean;");
+            mv.visitInsn(Opcodes.ARETURN);
+            l1 = helper.createLabel();
+            mv.visitLabel(l1);
+            mv.visitLocalVariable("this", "L" + className + "Extensibility;", null, l0, l1,
0);
+            mv.visitMaxs(1, 1);
+            mv.visitEnd();
+
+            mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "setRequired", "(Ljava/lang/Boolean;)V",
null, null);
+            mv.visitCode();
+            l0 = helper.createLabel();
+            mv.visitLabel(l0);
+            mv.visitLineNumber(71, l0);
+            mv.visitVarInsn(Opcodes.ALOAD, 0);
+            mv.visitVarInsn(Opcodes.ALOAD, 1);
+            mv.visitFieldInsn(Opcodes.PUTFIELD, className + "Extensibility", "required",
"Ljava/lang/Boolean;");
+            l1 = helper.createLabel();
+            mv.visitLabel(l1);
+            mv.visitLineNumber(72, l1);
+            mv.visitInsn(Opcodes.RETURN);
+            l2 = helper.createLabel();
+            mv.visitLabel(l2);
+            mv.visitLocalVariable("this", "L" + className + "Extensibility;", null, l0, l2,
0);
+            mv.visitLocalVariable("b", "Ljava/lang/Boolean;", null, l0, l2, 1);
+            mv.visitMaxs(2, 2);
+            mv.visitEnd();
+        }
 
         cw.visitEnd();
 



Mime
View raw message