com.legstar.cixs.jaxws.gen
Class Jaxws2CixsGenerator

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.legstar.cixs.gen.ant.AbstractCixsGenerator
              extended by com.legstar.cixs.jaxws.gen.AbstractCixsJaxwsGenerator
                  extended by com.legstar.cixs.jaxws.gen.Jaxws2CixsGenerator

public class Jaxws2CixsGenerator
extends AbstractCixsJaxwsGenerator

This Ant task creates the various Jaxws artifacts needed to implement a Jaxws Web Service that acts as an adapter for a mainframe program. Web service clients can consume this adapter as any other Web Service but internally the adapter use the LegStar transport to call a a mainframe program.


Field Summary
static String DEFAULT_WSDL_PORT_NAME_SUFFIX
          Will be appended to service name to form a port name.
static String DEFAULT_WSDL_SERVICE_NAME_SUFFIX
          By default the web service name is built from component name and this suffix.
static String DEFAULT_WSDL_TARGET_NAMESPACE_PREFIX
          By default the web service namespace is built from component name and this prefix.
static String JAXWS_TO_CIXS_GENERATOR_NAME
          This generator name.
static String OPERATION_FAULT_INFO_VLC_TEMPLATE
          Velocity template for fault info.
static String OPERATION_FAULT_VLC_TEMPLATE
          Velocity template for fault.
static String OPERATION_HOLDER_VLC_TEMPLATE
          Velocity template for holder.
static String OPERATION_HOST_PROGRAM_VLC_TEMPLATE
          Velocity template for host program bean.
static String OPERATION_PROGRAM_INVOKER_VLC_TEMPLATE
          Velocity template for operation invokers.
static String OPERATION_WRAPPER_VLC_TEMPLATE
          Velocity template for wrapper.
static String SERVICE_ANT_BUILD_JAR_VLC_TEMPLATE
          Velocity template for service ant-build-jar.
static String SERVICE_ANT_BUILD_WAR_VLC_TEMPLATE
          Velocity template for service ant-build-war.
static String SERVICE_ANT_DEPLOY_VLC_TEMPLATE
          Velocity template for service ant-deploy.
static String SERVICE_HEADER_VLC_TEMPLATE
          Velocity template for service header.
static String SERVICE_IMPLEMENTATION_VLC_TEMPLATE
          Velocity template for service implementation.
static String SERVICE_INTERFACE_VLC_TEMPLATE
          Velocity template for service interface.
static String SERVICE_OBJECTFACTORY_VLC_TEMPLATE
          Velocity template for service ObjectFactory.java.
static String SERVICE_PACKAGE_HTML_VLC_TEMPLATE
          Velocity template for package html.
static String SERVICE_PACKAGE_INFO_VLC_TEMPLATE
          Velocity template for service package-info.java.
static String SERVICE_SUN_JAXWS_XML_VLC_TEMPLATE
          Velocity template for service sun-jaxws-xml.
static String SERVICE_WEB_XML_VLC_TEMPLATE
          Velocity template for service web-xml.
 
Fields inherited from class com.legstar.cixs.jaxws.gen.AbstractCixsJaxwsGenerator
JAXWS_GENERATOR_NAME
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
Jaxws2CixsGenerator()
          Constructor.
 
Method Summary
 void addExtendedParameters(Map<String,Object> parameters)
          Add common parameters expected by templates to come from a parameters map.
 void addWebServiceParameters(WebServiceParameters webServiceParameters)
           
 void checkExtendedExtendedInput()
          Give the inheriting generators a chance to add more controls.
protected  void completeModel()
          Generate default values where they are missing in the model.
protected  void completeWebServiceParameters()
          Provide default values to expose this adapter as a Web Service.
static String generateAntBuildJar(CixsJaxwsService service, Map<String,Object> parameters, File serviceAntFilesDir)
          Create the JAX-WS Ant Build jar file.
static String generateAntBuildWar(CixsJaxwsService service, Map<String,Object> parameters, File serviceAntFilesDir)
          Create the JAX-WS Ant Build War file.
static String generateAntDeploy(CixsJaxwsService service, Map<String,Object> parameters, File serviceAntFilesDir)
          Create the deploy Ant Build file.
 void generateExtended(Map<String,Object> parameters)
          Create more artifacts for a Jboss ESB service.
