Package org.jboss.ws.api.tools
Class WSContractProvider
java.lang.Object
org.jboss.ws.api.tools.WSContractProvider
- Direct Known Subclasses:
CXFProviderImpl
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic WSContractProviderObtain a new instance of aWSContractProvider.static WSContractProvidernewInstance(ClassLoader loader) Obtain a new instance of aWSContractProvider.abstract voidGenerates artifacts using the current settings.abstract voidGenerates artifacts using the current settings.abstract voidsetClassLoader(ClassLoader loader) Sets the ClassLoader used to discover types.abstract voidsetExtension(boolean extension) Enables/Disables SOAP 1.2 binding extensionabstract voidsetGenerateSource(boolean generateSource) Enables/Disables Java source generation.abstract voidsetGenerateWsdl(boolean generateWsdl) Enables/Disables WSDL generation.abstract voidsetMessageStream(PrintStream messageStream) Sets the PrintStream to use for status feedback.abstract voidsetOutputDirectory(File directory) Sets the main output directory.abstract voidsetPortSoapAddress(String address) Sets the soap:address to be used for the generated port in the wsdl.abstract voidsetResourceDirectory(File directory) Sets the resource directory.abstract voidsetSourceDirectory(File directory) Sets the source directory.
-
Field Details
-
PROVIDER_PROPERTY
- See Also:
-
-
Constructor Details
-
WSContractProvider
protected WSContractProvider()
-
-
Method Details
-
newInstance
Obtain a new instance of aWSContractProvider. This will use the current thread's context class loader to locate theWSContractProviderFactoryimplementation.- Returns:
- a new
WSContractProvider
-
newInstance
Obtain a new instance of aWSContractProvider. The specified ClassLoader will be used to locate theWSContractProviderFactoryimplementation- 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
Sets the main output directory. If the directory does not exist, it will be created.- Parameters:
directory- the root directory for generated files
-
setResourceDirectory
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
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
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
Sets the ClassLoader used to discover types. This defaults to the one used in instantiation.- Parameters:
loader- the ClassLoader to use
-
provide
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
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
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:
-