You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2005/05/10 08:01:44 UTC
svn commit: r169419 - in
/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl: ./
codegen/ codegen/emitter/ codegen/extension/ codegen/writer/
template/csharp/ template/java/ tojava/ util/
Author: ajith
Date: Mon May 9 23:01:42 2005
New Revision: 169419
URL: http://svn.apache.org/viewcvs?rev=169419&view=rev
Log:
Doing a refactor. Now the toJava pacakage is completely moved to the codegen package and writers/emitters are in their correct places
Added:
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationException.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOption.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionParser.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClassWriterConstants.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientInterfaceWriter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientJavaEmitter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientStubWriter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/Emitter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/AbstractCodeGenerationExtension.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/AxisBindingBuilder.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/CodeGenExtention.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/PolicyEvaluator.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/ClassWriter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/InterfaceImplementationWriter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/InterfaceWriter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/package.html
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/package.html
Removed:
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/tojava/
Modified:
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/FileWriter.java
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java?rev=169419&r1=169418&r2=169419&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java Mon May 9 23:01:42 2005
@@ -1,8 +1,9 @@
package org.apache.axis.wsdl;
-import org.apache.axis.wsdl.tojava.CodeGenerationEngine;
-import org.apache.axis.wsdl.tojava.CommandLineOptionConstants;
-import org.apache.axis.wsdl.tojava.CommandLineOptionParser;
+import org.apache.axis.wsdl.codegen.CodeGenerationEngine;
+import org.apache.axis.wsdl.codegen.CommandLineOptionConstants;
+import org.apache.axis.wsdl.codegen.CommandLineOptionConstants;
+import org.apache.axis.wsdl.codegen.CommandLineOptionParser;
/**
* @author chathura@opensource.lk
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java Mon May 9 23:01:42 2005
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen;
+
+import java.io.File;
+
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+import org.apache.wsdl.WSDLDescription;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class CodeGenConfiguration implements CommandLineOptionConstants {
+
+ private WSDLDescription wom;
+ private CommandLineOptionParser parser;
+ private File outputLocation;
+ private int outputLanguage = XSLTConstants.LanguageTypes.JAVA;
+ private boolean advancedCodeGenEnabled=false;
+
+ /**
+ * @param wom
+ * @param parser
+ */
+ public CodeGenConfiguration(WSDLDescription wom,
+ CommandLineOptionParser parser) {
+ this.wom = wom;
+ this.parser = parser;
+ String outputLocation = ((CommandLineOption) parser.getAllOptions().get(
+ OUTPUT_LOCATION_OPTION)).getOptionValue();
+ advancedCodeGenEnabled = (parser.getAllOptions().get(ADVANCED_CODEGEN_OPTION)!=null);
+
+ this.outputLocation = new File(outputLocation);
+
+ }
+
+ /**
+ * @return Returns the parser.
+ */
+ public CommandLineOptionParser getParser() {
+ return parser;
+ }
+
+ /**
+ * @return Returns the wom.
+ */
+ public WSDLDescription getWom() {
+ return wom;
+ }
+
+
+ /**
+ * @return Returns the outputLocation.
+ */
+ public File getOutputLocation() {
+ return outputLocation;
+ }
+
+ public int getOutputLanguage() {
+ return outputLanguage;
+ }
+
+ public boolean isAdvancedCodeGenEnabled() {
+ return advancedCodeGenEnabled;
+ }
+}
\ No newline at end of file
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java Mon May 9 23:01:42 2005
@@ -0,0 +1,117 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.WSDLException;
+
+import org.apache.axis.wsdl.builder.WOMBuilderFactory;
+import org.apache.axis.wsdl.codegen.emitter.ClientJavaEmitter;
+import org.apache.axis.wsdl.codegen.emitter.Emitter;
+import org.apache.axis.wsdl.codegen.emitter.Emitter;
+import org.apache.axis.wsdl.codegen.emitter.CSharpEmitter;
+import org.apache.axis.wsdl.codegen.extension.AxisBindingBuilder;
+import org.apache.axis.wsdl.codegen.extension.AxisBindingBuilder;
+import org.apache.axis.wsdl.codegen.extension.CodeGenExtention;
+import org.apache.axis.wsdl.codegen.extension.CodeGenExtention;
+import org.apache.axis.wsdl.codegen.emitter.CSharpEmitter;
+import org.apache.axis.wsdl.codegen.emitter.JavaEmitter;
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+import org.apache.wsdl.WSDLDescription;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class CodeGenerationEngine {
+
+ private List moduleEndpoints = new ArrayList();
+
+ private CodeGenConfiguration configuration;
+
+
+
+
+ public CodeGenerationEngine(CommandLineOptionParser parser) throws CodeGenerationException{
+ WSDLDescription wom ;
+ try {
+ wom = this.getWOM(parser);
+ }
+ catch (WSDLException e) {
+ throw new CodeGenerationException("Error parsing WSDL", e);
+ }
+ catch(IOException e1){
+ throw new CodeGenerationException("Invalid WSDL Location ", e1);
+ }
+
+ this.configuration = new CodeGenConfiguration(wom, parser);
+ AxisBindingBuilder axisBindingBuilder = new AxisBindingBuilder();
+ axisBindingBuilder.init(this.configuration);
+ axisBindingBuilder.engage();
+
+ }
+
+
+ public void generate()throws CodeGenerationException{
+ for(int i = 0; i< this.moduleEndpoints.size(); i++){
+ ((CodeGenExtention)this.moduleEndpoints.get(i)).engage();
+ }
+
+ Emitter clientEmitter = null;
+
+ switch (configuration.getOutputLanguage()){
+ case XSLTConstants.LanguageTypes.JAVA:
+ if (configuration.isAdvancedCodeGenEnabled()){
+ clientEmitter = new JavaEmitter(this.configuration);
+ } else{
+ clientEmitter = new ClientJavaEmitter(this.configuration);
+ }
+ break;
+
+ case XSLTConstants.LanguageTypes.C_SHARP:
+ clientEmitter = new CSharpEmitter(this.configuration);
+ case XSLTConstants.LanguageTypes.C_PLUS_PLUS:
+ case XSLTConstants.LanguageTypes.VB_DOT_NET:
+
+ default:
+ throw new UnsupportedOperationException();
+
+ }
+
+ clientEmitter.emitStub();
+
+
+ }
+
+
+ private WSDLDescription getWOM(CommandLineOptionParser parser) throws WSDLException, IOException {
+ String uri = ((CommandLineOption) parser.getAllOptions().get(CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION)).getOptionValue();
+ InputStream in = new FileInputStream(new File(uri));
+ return WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).build(in);
+ }
+
+
+
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationException.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationException.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationException.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationException.java Mon May 9 23:01:42 2005
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class CodeGenerationException extends Exception {
+
+ public CodeGenerationException(String message){
+ super(message);
+ }
+
+ public CodeGenerationException(String message, Throwable throwable){
+ super(message, throwable);
+ }
+
+ public CodeGenerationException(Throwable throwable){
+ super(throwable);
+ }
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOption.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOption.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOption.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOption.java Mon May 9 23:01:42 2005
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen;
+
+import java.util.ArrayList;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class CommandLineOption implements CommandLineOptionConstants {
+
+ private String type;
+
+ private ArrayList optionValues;
+
+ private boolean invalid = false;
+
+ public CommandLineOption(String type, String[] values){
+ this.type = type;
+ ArrayList arrayList = new ArrayList(values.length);
+ for(int i =0; i< values.length; i++){
+ arrayList.add(values[i]);
+ }
+ }
+
+ /**
+ * @param type
+ * @param optionValues
+ */
+ public CommandLineOption(String type, ArrayList values) {
+
+ if (("-" + WSDL_LOCATION_URI_OPTION).equalsIgnoreCase(type)) {
+ this.type = WSDL_LOCATION_URI_OPTION;
+ } else if (("-" + OUTPUT_LOCATION_OPTION).equalsIgnoreCase(type)) {
+ this.type = OUTPUT_LOCATION_OPTION;
+ }else if (("-" + ADVANCED_CODEGEN_OPTION).equalsIgnoreCase(type)) {
+ this.type = ADVANCED_CODEGEN_OPTION;
+ } else {
+ this.invalid = true;
+ }
+
+ if (null != values) {
+
+ this.optionValues = values ;
+ }
+ }
+
+ /**
+ * @return Returns the type.
+ * @see <code>CommandLineOptionConstans</code>
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @return Returns the optionValues.
+ */
+ public String getOptionValue() {
+ return (String)optionValues.get(0);
+ }
+
+ /**
+ * @return Returns the invalid.
+ */
+ public boolean isInvalid() {
+ return invalid;
+ }
+
+
+ /**
+ * @return Returns the optionValues.
+ */
+ public ArrayList getOptionValues() {
+ return optionValues;
+ }
+}
\ No newline at end of file
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java Mon May 9 23:01:42 2005
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public interface CommandLineOptionConstants {
+
+ public static final String SOLE_INPUT = "SOLE_INPUT";
+
+ public static final String WSDL_LOCATION_URI_OPTION = "uri";
+ public static final String OUTPUT_LOCATION_OPTION = "o";
+ public static final String ADVANCED_CODEGEN_OPTION = "x";
+
+ public static final String INVALID_OPTION= "INVALID_OPTION";
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionParser.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionParser.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionParser.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionParser.java Mon May 9 23:01:42 2005
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen;
+
+import org.apache.axis.wsdl.codegen.CommandLineOption;
+import org.apache.axis.wsdl.codegen.CommandLineOptionConstants;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class CommandLineOptionParser implements CommandLineOptionConstants {
+
+ private Map commandLineOptions;
+
+ public CommandLineOptionParser(String[] args) {
+ this.commandLineOptions = this.parse(args);
+
+ }
+
+ /**
+ * Return a list with <code>CommandLineOption</code> objects
+ *
+ * @param args
+ * @return CommandLineOption List
+ */
+private Map parse(String[] args){
+ Map commandLineOptions = new HashMap();
+
+ if(0 == args.length)
+ return commandLineOptions;
+
+ //State 0 means started
+ //State 1 means earlier one was a new -option
+ //State 2 means earlier one was a sub param of a -option
+
+ int state = 0;
+ ArrayList optionBundle = null;
+ String optionType = null;
+ CommandLineOption commandLineOption ;
+
+ for(int i=0; i< args.length ; i++){
+
+ if(args[i].substring(0,1).equals("-")){
+ if(0 == state){
+ // fresh one
+ state = 1;
+ optionType = args[i];
+ }else if(2 == state || 1 == state){
+ // new one but old one should be saved
+ commandLineOption = new CommandLineOption(optionType, optionBundle);
+ commandLineOptions.put(commandLineOption.getType(), commandLineOption);
+ state = 1;
+ optionType = args[i];
+ optionBundle = null;
+
+ }
+ }else{
+ if(0 == state){
+ commandLineOption = new CommandLineOption(CommandLineOptionConstants.SOLE_INPUT, args);
+ commandLineOptions.put(commandLineOption.getType(), commandLineOption);
+ return commandLineOptions;
+
+ }else if(1 == state){
+ optionBundle = new ArrayList();
+ optionBundle.add(args[i]);
+ state =2;
+
+ }else if(2 == state){
+ optionBundle.add(args[i]);
+ }
+
+ }
+
+
+ }
+
+ commandLineOption = new CommandLineOption(optionType, optionBundle);
+ commandLineOptions.put(commandLineOption.getType(), commandLineOption);
+ return commandLineOptions;
+
+ }
+ public Map getAllOptions() {
+ return this.commandLineOptions;
+ }
+
+ public List getInvalidOptions() {
+ List faultList = new ArrayList();
+ Iterator iterator = this.commandLineOptions.values().iterator();
+ while (iterator.hasNext()) {
+ CommandLineOption commandLineOption = ((CommandLineOption) (iterator
+ .next()));
+ if (commandLineOption.isInvalid()) {
+ faultList.add(commandLineOption);
+ }
+ }
+
+ return faultList;
+ }
+
+}
\ No newline at end of file
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java Mon May 9 23:01:42 2005
@@ -0,0 +1,47 @@
+package org.apache.axis.wsdl.codegen;
+
+/*
+* 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.
+*
+* Constants for the XSLT related items
+*/
+public interface XSLTConstants {
+ /**
+ * Language constants
+ */
+ public interface LanguageTypes{
+
+ public static final int JAVA=1;
+ public static final int C_SHARP=2;
+ public static final int C_PLUS_PLUS=3;
+ public static final int VB_DOT_NET=4;
+ }
+
+ /**
+ * Interface templates
+ */
+ public interface XSLTInterfaceTemplates{
+ public static final String JAVA_TEMPLATE = "/org/apache/axis/wsdl/template/java/InterfaceTemplate.xsl";
+ public static final String CSHARP_TEMPLATE = "/org/apache/axis/wsdl/template/csharp/InterfaceTemplate.xsl";
+ }
+
+ /**
+ * Interface implementation templates
+ */
+ public interface XSLTInterfaceImplementationTemplates{
+ public static final String JAVA_TEMPLATE = "/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl";
+ public static final String CSHARP_TEMPLATE = "/org/apache/axis/wsdl/template/csharp/InterfaceImplementationTemplate.xsl";
+ }
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java Mon May 9 23:01:42 2005
@@ -0,0 +1,101 @@
+package org.apache.axis.wsdl.codegen.emitter;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.axis.wsdl.databinding.CsharpTypeMapper;
+import org.apache.axis.wsdl.databinding.TypeMapper;
+import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+import org.apache.crimson.tree.XmlDocument;
+import org.apache.wsdl.WSDLBinding;
+import org.apache.wsdl.WSDLInterface;
+import org.apache.wsdl.WSDLOperation;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+
+/*
+ * 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 class CSharpEmitter extends MultiLanguageClientEmitter{
+
+ public CSharpEmitter(CodeGenConfiguration configuration) {
+ this.configuration = configuration;
+ this.mapper = new CsharpTypeMapper();
+
+ }
+
+ public CSharpEmitter(CodeGenConfiguration configuration,TypeMapper mapper) {
+ this.configuration = configuration;
+ this.mapper =mapper;
+
+ }
+
+
+ /**
+ * @see org.apache.axis.wsdl.codegen.emitter.MultiLanguageClientEmitter#createDOMDocuementForInterface(org.apache.wsdl.WSDLBinding)
+ * @param binding
+ * @return
+ */
+ protected XmlDocument createDOMDocuementForInterface(WSDLBinding binding){
+ WSDLInterface boundInterface = binding.getBoundInterface();
+
+ XmlDocument doc = new XmlDocument();
+ Element rootElement = doc.createElement("interface");
+
+ Attr packageAttribute = doc.createAttribute("package");
+ packageAttribute.setValue("something"); //todo set this
+ rootElement.setAttributeNode(packageAttribute);
+
+ Attr nameAttribute = doc.createAttribute("name");
+ nameAttribute.setValue(boundInterface.getName().getLocalPart());
+ rootElement.setAttributeNode(nameAttribute);
+
+ Collection col = boundInterface.getOperations().values();
+
+ Element methodElement = null;
+ Attr methodNameAttr = null;
+ WSDLOperation operation = null;
+
+ for (Iterator iterator = col.iterator(); iterator.hasNext();) {
+
+ operation = (WSDLOperation) iterator.next();
+
+ methodElement = doc.createElement("method");
+ methodNameAttr = doc.createAttribute("name");
+ methodNameAttr.setValue(operation.getName().getLocalPart());
+ methodElement.setAttributeNode(methodNameAttr);
+
+ methodElement.appendChild(getInputElement(doc,operation));
+ methodElement.appendChild(getOutputElement(doc,operation));
+
+ rootElement.appendChild(methodElement);
+
+ }
+ doc.appendChild(rootElement);
+ return doc;
+
+ }
+
+ /**
+ * @see org.apache.axis.wsdl.codegen.emitter.MultiLanguageClientEmitter#createDOMDocuementForInterfaceImplementation(org.apache.wsdl.WSDLBinding)
+ * @param binding
+ * @return
+ */
+ protected XmlDocument createDOMDocuementForInterfaceImplementation(WSDLBinding binding) {
+ return null;
+ }
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClassWriterConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClassWriterConstants.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClassWriterConstants.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClassWriterConstants.java Mon May 9 23:01:42 2005
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen.emitter;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public interface ClassWriterConstants {
+
+ public static final String CLASS_FILE_EXTENSION = ".java";
+
+ public static final String PUBLIC_INTERFACE = "public interface ";
+
+ public static final String PUBLIC_CLASS = "public class";
+
+
+ public static final String REMOTE_INTERFACE = "java.rmi.Remote";
+
+ public static final String REMOTE_EXCEPTION = "java.rmi.RemoteException";
+
+ public static final String ABSTRACT_STUB = "org.apache.axis.clientapi.Stub";
+
+ public static final String AXIS_OPERATION = "org.apache.axis.description.AxisOperation";
+
+
+ public static final String INDENDATION_TAB = "\t";
+
+ public static final String INDENDATION_DOUBLE_TAB = "\t\t";
+
+ public static final String INDENDATION_SPACE = " ";
+
+
+ public static final String STUB_VARIABLE__OPERATION_ARRRAY = "_operations";
+
+ public static final String STUB_VARIABLE___OPERATION ="__operation";
+
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientInterfaceWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientInterfaceWriter.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientInterfaceWriter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientInterfaceWriter.java Mon May 9 23:01:42 2005
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen.emitter;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.Iterator;
+
+import org.apache.axis.wsdl.databinding.TypeMapper;
+import org.apache.axis.wsdl.codegen.emitter.ClassWriterConstants;
+import org.apache.wsdl.WSDLConstants;
+import org.apache.wsdl.WSDLInterface;
+import org.apache.wsdl.WSDLOperation;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class ClientInterfaceWriter implements ClassWriterConstants {
+
+ private WSDLInterface womInterface;
+
+ private File directory ;
+
+ private TypeMapper typeMapper;
+
+
+
+
+ public ClientInterfaceWriter(WSDLInterface womInterface, File directory,
+ TypeMapper typeMapper) {
+
+ this.womInterface = womInterface;
+ this.directory = directory;
+ this.typeMapper = typeMapper;
+ }
+ public void emit() throws IOException{
+ String name = womInterface.getName().getLocalPart();
+ OutputStream out = new FileOutputStream(new File(directory, name+CLASS_FILE_EXTENSION));
+
+ PrintStream printStream = new PrintStream(out);
+ printStream.println(PUBLIC_INTERFACE
+ + name
+ + " extends "+REMOTE_INTERFACE+ "{");
+ printStream.println();
+ Iterator iterator = womInterface.getAllOperations().values()
+ .iterator();
+ while (iterator.hasNext()) {
+
+ //FIXME Handle the multipart as multiple arguments.
+ WSDLOperation operation = (WSDLOperation) iterator.next();
+ if (WSDLConstants.MEP_URI_IN_OUT.equals(operation.getMessageExchangePattern())) {
+ Class outTypeMapping = this.typeMapper.getTypeMapping(operation.getOutputMessage().getElement());
+ Class inTypeMapping = this.typeMapper.getTypeMapping(operation.getInputMessage().getElement());
+ printStream.println( INDENDATION_TAB+"public "
+ + outTypeMapping==null?"void" :outTypeMapping.getName()
+ +" "+ operation.getName().getLocalPart()+"("
+ +inTypeMapping==null?"":(inTypeMapping.getName()
+ +" "+this.typeMapper.getParameterName(operation.getInputMessage().getElement()))
+ +") throws "+ REMOTE_EXCEPTION+";");
+ printStream.println();
+
+ }
+ }
+ printStream.println("}");
+ printStream.flush();
+ printStream.close();
+
+ }
+
+}
\ No newline at end of file
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientJavaEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientJavaEmitter.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientJavaEmitter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientJavaEmitter.java Mon May 9 23:01:42 2005
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen.emitter;
+
+import java.io.IOException;
+
+import org.apache.axis.wsdl.databinding.DefaultTypeMapper;
+import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis.wsdl.codegen.CodeGenerationException;
+import org.apache.axis.wsdl.codegen.extension.AxisBindingBuilder;
+import org.apache.axis.wsdl.codegen.emitter.ClientInterfaceWriter;
+import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+import org.apache.wsdl.WSDLBinding;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class ClientJavaEmitter implements Emitter {
+
+
+ private CodeGenConfiguration configuration;
+
+ /**
+ * @param configuration
+ */
+ public ClientJavaEmitter(CodeGenConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+ public void setCodeGenConfiguration(CodeGenConfiguration configuration) {
+ this.configuration = configuration;
+
+ }
+
+
+ public void emitStub() throws CodeGenerationException{
+ WSDLBinding axisBinding = this.configuration.getWom().getBinding(AxisBindingBuilder.AXIS_BINDING_QNAME);
+ ClientInterfaceWriter clientInterfaceWriter = new ClientInterfaceWriter(axisBinding.getBoundInterface(), this.configuration.getOutputLocation(), new DefaultTypeMapper());
+ ClientStubWriter clientStubWriter = new ClientStubWriter(axisBinding.getBoundInterface(), this.configuration.getOutputLocation(), new DefaultTypeMapper());
+ try {
+ clientInterfaceWriter.emit();
+ clientStubWriter.emit();
+ } catch (IOException e) {
+ throw new CodeGenerationException(e);
+ }
+ }
+
+
+ public void emitSkeleton() {
+ throw new UnsupportedOperationException("To be implemented");
+
+ }
+
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientStubWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientStubWriter.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientStubWriter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ClientStubWriter.java Mon May 9 23:01:42 2005
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen.emitter;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.Iterator;
+
+import org.apache.axis.wsdl.databinding.TypeMapper;
+import org.apache.axis.wsdl.codegen.emitter.ClassWriterConstants;
+import org.apache.wsdl.WSDLInterface;
+import org.apache.wsdl.WSDLOperation;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class ClientStubWriter implements ClassWriterConstants{
+
+ private WSDLInterface womInterface;
+
+ private File directory;
+
+ private TypeMapper typeMapper;
+
+
+
+ /**
+ * @param wsdlInterface
+ * @param directory
+ * @param typeMapper
+ */
+ public ClientStubWriter(WSDLInterface wsdlInterface, File directory,
+ TypeMapper typeMapper) {
+ this.womInterface = wsdlInterface;
+ this.directory = directory;
+ this.typeMapper = typeMapper;
+ }
+
+ public void emit() throws IOException{
+
+ String name = womInterface.getName().getLocalPart();
+ name += "Stub";
+ OutputStream out = new FileOutputStream(new File(directory, name+CLASS_FILE_EXTENSION));
+
+ PrintStream printStream = new PrintStream(out);
+ printStream.println(PUBLIC_CLASS + INDENDATION_SPACE
+ + name
+ + " extends "
+ + ABSTRACT_STUB
+ + " implements "+REMOTE_INTERFACE+ "{");
+ printStream.println();
+
+
+
+ ///Start of Static block
+ printStream.println(INDENDATION_TAB+"static {");
+ printStream.println(INDENDATION_DOUBLE_TAB+ INDENDATION_SPACE
+ +AXIS_OPERATION +INDENDATION_SPACE
+ +STUB_VARIABLE___OPERATION +";");
+
+ Iterator iterator = womInterface.getAllOperations().values()
+ .iterator();
+ int operationCounter = 0;
+ while (iterator.hasNext()) {
+ WSDLOperation operation = (WSDLOperation) iterator.next();
+ printStream.println();
+ printStream.println(INDENDATION_DOUBLE_TAB + STUB_VARIABLE___OPERATION
+ +INDENDATION_SPACE + "="
+ +INDENDATION_SPACE + "new"
+ +INDENDATION_SPACE + AXIS_OPERATION
+ +"("+"}"+";");
+
+ printStream.println(INDENDATION_DOUBLE_TAB
+ +STUB_VARIABLE__OPERATION_ARRRAY
+ +"["+operationCounter+"]"
+ +INDENDATION_SPACE + "="+INDENDATION_SPACE
+ +STUB_VARIABLE___OPERATION +";");
+ printStream.println();
+
+
+ operationCounter++;
+ }
+ printStream.println(INDENDATION_TAB+"}");
+ ///End of Static block
+ printStream.println(")");
+ printStream.flush();
+ printStream.close();
+
+
+ }
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/Emitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/Emitter.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/Emitter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/Emitter.java Mon May 9 23:01:42 2005
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen.emitter;
+
+import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis.wsdl.codegen.CodeGenerationException;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public interface Emitter {
+
+ public void setCodeGenConfiguration(CodeGenConfiguration configuration);
+
+ public void emitStub() throws CodeGenerationException;
+
+ public void emitSkeleton() throws CodeGenerationException;
+
+
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java Mon May 9 23:01:42 2005
@@ -0,0 +1,135 @@
+package org.apache.axis.wsdl.codegen.emitter;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.axis.wsdl.databinding.JavaTypeMapper;
+import org.apache.axis.wsdl.databinding.TypeMapper;
+import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+import org.apache.crimson.tree.XmlDocument;
+import org.apache.wsdl.WSDLBinding;
+import org.apache.wsdl.WSDLInterface;
+import org.apache.wsdl.WSDLOperation;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+
+/*
+* 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.
+*
+* Java emiiter implementation
+*/
+public class JavaEmitter extends MultiLanguageClientEmitter{
+
+ /**
+ *
+ * @param configuration
+ */
+ public JavaEmitter(CodeGenConfiguration configuration) {
+ this.configuration = configuration;
+ this.mapper = new JavaTypeMapper();
+
+ }
+
+ /**
+ *
+ * @param configuration
+ * @param mapper
+ */
+ public JavaEmitter(CodeGenConfiguration configuration,TypeMapper mapper) {
+ this.configuration = configuration;
+ this.mapper =mapper;
+
+ }
+
+
+ /**
+ * @see org.apache.axis.wsdl.codegen.emitter.MultiLanguageClientEmitter#createDOMDocuementForInterface(org.apache.wsdl.WSDLBinding)
+ * @param binding
+ * @return
+ */
+ protected XmlDocument createDOMDocuementForInterface(WSDLBinding binding){
+ WSDLInterface boundInterface = binding.getBoundInterface();
+
+ XmlDocument doc = new XmlDocument();
+ Element rootElement = doc.createElement("interface");
+
+ Attr packageAttribute = doc.createAttribute("package");
+ packageAttribute.setValue("something"); //todo set this
+ rootElement.setAttributeNode(packageAttribute);
+
+ Attr nameAttribute = doc.createAttribute("name");
+ nameAttribute.setValue(boundInterface.getName().getLocalPart());
+ rootElement.setAttributeNode(nameAttribute);
+
+ loadOperations(boundInterface, doc, rootElement);
+
+ doc.appendChild(rootElement);
+ return doc;
+
+ }
+
+ private void loadOperations(WSDLInterface boundInterface, XmlDocument doc, Element rootElement) {
+ Collection col = boundInterface.getOperations().values();
+
+ Element methodElement = null;
+ Attr methodNameAttr = null;
+ WSDLOperation operation = null;
+
+ for (Iterator iterator = col.iterator(); iterator.hasNext();) {
+
+ operation = (WSDLOperation) iterator.next();
+
+ methodElement = doc.createElement("method");
+ methodNameAttr = doc.createAttribute("name");
+ methodNameAttr.setValue(operation.getName().getLocalPart());
+ methodElement.setAttributeNode(methodNameAttr);
+
+ methodElement.appendChild(getInputElement(doc,operation));
+ methodElement.appendChild(getOutputElement(doc,operation));
+
+ rootElement.appendChild(methodElement);
+
+ }
+ }
+
+ /**
+ * @see org.apache.axis.wsdl.codegen.emitter.MultiLanguageClientEmitter#createDOMDocuementForInterfaceImplementation(org.apache.wsdl.WSDLBinding)
+ * @param binding
+ * @return
+ */
+ protected XmlDocument createDOMDocuementForInterfaceImplementation(WSDLBinding binding) {
+ WSDLInterface boundInterface = binding.getBoundInterface();
+
+ XmlDocument doc = new XmlDocument();
+ Element rootElement = doc.createElement("class");
+
+ Attr packageAttribute = doc.createAttribute("package");
+ packageAttribute.setValue("something"); //todo set this
+ rootElement.setAttributeNode(packageAttribute);
+
+ Attr nameAttribute = doc.createAttribute("name");
+ nameAttribute.setValue(boundInterface.getName().getLocalPart()+"Stub");
+ rootElement.setAttributeNode(nameAttribute);
+
+ Attr InterfaceNameAttribute = doc.createAttribute("interfaceName");
+ InterfaceNameAttribute.setValue(boundInterface.getName().getLocalPart());
+ rootElement.setAttributeNode(InterfaceNameAttribute);
+
+ loadOperations(boundInterface, doc, rootElement);
+ doc.appendChild(rootElement);
+ return doc;
+
+ }
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java Mon May 9 23:01:42 2005
@@ -0,0 +1,208 @@
+package org.apache.axis.wsdl.codegen.emitter;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.axis.wsdl.databinding.TypeMapper;
+import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis.wsdl.codegen.CodeGenerationException;
+import org.apache.axis.wsdl.codegen.CodeGenerationException;
+import org.apache.axis.wsdl.codegen.emitter.Emitter;
+import org.apache.axis.wsdl.codegen.extension.AxisBindingBuilder;
+import org.apache.axis.wsdl.codegen.extension.AxisBindingBuilder;
+import org.apache.axis.wsdl.codegen.writer.ClassWriter;
+import org.apache.axis.wsdl.codegen.writer.InterfaceWriter;
+import org.apache.axis.wsdl.codegen.writer.InterfaceImplementationWriter;
+import org.apache.crimson.tree.XmlDocument;
+import org.apache.wsdl.WSDLBinding;
+import org.apache.wsdl.WSDLOperation;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+
+/*
+* 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.
+*
+* Abstract Client emitter
+* the XML will look like the following
+* todo escape the following
+* <pre>
+ <interface package="">
+ <method name="">
+ <input>
+ <param name="" type=""/>*
+ </input> ?
+ <output>
+ <param name="" type=""/>?
+ </output>?
+ </method>
+ </interface>
+ </pre>
+*/
+
+
+public abstract class MultiLanguageClientEmitter implements Emitter{
+
+ protected InputStream xsltStream = null;
+ protected CodeGenConfiguration configuration;
+ protected TypeMapper mapper;
+
+ /**
+ * Sets the mapper
+ * @see org.apache.axis.wsdl.databinding.TypeMapper
+ * @param mapper
+ */
+ public void setMapper(TypeMapper mapper) {
+ this.mapper = mapper;
+ }
+
+ /**
+ * Sets the code generator configuration
+ * @param configuration
+ */
+ public void setCodeGenConfiguration(CodeGenConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+ /**
+ *
+ * @see org.apache.axis.wsdl.codegen.emitter.Emitter#emitStub()
+ */
+ public void emitStub() throws CodeGenerationException {
+ try {
+ //get the binding
+ WSDLBinding axisBinding = this.configuration.getWom().getBinding(AxisBindingBuilder.AXIS_BINDING_QNAME);
+ //write interfaces
+ writeInterfaces(axisBinding);
+ //write interface implementations
+ writeInterfaceImplementations(axisBinding);
+ } catch (Exception e) {
+ // e.printStackTrace();
+ throw new CodeGenerationException(e);
+ }
+ }
+
+ /**
+ * Writes the interfaces
+ * @param axisBinding
+ * @throws Exception
+ */
+ private void writeInterfaces(WSDLBinding axisBinding) throws Exception {
+ XmlDocument interfaceModel = createDOMDocuementForInterface(axisBinding);
+ InterfaceWriter interfaceWriter =
+ new InterfaceWriter(this.configuration.getOutputLocation(),
+ this.configuration.getOutputLanguage()
+ );
+ writeClasses(interfaceModel,interfaceWriter);
+ }
+
+ /**
+ * Writes the implementations
+ * @param axisBinding
+ * @throws Exception
+ */
+ private void writeInterfaceImplementations(WSDLBinding axisBinding) throws Exception {
+ XmlDocument interfaceImplModel = createDOMDocuementForInterfaceImplementation(axisBinding);
+ InterfaceImplementationWriter interfaceImplWriter =
+ new InterfaceImplementationWriter(this.configuration.getOutputLocation(),
+ this.configuration.getOutputLanguage()
+ );
+ writeClasses(interfaceImplModel,interfaceImplWriter);
+ }
+
+ /**
+ * A resusable method for the implementation of interface and implementation writing
+ * @param model
+ * @param writer
+ * @throws IOException
+ * @throws Exception
+ */
+ private void writeClasses(XmlDocument model,ClassWriter writer) throws IOException,Exception {
+ ByteArrayOutputStream memoryStream = new ByteArrayOutputStream();
+ model.write(memoryStream);
+ writer.loadTemplate();
+ writer.createOutFile(model.getDocumentElement().getAttribute("package"),
+ model.getDocumentElement().getAttribute("name"));
+ writer.writeOutFile(new ByteArrayInputStream(memoryStream.toByteArray()));
+ }
+
+ /**
+ * @see org.apache.axis.wsdl.codegen.emitter.Emitter#emitSkeleton()
+ */
+ public void emitSkeleton() throws CodeGenerationException {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ /**
+ * Creates the DOM tree for the interface creation
+ * @param binding
+ * @return
+ */
+ protected abstract XmlDocument createDOMDocuementForInterface(WSDLBinding binding);
+
+ /**
+ * Creates the DOM tree for implementations
+ * @param binding
+ * @return
+ */
+ protected abstract XmlDocument createDOMDocuementForInterfaceImplementation(WSDLBinding binding);
+
+ /**
+ * Finds the input element for the xml document
+ * @param doc
+ * @param operation
+ * @return
+ */
+ protected Element getInputElement(XmlDocument doc,WSDLOperation operation){
+ Element inputElt = doc.createElement("input");
+ //todo this should be multiple
+ Element param = doc.createElement("param");
+ Attr paramNameAttr = doc.createAttribute("name");
+ paramNameAttr.setValue(this.mapper.getParameterName(operation.getInputMessage().getElement()));
+ param.setAttributeNode(paramNameAttr);
+ Attr paramTypeAttr = doc.createAttribute("type");
+ Class typeMapping = this.mapper.getTypeMapping(operation.getInputMessage().getElement());
+ paramTypeAttr.setValue(typeMapping==null?"":typeMapping.getName());
+ param.setAttributeNode(paramTypeAttr);
+
+ inputElt.appendChild(param);
+
+ return inputElt;
+ }
+
+ /**
+ * Finds the output element for the output element
+ * @param doc
+ * @param operation
+ * @return
+ */
+ protected Element getOutputElement(XmlDocument doc,WSDLOperation operation){
+ Element outputElt = doc.createElement("output");
+ Element param = doc.createElement("param");
+ Attr paramNameAttr = doc.createAttribute("name");
+ paramNameAttr.setValue(this.mapper.getParameterName(operation.getOutputMessage().getElement()));
+ param.setAttributeNode(paramNameAttr);
+ Attr paramTypeAttr = doc.createAttribute("type");
+ Class typeMapping = this.mapper.getTypeMapping(operation.getOutputMessage().getElement());
+ paramTypeAttr.setValue(typeMapping==null?"":typeMapping.getName());
+ param.setAttributeNode(paramTypeAttr);
+
+ outputElt.appendChild(param);
+
+ return outputElt;
+ }
+}
+
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/AbstractCodeGenerationExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/AbstractCodeGenerationExtension.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/AbstractCodeGenerationExtension.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/AbstractCodeGenerationExtension.java Mon May 9 23:01:42 2005
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen.extension;
+
+import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class AbstractCodeGenerationExtension {
+
+ protected CodeGenConfiguration configuration;
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/AxisBindingBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/AxisBindingBuilder.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/AxisBindingBuilder.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/AxisBindingBuilder.java Mon May 9 23:01:42 2005
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen.extension;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis.wsdl.codegen.extension.AbstractCodeGenerationExtension;
+import org.apache.wsdl.WSDLBinding;
+import org.apache.wsdl.WSDLDescription;
+import org.apache.wsdl.WSDLInterface;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class AxisBindingBuilder extends AbstractCodeGenerationExtension implements CodeGenExtention {
+
+ public static final String AXIS_NAMESPACE = "http://ws.apache.org/axis2/";
+
+ public static final QName AXIS_BINDING_QNAME = new QName(AXIS_NAMESPACE, "codeGenerationBinding", "axis");
+
+
+
+ public AxisBindingBuilder() {
+ }
+
+ public void init(CodeGenConfiguration configuration){
+ this.configuration = configuration;
+ }
+
+ public void engage(){
+ WSDLDescription wom = this.configuration.getWom();
+ WSDLBinding binding = wom.getFirstBinding();
+
+ WSDLBinding newBinding = wom.createBinding();
+ newBinding.setName(AXIS_BINDING_QNAME);
+
+ WSDLInterface boundInterface = binding.getBoundInterface();
+ newBinding.setBoundInterface(boundInterface);
+
+ newBinding.setBindingFaults(binding.getBindingFaults());
+ newBinding.setBindingOperations(binding.getBindingOperations());
+ wom.addBinding(newBinding);
+ }
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/CodeGenExtention.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/CodeGenExtention.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/CodeGenExtention.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/CodeGenExtention.java Mon May 9 23:01:42 2005
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen.extension;
+
+import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public interface CodeGenExtention {
+
+
+ public void init(CodeGenConfiguration configuration);
+
+ public void engage();
+
+
+
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/PolicyEvaluator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/PolicyEvaluator.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/PolicyEvaluator.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/PolicyEvaluator.java Mon May 9 23:01:42 2005
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen.extension;
+
+import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis.wsdl.codegen.extension.CodeGenExtention;
+import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class PolicyEvaluator implements CodeGenExtention{
+
+ CodeGenConfiguration configuration;
+
+ public PolicyEvaluator() {
+ }
+
+ /**
+ * Go through the WSDL and extract the WS-Policy elements
+ * and map it into a Axis Module.
+ *
+ */
+ public void init( CodeGenConfiguration configuration){
+ this.configuration = configuration;
+ }
+
+ public void engage(){
+
+
+ }
+
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/ClassWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/ClassWriter.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/ClassWriter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/ClassWriter.java Mon May 9 23:01:42 2005
@@ -0,0 +1,77 @@
+package org.apache.axis.wsdl.codegen.writer;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+
+import org.apache.axis.wsdl.util.FileWriter;
+import org.apache.axis.wsdl.util.XSLTTemplateProcessor;
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+
+/*
+* 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.
+*
+*
+* Abstract writer to be extended by writers. To use a class writer one needs to call the
+* methods in order
+* ususally it is setLanguage() ->loadTemplate() ->createOutFile() ->WriteOutFile()
+*/
+public abstract class ClassWriter {
+
+ protected File outputFileLocation = null;
+ protected FileOutputStream stream = null;
+ protected InputStream xsltStream = null;
+ protected int language = XSLTConstants.LanguageTypes.JAVA; //default is again java
+
+ /**
+ * Sets the language
+ * @param language
+ */
+ public void setLanguage(int language) {
+ this.language = language;
+ }
+
+ /**
+ * Load the template
+ */
+ public abstract void loadTemplate();
+
+ /**
+ * Creates the output file
+ * @param packageName
+ * @param fileName
+ * @throws Exception
+ */
+ public void createOutFile(String packageName,String fileName) throws Exception{
+ File outputFile = FileWriter.createClassFile(outputFileLocation,packageName,fileName,language);
+ this.stream = new FileOutputStream(outputFile);
+ }
+
+ /**
+ * Writes the output file
+ * @param documentStream
+ * @throws Exception
+ */
+ public void writeOutFile(InputStream documentStream) throws Exception{
+ XSLTTemplateProcessor.parse(this.stream,documentStream,this.xsltStream);
+ this.stream.flush();
+ this.stream.close();
+
+
+ }
+
+
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/InterfaceImplementationWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/InterfaceImplementationWriter.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/InterfaceImplementationWriter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/InterfaceImplementationWriter.java Mon May 9 23:01:42 2005
@@ -0,0 +1,53 @@
+package org.apache.axis.wsdl.codegen.writer;
+
+import org.apache.axis.wsdl.codegen.writer.ClassWriter;
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+
+import java.io.File;
+
+/*
+* 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 class InterfaceImplementationWriter extends ClassWriter{
+
+ public InterfaceImplementationWriter(String outputFileLocation) {
+ this.outputFileLocation = new File(outputFileLocation);
+ }
+
+ public InterfaceImplementationWriter(File outputFileLocation,int language) {
+ this.outputFileLocation = outputFileLocation;
+ this.language = language;
+ }
+
+ public void loadTemplate() {
+ Class clazz = this.getClass();
+ switch (language){
+ case XSLTConstants.LanguageTypes.JAVA:
+ this.xsltStream = clazz.getResourceAsStream(XSLTConstants.XSLTInterfaceImplementationTemplates.JAVA_TEMPLATE);
+ break;
+ case XSLTConstants.LanguageTypes.C_SHARP:
+ this.xsltStream = clazz.getResourceAsStream(XSLTConstants.XSLTInterfaceImplementationTemplates.CSHARP_TEMPLATE);
+ break;
+ case XSLTConstants.LanguageTypes.C_PLUS_PLUS:
+ case XSLTConstants.LanguageTypes.VB_DOT_NET:
+ default:
+ throw new UnsupportedOperationException();
+ }
+
+ }
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/InterfaceWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/InterfaceWriter.java?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/InterfaceWriter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/InterfaceWriter.java Mon May 9 23:01:42 2005
@@ -0,0 +1,58 @@
+package org.apache.axis.wsdl.codegen.writer;
+
+import org.apache.axis.wsdl.codegen.writer.ClassWriter;
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+
+import java.io.File;
+
+/*
+* 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 class InterfaceWriter extends ClassWriter{
+
+
+ public InterfaceWriter(String outputFileLocation) {
+ this.outputFileLocation = new File(outputFileLocation);
+ }
+
+ public InterfaceWriter(File outputFileLocation,int language) {
+ this.outputFileLocation = outputFileLocation;
+ this.language = language;
+ }
+
+ /**
+ * @see org.apache.axis.wsdl.codegen.writer.ClassWriter#loadTemplate()
+ */
+ public void loadTemplate(){
+ Class clazz = this.getClass();
+ switch (language){
+ case XSLTConstants.LanguageTypes.JAVA:
+ this.xsltStream = clazz.getResourceAsStream(XSLTConstants.XSLTInterfaceTemplates.JAVA_TEMPLATE);
+ break;
+ case XSLTConstants.LanguageTypes.C_SHARP:
+ this.xsltStream = clazz.getResourceAsStream(XSLTConstants.XSLTInterfaceTemplates.CSHARP_TEMPLATE);
+ break;
+ case XSLTConstants.LanguageTypes.C_PLUS_PLUS:
+ case XSLTConstants.LanguageTypes.VB_DOT_NET:
+ default:
+ throw new UnsupportedOperationException();
+ }
+
+ }
+
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/package.html
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/package.html?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/package.html (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/package.html Mon May 9 23:01:42 2005
@@ -0,0 +1,6 @@
+<html>
+<body>
+ This package is a "non class containing" one that has the xsl templates for the C# class generation
+
+ </body>
+</html>
\ No newline at end of file
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/package.html
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/package.html?rev=169419&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/package.html (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/package.html Mon May 9 23:01:42 2005
@@ -0,0 +1,6 @@
+<html>
+<body>
+ This package is a "non class containing" one that has the xsl templates for the Java class generation
+
+ </body>
+</html>
\ No newline at end of file
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/FileWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/FileWriter.java?rev=169419&r1=169418&r2=169419&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/FileWriter.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/FileWriter.java Mon May 9 23:01:42 2005
@@ -3,7 +3,8 @@
import java.io.File;
import java.io.IOException;
-import org.apache.axis.wsdl.tojava.xslt.XSLTConstants;
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+import org.apache.axis.wsdl.codegen.XSLTConstants;
/*
* Copyright 2004,2005 The Apache Software Foundation.