static void generateFault(CixsOperation operation, Map<String,Object> parameters, File operationClassFilesDir)
          Create a fault class (Jaxws Exception).
static void generateFaultInfo(CixsOperation operation, Map<String,Object> parameters, File operationClassFilesDir)
          Create a fault info class.
static void generateHeader(CixsJaxwsService service, Map<String,Object> parameters, File serviceClassFilesDir)
          Create the Jaxws Header class file.
static void generateHolders(CixsOperation operation, Map<String,Object> parameters, File operationClassFilesDir)
          Create a holder classes for multi-structures input or output.
static void generateHostProgram(CixsOperation operation, Map<String,Object> parameters, File operationClassFilesDir)
          Create the host program bean.
static void generateImplementation(CixsJaxwsService service, Map<String,Object> parameters, File serviceClassFilesDir)
          Create the Jaxws Implementation class file.
static void generateInterface(CixsJaxwsService service, Map<String,Object> parameters, File serviceClassFilesDir)
          Create the Jaxws Interface class file.
static String generateObjectFactory(CixsJaxwsService service, Map<String,Object> parameters, File serviceClassFilesDir)
          Create the Jaxb ObjectFctory.java class.
static void generatePackageHtml(CixsJaxwsService service, Map<String,Object> parameters, File serviceClassFilesDir)
          Create a package level doc.
static String generatePackageInfo(CixsJaxwsService service, Map<String,Object> parameters, File serviceClassFilesDir)
          Create the Jaxb package-info.java class.
static void generateProgramInvoker(CixsOperation operation, Map<String,Object> parameters, File operationClassFilesDir)
          Create a program invoker class.
static void generateSunJaxwsXml(CixsJaxwsService service, Map<String,Object> parameters, File serviceWebFilesDir)
          Create the Jaxws Sun Jaxws Xml file.
static void generateWebXml(CixsJaxwsService service, Map<String,Object> parameters, File serviceWebFilesDir)
          Create the Jaxws Web Xml file.
static void generateWrappers(CixsOperation operation, Map<String,Object> parameters, File operationClassFilesDir)
          Create a wrapper class.
 AntBuildJaxws2CixsModel getAntModel()
          
 String getGeneratorName()
          
 WebServiceParameters getWebServiceParameters()
           
 boolean isNoPackageInfo()
          Prevents generation of package-info.java which does not compile under JDK 1.5.
 void setNoPackageInfo(boolean noPackageInfo)
          Prevents generation of package-info.java which does not compile under JDK 1.5.
 void setWebServiceParameters(WebServiceParameters webServiceParameters)
           
 
Methods inherited from class com.legstar.cixs.jaxws.gen.AbstractCixsJaxwsGenerator
add, addCixsJaxwsService, checkExtendedInput, generate, getCixsJaxwsService, getCixsOperations, getTargetWarDir, getTargetWDDDir, getVersion, setCixsJaxwsService, setTargetWarDir, setTargetWDDDir
 
Methods inherited from class com.legstar.cixs.gen.ant.AbstractCixsGenerator
add, addCixsService, execute, generateFile, generateFile, getCixsService, getCoxbBinDir, getCustBinDir, getHostCharset, getJaxbBinDir, getTargetAntDir, getTargetBinDir, getTargetDistDir, getTargetSrcDir, init, setCixsService, setCoxbBinDir, setCustBinDir, setHostCharset, setJaxbBinDir, setTargetAntDir, setTargetBinDir, setTargetDistDir, setTargetSrcDir
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAXWS_TO_CIXS_GENERATOR_NAME

public static final String JAXWS_TO_CIXS_GENERATOR_NAME
This generator name.

See Also:
Constant Field Values

SERVICE_INTERFACE_VLC_TEMPLATE

public static final String SERVICE_INTERFACE_VLC_TEMPLATE
Velocity template for service interface.

See Also:
Constant Field Values

SERVICE_IMPLEMENTATION_VLC_TEMPLATE

public static final String SERVICE_IMPLEMENTATION_VLC_TEMPLATE
Velocity template for service implementation.

See Also:
Constant Field Values

SERVICE_HEADER_VLC_TEMPLATE

public static final String SERVICE_HEADER_VLC_TEMPLATE
Velocity template for service header.

See Also:
Constant Field Values

SERVICE_ANT_BUILD_WAR_VLC_TEMPLATE

public static final String SERVICE_ANT_BUILD_WAR_VLC_TEMPLATE
Velocity template for service ant-build-war.

