axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r785384 - 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/java2wsdl/
Date Tue, 16 Jun 2009 20:38:00 GMT
Author: veithen
Date: Tue Jun 16 20:37:59 2009
New Revision: 785384

URL: http://svn.apache.org/viewvc?rev=785384&view=rev
Log:
Some more Java 5 stuff and corrected a mistake in my last commit.

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/utils/Java2WSDLCommandLineOption.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.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/java2wsdl/DefaultSchemaGenerator.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
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java?rev=785384&r1=785383&r2=785384&view=diff
==============================================================================
--- 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
Tue Jun 16 20:37:59 2009
@@ -41,7 +41,6 @@
 
 import java.io.OutputStream;
 import java.lang.reflect.Constructor;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
@@ -67,10 +66,10 @@
 	private String style = Java2WSDLConstants.DOCUMENT;
 	private String use = Java2WSDLConstants.LITERAL;
 	private String locationUri;
-	private ArrayList extraClasses;
+	private ArrayList<String> extraClasses;
 
 	private String nsGenClassName = null;
-	private Map pkg2nsMap = null;
+	private Map<String,String> pkg2nsMap = null;
 	private boolean pretty = true;
 	private String wsdlVersion = WSDL_VERSION_1;
 	private String schemaGenClassName = null;
@@ -80,7 +79,7 @@
     // location of the class name to package mapping file
     // File is simple file with qualifiedClassName:SchemaQName
     private String mappingFileLocation;
-    private HashMap messageReceivers = null;
+    private HashMap<String,MessageReceiver> messageReceivers = null;
 
     public Java2WSDLBuilder() {
 		try {
@@ -111,7 +110,7 @@
 	}
 
     public Java2WSDLBuilder(OutputStream out, String className,
-                            ClassLoader classLoader, HashMap messageReceivers) {
+                            ClassLoader classLoader, HashMap<String,MessageReceiver>
messageReceivers) {
         this(out, className, classLoader);
         this.messageReceivers = messageReceivers;
     }
@@ -213,7 +212,7 @@
 				className, getSchemaTargetNamespace(),
 				getSchemaTargetNamespacePrefix());
 
-		ArrayList excludedOperation = new ArrayList();
+		ArrayList<String> excludedOperation = new ArrayList<String>();
 		Utils.addExcludeMethods(excludedOperation);
 		schemaGenerator.setExcludeMethods(excludedOperation);
 		schemaGenerator.setAttrFormDefault(getAttrFormDefault());
@@ -231,13 +230,13 @@
 		}
 
         if(messageReceivers == null) {
-            messageReceivers = new HashMap();
-            Class inOnlyMessageReceiver = Loader
+            messageReceivers = new HashMap<String,MessageReceiver>();
+            Class<?> inOnlyMessageReceiver = Loader
                     .loadClass("org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver");
             MessageReceiver messageReceiver = (MessageReceiver) inOnlyMessageReceiver
                     .newInstance();
             messageReceivers.put(WSDL2Constants.MEP_URI_IN_ONLY, messageReceiver);
-            Class inoutMessageReceiver = Loader
+            Class<?> inoutMessageReceiver = Loader
                     .loadClass("org.apache.axis2.rpc.receivers.RPCMessageReceiver");
             MessageReceiver inOutmessageReceiver = (MessageReceiver) inoutMessageReceiver
                     .newInstance();
@@ -309,11 +308,11 @@
 		this.elementFormDefault = elementFormDefault;
 	}
 
