axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r544049 - in /webservices/axis2/trunk/java/modules: java2wsdl/src/org/apache/ws/java2wsdl/ java2wsdl/src/org/apache/ws/java2wsdl/utils/ kernel/src/org/apache/axis2/deployment/util/ kernel/src/org/apache/axis2/description/ kernel/src/org/apa...
Date Mon, 04 Jun 2007 04:47:42 GMT
Author: dims
Date: Sun Jun  3 21:47:40 2007
New Revision: 544049

URL: http://svn.apache.org/viewvc?view=rev&rev=544049
Log:
Thinking about adding a JAXB-RI based Schema Generator, so starting down the path of making
the SchemaGenerator pluggable by introducing an interface.


Added:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
  (contents, props changed)
      - copied, changed from r544041, webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
Modified:
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java?view=diff&rev=544049&r1=544048&r2=544049
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
Sun Jun  3 21:47:40 2007
@@ -2,10 +2,11 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
-import org.apache.axis2.description.java2wsdl.SchemaGenerator;
+import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator;
 import org.apache.axis2.description.java2wsdl.NamespaceGenerator;
 import org.apache.axis2.description.java2wsdl.DefaultNamespaceGenerator;
 import org.apache.axis2.description.java2wsdl.Java2WSDLUtils;
+import org.apache.axis2.description.java2wsdl.SchemaGenerator;
 import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisService2WSDL11;
@@ -18,9 +19,9 @@
 
 import java.io.OutputStream;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Map;
 import java.util.HashMap;
+
 /*
 * Copyright 2004,2005 The Apache Software Foundation.
 *
@@ -66,6 +67,7 @@
     private Map pkg2nsMap = null;
     private boolean pretty = true;
     private String wsdlVersion = WSDL_VERSION_1;
+    private String schemaGenClassName = null;
 
     public String getSchemaTargetNamespace() throws Exception {
         if ( schemaTargetNamespace == null ) {
@@ -165,7 +167,7 @@
      * @throws Exception
      */
     public void generateWSDL() throws Exception {
-        SchemaGenerator schemaGenerator = new SchemaGenerator(classLoader,
+        SchemaGenerator schemaGenerator = resolveSchemaGen(classLoader,
                                                     className,
                                                     getSchemaTargetNamespace(), 
                                                     getSchemaTargetNamespacePrefix());
@@ -272,6 +274,14 @@
         this.nsGenClassName = nsGenClassName;
     }
 
+    public String getSchemaGenClassName() {
+        return schemaGenClassName;
+    }
+
+    public void setSchemaGenClassName(String schemaGenClassName) {
+        this.schemaGenClassName = schemaGenClassName;
+    }
+
     public Map getPkg2nsMap() {
         return pkg2nsMap;
     }
@@ -292,6 +302,24 @@
             }
         }
         return nsGen;