See Also:
Constant Field Values

SERVICE_ANT_BUILD_JAR_VLC_TEMPLATE

public static final String SERVICE_ANT_BUILD_JAR_VLC_TEMPLATE
Velocity template for service ant-build-jar.

See Also:
Constant Field Values

SERVICE_ANT_DEPLOY_VLC_TEMPLATE

public static final String SERVICE_ANT_DEPLOY_VLC_TEMPLATE
Velocity template for service ant-deploy.

See Also:
Constant Field Values

SERVICE_SUN_JAXWS_XML_VLC_TEMPLATE

public static final String SERVICE_SUN_JAXWS_XML_VLC_TEMPLATE
Velocity template for service sun-jaxws-xml.

See Also:
Constant Field Values

SERVICE_WEB_XML_VLC_TEMPLATE

public static final String SERVICE_WEB_XML_VLC_TEMPLATE
Velocity template for service web-xml.

See Also:
Constant Field Values

SERVICE_PACKAGE_HTML_VLC_TEMPLATE

public static final String SERVICE_PACKAGE_HTML_VLC_TEMPLATE
Velocity template for package html.

See Also:
Constant Field Values

OPERATION_FAULT_VLC_TEMPLATE

public static final String OPERATION_FAULT_VLC_TEMPLATE
Velocity template for fault.

See Also:
Constant Field Values

OPERATION_FAULT_INFO_VLC_TEMPLATE

public static final String OPERATION_FAULT_INFO_VLC_TEMPLATE
Velocity template for fault info.

See Also:
Constant Field Values

OPERATION_HOLDER_VLC_TEMPLATE

public static final String OPERATION_HOLDER_VLC_TEMPLATE
Velocity template for holder.

See Also:
Constant Field Values

OPERATION_HOST_PROGRAM_VLC_TEMPLATE

public static final String OPERATION_HOST_PROGRAM_VLC_TEMPLATE
Velocity template for host program bean.

See Also:
Constant Field Values

OPERATION_WRAPPER_VLC_TEMPLATE

public static final String OPERATION_WRAPPER_VLC_TEMPLATE
Velocity template for wrapper.

See Also:
Constant Field Values

OPERATION_PROGRAM_INVOKER_VLC_TEMPLATE

public static final String OPERATION_PROGRAM_INVOKER_VLC_TEMPLATE
Velocity template for operation invokers.

See Also:
Constant Field Values

SERVICE_PACKAGE_INFO_VLC_TEMPLATE

public static final String SERVICE_PACKAGE_INFO_VLC_TEMPLATE
Velocity template for service package-info.java.

See Also:
Constant Field Values

SERVICE_OBJECTFACTORY_VLC_TEMPLATE

public static final String SERVICE_OBJECTFACTORY_VLC_TEMPLATE
Velocity template for service ObjectFactory.java.

See Also:
Constant Field Values

DEFAULT_WSDL_PORT_NAME_SUFFIX

public static final String DEFAULT_WSDL_PORT_NAME_SUFFIX
Will be appended to service name to form a port name.

See Also:
Constant Field Values

DEFAULT_WSDL_SERVICE_NAME_SUFFIX

public static final String DEFAULT_WSDL_SERVICE_NAME_SUFFIX
By default the web service name is built from component name and this suffix.

See Also:
Constant Field Values

DEFAULT_WSDL_TARGET_NAMESPACE_PREFIX

public static final String DEFAULT_WSDL_TARGET_NAMESPACE_PREFIX
By default the web service namespace is built from component name and this prefix.

See Also:
Constant Field Values
Constructor Detail

Jaxws2CixsGenerator

public Jaxws2CixsGenerator()
Constructor.

Method Detail

addExtendedParameters

public void addExtendedParameters(Map<String,Object> parameters)
Add common parameters expected by templates to come from a parameters map.

Specified by:
addExtendedParameters in class AbstractCixsJaxwsGenerator
Parameters:
parameters - a parameters map to which parameters must be added

checkExtendedExtendedInput

public void checkExtendedExtendedInput()
                                throws com.legstar.codegen.CodeGenMakeException
Give the inheriting generators a chance to add more controls.

Specified by:
checkExtendedExtendedInput in class AbstractCixsJaxwsGenerator
Throws:
com.legstar.codegen.CodeGenMakeException - if control fails

