You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ews-dev@ws.apache.org by gu...@apache.org on 2005/05/24 14:12:07 UTC

svn commit: r178156 - /webservices/ews/trunk/src/org/apache/geronimo/ews/jaxrpcmapping/J2eeEmitter.java /webservices/ews/trunk/src/org/apache/geronimo/ews/jaxrpcmapping/J2eeGeneratorFactory.java

Author: guillaume
Date: Tue May 24 05:12:07 2005
New Revision: 178156

URL: http://svn.apache.org/viewcvs?rev=178156&view=rev
Log:
J2eeEmitter:
* pass wrapArrays and quiet flag to the SymbolTable
J2eeGeneratorFactory:
* update to take into account latest JavaGeneratorFactory change about
attributeGroups

Modified:
    webservices/ews/trunk/src/org/apache/geronimo/ews/jaxrpcmapping/J2eeEmitter.java
    webservices/ews/trunk/src/org/apache/geronimo/ews/jaxrpcmapping/J2eeGeneratorFactory.java

Modified: webservices/ews/trunk/src/org/apache/geronimo/ews/jaxrpcmapping/J2eeEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/src/org/apache/geronimo/ews/jaxrpcmapping/J2eeEmitter.java?rev=178156&r1=178155&r2=178156&view=diff
==============================================================================
--- webservices/ews/trunk/src/org/apache/geronimo/ews/jaxrpcmapping/J2eeEmitter.java (original)
+++ webservices/ews/trunk/src/org/apache/geronimo/ews/jaxrpcmapping/J2eeEmitter.java Tue May 24 05:12:07 2005
@@ -1,12 +1,12 @@
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed 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.
@@ -60,22 +60,12 @@
     private QName serviceQName;
     private JaxRpcMapper jaxRpcMapper;
     private SymbolTable symbolTable;
-//    private boolean usedbyws4j2ee = false;
-//    private boolean seiNeeded = true;
     protected J2EEWebServiceContext wscontext;
 
     public J2eeEmitter() {
         J2eeGeneratorFactory factory = new J2eeGeneratorFactory(this);
         setFactory(factory);
     } // ctor
-//    public J2eeEmitter(boolean usedByws4j2ee,boolean needSei,J2EEWebServiceContext wscontext) {
-//    	this.usedbyws4j2ee = usedByws4j2ee;
-//    	this.seiNeeded = needSei;
-//		this.wscontext = wscontext;
-//        J2eeGeneratorFactory factory = new J2eeGeneratorFactory(this);
-//        setFactory(factory);
-//
-//    } // ctor
 
     public J2eeEmitter(J2EEWebServiceContext wscontext, J2eeGeneratorFactory factory) {
         this.wscontext = wscontext;
@@ -124,6 +114,8 @@
                 imports,
                 verbose,
                 nowrap);
+        symbolTable.setQuiet(quiet);
+        symbolTable.setWrapArrays(wrapArrays);
         symbolTable.populate(wsdlURL, username, password);
         generate(symbolTable);
     }
@@ -245,7 +237,7 @@
 
 
         // Use the namespace uri to get the appropriate package
-      
+
         String pkg = getPackage(qName.getNamespaceURI());
         if (pkg != null) {
             fullJavaName = pkg + "." + Utils.xmlNameToJavaClass(qName.getLocalPart());
@@ -268,6 +260,8 @@
                 imports,
                 verbose,
                 nowrap);
+        symbolTable.setQuiet(quiet);
+        symbolTable.setWrapArrays(wrapArrays);
 // We run the actual Emitter in a thread that we can kill
         WSDLRunnable runnable = new WSDLRunnable(symbolTable, wsdlURI);
         Thread wsdlThread = new Thread(runnable);
@@ -410,13 +404,12 @@
 
             // A CollectionElement is an array that might need a holder
 
