com.sun.xml.ws.api.server.Container Maven / Gradle / Ivy
/*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the license at
* https://glassfish.dev.java.net/public/CDDLv1.0.html.
* See the License for the specific language governing
* permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at https://glassfish.dev.java.net/public/CDDLv1.0.html.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* you own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* Copyright 2006 Sun Microsystems Inc. All Rights Reserved
*/
package com.sun.xml.ws.api.server;
/**
* Root of the SPI implemented by the container
* (such as application server.)
*
*
* Often technologies that are built on top of JAX-WS
* (such as Tango) needs to negotiate private contracts between
* them and the container. This interface allows such technologies
* to query the negotiated SPI by using the {@link #getSPI(Class)}.
*
*
* For example, if a security pipe needs to get some information
* from a container, they can do the following:
*
* - Negotiate an interface with the container and define it.
* (let's call it ContainerSecuritySPI.)
*
- The container will implement ContainerSecuritySPI.
*
- At the runtime, a security pipe gets
* {@link WSEndpoint} and then to {@link Container}.
*
- It calls container.getSPI(ContainerSecuritySPI.class)
*
- The container returns an instance of ContainerSecuritySPI.
*
- The security pipe talks to the container through this SPI.
*
*
*
* This protects JAX-WS from worrying about the details of such contracts,
* while still providing the necessary service of hooking up those parties.
*
*
* Technologies that run inside JAX-WS server runtime can access this object through
* {@link WSEndpoint#getContainer()}. In the client runtime, it can be accessed from
* {@link ContainerResolver#getContainer()}
*
* @author Kohsuke Kawaguchi
* @see WSEndpoint
*/
public abstract class Container {
/**
* For derived classes.
*/
protected Container() {
}
/**
* Gets the specified SPI.
*
*
* This method works as a kind of directory service
* for SPIs between technologies on top of JAX-WS
* and the container.
*
* @param spiType
* Always non-null.
*
* @return
* null if such an SPI is not implemented by this container.
*/
public abstract T getSPI(Class spiType);
/**
* Constant that represents a "no {@link Container}",
* which always returns null from {@link #getSPI(Class)}.
*/
public static final Container NONE = new Container() {
public T getSPI(Class spiType) {
return null;
}
};
}