generateExtended

public void generateExtended(Map<String,Object> parameters)
                      throws com.legstar.codegen.CodeGenMakeException
Create more artifacts for a Jboss ESB service.

Specified by:
generateExtended in class AbstractCixsJaxwsGenerator
Parameters:
parameters - a predefined set of parameters useful for generation
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

completeModel

protected void completeModel()
Generate default values where they are missing in the model. This will reduce the amount of code in the velocity templates.

The adapter target namespace is used for wrapper JAXB classes.

Overrides:
completeModel in class AbstractCixsGenerator

completeWebServiceParameters

protected void completeWebServiceParameters()
Provide default values to expose this adapter as a Web Service.


generateInterface

public static void generateInterface(CixsJaxwsService service,
                                     Map<String,Object> parameters,
                                     File serviceClassFilesDir)
                              throws com.legstar.codegen.CodeGenMakeException
Create the Jaxws Interface class file.

Parameters:
service - the Jaxws service description
parameters - miscellaneous help parameters
serviceClassFilesDir - where to store the generated file
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generatePackageHtml

public static void generatePackageHtml(CixsJaxwsService service,
                                       Map<String,Object> parameters,
                                       File serviceClassFilesDir)
                                throws com.legstar.codegen.CodeGenMakeException
Create a package level doc.

Parameters:
service - the Jaxws service description
parameters - miscellaneous help parameters
serviceClassFilesDir - where to store the generated file
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generateImplementation

public static void generateImplementation(CixsJaxwsService service,
                                          Map<String,Object> parameters,
                                          File serviceClassFilesDir)
                                   throws com.legstar.codegen.CodeGenMakeException
Create the Jaxws Implementation class file.

Parameters:
service - the Jaxws service description
parameters - miscellaneous help parameters
serviceClassFilesDir - where to store the generated file
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generateHeader

public static void generateHeader(CixsJaxwsService service,
                                  Map<String,Object> parameters,
                                  File serviceClassFilesDir)
                           throws com.legstar.codegen.CodeGenMakeException
Create the Jaxws Header class file.

Parameters:
service - the Jaxws service description
parameters - miscellaneous help parameters
serviceClassFilesDir - where to store the generated file
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generateAntBuildWar

public static String generateAntBuildWar(CixsJaxwsService service,
                                         Map<String,Object> parameters,
                                         File serviceAntFilesDir)
                                  throws com.legstar.codegen.CodeGenMakeException
Create the JAX-WS Ant Build War file.

Parameters:
service - the Jaxws service description
parameters - miscellaneous help parameters
serviceAntFilesDir - where to store the generated file
Returns:
the generated file name
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generateAntBuildJar

public static String generateAntBuildJar(CixsJaxwsService service,
                                         Map<String,Object> parameters,
                                         File serviceAntFilesDir)
                                  throws com.legstar.codegen.CodeGenMakeException
Create the JAX-WS Ant Build jar file.

Parameters:
service - the Jaxws service description
parameters - miscellaneous help parameters
serviceAntFilesDir - where to store the generated file
Returns:
the generated file name
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generateAntDeploy

public static String generateAntDeploy(CixsJaxwsService service,
                                       Map<String,Object> parameters,
                                       File serviceAntFilesDir)
                                throws com.legstar.codegen.CodeGenMakeException
Create the deploy Ant Build file.

Parameters:
service - the Jaxws service description
parameters - miscellaneous help parameters
serviceAntFilesDir - where to store the generated file
Returns:
the generated file name
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generateWebXml

public static void generateWebXml(CixsJaxwsService service,
                                  Map<String,Object> parameters,
                                  File serviceWebFilesDir)
                           throws com.legstar.codegen.CodeGenMakeException
Create the Jaxws Web Xml file.

Parameters:
service - the Jaxws service description
parameters - miscellaneous help parameters
serviceWebFilesDir - where to store the generated file
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generateSunJaxwsXml

public static void generateSunJaxwsXml(CixsJaxwsService service,
                                       Map<String,Object> parameters,
                                       File serviceWebFilesDir)
                                throws com.legstar.codegen.CodeGenMakeException
Create the Jaxws Sun Jaxws Xml file.

Parameters:
service - the Jaxws service description
parameters - miscellaneous help parameters
serviceWebFilesDir - where to store the generated file
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generateFault

