|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.codehaus.enunciate.modules.BasicDeploymentModule
org.codehaus.enunciate.modules.FreemarkerDeploymentModule
org.codehaus.enunciate.modules.java_client.JavaClientDeploymentModule
public class JavaClientDeploymentModule
The Java client module generates the client-side libraries that will access the Web service API. For SOAP endpoints, a client-side service interface will be generated that uses JAX-WS. For REST endpoints, the JAXB data model classes will be generated to access the XML endpoints. If there are any JSON endpoints, a set of data model classes will be generated that can be used in conjunction with the Jackson library to access them.
The order of the Java client module is 50, so as to allow the Java module to apply metadata to the endpoints before processing the client.
The "generate" step is by far the most intensive and complex step in the execution of the Java client module. The "generate" step generates all source code for accessing the web service API.
During the "compile" step, the Java client module compiles the code that was generated.
The "build" step assembles the classes that were assembled into a jar. If there are any JSON endpoints, the JSON client library will be assembled into a separate jar. It also creates a source jar for each library.
The Java client module is configured by the "java-client" element under the "modules" element of the enunciate configuration file. It supports the following attributes:
The "package-conversions" subelement of the "java-client" element is used to map packages from the original API packages to different package names. This element supports an arbitrary number of "convert" child elements that are used to specify the conversions. These "convert" elements support the following attributes:
The "json-package-conversions" element has the same purpose and syntax as the "package-conversions" element above, but is instead applied to the JSON java client. By default, ths JSON conversions will be the same as the "package-conversions" with the "json" subpackage appended.
An arbitrary number of "server-side-type" elements are allowed as child elements of the "java-client" element. The "server-side-type" element can be used to specify a server-side type that is to be ported directly over to the client-side library (as opposed to generating the client-side type from the server-side type). This can be useful to provide more useful client-side capabilities, but requires that there be no package conversions for types and web faults.
The "server-side-type" element supports one attribute, "pattern" that defines an ant-style pattern of the type(s) that are to be included (using a '.' for separating the package name).
The "facets" element is applicable to the Java Client module to configure which facets are to be included/excluded from the Java Client artifacts. For more information, see API Facets
The Java client module exports the following artifacts:
| Field Summary |
|---|
| Fields inherited from class org.codehaus.enunciate.modules.BasicDeploymentModule |
|---|
enunciate |
| Constructor Summary | |
|---|---|
JavaClientDeploymentModule()
|
|
| Method Summary | |
|---|---|
void |
addClientPackageConversion(ClientPackageConversion conversion)
Add a client package conversion. |
void |
addFacetExclude(String name)
Add a facet exclude. |
void |
addFacetInclude(String name)
Add a facet include. |
void |
addJsonClientPackageConversion(ClientPackageConversion conversion)
Add a client package conversion. |
void |
addServerSideTypeToUse(String serverSideTypeToUse)
Add a server-side type to use for the client-side library. |
protected void |
doBuild()
|
protected void |
doCompile()
|
void |
doFreemarkerGenerate()
|
protected boolean |
existsAnyJsonResourceMethod(List<RootResource> rootResources)
Whether any root resources exist that produce json. |
protected String |
getBeanName(ClientClassnameForMethod conversion,
String preconvert)
Get the bean name for a specified string. |
protected File |
getClientCompileDir()
The generate directory for the java client classes. |
protected File |
getClientGenerateDir()
The generate directory for the java client classes. |
Map<String,String> |
getClientPackageConversions()
The client package conversions. |
org.apache.commons.digester.RuleSet |
getConfigurationRules()
An Java configuration rule set. |
Set<String> |
getFacetExcludes()
The set of facets to exclude. |
Set<String> |
getFacetIncludes()
The set of facets to include. |
String |
getJarName()
The name of the jar. |
protected File |
getJsonClientCompileDir()
The generate directory for the java json client classes. |
protected File |
getJsonClientGenerateDir()
The generate directory for the java json client classes. |
Map<String,String> |
getJsonClientPackageConversions()
The json client package conversions. |
String |
getJsonJarName()
The name of the json client jar. |
protected Map<String,String> |
getJsonPackageConversions(Set<String> uniquePackages)
Get the list of json package conversions given the specified list of unique packages. |
String |
getLabel()
The label for the JAX-WS Client API. |
String |
getName()
|
protected freemarker.template.ObjectWrapper |
getObjectWrapper()
|
int |
getOrder()
|
List<File> |
getProjectResourceDirectories()
|
List<File> |
getProjectSources()
|
List<File> |
getProjectTestResourceDirectories()
|
List<File> |
getProjectTestSources()
|
protected File |
getServerSideDestFile(File sourceFile,
com.sun.mirror.declaration.TypeDeclaration declaration)
Get the destination for the specified declaration if the server-side type is to be used. |
Set<String> |
getServerSideTypesToUse()
The server-side types that are to be used for the client-side libraries. |
protected URL |
getTemplateURL(String template)
Get a template URL for the template of the given name. |
Validator |
getValidator()
An java-client validator. |
boolean |
isBundleSourcesWithClasses()
Whether to bundle the sources and the classes together. |
boolean |
isDisableCompile()
Whether to disable the compilation of the java sources (default: false). |
boolean |
isDisabled()
|
boolean |
isGenerateJsonJar()
Whether to generate the JSON client jar. |
void |
onClassesFound(Set<String> classes)
|
protected String |
readResource(String resource)
Reads a resource into string form. |
void |
setBundleSourcesWithClasses(boolean bundleSourcesWithClasses)
Whether to bundle the sources and the classes together. |
void |
setDisableCompile(boolean disableCompile)
Whether to disable the compilation of the java sources (default: false). |
void |
setGenerateJsonJar(boolean generateJsonJar)
Whether to generate the JSON client jar. |
void |
setJarName(String jarName)
The name of the jar. |
void |
setJsonJarName(String jarName)
The name of the json client jar. |
void |
setLabel(String label)
The label for the JAX-WS Client API. |
protected boolean |
useServerSide(com.sun.mirror.declaration.TypeDeclaration declaration,
AntPatternMatcher matcher)
Whether to use the server-side declaration for this declaration. |
| Methods inherited from class org.codehaus.enunciate.modules.FreemarkerDeploymentModule |
|---|
close, doGenerate, getConfiguration, getModel, getModelInternal, getTemplateExceptionHandler, getTemplateLoader, initModel, processTemplate, processTemplate, processTemplate, processTemplate |
| Methods inherited from class org.codehaus.enunciate.modules.BasicDeploymentModule |
|---|
debug, doPackage, getAliases, getBuildDir, getCompileDir, getEnunciate, getGenerateDir, getPackageDir, info, init, setBuildDir, setCompileDir, setDisabled, setGenerateDir, setPackageDir, step, warn |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.codehaus.enunciate.modules.DeploymentModule |
|---|
close, getAliases, init, step |
| Constructor Detail |
|---|
public JavaClientDeploymentModule()
| Method Detail |
|---|
public String getName()
getName in interface DeploymentModulegetName in class BasicDeploymentModulepublic int getOrder()
getOrder in interface DeploymentModulegetOrder in class BasicDeploymentModulepublic void onClassesFound(Set<String> classes)
onClassesFound in interface EnunciateClasspathListener
public void doFreemarkerGenerate()
throws IOException,
freemarker.template.TemplateException,
EnunciateException
doFreemarkerGenerate in class FreemarkerDeploymentModuleIOException
freemarker.template.TemplateException
EnunciateExceptionprotected Map<String,String> getJsonPackageConversions(Set<String> uniquePackages)
uniquePackages - The unique packages.
protected File getClientGenerateDir()
protected File getJsonClientGenerateDir()
protected File getServerSideDestFile(File sourceFile,
com.sun.mirror.declaration.TypeDeclaration declaration)
sourceFile - The source file.declaration - The declaration.
protected boolean useServerSide(com.sun.mirror.declaration.TypeDeclaration declaration,
AntPatternMatcher matcher)
declaration - The declaration.matcher - The matcher.
protected String getBeanName(ClientClassnameForMethod conversion,
String preconvert)
conversion - The conversion to use.preconvert - The pre-converted fqn.
protected void doCompile()
throws EnunciateException,
IOException
doCompile in class BasicDeploymentModuleEnunciateException
IOExceptionprotected File getClientCompileDir()
protected File getJsonClientCompileDir()
protected void doBuild()
throws EnunciateException,
IOException
doBuild in class BasicDeploymentModuleEnunciateException
IOException
protected String readResource(String resource)
throws IOException,
EnunciateException
resource - The resource to read.
IOException
EnunciateExceptionprotected URL getTemplateURL(String template)
template - The specified template.
public String getJarName()
public String getJsonJarName()
public void setJarName(String jarName)
jarName - The name of the jar.public void setJsonJarName(String jarName)
jarName - The name of the json client jar.public org.apache.commons.digester.RuleSet getConfigurationRules()
getConfigurationRules in interface DeploymentModulegetConfigurationRules in class BasicDeploymentModulepublic Validator getValidator()
getValidator in interface DeploymentModulegetValidator in class BasicDeploymentModuleprotected freemarker.template.ObjectWrapper getObjectWrapper()
getObjectWrapper in class FreemarkerDeploymentModulepublic Map<String,String> getClientPackageConversions()
public void addClientPackageConversion(ClientPackageConversion conversion)
conversion - The conversion to add.public Map<String,String> getJsonClientPackageConversions()
public void addJsonClientPackageConversion(ClientPackageConversion conversion)
conversion - The conversion to add.public Set<String> getServerSideTypesToUse()
public void addServerSideTypeToUse(String serverSideTypeToUse)
serverSideTypeToUse - The server-side type to use.public String getLabel()
public void setLabel(String label)
label - The label for the JAX-WS Client API.public boolean isBundleSourcesWithClasses()
public void setBundleSourcesWithClasses(boolean bundleSourcesWithClasses)
bundleSourcesWithClasses - Whether to bundle the sources and the classes together.public boolean isGenerateJsonJar()
protected boolean existsAnyJsonResourceMethod(List<RootResource> rootResources)
rootResources - The root resources.
public void setGenerateJsonJar(boolean generateJsonJar)
generateJsonJar - Whether to generate the JSON jar.public boolean isDisabled()
isDisabled in interface DeploymentModuleisDisabled in class BasicDeploymentModulepublic List<File> getProjectSources()
getProjectSources in interface ProjectExtensionModulepublic List<File> getProjectTestSources()
getProjectTestSources in interface ProjectExtensionModulepublic List<File> getProjectResourceDirectories()
getProjectResourceDirectories in interface ProjectExtensionModulepublic List<File> getProjectTestResourceDirectories()
getProjectTestResourceDirectories in interface ProjectExtensionModulepublic boolean isDisableCompile()
public void setDisableCompile(boolean disableCompile)
disableCompile - Whether to disable the compilation of the java sources (default: false).public Set<String> getFacetIncludes()
getFacetIncludes in interface FacetAwarepublic void addFacetInclude(String name)
name - The name.public Set<String> getFacetExcludes()
getFacetExcludes in interface FacetAwarepublic void addFacetExclude(String name)
name - The name.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||