aoqi@0: /* aoqi@0: * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. Oracle designates this aoqi@0: * particular file as subject to the "Classpath" exception as provided aoqi@0: * by Oracle in the LICENSE file that accompanied this code. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: aoqi@0: package com.sun.xml.internal.ws.wsdl; aoqi@0: aoqi@0: import com.sun.xml.internal.ws.api.message.Packet; aoqi@0: import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation; aoqi@0: import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort; aoqi@0: import com.sun.xml.internal.ws.api.model.JavaMethod; aoqi@0: import com.sun.xml.internal.ws.api.model.SEIModel; aoqi@0: import com.sun.xml.internal.ws.api.model.WSDLOperationMapping; aoqi@0: import com.sun.xml.internal.ws.api.WSBinding; aoqi@0: import com.sun.xml.internal.ws.model.JavaMethodImpl; aoqi@0: import com.sun.istack.internal.NotNull; aoqi@0: import com.sun.istack.internal.Nullable; aoqi@0: aoqi@0: import javax.xml.namespace.QName; aoqi@0: aoqi@0: /** aoqi@0: * Extensions if this class will be used for dispatching the request message to the correct endpoint method by aoqi@0: * identifying the wsdl operation associated with the request. aoqi@0: * aoqi@0: * @see OperationDispatcher aoqi@0: * aoqi@0: * @author Rama Pulavarthi aoqi@0: */ aoqi@0: public abstract class WSDLOperationFinder { aoqi@0: protected final WSDLPort wsdlModel; aoqi@0: protected final WSBinding binding; aoqi@0: protected final SEIModel seiModel; aoqi@0: aoqi@0: public WSDLOperationFinder(@NotNull WSDLPort wsdlModel, @NotNull WSBinding binding, @Nullable SEIModel seiModel) { aoqi@0: this.wsdlModel = wsdlModel; aoqi@0: this.binding = binding; aoqi@0: this.seiModel= seiModel; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * This methods returns the QName of the WSDL operation correponding to a request Packet. aoqi@0: * An implementation should return null when it cannot dispatch to a unique method based on the information it processes. aoqi@0: * In such case, other OperationFinders are queried to resolve a WSDL operation. aoqi@0: * It should throw an instance of DispatchException if it finds incorrect information in the packet. aoqi@0: * aoqi@0: * @deprecated use getWSDLOperationMapping(Packet request) aoqi@0: * aoqi@0: * @param request Request Packet that is used to find the associated WSDLOperation aoqi@0: * @return QName of the WSDL Operation that this request correponds to. aoqi@0: * null when it cannot find a unique operation to dispatch to. aoqi@0: * @throws DispatchException When the information in the Packet is invalid aoqi@0: */ aoqi@0: public QName getWSDLOperationQName(Packet request) throws DispatchException { aoqi@0: WSDLOperationMapping m = getWSDLOperationMapping(request); aoqi@0: return m != null ? m.getOperationName() : null; aoqi@0: } aoqi@0: aoqi@0: public WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException { aoqi@0: return null; aoqi@0: } aoqi@0: aoqi@0: protected WSDLOperationMapping wsdlOperationMapping(JavaMethodImpl j) { aoqi@0: return new WSDLOperationMappingImpl(j.getOperation(), j); aoqi@0: } aoqi@0: aoqi@0: protected WSDLOperationMapping wsdlOperationMapping(WSDLBoundOperation o) { aoqi@0: return new WSDLOperationMappingImpl(o, null); aoqi@0: } aoqi@0: aoqi@0: static class WSDLOperationMappingImpl implements WSDLOperationMapping { aoqi@0: private WSDLBoundOperation wsdlOperation; aoqi@0: private JavaMethod javaMethod; aoqi@0: private QName operationName; aoqi@0: aoqi@0: WSDLOperationMappingImpl(WSDLBoundOperation wsdlOperation, JavaMethodImpl javaMethod) { aoqi@0: this.wsdlOperation = wsdlOperation; aoqi@0: this.javaMethod = javaMethod; aoqi@0: operationName = (javaMethod != null) ? javaMethod.getOperationQName() : wsdlOperation.getName(); aoqi@0: } aoqi@0: aoqi@0: public WSDLBoundOperation getWSDLBoundOperation() { aoqi@0: return wsdlOperation; aoqi@0: } aoqi@0: aoqi@0: public JavaMethod getJavaMethod() { aoqi@0: return javaMethod; aoqi@0: } aoqi@0: aoqi@0: public QName getOperationName() { aoqi@0: return operationName; aoqi@0: } aoqi@0: } aoqi@0: }