Class AxisServiceBasedMultiLanguageEmitter
- java.lang.Object
-
- org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter
-
- All Implemented Interfaces:
Emitter
- Direct Known Subclasses:
CEmitter,JavaEmitter,JAXWSEmitter
public class AxisServiceBasedMultiLanguageEmitter extends Object implements Emitter
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description AxisServiceBasedMultiLanguageEmitter()default constructor - builds
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddAttribute(Document document, String AttribName, String attribValue, Element element)Utility method to add an attribute to a given element.protected ElementaddElement(Document document, String eltName, String eltValue, Element element)Utility method to add an attribute to a given element.protected voidaddEndpoint(Document doc, Element rootElement)Adds the endpoint to the document.protected voidaddFaultMessages(List operationFaultMessages, Set faultMessagesToMep)add the qNames of the operation fault message names to faultMessages Mepprotected voidaddHeaderOperations(List soapHeaderParameterQNameList, AxisBindingOperation bindingOperation, boolean input)populate the header parametersprotected voidaddHeaderOperationsToFault(List soapHeaderParameterQNameList, AxisOperation axisOperation)populate the header parameters to faultsprotected voidaddShortType(Element paramElement, String xmlName)set the short type as it is in the data bindingprotected voidaddSOAPAction(Document doc, Element rootElement, QName qName)Adds the soap actionprotected voidaddSoapVersion(Document doc, Element rootElement)Looks for the SOAPVersion and adds it.voidcopyMap(Map copyFormMap, Map copyToMap)protected voidcopyToFaultMap()Utility method to copy the faults to the correct mapprotected DocumentcreateDocumentForMessageReceiver(String mep, boolean isServerSideInterface)Creates the XML model for the message receiverprotected DocumentcreateDOMDocumentForAntBuild()Creates the DOM tree for the Ant build.protected DocumentcreateDOMDocumentForCallbackHandler()Generates the model for the callbacks.protected DocumentcreateDOMDocumentForException()Generates the model for the callbacks.protected DocumentcreateDOMDocumentForInterface(boolean writeDatabinders)Creates the DOM tree for the interface creation.protected DocumentcreateDOMDocumentForInterfaceImplementation()Creates the DOM tree for implementations.protected DocumentcreateDOMDocumentForServiceXML()protected DocumentcreateDOMDocumentForSkeleton(boolean isSkeletonInterface)Creates the XMLModel for the skeletonprotected DocumentcreateDOMDocumentForSkeletonInterface()Creates the XML model for the skeleton interfaceprotected DocumentcreateDOMDocumentForTestCase()Creates the XML Model for the test caseprotected ElementcreateDOMElementforDatabinders(Document doc, boolean isServerside)create a dom element for databinders.protected voiddebugLogDocument(String description, Document doc)debugging method - write the output to the debuggervoidemitSkeleton()Emits the skeletonvoidemitStub()Emits the stubcode with bindings.protected voidfillSyncAttributes(Document doc, Element rootElement)protected voidgenerateAndPopulateFaultNames()Populate a map of fault class namesprotected ElementgenerateMethodElement(Document doc, String endpointName, AxisBindingOperation bindingOperation)Common code to generate aelement from an operation. protected ElementgenerateOptionParamComponent(Document doc, String name, String value)A convenient method for the generating optionParam componentsprotected ElementgenerateParamComponent(Document doc, String comment, String paramName, String paramType, QName paramQName)A convenient method for the generating the parameter elementprotected ElementgenerateParamComponent(Document doc, String comment, String paramName, String paramType, QName operationName, QName paramQName)A convenient method for the generating the parameter elementprotected ElementgenerateParamComponent(Document doc, String comment, String paramName, String paramType, QName opName, QName paramQName, String partName, boolean isPrimitive, boolean isArray)A convenient method for the generating the parameter elementprotected ElementgetBase64Elements(Document doc)Gets the base64 types.protected org.apache.neethi.PolicygetBindingPolicyFromMessage(AxisBindingOperation axisBindingOperation, String key)protected ObjectgetBindingPropertyFromMessage(String name, QName qName, String key)protected ObjectgetBindingPropertyFromMessageFault(String name, QName qName, String key)protected ObjectgetBindingPropertyFromOperation(String name, QName qName)protected DocumentgetEmptyDocument()protected ElementgetFaultElement(Document doc, AxisOperation operation)Get the fault element - No header faults are supportedprotected Element[]getFaultParamElements(Document doc, AxisOperation operation)protected StringgetFullyQualifiedMessageReceiverName()protected StringgetFullyQualifiedSkeletonInterfaceName()protected StringgetFullyQualifiedSkeletonName()protected StringgetFullyQualifiedStubName()Returns the fully qualified Stub name reused in many methodsprotected ElementgetInputElement(Document doc, AxisBindingOperation bindingOperation, List headerParameterQNameList)Get the input elementprotected Element[]getInputParamElement(Document doc, AxisOperation operation)MapgetNewCopy(Map copyFormMap)protected ElementgetOpNames(Document doc)Gets an element representing the operation namesprotected FilegetOutputDirectory(File outputDir, String dir2)Gets the output directory for source files.protected ElementgetOutputElement(Document doc, AxisBindingOperation bindingOperation, List headerParameterQNameList)Finds the output element.protected ElementgetOutputParamElement(Document doc, AxisOperation operation)protected ListgetParameterElementList(Document doc, List parameters, String location)protected ListgetParameterElementListForHttpHeader(Document doc, List parameters, String location)protected ListgetParameterElementListForSOAPModules(Document doc, List parameters)protected StringgetParamInitializer(String paramType)protected ElementgetServiceElement(String serviceName, String className, Document doc)A resusable method to return the service element for creating the service xmlprotected ElementgetUniqueListofFaults(Document doc)A util method that returns a unique list of faultsprotected ElementgetUniqueListofFaultsofMep(Document doc, String mep)A util method that returns a unique list of faults for a given mepprotected booleanloadOperations(Document doc, Element rootElement, String mep)Loads the operationsprotected StringmakeJavaClassName(String word)protected voidprocessModelObjects(Map objectMappings, Element root, Document doc)protected voidresetFaultNames()rests the fault name mapsvoidsetCodeGenConfiguration(CodeGenConfiguration configuration)Sets the relevant codegen configurationvoidsetMapper(TypeMapper mapper)Sets the type mapperprotected voidupdateFaultPackageForStub()Change the fault classnames to go with the package and stubprotected voidupdateMapperClassnames(String fullyQulifiedIncludingClassNamePrefix)we need to modify the mapper's class name list.protected voidupdateMapperForMessageReceiver()Update mapper for message receiverprotected voidupdateMapperForStub()Update mapper for the stubprotected voidwriteAntBuild()Writes the Ant build.protected voidwriteCallBackHandlers()Writes the callback handlers.protected voidwriteExceptions()Writes the exceptions.protected voidwriteFile(Document model, FileWriter writer)A resusable method for the implementation of interface and implementation writing.protected voidwriteInterface(boolean writeDatabinders)Writes the interfaces.protected voidwriteInterfaceImplementation()Writes the implementations.protected voidwriteMessageReceiver()Writes the message receiverprotected voidwriteServiceXml()Write the service XMLprotected voidwriteSkeleton()protected voidwriteSkeletonInterface()Write the skeletonInterfaceprotected voidwriteTestClasses()Write the test classesprotected voidwriteWSDLFiles()Write out the WSDL files (and the schemas) writing the WSDL (and schemas) is somewhat special so we cannot follow the usual pattern of using the class writer
-
-
-
Field Detail
-
CALL_BACK_HANDLER_SUFFIX
protected static final String CALL_BACK_HANDLER_SUFFIX
- See Also:
- Constant Field Values
-
STUB_SUFFIX
protected static final String STUB_SUFFIX
- See Also:
- Constant Field Values
-
TEST_SUFFIX
protected static final String TEST_SUFFIX
- See Also:
- Constant Field Values
-
SKELETON_CLASS_SUFFIX
protected static final String SKELETON_CLASS_SUFFIX
- See Also:
- Constant Field Values
-
SKELETON_CLASS_SUFFIX_BACK
protected static final String SKELETON_CLASS_SUFFIX_BACK
- See Also:
- Constant Field Values
-
SKELETON_INTERFACE_SUFFIX
protected static final String SKELETON_INTERFACE_SUFFIX
- See Also:
- Constant Field Values
-
SKELETON_INTERFACE_SUFFIX_BACK
protected static final String SKELETON_INTERFACE_SUFFIX_BACK
- See Also:
- Constant Field Values
-
STUB_INTERFACE_SUFFIX_BACK
protected static final String STUB_INTERFACE_SUFFIX_BACK
- See Also:
- Constant Field Values
-
MESSAGE_RECEIVER_SUFFIX
protected static final String MESSAGE_RECEIVER_SUFFIX
- See Also:
- Constant Field Values
-
DATABINDING_SUPPORTER_NAME_SUFFIX
protected static final String DATABINDING_SUPPORTER_NAME_SUFFIX
- See Also:
- Constant Field Values
-
mepToClassMap
protected static final Map mepToClassMap
-
mepToSuffixMap
protected static final Map mepToSuffixMap
-
axisBinding
protected AxisBinding axisBinding
-
axisEndpoint
protected AxisEndpoint axisEndpoint
-
uniqueFaultNameCounter
protected int uniqueFaultNameCounter
-
constructorMap
protected static final HashMap constructorMap
Field constructorMap
-
log
protected static final org.apache.commons.logging.Log log
-
resolver
protected URIResolver resolver
-
infoHolder
protected Map infoHolder
-
allServiceInfoHolder
protected Map allServiceInfoHolder
-
codeGenConfiguration
protected CodeGenConfiguration codeGenConfiguration
-
mapper
protected TypeMapper mapper
-
axisService
protected AxisService axisService
-
axisServices
protected List axisServices
-
fullyQualifiedFaultClassNameMap
protected Map fullyQualifiedFaultClassNameMap
-
faultClassNameMap
protected Map faultClassNameMap
-
faultElementQNameMap
protected Map faultElementQNameMap
-
instantiatableMessageClassNames
protected Map instantiatableMessageClassNames
-
TEST_SRC_DIR_NAME
protected static final String TEST_SRC_DIR_NAME
- See Also:
- Constant Field Values
-
useHolderClass_jaxws
protected boolean useHolderClass_jaxws
-
wrapped_jaxws
protected boolean wrapped_jaxws
-
-
Method Detail
-
setCodeGenConfiguration
public void setCodeGenConfiguration(CodeGenConfiguration configuration)
Sets the relevant codegen configuration- Specified by:
setCodeGenConfigurationin interfaceEmitter- Parameters:
configuration-- See Also:
Emitter.setCodeGenConfiguration(org.apache.axis2.wsdl.codegen.CodeGenConfiguration)
-
setMapper
public void setMapper(TypeMapper mapper)
Sets the type mapper- Specified by:
setMapperin interfaceEmitter- Parameters:
mapper-- See Also:
Emitter.setMapper(org.apache.axis2.wsdl.databinding.TypeMapper)
-
getBindingPropertyFromOperation
protected Object getBindingPropertyFromOperation(String name, QName qName)
-
getBindingPolicyFromMessage
protected org.apache.neethi.Policy getBindingPolicyFromMessage(AxisBindingOperation axisBindingOperation, String key)
-
getBindingPropertyFromMessage
protected Object getBindingPropertyFromMessage(String name, QName qName, String key)
-
getBindingPropertyFromMessageFault
protected Object getBindingPropertyFromMessageFault(String name, QName qName, String key)
-
updateMapperForStub
protected void updateMapperForStub()
Update mapper for the stub
-
getFullyQualifiedStubName
protected String getFullyQualifiedStubName()
Returns the fully qualified Stub name reused in many methods- Returns:
- classname
-
resetFaultNames
protected void resetFaultNames()
rests the fault name maps
-
generateAndPopulateFaultNames
protected void generateAndPopulateFaultNames()
Populate a map of fault class names
-
emitStub
public void emitStub() throws CodeGenerationExceptionEmits the stubcode with bindings.- Specified by:
emitStubin interfaceEmitter- Throws:
CodeGenerationException- See Also:
Emitter.emitStub()
-
writeAntBuild
protected void writeAntBuild() throws ExceptionWrites the Ant build.- Throws:
Exception
-
createDOMDocumentForAntBuild
protected Document createDOMDocumentForAntBuild()
Creates the DOM tree for the Ant build. Uses the interface.
-
writeTestClasses
protected void writeTestClasses() throws ExceptionWrite the test classes- Throws:
Exception
-
createDOMDocumentForTestCase
protected Document createDOMDocumentForTestCase()
Creates the XML Model for the test case- Returns:
- DOM document
-
writeInterfaceImplementation
protected void writeInterfaceImplementation() throws ExceptionWrites the implementations.- Throws:
Exception
-
createDOMDocumentForInterfaceImplementation
protected Document createDOMDocumentForInterfaceImplementation() throws Exception
Creates the DOM tree for implementations.- Throws:
Exception
-
getUniqueListofFaults
protected Element getUniqueListofFaults(Document doc)
A util method that returns a unique list of faults- Parameters:
doc-- Returns:
- DOM element
-
addFaultMessages
protected void addFaultMessages(List operationFaultMessages, Set faultMessagesToMep)
add the qNames of the operation fault message names to faultMessages Mep- Parameters:
operationFaultMessages-faultMessagesToMep-
-
getUniqueListofFaultsofMep
protected Element getUniqueListofFaultsofMep(Document doc, String mep)
A util method that returns a unique list of faults for a given mep- Parameters:
doc-- Returns:
- DOM element
-
addEndpoint
protected void addEndpoint(Document doc, Element rootElement) throws Exception
Adds the endpoint to the document.- Parameters:
doc-rootElement-- Throws:
Exception
-
addSoapVersion
protected void addSoapVersion(Document doc, Element rootElement)
Looks for the SOAPVersion and adds it.- Parameters:
doc-rootElement-
-
writeExceptions
protected void writeExceptions() throws ExceptionWrites the exceptions.- Throws:
Exception
-
createDOMDocumentForException
protected Document createDOMDocumentForException()
Generates the model for the callbacks.
-
writeCallBackHandlers
protected void writeCallBackHandlers() throws ExceptionWrites the callback handlers.- Throws:
Exception
-
createDOMDocumentForCallbackHandler
protected Document createDOMDocumentForCallbackHandler()
Generates the model for the callbacks.
-
writeInterface
protected void writeInterface(boolean writeDatabinders) throws ExceptionWrites the interfaces.- Throws:
Exception
-
createDOMDocumentForInterface
protected Document createDOMDocumentForInterface(boolean writeDatabinders)
Creates the DOM tree for the interface creation. Uses the interface.
-
updateMapperForMessageReceiver
protected void updateMapperForMessageReceiver()
Update mapper for message receiver
-
getFullyQualifiedMessageReceiverName
protected String getFullyQualifiedMessageReceiverName()
- Returns:
- fully qualified MR name
-
getFullyQualifiedSkeletonName
protected String getFullyQualifiedSkeletonName()
- Returns:
- fully qualified skeleton name
-
getFullyQualifiedSkeletonInterfaceName
protected String getFullyQualifiedSkeletonInterfaceName()
- Returns:
- fully qualified skeleton interface name
-
emitSkeleton
public void emitSkeleton() throws CodeGenerationExceptionEmits the skeleton- Specified by:
emitSkeletonin interfaceEmitter- Throws:
CodeGenerationException
-
writeWSDLFiles
protected void writeWSDLFiles()
Write out the WSDL files (and the schemas) writing the WSDL (and schemas) is somewhat special so we cannot follow the usual pattern of using the class writer
-
copyToFaultMap
protected void copyToFaultMap()
Utility method to copy the faults to the correct map
-
updateFaultPackageForStub
protected void updateFaultPackageForStub()
Change the fault classnames to go with the package and stub
-
writeMessageReceiver
protected void writeMessageReceiver() throws ExceptionWrites the message receiver- Throws:
Exception
-
createDocumentForMessageReceiver
protected Document createDocumentForMessageReceiver(String mep, boolean isServerSideInterface)
Creates the XML model for the message receiver- Parameters:
mep-isServerSideInterface-- Returns:
- DOM Document
-
createDOMElementforDatabinders
protected Element createDOMElementforDatabinders(Document doc, boolean isServerside)
create a dom element for databinders. This is called by other- Parameters:
doc-
-
addShortType
protected void addShortType(Element paramElement, String xmlName)
set the short type as it is in the data binding- Parameters:
paramElement-xmlName-
-
getOpNames
protected Element getOpNames(Document doc)
Gets an element representing the operation names- Parameters:
doc-- Returns:
- Returns Element.
-
getBase64Elements
protected Element getBase64Elements(Document doc)
Gets the base64 types. If not available this will be empty!!!- Parameters:
doc-- Returns:
- Returns Element.
-
processModelObjects
protected void processModelObjects(Map objectMappings, Element root, Document doc)
- Parameters:
objectMappings-root-doc-
-
updateMapperClassnames
protected void updateMapperClassnames(String fullyQulifiedIncludingClassNamePrefix)
we need to modify the mapper's class name list. The issue here is that in this case we do not expect the fully qulified class names to be present in the class names list due to the simple reason that they've not been written yet! Hence the mappers class name list needs to be updated to suit the expected package to be written in this case we modify the package name to have the class a inner class of the stub, interface or the message receiver depending on the style
-
writeServiceXml
protected void writeServiceXml() throws ExceptionWrite the service XML- Throws:
Exception
-
createDOMDocumentForServiceXML
protected Document createDOMDocumentForServiceXML()
-
getServiceElement
protected Element getServiceElement(String serviceName, String className, Document doc)
A resusable method to return the service element for creating the service xml- Parameters:
serviceName-className-doc-- Returns:
- DOM Element
-
writeSkeletonInterface
protected void writeSkeletonInterface() throws ExceptionWrite the skeletonInterface- Throws:
Exception
-
createDOMDocumentForSkeleton
protected Document createDOMDocumentForSkeleton(boolean isSkeletonInterface)
Creates the XMLModel for the skeleton- Parameters:
isSkeletonInterface-- Returns:
- DOM Document
-
createDOMDocumentForSkeletonInterface
protected Document createDOMDocumentForSkeletonInterface()
Creates the XML model for the skeleton interface- Returns:
- DOM Document
-
loadOperations
protected boolean loadOperations(Document doc, Element rootElement, String mep)
Loads the operations- Parameters:
doc-rootElement-mep-- Returns:
- boolean
-
generateMethodElement
protected Element generateMethodElement(Document doc, String endpointName, AxisBindingOperation bindingOperation) throws DOMException
Common code to generate aelement from an operation. - Parameters:
doc-endpointName-bindingOperation-- Returns:
- generated element
- Throws:
DOMException
-
getEmptyDocument
protected Document getEmptyDocument()
-
makeJavaClassName
protected String makeJavaClassName(String word)
- Parameters:
word-- Returns:
- Returns character removed string.
-
addAttribute
protected void addAttribute(Document document, String AttribName, String attribValue, Element element)
Utility method to add an attribute to a given element.- Parameters:
document-AttribName-attribValue-element-
-
fillSyncAttributes
protected void fillSyncAttributes(Document doc, Element rootElement)
- Parameters:
doc-rootElement-
-
debugLogDocument
protected void debugLogDocument(String description, Document doc)
debugging method - write the output to the debugger- Parameters:
description-doc-
-
getOutputDirectory
protected File getOutputDirectory(File outputDir, String dir2)
Gets the output directory for source files.- Parameters:
outputDir-- Returns:
- Returns File.
-
writeFile
protected void writeFile(Document model, FileWriter writer) throws IOException, Exception
A resusable method for the implementation of interface and implementation writing.- Parameters:
model-writer-- Throws:
IOExceptionException
-
addSOAPAction
protected void addSOAPAction(Document doc, Element rootElement, QName qName)
Adds the soap action- Parameters:
doc-rootElement-qName-
-
addHeaderOperations
protected void addHeaderOperations(List soapHeaderParameterQNameList, AxisBindingOperation bindingOperation, boolean input)
populate the header parameters- Parameters:
soapHeaderParameterQNameList-bindingOperation-input-
-
addHeaderOperationsToFault
protected void addHeaderOperationsToFault(List soapHeaderParameterQNameList, AxisOperation axisOperation)
populate the header parameters to faults- Parameters:
soapHeaderParameterQNameList-axisOperation-
-
getInputElement
protected Element getInputElement(Document doc, AxisBindingOperation bindingOperation, List headerParameterQNameList)
Get the input element- Parameters:
doc-bindingOperation-headerParameterQNameList-- Returns:
- DOM element
-
getFaultElement
protected Element getFaultElement(Document doc, AxisOperation operation)
Get the fault element - No header faults are supported- Parameters:
doc-operation-
-
getOutputElement
protected Element getOutputElement(Document doc, AxisBindingOperation bindingOperation, List headerParameterQNameList)
Finds the output element.- Parameters:
doc-bindingOperation-headerParameterQNameList-
-
getFaultParamElements
protected Element[] getFaultParamElements(Document doc, AxisOperation operation)
- Parameters:
doc-operation-- Returns:
- Returns the parameter element.
-
getInputParamElement
protected Element[] getInputParamElement(Document doc, AxisOperation operation)
- Parameters:
doc-operation-- Returns:
- Returns the parameter element.
-
generateParamComponent
protected Element generateParamComponent(Document doc, String comment, String paramName, String paramType, QName operationName, QName paramQName)
A convenient method for the generating the parameter element- Parameters:
doc-paramName-paramType-- Returns:
- DOM Element
-
generateParamComponent
protected Element generateParamComponent(Document doc, String comment, String paramName, String paramType, QName paramQName)
A convenient method for the generating the parameter element- Parameters:
doc-paramName-paramType-- Returns:
- DOM Element
-
generateOptionParamComponent
protected Element generateOptionParamComponent(Document doc, String name, String value)
A convenient method for the generating optionParam components- Parameters:
doc-name-value-- Returns:
- Element
-
generateParamComponent
protected Element generateParamComponent(Document doc, String comment, String paramName, String paramType, QName opName, QName paramQName, String partName, boolean isPrimitive, boolean isArray)
A convenient method for the generating the parameter element- Parameters:
doc-paramName-paramType-opName-paramName-
-
getOutputParamElement
protected Element getOutputParamElement(Document doc, AxisOperation operation)
- Parameters:
doc-operation-- Returns:
- Returns Element.
-
getParameterElementList
protected List getParameterElementList(Document doc, List parameters, String location)
- Parameters:
doc-parameters-location-
-
getParameterElementListForHttpHeader
protected List getParameterElementListForHttpHeader(Document doc, List parameters, String location)
-
getParameterElementListForSOAPModules
protected List getParameterElementListForSOAPModules(Document doc, List parameters)
-
-