+    }
+
+    private SchemaGenerator resolveSchemaGen(ClassLoader loader, String className,
+                           String schematargetNamespace,
+                           String schematargetNamespacePrefix) throws Exception {
+        SchemaGenerator schemaGen = null;
+        if(this.schemaGenClassName == null){
+            schemaGen = new DefaultSchemaGenerator(loader, className, schematargetNamespace,
schematargetNamespacePrefix);
+        } else {
+            try {
+                schemaGen = (DefaultSchemaGenerator) Class.forName(this.nsGenClassName).getConstructor(
+                        new Class[]{ClassLoader.class, String.class, String.class, String.class}).newInstance(
+                            new Object[]{loader, className, schematargetNamespace, schematargetNamespacePrefix});
+            } catch ( Exception e ) {
+                schemaGen = new DefaultSchemaGenerator(loader, className, schematargetNamespace,
schematargetNamespacePrefix);
+            }
+        }
+        return schemaGen;
     }
 
     public boolean isPretty() {

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java?view=diff&rev=544049&r1=544048&r2=544049
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
(original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
Sun Jun  3 21:47:40 2007
@@ -193,6 +193,12 @@
             java2WsdlBuilder.setNsGenClassName(option.getOptionValue());
         }
         
+        option = loadOption(Java2WSDLConstants.SCHEMA_GENERATOR_OPTION,
+                            Java2WSDLConstants.SCHEMA_GENERATOR_OPTION_LONG, optionsMap);
+        if ( option != null ) {
+            java2WsdlBuilder.setSchemaGenClassName(option.getOptionValue());
+        }
+
         option = loadOption(Java2WSDLConstants.JAVA_PKG_2_NSMAP_OPTION,
                             Java2WSDLConstants.JAVA_PKG_2_NSMAP_OPTION_LONG, optionsMap);
         java2WsdlBuilder.setPkg2nsMap(loadJavaPkg2NamespaceMap(option));

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java?view=diff&rev=544049&r1=544048&r2=544049
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java
(original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java
Sun Jun  3 21:47:40 2007
@@ -62,6 +62,8 @@
     private ArrayList pkg2nsMappings = new ArrayList();
 
     private MappingSet mappings = new MappingSet();
+    
+    private String schemaGenClassName = null;
 
     public String getLocationUri() {
         return locationUri;
@@ -177,6 +179,10 @@
                 Java2WSDLConstants.NAMESPACE_GENERATOR_OPTION,
                 getNsGenClassName());
 
+        addToOptionMap(optionMap,
+                Java2WSDLConstants.SCHEMA_GENERATOR_OPTION,
+                getSchemaGenClassName());
+
         loadPkg2NsMap();
         addToOptionMap(optionMap,
                 Java2WSDLConstants.JAVA_PKG_2_NSMAP_OPTION,
@@ -343,6 +349,14 @@
 
     public void setNsGenClassName(String nsGenClassName) {
         this.nsGenClassName = nsGenClassName;
+    }
+
+    public String getSchemaGenClassName() {
+        return schemaGenClassName;
+    }
+
+    public void setSchemaGenClassName(String schemaGenClassName) {
+        this.schemaGenClassName = schemaGenClassName;
     }
 
     public void loadPkg2NsMap() {

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java?view=diff&rev=544049&r1=544048&r2=544049
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
(original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
Sun Jun  3 21:47:40 2007
@@ -44,6 +44,8 @@
                 Java2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION.equalsIgnoreCase(optionType)
||
                 Java2WSDLConstants.NAMESPACE_GENERATOR_OPTION.equalsIgnoreCase(optionType)
||
                 Java2WSDLConstants.NAMESPACE_GENERATOR_OPTION_LONG.equalsIgnoreCase(optionType)
||
+                Java2WSDLConstants.SCHEMA_GENERATOR_OPTION.equalsIgnoreCase(optionType) ||
+                Java2WSDLConstants.SCHEMA_GENERATOR_OPTION_LONG.equalsIgnoreCase(optionType)
||
                 Java2WSDLConstants.JAVA_PKG_2_NSMAP_OPTION.equalsIgnoreCase(optionType) ||
                 Java2WSDLConstants.JAVA_PKG_2_NSMAP_OPTION_LONG.equalsIgnoreCase(optionType)
||
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?view=diff&rev=544049&r1=544048&r2=544049
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
Sun Jun  3 21:47:40 2007
@@ -6,7 +6,6 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.deployment.DeploymentConstants;
 import org.apache.axis2.deployment.DeploymentException;
 import org.apache.axis2.deployment.DeploymentClassLoader;
 import org.apache.axis2.deployment.repository.util.ArchiveReader;
@@ -23,6 +22,7 @@
 import org.apache.axis2.description.java2wsdl.TypeTable;
 import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
 import org.apache.axis2.description.java2wsdl.AnnotationConstants;
+import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator;
 import org.apache.axis2.description.java2wsdl.SchemaGenerator;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.Handler;
@@ -48,7 +48,6 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
-import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -311,7 +310,7 @@
         map.put(Java2WSDLConstants.DEFAULT_SCHEMA_NAMESPACE_PREFIX,
                 Java2WSDLConstants.URI_2001_SCHEMA_XSD);
         axisService.setNameSpacesMap(map);
-        SchemaGenerator schemaGenerator = new SchemaGenerator(serviceClassLoader,
+        SchemaGenerator schemaGenerator = new DefaultSchemaGenerator(serviceClassLoader,
                                                               serviceClass.trim(),
                                                               axisService.getSchematargetNamespace(),
                                                               axisService.getSchematargetNamespacePrefix());

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=544049&r1=544048&r2=544049
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
Sun Jun  3 21:47:40 2007
@@ -21,9 +21,9 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.description.java2wsdl.TypeTable;
-import org.apache.axis2.description.java2wsdl.AnnotationConstants;
-import org.apache.axis2.description.java2wsdl.SchemaGenerator;
+import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator;
 import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
+import org.apache.axis2.description.java2wsdl.SchemaGenerator;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
@@ -60,7 +60,6 @@
 import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
 import org.apache.ws.commons.schema.utils.NamespaceMap;
 import org.apache.ws.commons.schema.utils.NamespacePrefixList;
-import org.codehaus.jam.JAnnotation;
 import org.codehaus.jam.JMethod;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
@@ -1553,7 +1552,7 @@
         ArrayList excludeOpeartion = new ArrayList();
 
         try {
-            schemaGenerator = new SchemaGenerator(loader,
+            schemaGenerator = new DefaultSchemaGenerator(loader,
                                                   implClass, schemaNamespace,
                                                   Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX);
             schemaGenerator.setElementFormDefault(Java2WSDLConstants.FORM_DEFAULT_UNQUALIFIED);
@@ -1737,7 +1736,7 @@
 
 
         try {
-            schemaGenerator = new SchemaGenerator(serviceClassLoader,
+            schemaGenerator = new DefaultSchemaGenerator(serviceClassLoader,
                                                   implClass, schemaNameSpace,
                                                   axisService.getSchematargetNamespacePrefix());
             schemaGenerator.setElementFormDefault(Java2WSDLConstants.FORM_DEFAULT_UNQUALIFIED);

Copied: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
(from r544041, webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?view=diff&rev=544049&p1=webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java&r1=544041&p2=webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java&r2=544049
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
Sun Jun  3 21:47:40 2007
@@ -39,7 +39,6 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.List;
-import java.lang.reflect.Array;
 
 /*
 * Copyright 2004,2005 The Apache Software Foundation.
@@ -58,9 +57,9 @@
 *
 */
 
-public class SchemaGenerator implements Java2WSDLConstants {
+public class DefaultSchemaGenerator implements Java2WSDLConstants, SchemaGenerator {
 
-    private static final Log log = LogFactory.getLog(SchemaGenerator.class);
+    private static final Log log = LogFactory.getLog(DefaultSchemaGenerator.class);
 
     public static final String NAME_SPACE_PREFIX = "ax2";// axis2 name space
 
@@ -119,7 +118,7 @@
         this.nsGen = nsGen;
     }
 
-    public SchemaGenerator(ClassLoader loader, String className,
+    public DefaultSchemaGenerator(ClassLoader loader, String className,
                            String schematargetNamespace,
                            String schematargetNamespacePrefix)
             throws Exception {
@@ -676,10 +675,6 @@
     public void setExcludeMethods(ArrayList excludeMethods) {
         if (excludeMethods == null) excludeMethods = new ArrayList();
         this.excludeMethods = excludeMethods;
-    }
-
-    public List getExcludeMethods() {
-        return this.excludeMethods;
     }
 
     public String getSchemaTargetNameSpace() {

Propchange: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java?view=diff&rev=544049&r1=544048&r2=544049
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
Sun Jun  3 21:47:40 2007
@@ -104,6 +104,7 @@
     String ELEMENT_FORM_DEFAULT_OPTION = "efd";
     String EXTRA_CLASSES_DEFAULT_OPTION = "xc";
     String NAMESPACE_GENERATOR_OPTION = "nsg";
+    String SCHEMA_GENERATOR_OPTION = "sg";
     String JAVA_PKG_2_NSMAP_OPTION = "p2n";
     String WSDL_VERSION_OPTION = "wv";
 
@@ -125,6 +126,7 @@
     String ELEMENT_FORM_DEFAULT_OPTION_LONG = "elementFormDefault";
     String EXTRA_CLASSES_DEFAULT_OPTION_LONG = "extraClasses";
     String NAMESPACE_GENERATOR_OPTION_LONG = "namespaceGenerator";
+    String SCHEMA_GENERATOR_OPTION_LONG = "schemaGenerator";
     String JAVA_PKG_2_NSMAP_OPTION_LONG = "package2Namespace";
     String WSDL_VERSION_OPTION_LONG = "wsdl-version";
 

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java?view=auto&rev=544049
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
(added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
Sun Jun  3 21:47:40 2007
@@ -0,0 +1,52 @@
+package org.apache.axis2.description.java2wsdl;
+
+import org.codehaus.jam.JMethod;
+
+import java.util.Collection;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/*
+* Copyright 2004,2005 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.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+public interface SchemaGenerator {
+    void setNsGen(NamespaceGenerator nsGen);
+
+    Collection generateSchema() throws Exception;
+
+    TypeTable getTypeTable();
+
+    JMethod[] getMethods();
+
+    void setExcludeMethods(ArrayList excludeMethods);
+
+    String getSchemaTargetNameSpace();
+
+    void setAttrFormDefault(String attrFormDefault);
+
+    void setElementFormDefault(String elementFormDefault);
+
+    void setExtraClasses(ArrayList extraClasses);
+
+    void setUseWSDLTypesNamespace(boolean useWSDLTypesNamespace);
+
+    void setPkg2nsmap(Map pkg2nsmap);
+
+    String getTargetNamespace();
+
+    void setNonRpcMethods(ArrayList nonRpcMethods);
+}



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


Mime
View raw message