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  import com.sun.xml.internal.ws.api.Component;
31  import com.sun.xml.internal.ws.transport.http.HttpAdapterList;
32  
33  import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
34  import java.util.List;
35  
36  /**
37   * Represents an object scoped to the current "module" (like a JavaEE web appliation).
38   *
39   * <p>
40   * This object can be obtained from {@link Container#getSPI(Class)}.
41   *
42   * <p>
43   * The scope of the module is driven by {@link W3CEndpointReferenceBuilder#build()}'s
44   * requirement that we need to identify a {@link WSEndpoint} that has a specific
45   * service/port name.
46   *
47   * <p>
48   * For JavaEE containers this should be scoped to a JavaEE application. For
49   * other environment, this could be scoped to any similar notion. If no such
50   * notion is available, the implementation of {@link Container} can return
51   * a new {@link Module} object each time {@link Container#getSPI(Class)} is invoked.
52   *
53   * <p>
54   * There's a considerable overlap between this and {@link HttpAdapterList}.
55   * The SPI really needs to be reconsidered
56   *
57   *
58   * @see Container
59   * @author Kohsuke Kawaguchi
60   * @since 2.1 EA3
61   */
62  public abstract class Module implements Component {
63      /**
64       * Gets the list of {@link BoundEndpoint} deployed in this module.
65       *
66       * <p>
67       * From the point of view of the {@link Module} implementation,
68       * it really only needs to provide a {@link List} object as a data store.
69       * JAX-WS will update this list accordingly.
70       *
71       * @return
72       *      always return the same non-null instance.
73       */
74      public abstract @NotNull List<BoundEndpoint> getBoundEndpoints();
75  
76      public @Nullable <S> S getSPI(@NotNull Class<S> spiType) {
77          return null;
78      }
79  
80  }