-			
-            
             boolean isType = ((type instanceof Type)
                              || (type instanceof CollectionElement));
 
                      if ((type.getNode() != null)
-                             && !type.getNode().getLocalName().equals("attributeGroup")
+                    && !type.getNode().getLocalName().equals("attributeGroup")
+                    && !type.getNode().getLocalName().equals("group")
                              && type.isReferenced() && isType
                              && (type.getBaseType() == null)) {
                          Generator gen = getFactory().getGenerator(type, symbolTable);
@@ -438,14 +431,15 @@
             //  because they may require a Holder)
 
             // A CollectionElement is an array that might need a holder
-            boolean isType = (type instanceof Type ||
-                    type instanceof CollectionElement);
-            if (type.getNode() != null &&
+
+            boolean isType = (type instanceof Type || type instanceof CollectionElement);
+            if (type.getNode() != null
+                    && !type.getNode().getLocalName().equals("attributeGroup")
+                    && !type.getNode().getLocalName().equals("group") &&
                     type.isReferenced() &&
                     isType &&
                     type.getBaseType() == null) {
                 Generator gen = getFactory().getGenerator(type, symbolTable);
-                //System.out.println("B= " +type.getQName());
                 gen.generate();
             }
         }
@@ -494,34 +488,6 @@
     public void setJaxRpcMapper(JaxRpcMapper jaxRpcMapper) {
         this.jaxRpcMapper = jaxRpcMapper;
     }
-
-//    /**
-//     * @return
-//     */
-//    public boolean isSeiNeeded() {
-//        return seiNeeded;
-//    }
-//
-//    /**
-//     * @return
-//     */
-//    public boolean isUsedbyws4j2ee() {
-//        return usedbyws4j2ee;
-//    }
-//
-//    /**
-//     * @param b
-//     */
-//    public void setSeiNeeded(boolean b) {
-//        seiNeeded = b;
-//    }
-//
-//    /**
-//     * @param b
-//     */
-//    public void setUsedbyws4j2ee(boolean b) {
-//        usedbyws4j2ee = b;
-//    }
 
     /**
      * @return

Modified: webservices/ews/trunk/src/org/apache/geronimo/ews/jaxrpcmapping/J2eeGeneratorFactory.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/src/org/apache/geronimo/ews/jaxrpcmapping/J2eeGeneratorFactory.java?rev=178156&r1=178155&r2=178156&view=diff
==============================================================================
--- webservices/ews/trunk/src/org/apache/geronimo/ews/jaxrpcmapping/J2eeGeneratorFactory.java (original)
+++ webservices/ews/trunk/src/org/apache/geronimo/ews/jaxrpcmapping/J2eeGeneratorFactory.java Tue May 24 05:12:07 2005
@@ -1,12 +1,12 @@
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed 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.
@@ -192,7 +192,6 @@
     protected Writers bindingWriters = new Writers();
 
     public Generator getGenerator(Binding binding, SymbolTable symbolTable) {
-//        Generator writer = new JavaBindingWriter(emitter, binding, symbolTable);
         Generator writer = new J2eeBindingWriter(emitter, binding, symbolTable);
         BindingEntry bEntry = symbolTable.getBindingEntry(binding.getQName());
         bindingWriters.addStuff(writer, bEntry, symbolTable);
@@ -322,7 +321,7 @@
                 if (entry instanceof TypeEntry) {
                     uniqueNum = javifyTypeEntryName(symbolTable, (TypeEntry) entry, anonQNames, uniqueNum);
                 }
-                // If it is not a type, then use this entry's QName to 
+                // If it is not a type, then use this entry's QName to
                 // generate its name.
                 else {
                     entry.setName(emitter.getJavaName(entry.getQName()));
@@ -383,8 +382,8 @@
             // Get the QName of the ref'd TypeEntry, which
             // is will be used to javify the name
             QName typeQName = tEntry.getQName();
-            
-            // In case of <xsd:list itemType="...">, 
+
+            // In case of <xsd:list itemType="...">,
             // set typeQName to the value of the itemType attribute.
             QName itemType = SchemaUtils.getListItemType(tEntry.getNode());
             boolean isArray = false;
@@ -404,25 +403,6 @@
 
                 String localName = typeQName.getLocalPart();
 
-                // Check to see if this is an anonymous type,
-                // if it is, replace Axis' ANON_TOKEN with
-                // an underscore to make sure we don't run
-                // into name collisions with similarly named
-                // non-anonymous types
-                
-                // OW Guillaume Change
-                // no replace > into _ (otherwise info from mapping file is not read)
-                /*
-                StringBuffer sb = new StringBuffer(localName);
-                int aidx = -1;
-                while ((aidx = sb.toString().indexOf(SymbolTable.ANON_TOKEN)) > -1) {
-                    sb.replace(aidx,
-                            aidx + SymbolTable.ANON_TOKEN.length(),
-                            "_");
-                }
-                localName = sb.toString();
-                typeQName = new QName(typeQName.getNamespaceURI(), localName);
-*/
                 // If there is already an existing type,
                 // there will be a collision.
                 // If there is an existing anon type,
@@ -531,7 +511,7 @@
                     null);
         } catch (IOException e) {
         }