-	public ArrayList getExtraClasses() {
+	public ArrayList<String> getExtraClasses() {
 		return extraClasses;
 	}
 
-	public void setExtraClasses(ArrayList extraClasses) {
+	public void setExtraClasses(ArrayList<String> extraClasses) {
 		this.extraClasses = extraClasses;
 	}
 
@@ -333,11 +332,11 @@
 		this.schemaGenClassName = schemaGenClassName;
 	}
 
-	public Map getPkg2nsMap() {
+	public Map<String,String> getPkg2nsMap() {
 		return pkg2nsMap;
 	}
 
-	public void setPkg2nsMap(Map pkg2nsMap) {
+	public void setPkg2nsMap(Map<String,String> pkg2nsMap) {
 		this.pkg2nsMap = pkg2nsMap;
 	}
 
@@ -373,8 +372,8 @@
 
 		} else {
 			try {
-				Class clazz = Class.forName(this.schemaGenClassName);
-				Constructor constructor = clazz.getConstructor(new Class[] {
+				Class<?> clazz = Class.forName(this.schemaGenClassName);
+				Constructor<?> constructor = clazz.getConstructor(new Class[] {
 						ClassLoader.class, String.class, String.class,
 						String.class });
 				schemaGen = (SchemaGenerator) constructor

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?rev=785384&r1=785383&r2=785384&view=diff
==============================================================================
--- 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
Tue Jun 16 20:37:59 2009
@@ -38,7 +38,7 @@
     public static final String WSDL_FILENAME_SUFFIX = ".wsdl";
     public static final String COMMA = ",";
 
-    public Java2WSDLCodegenEngine(Map optionsMap) throws Exception {
+    public Java2WSDLCodegenEngine(Map<String,Java2WSDLCommandLineOption> optionsMap)
throws Exception {
         //create a new  Java2WSDLBuilder and populate it
         Java2WSDLCommandLineOption option = loadOption(Java2WSDLConstants.CLASSNAME_OPTION,
Java2WSDLConstants.CLASSNAME_OPTION_LONG, optionsMap);
         String className = option == null ? null : option.getOptionValue();
@@ -59,7 +59,7 @@
         java2WsdlBuilder.generateWSDL();
     }
 
-    private FileOutputStream resolveOutputStream(String className, Map optionsMap) throws
Exception
+    private FileOutputStream resolveOutputStream(String className, Map<String,Java2WSDLCommandLineOption>
optionsMap) throws Exception
     {
         Java2WSDLCommandLineOption option = loadOption(Java2WSDLConstants.OUTPUT_LOCATION_OPTION,
                                                        Java2WSDLConstants.OUTPUT_LOCATION_OPTION_LONG,
optionsMap);
@@ -96,7 +96,7 @@
         return out;
     }
     
-    private ClassLoader resolveClassLoader(Map optionsMap) throws Exception
+    private ClassLoader resolveClassLoader(Map<String,Java2WSDLCommandLineOption> optionsMap)
throws Exception
     {
         // if the class path is present, create a URL class loader with those
         //class path entries present. if not just take the  TCCL
@@ -106,9 +106,9 @@
         ClassLoader classLoader;
 
         if (option != null) {
-            ArrayList optionValues = option.getOptionValues();
+            ArrayList<String> optionValues = option.getOptionValues();
             URL[] urls = new URL[optionValues.size()];
-            String[] classPathEntries = (String[]) optionValues.toArray(new String[optionValues.size()]);
+            String[] classPathEntries = optionValues.toArray(new String[optionValues.size()]);
 
             try {
                 for (int i = 0; i < classPathEntries.length; i++) {
@@ -136,7 +136,7 @@
         return classLoader;
     }
 
-    private void configureJava2WSDLBuilder(Map optionsMap, String className) throws Exception
+    private void configureJava2WSDLBuilder(Map<String,Java2WSDLCommandLineOption> optionsMap,
String className) throws Exception
     {
         //set the other parameters to the builder
         Java2WSDLCommandLineOption option = loadOption(Java2WSDLConstants.SCHEMA_TARGET_NAMESPACE_OPTION,
@@ -187,7 +187,7 @@
         
         option = loadOption(Java2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION,
                             Java2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION_LONG, optionsMap);
-        java2WsdlBuilder.setExtraClasses(option == null ? new ArrayList() : option.getOptionValues());
+        java2WsdlBuilder.setExtraClasses(option == null ? new ArrayList<String>() :
option.getOptionValues());
         
         option = loadOption(Java2WSDLConstants.NAMESPACE_GENERATOR_OPTION,
                             Java2WSDLConstants.NAMESPACE_GENERATOR_OPTION_LONG, optionsMap);
@@ -238,17 +238,19 @@
         }
     }
     
-    private Java2WSDLCommandLineOption loadOption(String shortOption, String longOption,
Map options) {
+    private Java2WSDLCommandLineOption loadOption(String shortOption, String longOption,
+                Map<String,Java2WSDLCommandLineOption> options) {
+        
         //short option gets precedence
         Java2WSDLCommandLineOption option = null;
         if (longOption != null) {
-            option = (Java2WSDLCommandLineOption) options.get(longOption);
+            option = options.get(longOption);
             if (option != null) {
                 return option;
             }
         }
         if (shortOption != null) {
-            option = (Java2WSDLCommandLineOption) options.get(shortOption);
+            option = options.get(shortOption);
         }
 
         return option;
@@ -261,16 +263,16 @@
         
     }
     
-    protected Map loadJavaPkg2NamespaceMap(Java2WSDLCommandLineOption option) 
+    protected Map<String,String> loadJavaPkg2NamespaceMap(Java2WSDLCommandLineOption
option) 
     { 
-        Map pkg2nsMap = new Hashtable();
+        Map<String,String> pkg2nsMap = new Hashtable<String,String>();
         if (option != null) 
         {
-            ArrayList optionValues = option.getOptionValues();
+            ArrayList<String> optionValues = option.getOptionValues();
             String anOptionValue ;
             for ( int count = 0 ; count < optionValues.size() ; ++count )
             {
-                anOptionValue = ((String)optionValues.get(count)).trim();
+                anOptionValue = optionValues.get(count).trim();
                 
                 //an option value will be of the form [java package, namespace]
                 //hence we take the two substrings starting after '[' and upto ',' and

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOption.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOption.java?rev=785384&r1=785383&r2=785384&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOption.java
(original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOption.java
Tue Jun 16 20:37:59 2009
@@ -26,11 +26,11 @@
 public class Java2WSDLCommandLineOption implements Java2WSDLConstants {
 
     private String type;
-       private ArrayList optionValues;
+       private ArrayList<String> optionValues;
 
        public Java2WSDLCommandLineOption(String type, String[] values) {
            setOptionType(type);
-           ArrayList arrayList = new ArrayList(values.length);
+           ArrayList<String> arrayList = new ArrayList<String>(values.length);
            for (int i = 0; i < values.length; i++) {
                arrayList.add(values[i]);
            }
@@ -47,7 +47,7 @@
        /**
         * @param type
         */
-       public Java2WSDLCommandLineOption(String type, ArrayList values) {
+       public Java2WSDLCommandLineOption(String type, ArrayList<String> values) {
            setOptionType(type);
 
            if (null != values) {
@@ -69,7 +69,7 @@
         */
        public String getOptionValue() {
            if (optionValues != null)
-               return (String) optionValues.get(0);
+               return optionValues.get(0);
            else
                return null;
        }
@@ -79,7 +79,7 @@
        /**
         * @return Returns the optionValues.
         */
-       public ArrayList getOptionValues() {
+       public ArrayList<String> getOptionValues() {
            return optionValues;
        }
 

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.java?rev=785384&r1=785383&r2=785384&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.java
(original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.java
Tue Jun 16 20:37:59 2009
@@ -23,7 +23,6 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -32,9 +31,9 @@
     private static int NEW_OPTION = 1;
     private static int SUB_PARAM_OF_OPTION = 2;
 
-    private Map commandLineOptions;
+    private Map<String,Java2WSDLCommandLineOption> commandLineOptions;
 
-    public Java2WSDLCommandLineOptionParser(Map commandLineOptions) {
+    public Java2WSDLCommandLineOptionParser(Map<String,Java2WSDLCommandLineOption>
commandLineOptions) {
         this.commandLineOptions = commandLineOptions;
     }
 
@@ -49,8 +48,9 @@
      * @param args
      * @return CommandLineOption List
      */
-    private Map parse(String[] args) {
-        Map commandLineOptions = new HashMap();
+    private Map<String,Java2WSDLCommandLineOption> parse(String[] args) {
+        Map<String,Java2WSDLCommandLineOption> commandLineOptions
+                = new HashMap<String,Java2WSDLCommandLineOption>();
 
         if (0 == args.length)
             return commandLineOptions;
@@ -60,17 +60,17 @@
         //State 2 means earlier one was a sub param of a -option
 
         int state = STARTED;
-        ArrayList optionBundle = null;
+        ArrayList<String> optionBundle = null;
         String optionType = null;
         Java2WSDLCommandLineOption commandLineOption;
 
-        for (int i = 0; i < args.length; i++) {
+        for (String arg : args) {
 
-            if (args[i].startsWith("-")) {
+            if (arg.startsWith("-")) {
                 if (STARTED == state) {
                     // fresh one
                     state = NEW_OPTION;
-                    optionType = args[i];
+                    optionType = arg;
                 } else if (SUB_PARAM_OF_OPTION == state || NEW_OPTION == state) {
                     // new one but old one should be saved
                     commandLineOption =
@@ -78,7 +78,7 @@
                     commandLineOptions.put(commandLineOption.getOptionType(),
                             commandLineOption);
                     state = NEW_OPTION;
-                    optionType = args[i];
+                    optionType = arg;
                     optionBundle = null;
                 }
             } else {
@@ -92,18 +92,18 @@
                     return commandLineOptions;
 
                 } else if (NEW_OPTION == state) {
-                    Java2WSDLCommandLineOption old = (Java2WSDLCommandLineOption)commandLineOptions.get(getOptionType(optionType));
+                    Java2WSDLCommandLineOption old = commandLineOptions.get(getOptionType(optionType));
                     if(old !=null){
-                        old.getOptionValues().add(args[i]);
+                        old.getOptionValues().add(arg);
                         optionBundle = null;
                         state = STARTED;
                     } else {
-                        optionBundle = new ArrayList();
-                        optionBundle.add(args[i]);
+                        optionBundle = new ArrayList<String>();
+                        optionBundle.add(arg);
                         state = SUB_PARAM_OF_OPTION;
                     }
                 } else if (SUB_PARAM_OF_OPTION == state) {
-                    optionBundle.add(args[i]);
+                    optionBundle.add(arg);
                 }
 
             }
@@ -125,16 +125,13 @@
         return type;
     }
 
-    public Map getAllOptions() {
+    public Map<String,Java2WSDLCommandLineOption> getAllOptions() {
         return this.commandLineOptions;
     }
 
-    public List getInvalidOptions(Java2WSDLOptionsValidator validator) {
-        List faultList = new ArrayList();
-        Iterator iterator = this.commandLineOptions.values().iterator();
-        while (iterator.hasNext()) {
-            Java2WSDLCommandLineOption commandLineOption = ((Java2WSDLCommandLineOption)
(iterator
-                    .next()));
+    public List<Java2WSDLCommandLineOption> getInvalidOptions(Java2WSDLOptionsValidator
validator) {
+        List<Java2WSDLCommandLineOption> faultList = new ArrayList<Java2WSDLCommandLineOption>();
+        for (Java2WSDLCommandLineOption commandLineOption : commandLineOptions.values())
{
             if (validator.isInvalid(commandLineOption)) {
                 faultList.add(commandLineOption);
             }

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?rev=785384&r1=785383&r2=785384&view=diff
==============================================================================
--- 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
Tue Jun 16 20:37:59 2009
@@ -835,7 +835,7 @@
      *
      * @param excludeList an ArrayList containing method names - we'll add ours to this.
      */
-    public static void addExcludeMethods(ArrayList excludeList) {
+    public static void addExcludeMethods(ArrayList<String> excludeList) {
         excludeList.add("init");
         excludeList.add("setOperationContext");
         excludeList.add("startUp");

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?rev=785384&r1=785383&r2=785384&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
Tue Jun 16 20:37:59 2009
@@ -87,9 +87,9 @@
 
     protected String elementFormDefault = null;
 
-    protected ArrayList<Method> excludeMethods = new ArrayList<Method>();
+    protected ArrayList<String> excludeMethods = new ArrayList<String>();
 
-    protected ArrayList<Class<?>> extraClasses = null;
+    protected ArrayList<String> extraClasses = null;
 
     protected boolean useWSDLTypesNamespace = false;
 
@@ -1329,8 +1329,8 @@
         return NAME_SPACE_PREFIX + prefixCount++;
     }
 
-    public void setExcludeMethods(ArrayList<Method> excludeMethods) {
-        if (excludeMethods == null) excludeMethods = new ArrayList<Method>();
+    public void setExcludeMethods(ArrayList<String> excludeMethods) {
+        if (excludeMethods == null) excludeMethods = new ArrayList<String>();
         this.excludeMethods = excludeMethods;
     }
 
@@ -1387,14 +1387,14 @@
         }
     }
 
-    public ArrayList<Class<?>> getExtraClasses() {
+    public ArrayList<String> getExtraClasses() {
         if (extraClasses == null) {
-            extraClasses = new ArrayList<Class<?>>();
+            extraClasses = new ArrayList<String>();
         }
         return extraClasses;
     }
 
-    public void setExtraClasses(ArrayList<Class<?>> extraClasses) {
+    public void setExtraClasses(ArrayList<String> extraClasses) {
         this.extraClasses = extraClasses;
     }
 

Modified: 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?rev=785384&r1=785383&r2=785384&view=diff
==============================================================================
--- 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/SchemaGenerator.java
Tue Jun 16 20:37:59 2009
@@ -36,7 +36,7 @@
 
     Method[] getMethods();
 
-    void setExcludeMethods(ArrayList<Method> excludeMethods);
+    void setExcludeMethods(ArrayList<String> excludeMethods);
 
     String getSchemaTargetNameSpace();
 
@@ -44,7 +44,7 @@
 
     void setElementFormDefault(String elementFormDefault);
 
-    void setExtraClasses(ArrayList<Class<?>> extraClasses);
+    void setExtraClasses(ArrayList<String> extraClasses);
 
     void setUseWSDLTypesNamespace(boolean useWSDLTypesNamespace);
 



Mime
View raw message