|
|||||||||
| 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 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 |
addJsonClientPackageConversion(ClientPackageConversion conversion)
Add a client package conversion. |
void |
addServerSideTypeToUse(java.lang.String serverSideTypeToUse)
Add a server-side type to use for the client-side library. |
protected void |
doBuild()
Default implementation is a no-op. |
protected void |
doCompile()
Default implementation is a no-op. |
void |
doFreemarkerGenerate()
Generate using Freemarker. |
protected boolean |
existsAnyJsonResourceMethod(java.util.List<RootResource> rootResources)
Whether any root resources exist that produce json. |
protected java.lang.String |
getBeanName(ClientClassnameForMethod conversion,
java.lang.String preconvert)
Get the bean name for a specified string. |
protected java.io.File |
getClientCompileDir()
The generate directory for the java client classes. |
protected java.io.File |
getClientGenerateDir()
The generate directory for the java client classes. |
java.util.Map<java.lang.String,java.lang.String> |
getClientPackageConversions()
The client package conversions. |
org.apache.commons.digester.RuleSet |
getConfigurationRules()
An Java configuration rule set. |
java.lang.String |
getJarName()
The name of the jar. |
protected java.io.File |
getJsonClientCompileDir()
The generate directory for the java json client classes. |
protected java.io.File |
getJsonClientGenerateDir()
The generate directory for the java json client classes. |
java.util.Map<java.lang.String,java.lang.String> |
getJsonClientPackageConversions()
The json client package conversions. |
java.lang.String |
getJsonJarName()
The name of the json client jar. |
protected java.util.Map<java.lang.String,java.lang.String> |
getJsonPackageConversions(java.util.Set<java.lang.String> uniquePackages)
Get the list of json package conversions given the specified list of unique packages. |
java.lang.String |
getLabel()
The label for the JAX-WS Client API. |
java.lang.String |
getName()
The name of the deployment module. |
protected freemarker.template.ObjectWrapper |
getObjectWrapper()
The object wrapper to use for the model. |
int |
getOrder()
The order of execution for the deployment module. |
java.util.List<java.io.File> |
getProjectResourceDirectories()
Any additional project resource directories to add to the project. |
java.util.List<java.io.File> |
getProjectSources()
Any additional project source roots to add to the project. |
java.util.List<java.io.File> |
getProjectTestResourceDirectories()
Any additional project resource directories to add to the project. |
java.util.List<java.io.File> |
getProjectTestSources()
Any additional project test source roots to add to the project. |
protected java.io.File |
getServerSideDestFile(java.io.File sourceFile,
com.sun.mirror.declaration.TypeDeclaration declaration)
Get the destination for the specified declaration if the server-side type is to be used. |
java.util.Set<java.lang.String> |
getServerSideTypesToUse()
The server-side types that are to be used for the client-side libraries. |
protected java.net.URL |
getTemplateURL(java.lang.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()
Whether this deployment module has been disabled, e.g. |
boolean |
isGenerateJsonJar()
Whether to generate the JSON client jar. |
void |
onClassesFound(java.util.Set<java.lang.String> classes)
Logic for handling a set of classes that were found on the Enunciate classpath. |
protected java.lang.String |
readResource(java.lang.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(java.lang.String jarName)
The name of the jar. |
void |
setJsonJarName(java.lang.String jarName)
The name of the json client jar. |
void |
setLabel(java.lang.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 java.lang.String getName()
DeploymentModule
getName in interface DeploymentModulegetName in class BasicDeploymentModulepublic int getOrder()
DeploymentModule
getOrder in interface DeploymentModulegetOrder in class BasicDeploymentModulepublic void onClassesFound(java.util.Set<java.lang.String> classes)
EnunciateClasspathListener
onClassesFound in interface EnunciateClasspathListenerclasses - The classes that were found.
public void doFreemarkerGenerate()
throws java.io.IOException,
freemarker.template.TemplateException,
EnunciateException
FreemarkerDeploymentModuleFreemarkerDeploymentModule.doGenerate() but can throw a TemplateException.
doFreemarkerGenerate in class FreemarkerDeploymentModulejava.io.IOException
freemarker.template.TemplateException
EnunciateExceptionprotected java.util.Map<java.lang.String,java.lang.String> getJsonPackageConversions(java.util.Set<java.lang.String> uniquePackages)
uniquePackages - The unique packages.
protected java.io.File getClientGenerateDir()
protected java.io.File getJsonClientGenerateDir()
protected java.io.File getServerSideDestFile(java.io.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 java.lang.String getBeanName(ClientClassnameForMethod conversion,
java.lang.String preconvert)
conversion - The conversion to use.preconvert - The pre-converted fqn.
protected void doCompile()
throws EnunciateException,
java.io.IOException
BasicDeploymentModule
doCompile in class BasicDeploymentModuleEnunciateException
java.io.IOExceptionprotected java.io.File getClientCompileDir()
protected java.io.File getJsonClientCompileDir()
protected void doBuild()
throws EnunciateException,
java.io.IOException
BasicDeploymentModule
doBuild in class BasicDeploymentModuleEnunciateException
java.io.IOException
protected java.lang.String readResource(java.lang.String resource)
throws java.io.IOException,
EnunciateException
resource - The resource to read.
java.io.IOException
EnunciateExceptionprotected java.net.URL getTemplateURL(java.lang.String template)
template - The specified template.
public java.lang.String getJarName()
public java.lang.String getJsonJarName()
public void setJarName(java.lang.String jarName)
jarName - The name of the jar.public void setJsonJarName(java.lang.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()
FreemarkerDeploymentModule
getObjectWrapper in class FreemarkerDeploymentModulepublic java.util.Map<java.lang.String,java.lang.String> getClientPackageConversions()
public void addClientPackageConversion(ClientPackageConversion conversion)
conversion - The conversion to add.public java.util.Map<java.lang.String,java.lang.String> getJsonClientPackageConversions()
public void addJsonClientPackageConversion(ClientPackageConversion conversion)
conversion - The conversion to add.public java.util.Set<java.lang.String> getServerSideTypesToUse()
public void addServerSideTypeToUse(java.lang.String serverSideTypeToUse)
serverSideTypeToUse - The server-side type to use.public java.lang.String getLabel()
public void setLabel(java.lang.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(java.util.List<RootResource> rootResources)
rootResources - The root resources.
public void setGenerateJsonJar(boolean generateJsonJar)
generateJsonJar - Whether to generate the JSON jar.public boolean isDisabled()
DeploymentModule
isDisabled in interface DeploymentModuleisDisabled in class BasicDeploymentModulepublic java.util.List<java.io.File> getProjectSources()
ProjectExtensionModule
getProjectSources in interface ProjectExtensionModulepublic java.util.List<java.io.File> getProjectTestSources()
ProjectExtensionModule
getProjectTestSources in interface ProjectExtensionModulepublic java.util.List<java.io.File> getProjectResourceDirectories()
ProjectExtensionModule
getProjectResourceDirectories in interface ProjectExtensionModulepublic java.util.List<java.io.File> getProjectTestResourceDirectories()
ProjectExtensionModule
getProjectTestResourceDirectories in interface ProjectExtensionModulepublic boolean isDisableCompile()
public void setDisableCompile(boolean disableCompile)
disableCompile - Whether to disable the compilation of the java sources (default: false).
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||