public static void generateFault(CixsOperation operation,
                                 Map<String,Object> parameters,
                                 File operationClassFilesDir)
                          throws com.legstar.codegen.CodeGenMakeException
Create a fault class (Jaxws Exception).

Parameters:
operation - the cixs operation
parameters - miscellaneous help parameters
operationClassFilesDir - where to store the generated file
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generateFaultInfo

public static void generateFaultInfo(CixsOperation operation,
                                     Map<String,Object> parameters,
                                     File operationClassFilesDir)
                              throws com.legstar.codegen.CodeGenMakeException
Create a fault info class.

Parameters:
operation - the cixs operation
parameters - miscellaneous help parameters
operationClassFilesDir - where to store the generated file
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generateWrappers

public static void generateWrappers(CixsOperation operation,
                                    Map<String,Object> parameters,
                                    File operationClassFilesDir)
                             throws com.legstar.codegen.CodeGenMakeException
Create a wrapper class.

Parameters:
operation - the cixs operation
parameters - miscellaneous help parameters
operationClassFilesDir - where to store the generated file
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generateHolders

public static void generateHolders(CixsOperation operation,
                                   Map<String,Object> parameters,
                                   File operationClassFilesDir)
                            throws com.legstar.codegen.CodeGenMakeException
Create a holder classes for multi-structures input or output.

Parameters:
operation - the cixs operation
parameters - miscellaneous help parameters
operationClassFilesDir - where to store the generated file
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generateProgramInvoker

public static void generateProgramInvoker(CixsOperation operation,
                                          Map<String,Object> parameters,
                                          File operationClassFilesDir)
                                   throws com.legstar.codegen.CodeGenMakeException
Create a program invoker class.

Parameters:
operation - the cixs operation
parameters - miscellaneous help parameters
operationClassFilesDir - where to store the generated file
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generateHostProgram

public static void generateHostProgram(CixsOperation operation,
                                       Map<String,Object> parameters,
                                       File operationClassFilesDir)
                                throws com.legstar.codegen.CodeGenMakeException
Create the host program bean.

Parameters:
operation - the cixs operation
parameters - miscellaneous help parameters
operationClassFilesDir - where to store the generated file
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generatePackageInfo

public static String generatePackageInfo(CixsJaxwsService service,
                                         Map<String,Object> parameters,
                                         File serviceClassFilesDir)
                                  throws com.legstar.codegen.CodeGenMakeException
Create the Jaxb package-info.java class.

Parameters:
service - the Jaxws service description
parameters - miscellaneous help parameters
serviceClassFilesDir - where to store the generated file
Returns:
the generated local file name
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

generateObjectFactory

public static String generateObjectFactory(CixsJaxwsService service,
                                           Map<String,Object> parameters,
                                           File serviceClassFilesDir)
                                    throws com.legstar.codegen.CodeGenMakeException
Create the Jaxb ObjectFctory.java class.

Parameters:
service - the Jaxws service description
parameters - miscellaneous help parameters
serviceClassFilesDir - where to store the generated file
Returns:
the generated local file name
Throws:
com.legstar.codegen.CodeGenMakeException - if generation fails

getAntModel

public AntBuildJaxws2CixsModel getAntModel()

Overrides:
getAntModel in class AbstractCixsJaxwsGenerator
See Also:
AbstractCixsGenerator.getAntModel()

getGeneratorName

public String getGeneratorName()

Specified by:
getGeneratorName in class AbstractCixsGenerator

getWebServiceParameters

public WebServiceParameters getWebServiceParameters()
Returns:
the set of parameters needed to expose a Web Service

setWebServiceParameters

public void setWebServiceParameters(WebServiceParameters webServiceParameters)
Parameters:
webServiceParameters - the set of parameters needed to expose a Web Service to set

addWebServiceParameters

public void addWebServiceParameters(WebServiceParameters webServiceParameters)
Parameters:
webServiceParameters - the set of parameters needed to expose a Web Service to set

isNoPackageInfo

public boolean isNoPackageInfo()
Prevents generation of package-info.java which does not compile under JDK 1.5.

Returns:
true if we should not generate package-info.java

setNoPackageInfo

public void setNoPackageInfo(boolean noPackageInfo)
Prevents generation of package-info.java which does not compile under JDK 1.5.

Parameters:
noPackageInfo - true if we should not generate package-info.java


Copyright © 2014 LegSem. All Rights Reserved.