org.jboss.ws.api.tools
Class WSContractProvider
- java.lang.Object
- org.jboss.ws.api.tools.WSContractProvider
public abstract class WSContractProvider extends Object
WSContractProvider is responsible for generating the required portable JAX-WS artifacts for a service endpoint implementation. This includes class files for wrapper types and fault beans. WSDL may be optionally generated as well using this API.The following example generates class files, source files and WSDL for an endpoint:
WSContractProvider provider = WSContractProvider.newInstance(); provider.setGenerateSource(true); provider.setGenerateWsdl(true); provider.setOutputDirectory(new File("output")); provider.setMessageStream(System.out); provider.provide(TestMe.class);
Thread-Safety:
This class expects to be thread-confined, so it can not be shared between threads.- Author:
- Jason T. Greene, Richard Opalka
Field Summary
Fields Modifier and Type Field and Description static String
PROVIDER_PROPERTY
Constructor Summary
Constructors Modifier Constructor and Description protected
WSContractProvider()
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description static WSContractProvider
newInstance()
Obtain a new instance of aWSContractProvider
.static WSContractProvider
newInstance(ClassLoader loader)
Obtain a new instance of aWSContractProvider
.abstract void
provide(Class<?> endpointClass)
Generates artifacts using the current settings.abstract void
provide(String endpointClass)
Generates artifacts using the current settings.abstract void
setClassLoader(ClassLoader loader)
Sets the ClassLoader used to discover types.abstract void
setExtension(boolean extension)
Enables/Disables SOAP 1.2 binding extensionabstract void
setGenerateSource(boolean generateSource)
Enables/Disables Java source generation.abstract void
setGenerateWsdl(boolean generateWsdl)
Enables/Disables WSDL generation.abstract void
setMessageStream(PrintStream messageStream)
Sets the PrintStream to use for status feedback.abstract void
setOutputDirectory(File directory)
Sets the main output directory.abstract void
setPortSoapAddress(String address)
Sets the soap:address to be used for the generated port in the wsdl.abstract void
setResourceDirectory(File directory)
Sets the resource directory.abstract void
setSourceDirectory(File directory)
Sets the source directory.
Field Detail
PROVIDER_PROPERTY
public static final String PROVIDER_PROPERTY
- See Also:
- Constant Field Values
Method Detail
newInstance
public static WSContractProvider newInstance()
Obtain a new instance of aWSContractProvider
. This will use the current thread's context class loader to locate theWSContractProviderFactory
implementation.- Returns:
- a new
WSContractProvider
newInstance
public static WSContractProvider newInstance(ClassLoader loader)
Obtain a new instance of aWSContractProvider
. The specified ClassLoader will be used to locate theWSContractProviderFactory
implementation- Parameters:
loader
- the ClassLoader to use- Returns:
- a new
WSContractProvider
setGenerateWsdl
public abstract void setGenerateWsdl(boolean generateWsdl)
Enables/Disables WSDL generation.- Parameters:
generateWsdl
- whether or not to generate WSDL
setExtension
public abstract void setExtension(boolean extension)
Enables/Disables SOAP 1.2 binding extension- Parameters:
extension
- whether or not to enable SOAP 1.2 binding extension
setGenerateSource
public abstract void setGenerateSource(boolean generateSource)
Enables/Disables Java source generation.- Parameters:
generateSource
- whether or not to generate Java source.
setOutputDirectory
public abstract void setOutputDirectory(File directory)
Sets the main output directory. If the directory does not exist, it will be created.- Parameters:
directory
- the root directory for generated files
setResourceDirectory
public abstract void setResourceDirectory(File directory)
Sets the resource directory. This directory will contain any generated WSDL and XSD files. If the directory does not exist, it will be created. If not specified, the output directory will be used instead.- Parameters:
directory
- the root directory for generated resource files
setSourceDirectory
public abstract void setSourceDirectory(File directory)
Sets the source directory. This directory will contain any generated Java source. If the directory does not exist, it will be created. If not specified, the output directory will be used instead.- Parameters:
directory
- the root directory for generated source code
setPortSoapAddress
public abstract void setPortSoapAddress(String address)
Sets the soap:address to be used for the generated port in the wsdl. This is ignored if WSDL generation is disabled.- Parameters:
address
- soap address
setClassLoader
public abstract void setClassLoader(ClassLoader loader)
Sets the ClassLoader used to discover types. This defaults to the one used in instantiation.- Parameters:
loader
- the ClassLoader to use
provide
public abstract void provide(String endpointClass)
Generates artifacts using the current settings. This method may be invoked more than once (e.g. multiple endpoints).- Parameters:
endpointClass
- the name of the endpoint implementation bean- Throws:
RuntimeException
- if any error occurs during processing, or the class is not found
provide
public abstract void provide(Class<?> endpointClass)
Generates artifacts using the current settings. This method may be invoked more than once (e.g. multiple endpoints).- Parameters:
endpointClass
- the endpoint implementation bean- Throws:
RuntimeException
- if any error occurs during processing
setMessageStream
public abstract void setMessageStream(PrintStream messageStream)
Sets the PrintStream to use for status feedback. The simplest example would be to use System.out.Example output:
Generating WSDL: TestMeService.wsdl Writing Source: org/jboss/ws/tools/jaxws/TestMe.java org/jboss/ws/tools/jaxws/TestMeResponse.java Writing Classes: org/jboss/ws/tools/jaxws/TestMe.class org/jboss/ws/tools/jaxws/TestMeResponse.class
- Parameters:
messageStream
- the stream to use for status messages:
Copyright © 2018 JBoss, by Red Hat. All rights reserved.