src/share/jaxws_classes/com/sun/tools/internal/ws/processor/modeler/wsdl/WSDLModelerBase.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 30,40 **** import com.sun.tools.internal.ws.processor.generator.Names; import com.sun.tools.internal.ws.processor.model.Fault; import com.sun.tools.internal.ws.processor.model.Operation; import com.sun.tools.internal.ws.processor.model.Port; import com.sun.tools.internal.ws.processor.model.java.JavaException; - import com.sun.tools.internal.ws.processor.modeler.JavaSimpleTypeCreator; import com.sun.tools.internal.ws.processor.modeler.Modeler; import com.sun.tools.internal.ws.resources.ModelerMessages; import com.sun.tools.internal.ws.wscompile.AbortException; import com.sun.tools.internal.ws.wscompile.ErrorReceiver; import com.sun.tools.internal.ws.wscompile.ErrorReceiverFilter; --- 30,39 ----
*** 47,60 **** import com.sun.tools.internal.ws.wsdl.document.schema.SchemaKinds; import com.sun.tools.internal.ws.wsdl.document.soap.*; import com.sun.tools.internal.ws.wsdl.framework.Entity; import com.sun.tools.internal.ws.wsdl.framework.GloballyKnown; import com.sun.tools.internal.ws.wsdl.framework.NoSuchEntityException; - import com.sun.tools.internal.ws.wsdl.parser.DOMForest; import com.sun.tools.internal.ws.wsdl.parser.WSDLParser; import com.sun.tools.internal.ws.wsdl.parser.MetadataFinder; - import com.sun.xml.internal.ws.spi.db.BindingContext; import com.sun.xml.internal.ws.spi.db.BindingHelper; import org.xml.sax.helpers.LocatorImpl; import javax.xml.namespace.QName; --- 46,57 ----
*** 82,93 **** * * @param port * @param wsdlPort */ protected void applyPortMethodCustomization(Port port, com.sun.tools.internal.ws.wsdl.document.Port wsdlPort) { ! if(isProvider(wsdlPort)) return; JAXWSBinding jaxwsBinding = (JAXWSBinding)getExtensionOfType(wsdlPort, JAXWSBinding.class); String portMethodName = (jaxwsBinding != null)?((jaxwsBinding.getMethodName() != null)?jaxwsBinding.getMethodName().getName():null):null; if(portMethodName != null){ port.setPortGetter(portMethodName); --- 79,91 ---- * * @param port * @param wsdlPort */ protected void applyPortMethodCustomization(Port port, com.sun.tools.internal.ws.wsdl.document.Port wsdlPort) { ! if (isProvider(wsdlPort)) { return; + } JAXWSBinding jaxwsBinding = (JAXWSBinding)getExtensionOfType(wsdlPort, JAXWSBinding.class); String portMethodName = (jaxwsBinding != null)?((jaxwsBinding.getMethodName() != null)?jaxwsBinding.getMethodName().getName():null):null; if(portMethodName != null){ port.setPortGetter(portMethodName);
*** 106,117 **** return isProvider; } JAXWSBinding jaxwsGlobalCustomization = (JAXWSBinding)getExtensionOfType(document.getDefinitions(), JAXWSBinding.class); isProvider = (jaxwsGlobalCustomization != null)?jaxwsGlobalCustomization.isProvider():null; ! if(isProvider != null) return isProvider; return false; } protected SOAPBody getSOAPRequestBody() { SOAPBody requestBody = --- 104,116 ---- return isProvider; } JAXWSBinding jaxwsGlobalCustomization = (JAXWSBinding)getExtensionOfType(document.getDefinitions(), JAXWSBinding.class); isProvider = (jaxwsGlobalCustomization != null)?jaxwsGlobalCustomization.isProvider():null; ! if (isProvider != null) { return isProvider; + } return false; } protected SOAPBody getSOAPRequestBody() { SOAPBody requestBody =
*** 155,166 **** } return responseBody; } protected com.sun.tools.internal.ws.wsdl.document.Message getOutputMessage() { ! if (info.portTypeOperation.getOutput() == null) return null; return info.portTypeOperation.getOutput().resolveMessage(info.document); } protected com.sun.tools.internal.ws.wsdl.document.Message getInputMessage() { return info.portTypeOperation.getInput().resolveMessage(info.document); --- 154,166 ---- } return responseBody; } protected com.sun.tools.internal.ws.wsdl.document.Message getOutputMessage() { ! if (info.portTypeOperation.getOutput() == null) { return null; + } return info.portTypeOperation.getOutput().resolveMessage(info.document); } protected com.sun.tools.internal.ws.wsdl.document.Message getInputMessage() { return info.portTypeOperation.getInput().resolveMessage(info.document);
*** 178,191 **** ArrayList<MessagePart> partsList = new ArrayList<MessagePart>(); List<MessagePart> parts = new ArrayList<MessagePart>(); //get Mime parts List mimeParts; ! if(isInput) mimeParts = getMimeContentParts(message, info.bindingOperation.getInput()); ! else mimeParts = getMimeContentParts(message, info.bindingOperation.getOutput()); if (bodyParts != null) { StringTokenizer in = new StringTokenizer(bodyParts.trim(), " "); while (in.hasMoreTokens()) { String part = in.nextToken(); --- 178,192 ---- ArrayList<MessagePart> partsList = new ArrayList<MessagePart>(); List<MessagePart> parts = new ArrayList<MessagePart>(); //get Mime parts List mimeParts; ! if (isInput) { mimeParts = getMimeContentParts(message, info.bindingOperation.getInput()); ! } else { mimeParts = getMimeContentParts(message, info.bindingOperation.getOutput()); + } if (bodyParts != null) { StringTokenizer in = new StringTokenizer(bodyParts.trim(), " "); while (in.hasMoreTokens()) { String part = in.nextToken();
*** 196,216 **** mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING); partsList.add(mPart); } } else { for (MessagePart mPart : message.getParts()) { ! if (!mimeParts.contains(mPart)) mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING); partsList.add(mPart); } } for (MessagePart mPart : message.getParts()) { ! if(mimeParts.contains(mPart)) { mPart.setBindingExtensibilityElementKind(MessagePart.WSDL_MIME_BINDING); parts.add(mPart); ! }else if(partsList.contains(mPart)) { mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING); parts.add(mPart); } } --- 197,218 ---- mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING); partsList.add(mPart); } } else { for (MessagePart mPart : message.getParts()) { ! if (!mimeParts.contains(mPart)) { mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING); + } partsList.add(mPart); } } for (MessagePart mPart : message.getParts()) { ! if (mimeParts.contains(mPart)) { mPart.setBindingExtensibilityElementKind(MessagePart.WSDL_MIME_BINDING); parts.add(mPart); ! } else if(partsList.contains(mPart)) { mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING); parts.add(mPart); } }
*** 224,236 **** protected List<MessagePart> getMimeContentParts(Message message, TWSDLExtensible ext) { ArrayList<MessagePart> mimeContentParts = new ArrayList<MessagePart>(); for (MIMEPart mimePart : getMimeParts(ext)) { MessagePart part = getMimeContentPart(message, mimePart); ! if (part != null) mimeContentParts.add(part); } return mimeContentParts; } /** * @param mimeParts --- 226,239 ---- protected List<MessagePart> getMimeContentParts(Message message, TWSDLExtensible ext) { ArrayList<MessagePart> mimeContentParts = new ArrayList<MessagePart>(); for (MIMEPart mimePart : getMimeParts(ext)) { MessagePart part = getMimeContentPart(message, mimePart); ! if (part != null) { mimeContentParts.add(part); } + } return mimeContentParts; } /** * @param mimeParts
*** 248,259 **** gotRootPart = true; } else if (obj instanceof MIMEContent) { mimeContents.add((MIMEContent) obj); } } ! if(!validateMimeContentPartNames(mimeContents)) return false; if(mPart.getName() != null) { warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_NAME_NOT_ALLOWED(info.portTypeOperation.getName())); } } return true; --- 251,263 ---- gotRootPart = true; } else if (obj instanceof MIMEContent) { mimeContents.add((MIMEContent) obj); } } ! if (!validateMimeContentPartNames(mimeContents)) { return false; + } if(mPart.getName() != null) { warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_NAME_NOT_ALLOWED(info.portTypeOperation.getName())); } } return true;
*** 279,291 **** List<String> mimeTypes = new ArrayList<String>(); //validateMimeContentPartNames(mimeContents.iterator()); // String mimeType = null; for(MIMEContent mimeContent:mimeContents){ String mimeType = getMimeContentType(mimeContent); ! if(!mimeTypes.contains(mimeType)) mimeTypes.add(mimeType); } return mimeTypes; } private boolean validateMimeContentPartNames(List<MIMEContent> mimeContents) { //validate mime:content(s) in the mime:part as per R2909 --- 283,296 ---- List<String> mimeTypes = new ArrayList<String>(); //validateMimeContentPartNames(mimeContents.iterator()); // String mimeType = null; for(MIMEContent mimeContent:mimeContents){ String mimeType = getMimeContentType(mimeContent); ! if (!mimeTypes.contains(mimeType)) { mimeTypes.add(mimeType); } + } return mimeTypes; } private boolean validateMimeContentPartNames(List<MIMEContent> mimeContents) { //validate mime:content(s) in the mime:part as per R2909
*** 430,442 **** * @param part * @return true if part is the Root part */ private boolean isRootPart(MIMEPart part) { for (TWSDLExtension twsdlExtension : part.extensions()) { ! if (twsdlExtension instanceof SOAPBody) return true; } return false; } protected Set getDuplicateFaultNames() { // look for fault messages with the same soap:fault name --- 435,448 ---- * @param part * @return true if part is the Root part */ private boolean isRootPart(MIMEPart part) { for (TWSDLExtension twsdlExtension : part.extensions()) { ! if (twsdlExtension instanceof SOAPBody) { return true; } + } return false; } protected Set getDuplicateFaultNames() { // look for fault messages with the same soap:fault name
*** 504,521 **** protected boolean validateBodyParts(BindingOperation operation) { boolean isRequestResponse = info.portTypeOperation.getStyle() == OperationStyle.REQUEST_RESPONSE; List<MessagePart> inputParts = getMessageParts(getSOAPRequestBody(), getInputMessage(), true); ! if(!validateStyleAndPart(operation, inputParts)) return false; if(isRequestResponse){ List<MessagePart> outputParts = getMessageParts(getSOAPResponseBody(), getOutputMessage(), false); ! if(!validateStyleAndPart(operation, outputParts)) return false; } return true; } /** * @param operation --- 510,529 ---- protected boolean validateBodyParts(BindingOperation operation) { boolean isRequestResponse = info.portTypeOperation.getStyle() == OperationStyle.REQUEST_RESPONSE; List<MessagePart> inputParts = getMessageParts(getSOAPRequestBody(), getInputMessage(), true); ! if (!validateStyleAndPart(operation, inputParts)) { return false; + } if(isRequestResponse){ List<MessagePart> outputParts = getMessageParts(getSOAPResponseBody(), getOutputMessage(), false); ! if (!validateStyleAndPart(operation, outputParts)) { return false; } + } return true; } /** * @param operation
*** 524,547 **** private boolean validateStyleAndPart(BindingOperation operation, List<MessagePart> parts) { SOAPOperation soapOperation = (SOAPOperation) getExtensionOfType(operation, SOAPOperation.class); for (MessagePart part : parts) { if (part.getBindingExtensibilityElementKind() == MessagePart.SOAP_BODY_BINDING) { ! if (!isStyleAndPartMatch(soapOperation, part)) return false; } } return true; } protected String getLiteralJavaMemberName(Fault fault) { String javaMemberName; QName memberName = fault.getElementName(); javaMemberName = fault.getJavaMemberName(); ! if (javaMemberName == null) javaMemberName = memberName.getLocalPart(); return javaMemberName; } /** * @param ext --- 532,557 ---- private boolean validateStyleAndPart(BindingOperation operation, List<MessagePart> parts) { SOAPOperation soapOperation = (SOAPOperation) getExtensionOfType(operation, SOAPOperation.class); for (MessagePart part : parts) { if (part.getBindingExtensibilityElementKind() == MessagePart.SOAP_BODY_BINDING) { ! if (!isStyleAndPartMatch(soapOperation, part)) { return false; } } + } return true; } protected String getLiteralJavaMemberName(Fault fault) { String javaMemberName; QName memberName = fault.getElementName(); javaMemberName = fault.getJavaMemberName(); ! if (javaMemberName == null) { javaMemberName = memberName.getLocalPart(); + } return javaMemberName; } /** * @param ext
*** 551,564 **** */ protected List<MIMEContent> getMimeContents(TWSDLExtensible ext, Message message, String name) { for (MIMEPart mimePart : getMimeParts(ext)) { List<MIMEContent> mimeContents = getMimeContents(mimePart); for (MIMEContent mimeContent : mimeContents) { ! if (mimeContent.getPart().equals(name)) return mimeContents; } } return null; } protected String makePackageQualified(String s) { if (s.indexOf(".") != -1) { --- 561,575 ---- */ protected List<MIMEContent> getMimeContents(TWSDLExtensible ext, Message message, String name) { for (MIMEPart mimePart : getMimeParts(ext)) { List<MIMEContent> mimeContents = getMimeContents(mimePart); for (MIMEContent mimeContent : mimeContents) { ! if (mimeContent.getPart().equals(name)) { return mimeContents; } } + } return null; } protected String makePackageQualified(String s) { if (s.indexOf(".") != -1) {
*** 603,628 **** } protected TWSDLExtension getAnyExtensionOfType( TWSDLExtensible extensible, Class type) { ! if(extensible == null) return null; for (TWSDLExtension extension:extensible.extensions()) { if(extension.getClass().equals(type)) { return extension; }else if (extension.getClass().equals(MIMEMultipartRelated.class) && (type.equals(SOAPBody.class) || type.equals(MIMEContent.class) || type.equals(MIMEPart.class))) { for (MIMEPart part : ((MIMEMultipartRelated)extension).getParts()) { //bug fix: 5024001 TWSDLExtension extn = getExtensionOfType(part, type); ! if (extn != null) return extn; } } } return null; } // bug fix: 4857100 --- 614,641 ---- } protected TWSDLExtension getAnyExtensionOfType( TWSDLExtensible extensible, Class type) { ! if (extensible == null) { return null; + } for (TWSDLExtension extension:extensible.extensions()) { if(extension.getClass().equals(type)) { return extension; }else if (extension.getClass().equals(MIMEMultipartRelated.class) && (type.equals(SOAPBody.class) || type.equals(MIMEContent.class) || type.equals(MIMEPart.class))) { for (MIMEPart part : ((MIMEMultipartRelated)extension).getParts()) { //bug fix: 5024001 TWSDLExtension extn = getExtensionOfType(part, type); ! if (extn != null) { return extn; } } } + } return null; } // bug fix: 4857100
*** 658,672 **** } protected String getUniqueClassName(String className) { int cnt = 2; String uniqueName = className; ! while (reqResNames.contains(uniqueName.toLowerCase())) { uniqueName = className + cnt; cnt++; } ! reqResNames.add(uniqueName.toLowerCase()); return uniqueName; } protected boolean isConflictingClassName(String name) { if (_conflictingClassNames == null) { --- 671,685 ---- } protected String getUniqueClassName(String className) { int cnt = 2; String uniqueName = className; ! while (reqResNames.contains(uniqueName.toLowerCase(Locale.ENGLISH))) { uniqueName = className + cnt; cnt++; } ! reqResNames.add(uniqueName.toLowerCase(Locale.ENGLISH)); return uniqueName; } protected boolean isConflictingClassName(String name) { if (_conflictingClassNames == null) {
*** 698,720 **** int numPasses = 0; protected void warning(Entity entity, String message){ //avoid duplicate warning for the second pass ! if(numPasses > 1) return; ! if(entity == null) errReceiver.warning(null, message); ! else errReceiver.warning(entity.getLocator(), message); } protected void error(Entity entity, String message){ ! if(entity == null) errReceiver.error(null, message); ! else errReceiver.error(entity.getLocator(), message); throw new AbortException(); } protected static final String OPERATION_HAS_VOID_RETURN_TYPE = "com.sun.xml.internal.ws.processor.modeler.wsdl.operationHasVoidReturnType"; --- 711,736 ---- int numPasses = 0; protected void warning(Entity entity, String message){ //avoid duplicate warning for the second pass ! if (numPasses > 1) { return; ! } ! if (entity == null) { errReceiver.warning(null, message); ! } else { errReceiver.warning(entity.getLocator(), message); } + } protected void error(Entity entity, String message){ ! if (entity == null) { errReceiver.error(null, message); ! } else { errReceiver.error(entity.getLocator(), message); + } throw new AbortException(); } protected static final String OPERATION_HAS_VOID_RETURN_TYPE = "com.sun.xml.internal.ws.processor.modeler.wsdl.operationHasVoidReturnType";
*** 730,744 **** private Set _conflictingClassNames; protected Map<String,JavaException> _javaExceptions; protected Map _faultTypeToStructureMap; protected Map<QName, Port> _bindingNameToPortMap; - protected boolean useWSIBasicProfile = true; private final Set<String> reqResNames = new HashSet<String>(); ! public class ProcessSOAPOperationInfo { public ProcessSOAPOperationInfo( Port modelPort, com.sun.tools.internal.ws.wsdl.document.Port port, com.sun.tools.internal.ws.wsdl.document.Operation portTypeOperation, --- 746,759 ---- private Set _conflictingClassNames; protected Map<String,JavaException> _javaExceptions; protected Map _faultTypeToStructureMap; protected Map<QName, Port> _bindingNameToPortMap; private final Set<String> reqResNames = new HashSet<String>(); ! public static class ProcessSOAPOperationInfo { public ProcessSOAPOperationInfo( Port modelPort, com.sun.tools.internal.ws.wsdl.document.Port port, com.sun.tools.internal.ws.wsdl.document.Operation portTypeOperation,
*** 766,786 **** public boolean hasOverloadedOperations; public Map headers; // additional data public Operation operation; - public String uniqueOperationName; } - public static class WSDLExceptionInfo { - public String exceptionType; - public QName wsdlMessage; - public String wsdlMessagePartName; - public HashMap constructorOrder; // mapping of element name to - // constructor order (of type Integer) - } - - protected WSDLParser parser; protected WSDLDocument document; protected static final LocatorImpl NULL_LOCATOR = new LocatorImpl(); } --- 781,791 ----