View Javadoc
1   /*
2    * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4    *
5    * This code is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU General Public License version 2 only, as
7    * published by the Free Software Foundation.  Oracle designates this
8    * particular file as subject to the "Classpath" exception as provided
9    * by Oracle in the LICENSE file that accompanied this code.
10   *
11   * This code is distributed in the hope that it will be useful, but WITHOUT
12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   * version 2 for more details (a copy is included in the LICENSE file that
15   * accompanied this code).
16   *
17   * You should have received a copy of the GNU General Public License version
18   * 2 along with this work; if not, write to the Free Software Foundation,
19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20   *
21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22   * or visit www.oracle.com if you need additional information or have any
23   * questions.
24   */
25  
26  package com.sun.xml.internal.ws.api.server;
27  
28  import com.sun.istack.internal.NotNull;
29  import com.sun.istack.internal.Nullable;
30  
31  import javax.xml.namespace.QName;
32  
33  /**
34   * Resolves port address for an endpoint. A WSDL may contain multiple
35   * endpoints, and some of the endpoints may be packaged in a single WAR file.
36   * If an endpoint is serving the WSDL, it would be nice to fill the port addresses
37   * of other endpoints in the WAR.
38   *
39   * <p>
40   * This interface is implemented by the caller of
41   * {@link SDDocument#writeTo} method so
42   * that the {@link SDDocument} can correctly fills the addresses of known
43   * endpoints.
44   *
45   *
46   * @author Jitendra Kotamraju
47   */
48  public abstract class PortAddressResolver {
49      /**
50       * Gets the endpoint address for a WSDL port
51       *
52       * @param serviceName
53       *       WSDL service name(wsd:service in WSDL) for which address is needed. Always non-null.
54       * @param portName
55       *       WSDL port name(wsdl:port in WSDL) for which address is needed. Always non-null.
56       * @return
57       *      The address needs to be put in WSDL for port element's location
58       *      attribute. Can be null. If it is null, existing port address
59       *      is written as it is (without any patching).
60       */
61      public abstract @Nullable String getAddressFor(@NotNull QName serviceName, @NotNull String portName);
62  
63      /**
64       * Gets the endpoint address for a WSDL port
65       *
66       * @param serviceName
67       *       WSDL service name(wsd:service in WSDL) for which address is needed. Always non-null.
68       * @param portName
69       *       WSDL port name(wsdl:port in WSDL) for which address is needed. Always non-null.
70       * @param currentAddress
71       *       Whatever current address specified for the port in the WSDL
72       * @return
73       *      The address needs to be put in WSDL for port element's location
74       *      attribute. Can be null. If it is null, existing port address
75       *      is written as it is (without any patching).
76       */
77      public @Nullable String getAddressFor(@NotNull QName serviceName, @NotNull String portName, String currentAddress) {
78          return getAddressFor(serviceName, portName);
79      }
80  }