/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Factory for transport tubes that enables transport pluggability.
*
* <p>
* At runtime, on the client side, JAX-WS (more specifically the default {@link TubelineAssembler}
* of JAX-WS client runtime) relies on this factory to create a suitable transport {@link Tube}
* that can handle the given {@link EndpointAddress endpoint address}.
*
* <p>
* JAX-WS extensions that provide additional transport support can
* extend this class and implement the {@link #doCreate} method.
* They are expected to check the scheme of the endpoint address
* (and possibly some other settings from bindings), and create
* their transport tube implementations accordingly.
* For example,
*
* <pre>
* class MyTransportTubeFactoryImpl {
* Tube doCreate(...) {
* String scheme = address.getURI().getScheme();
* if(scheme.equals("foo"))
* return new MyTransport(...);
* else
* return null;
* }
* }
* </pre>
*
* <p>
* {@link TransportTubeFactory} look-up follows the standard service
* discovery mechanism, so you need
*
* @author Jitendra Kotamraju
* @see StandaloneTubeAssembler
*/
public abstract class TransportTubeFactory {
/**
* Creates a transport {@link Tube} for the given port, if this factory can do so,
* or return null.
*
* @param context
* Object that captures various contextual information
* that can be used to determine the tubeline to be assembled.
*
* @return
* null to indicate that this factory isn't capable of creating a transport
* for this port (which causes the caller to search for other {@link TransportTubeFactory}s
* that can. Or non-null.
*
* @throws WebServiceException
* if this factory is capable of creating a transport tube but some fatal
* error prevented it from doing so. This exception will be propagated
* back to the user application, and no further {@link TransportTubeFactory}s
* are consulted.
*/
/**
* Locates {@link TransportTubeFactory}s and create a suitable transport {@link Tube}.
*
* @param classLoader
* @return
* Always non-null, since we fall back to our default {@link Tube}.
*/
public static Tube create(@Nullable ClassLoader classLoader, @NotNull ClientTubeAssemblerContext context) {
return tube;
}
}
// See if there is a {@link TransportPipeFactory} out there and use it for compatibility.
}
}
// default built-in transports
}
}
}