-        
+
         // Inspect each TypeEntry referenced in a Fault Message Part
         String exceptionClassName = null;
         QName faultMessageQName = fault.getMessage().getQName();
@@ -548,7 +528,7 @@
 
             // remember the QName of the type.
             faultXmlType = te.getQName();
-            
+
             // Determine if the te should be processed using the
             // simple type mapping or the complex type mapping
             // NOTE: treat array types as simple types
@@ -685,7 +665,7 @@
                 boolean resolve = true;
                 // Common Special Case:
                 // If a Type and Element have the same QName, and the Element
-                // references the Type, then they are the same class so 
+                // references the Type, then they are the same class so
                 // don't bother mangling.
                 if (v.size() == 2 &&
                         ((v.elementAt(0) instanceof Element &&
@@ -733,7 +713,7 @@
                             entry.setName(mangleName(entry.getName(),
                                     "_ElemType"));
 
-                            // If this global element was defined using 
+                            // If this global element was defined using
                             // an anonymous type, then need to change the
                             // java name of the anonymous type to match.
                             QName anonQName = new QName(entry.getQName().getNamespaceURI(),
@@ -978,7 +958,7 @@
         signature = signature + ") throws java.rmi.RemoteException";
         if (parms != null && parms.faults != null) {
             // Collect the list of faults into a single string, separated by commas.
-            
+
             Iterator i = parms.faults.values().iterator();
             while (i.hasNext()) {
                 Fault fault = (Fault) i.next();
@@ -1005,7 +985,7 @@
                     // If entry is a BindingEntry, look at all the Parameters
                     // in its portType
                     BindingEntry bEntry = (BindingEntry) v.get(i);
-//					  PortTypeEntry ptEntry = 
+//					  PortTypeEntry ptEntry =
 //							  symbolTable.getPortTypeEntry(bEntry.getBinding().getPortType().getQName());
                     Iterator operations =
                             bEntry.getParameters().values().iterator();
@@ -1014,7 +994,7 @@
                         for (int j = 0; j < parms.list.size(); ++j) {
                             Parameter p =
                                     (Parameter) parms.list.get(j);
-                            
+
                             // If the given parameter is an inout or out parameter, then
                             // set a HOLDER_IS_NEEDED flag using the dynamicVar design.
                             if (p.getMode() != Parameter.IN) {
@@ -1028,7 +1008,7 @@
                                             Boolean.TRUE);
                                 }
 
-                                // If the type is a DefinedElement, need to 
+                                // If the type is a DefinedElement, need to
                                 // set HOLDER_IS_NEEDED on the anonymous type.
                                 QName anonQName = SchemaUtils.
                                         getElementAnonQName(p.getType().getNode());
@@ -1081,7 +1061,7 @@
 //    	try{
 //            if(emitter.isUsedbyws4j2ee()){
 //            	return Class.forName("org.apache.geronimo.ews.ws4j2ee.toWs.ws.J2eeDeployWriter");
-//            }else 
+//            }else
 //            	return  JavaDeployWriter.class;
 //        } catch (Exception e) {
 //        	e.printStackTrace();



---------------------------------------------------------------------
To unsubscribe, e-mail: ews-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: ews-dev-help@ws.apache.org