/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.axis2.wsdl.codegen.emitter;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.description.AxisBinding;
import org.apache.axis2.description.AxisBindingMessage;
import org.apache.axis2.description.AxisBindingOperation;
import org.apache.axis2.description.AxisEndpoint;
import org.apache.axis2.description.AxisMessage;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.description.WSDL20DefaultValueHolder;
import org.apache.axis2.description.WSDL2Constants;
import org.apache.axis2.util.CommandLineOptionConstants;
import org.apache.axis2.util.JavaUtils;
import org.apache.axis2.util.PolicyUtil;
import org.apache.axis2.util.Utils;
import org.apache.axis2.util.XSLTUtils;
import org.apache.axis2.wsdl.HTTPHeaderMessage;
import org.apache.axis2.wsdl.SOAPHeaderMessage;
import org.apache.axis2.wsdl.SOAPModuleMessage;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.axis2.wsdl.WSDLUtil;
import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
import org.apache.axis2.wsdl.codegen.CodeGenerationException;
import org.apache.axis2.wsdl.codegen.writer.AntBuildWriter;
import org.apache.axis2.wsdl.codegen.writer.CallbackHandlerWriter;
import org.apache.axis2.wsdl.codegen.writer.ExceptionWriter;
import org.apache.axis2.wsdl.codegen.writer.FileWriter;
import org.apache.axis2.wsdl.codegen.writer.InterfaceImplementationWriter;
import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter;
import org.apache.axis2.wsdl.codegen.writer.MessageReceiverWriter;
import org.apache.axis2.wsdl.codegen.writer.SchemaWriter;
import org.apache.axis2.wsdl.codegen.writer.ServiceXMLWriter;
import org.apache.axis2.wsdl.codegen.writer.SkeletonInterfaceWriter;
import org.apache.axis2.wsdl.codegen.writer.SkeletonWriter;
import org.apache.axis2.wsdl.codegen.writer.TestClassWriter;
import org.apache.axis2.wsdl.codegen.writer.WSDL11Writer;
import org.apache.axis2.wsdl.codegen.writer.WSDL20Writer;
import org.apache.axis2.wsdl.databinding.TypeMapper;
import org.apache.axis2.wsdl.util.Constants;
import org.apache.axis2.wsdl.util.MessagePartInformationHolder;
import org.apache.axis2.wsdl.util.TypeTesterUtil;
import org.apache.axis2.wsdl.util.XSLTIncludeResolver;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.neethi.Policy;
import org.apache.ws.commons.schema.XmlSchema;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.URIResolver;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.lang.reflect.Constructor;
import com.ibm.wsdl.util.xml.DOM2Writer;
public class AxisServiceBasedMultiLanguageEmitter implements Emitter {
protected static final String CALL_BACK_HANDLER_SUFFIX = "CallbackHandler";
protected static final String STUB_SUFFIX = "Stub";
protected static final String TEST_SUFFIX = "Test";
protected static final String SKELETON_CLASS_SUFFIX = "Skeleton";
protected static final String SKELETON_CLASS_SUFFIX_BACK = "Impl";
protected static final String SKELETON_INTERFACE_SUFFIX = "SkeletonInterface";
// keep a seperate variable for SKELETON_INTERFACE_SUFFIX_BACK although it is
// "" to accomadate any future changes easily.
protected static final String SKELETON_INTERFACE_SUFFIX_BACK = "";
protected static final String STUB_INTERFACE_SUFFIX_BACK = "Stub";
protected static final String MESSAGE_RECEIVER_SUFFIX = "MessageReceiver";
protected static final String DATABINDING_SUPPORTER_NAME_SUFFIX = "DatabindingSupporter";
protected static Map mepToClassMap;
protected static Map mepToSuffixMap;
protected AxisBinding axisBinding;
protected AxisEndpoint axisEndpoint;
protected int uniqueFaultNameCounter = 0;
/**
* Field constructorMap
*/
protected static HashMap constructorMap = new HashMap(50);
//~--- static initializers ------------------------------------------------
static {
// Type maps to a valid initialization value for that type
// Type var = new Type(arg)
// Where "Type" is the key and "new Type(arg)" is the string stored
// Used in emitting test cases and server skeletons.
constructorMap.put("int", "0");
constructorMap.put("float", "0");
constructorMap.put("boolean", "true");
constructorMap.put("double", "0");
constructorMap.put("byte", "(byte)0");
constructorMap.put("short", "(short)0");
constructorMap.put("long", "0");
constructorMap.put("java.lang.Boolean", "new java.lang.Boolean(false)");
constructorMap.put("java.lang.Byte", "new java.lang.Byte((byte)0)");
constructorMap.put("java.lang.Double", "new java.lang.Double(0)");
constructorMap.put("java.lang.Float", "new java.lang.Float(0)");
constructorMap.put("java.lang.Integer", "new java.lang.Integer(0)");
constructorMap.put("java.lang.Long", "new java.lang.Long(0)");
constructorMap.put("java.lang.Short", "new java.lang.Short((short)0)");
constructorMap.put("java.math.BigDecimal", "new java.math.BigDecimal(0)");
constructorMap.put("java.math.BigInteger", "new java.math.BigInteger(\"0\")");
constructorMap.put("java.lang.Object", "new java.lang.String()");
constructorMap.put("byte[]", "new byte[0]");
constructorMap.put("java.util.Calendar", "java.util.Calendar.getInstance()");
constructorMap.put("javax.xml.namespace.QName",
"new javax.xml.namespace.QName(\"http://foo\", \"bar\")");
//populate the MEP -> class map
mepToClassMap = new HashMap();
mepToClassMap.put(WSDL2Constants.MEP_URI_IN_ONLY,
"org.apache.axis2.receivers.AbstractInMessageReceiver");
mepToClassMap.put(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY,
"org.apache.axis2.receivers.AbstractMessageReceiver");
mepToClassMap.put(WSDL2Constants.MEP_URI_IN_OUT,
"org.apache.axis2.receivers.AbstractInOutMessageReceiver");
//populate the MEP -> suffix map
mepToSuffixMap = new HashMap();
mepToSuffixMap.put(WSDLConstants.WSDL20_2004_Constants.MEP_URI_IN_ONLY,
评论0