it.imolinfo.jbi4corba.webservice.generator.bcm
Class WebServiceAnnotationAdapter

java.lang.Object
  extended by org.objectweb.asm.ClassAdapter
      extended by it.imolinfo.jbi4corba.webservice.generator.bcm.WebServiceAnnotationAdapter
All Implemented Interfaces:
org.objectweb.asm.ClassVisitor

public class WebServiceAnnotationAdapter
extends org.objectweb.asm.ClassAdapter

This class is used to add the annotations for the WebService. Also collect the exceptions classes name thrown by the operation methods. FIXME with method overloading the behavior is undefined.


Nested Class Summary
 class WebServiceAnnotationAdapter.SignatureDescription
          Wrapper class for the description and signature of the analized methods
 
Field Summary
protected  Set<Class> allTypes
          All types in idl
protected  org.objectweb.asm.ClassWriter classWriter
          The class writer for this bytecode manipulation.
 Set<String> exceptionsThrown
           
static String JAVAX_XML_WS_HOLDER_TYPE
           
static String JAVAX_XML_WS_HOLDER_TYPE_CANONICAL_NAME
           
static String JAVAX_XML_WS_HOLDER_TYPE_NO_SEMICOLON
           
static String JAXB_XML_SEE_ALSO_ANNOTATOIN
           
static String JSR181_BARE
           
static String JSR181_LITERAL
           
static String JSR181_ONEWAY
          Used to mark an asynchronous WebMethod.
static String JSR181_SOAP_BINDING
           
static String JSR181_SOAP_BINDING_STYLE
           
static String JSR181_SOAP_BINDING_USE
           
static String JSR181_WEB_METHOD
          A JSR181 annotation internal class name.
static String JSR181_WEB_PARAM
           ========================================================================== member | mean | default ========================================================================== name | name of the parameter.
static String JSR181_WEB_PARAM_MODE
           
static String JSR181_WEB_PARAM_MODE_INOUT
           
static String JSR181_WEB_RESULT
           
static String JSR181_WEB_SERVICE
          A JSR181 annotation internal class name.
static String JSR181_WRAPPED
           
protected  List<MethodSignature> methodSignatureList
          The list of method's signature.
protected  String nameSpace
          The namespace
protected static Set<String> noAnnotatedMethods
           
protected  String portTypeName
          The porttype wsdl name
 
Fields inherited from class org.objectweb.asm.ClassAdapter
cv
 
Constructor Summary
WebServiceAnnotationAdapter(org.objectweb.asm.ClassVisitor cv, org.objectweb.asm.ClassWriter cw, List<MethodSignature> aMethodSignatureList, String ns, String ptn, String workingDir, Map<String,UnionType> unionTypes, Map<String,InterfaceType> intfTypes, Set<Class> allTypesIDL)
          Constructor.
 
Method Summary
protected  void addAnnotationOperationName(org.objectweb.asm.MethodVisitor methodVisitor, String operationName)
          This method is used to add an annotation to customize the operation name.
protected  void addAnnotationReturnName(org.objectweb.asm.MethodVisitor methodVisitor, String returnName)
          This method is used to add an annotation to customize the name of the return element.
protected  void addMethodSignatureAnnotation(org.objectweb.asm.MethodVisitor methodVisitor, MethodSignature methodSignature, String description, String signature)
          Add annotation: WebMethod, Oneway, WebResult, WebParam.
protected  void addParameterAnnotation(org.objectweb.asm.MethodVisitor methodVisitor, MethodSignature sig)
          This method is used to add the annotation to the method's parameters.
protected  WebServiceAnnotationAdapter.SignatureDescription changeHolderParameters(MethodSignature sig, String methodDescription, String methodSignature)
          Changes the method description and signature to change the method interface.
protected  MethodSignature findFirstMethodSignature(String methodName)
          Find a method.
 Set<String> getExceptionsThrown()
           
 void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
          Override.
 void visitEnd()
           
 org.objectweb.asm.MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)
          Override.
 
Methods inherited from class org.objectweb.asm.ClassAdapter
visitAnnotation, visitAttribute, visitField, visitInnerClass, visitOuterClass, visitSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JSR181_WEB_SERVICE

public static final String JSR181_WEB_SERVICE
A JSR181 annotation internal class name.
 ==========================================================================
 member            | mean                              | default
 ==========================================================================
 name              | the name of the WS.               | Simple name of the
                   | Used as the name of               | java class or
                   | the wsdl:portType                 | interface.
 --------------------------------------------------------------------------
 targetNamespace   | used for wsdl:portType            | see JaxWs 2.0
                   | or wsdl:service or both           |
 --------------------------------------------------------------------------
 serviceName       | wsdl:service (not allowed         | simple name of the
                   | on endpoint interface)            | java class
                   |                                   | + Service
 --------------------------------------------------------------------------
 portName          | wsdl:port (not allowed on         | WS name + Port
                   | endpoint interface)               |
 --------------------------------------------------------------------------
 wsdlLocation      |                                   | none
 --------------------------------------------------------------------------
 endpointInterface | (not allowed on                   | none
                   | endpoint interface)               |
 ==========================================================================
 

See Also:
Constant Field Values

JSR181_WEB_METHOD

public static final String JSR181_WEB_METHOD
A JSR181 annotation internal class name.
 ==========================================================================
 member            | mean                              | default
 ==========================================================================
 operationName     | wsdl:operation name               | name of the java
                   |                                   | method
 --------------------------------------------------------------------------
 action            | the soap action                   | ""
 --------------------------------------------------------------------------
 exclude           | a method not exposed (not allowed | false
                   | on endpoint interface)            |
 ==========================================================================
 

See Also:
Constant Field Values

JSR181_WEB_PARAM

public static final String JSR181_WEB_PARAM
 ==========================================================================
 member            | mean                              | default
 ==========================================================================
 name              | name of the parameter.            | WebMethod.operation
                   |                                   | name if the
                   | If RPC and WebParam.partName has  | operation is
                   | not been specified, this is the   | DOCUMENT style and
                   | name of the wsdl:part             | the parameter style
                   |                                   | is BARE.
                   | If DOCUMENT or the parameter maps |
                   | to a header, this is the local    | Otherwise:
                   | name of the XML element           | arg0,arg1,...
                   | representing the parameter.       |
                   |                                   |
                   | A name MUST be specified if the   |
                   | operation is DOCUMENT style, the  |
                   | parameter style is BARE, and the  |
                   | mode is OUT or INOUT.             |
 --------------------------------------------------------------------------
 partName          | the wsdl:part name.               | WebParam.name
                   | Used only if the operation is RPC |
                   | or the operation is DOCUMENT and  |
                   | parameter style is BARE           |
 --------------------------------------------------------------------------
 mode              | the direction of the parameter    | INOUT if Holder
                   | on endpoint interface)            | type otherwise IN
                   |                                   | (see JaxWs 2.0)
 --------------------------------------------------------------------------
 header            | If true the parameter is pulled   | false
                   | from a message header rather then |
                   | the message body                  |
 ==========================================================================
 

See Also:
Constant Field Values

JSR181_WEB_PARAM_MODE

public static final String JSR181_WEB_PARAM_MODE
See Also:
Constant Field Values

JSR181_WEB_PARAM_MODE_INOUT

public static final String JSR181_WEB_PARAM_MODE_INOUT
See Also:
Constant Field Values

JSR181_WEB_RESULT

public static final String JSR181_WEB_RESULT
See Also:
Constant Field Values

JAVAX_XML_WS_HOLDER_TYPE

public static final String JAVAX_XML_WS_HOLDER_TYPE
See Also:
Constant Field Values

JAVAX_XML_WS_HOLDER_TYPE_CANONICAL_NAME

public static final String JAVAX_XML_WS_HOLDER_TYPE_CANONICAL_NAME
See Also:
Constant Field Values

JAVAX_XML_WS_HOLDER_TYPE_NO_SEMICOLON

public static final String JAVAX_XML_WS_HOLDER_TYPE_NO_SEMICOLON
See Also:
Constant Field Values

JSR181_SOAP_BINDING

public static final String JSR181_SOAP_BINDING
See Also:
Constant Field Values

JAXB_XML_SEE_ALSO_ANNOTATOIN

public static final String JAXB_XML_SEE_ALSO_ANNOTATOIN
See Also:
Constant Field Values

JSR181_SOAP_BINDING_USE

public static final String JSR181_SOAP_BINDING_USE
See Also:
Constant Field Values

JSR181_SOAP_BINDING_STYLE

public static final String JSR181_SOAP_BINDING_STYLE
See Also:
Constant Field Values

JSR181_LITERAL

public static final String JSR181_LITERAL
See Also:
Constant Field Values

JSR181_WRAPPED

public static final String JSR181_WRAPPED
See Also:
Constant Field Values

JSR181_BARE

public static final String JSR181_BARE
See Also:
Constant Field Values

exceptionsThrown

public Set<String> exceptionsThrown

JSR181_ONEWAY

public static final String JSR181_ONEWAY
Used to mark an asynchronous WebMethod.

See Also:
Constant Field Values

noAnnotatedMethods

protected static Set<String> noAnnotatedMethods

classWriter

protected org.objectweb.asm.ClassWriter classWriter
The class writer for this bytecode manipulation.


methodSignatureList

protected List<MethodSignature> methodSignatureList
The list of method's signature.


nameSpace

protected String nameSpace
The namespace


portTypeName

protected String portTypeName
The porttype wsdl name


allTypes

protected Set<Class> allTypes
All types in idl

Constructor Detail

WebServiceAnnotationAdapter

public WebServiceAnnotationAdapter(org.objectweb.asm.ClassVisitor cv,
                                   org.objectweb.asm.ClassWriter cw,
                                   List<MethodSignature> aMethodSignatureList,
                                   String ns,
                                   String ptn,
                                   String workingDir,
                                   Map<String,UnionType> unionTypes,
                                   Map<String,InterfaceType> intfTypes,
                                   Set<Class> allTypesIDL)
Constructor.

Parameters:
cv - The class visitor.
cw - The class writer.
aMethodSignatureList - The list of method to manipulate.
ns -
portTypeName - if not null, the port type name
Method Detail

visit

public void visit(int version,
                  int access,
                  String name,
                  String signature,
                  String superName,
                  String[] interfaces)
Override.

Specified by:
visit in interface org.objectweb.asm.ClassVisitor
Overrides:
visit in class org.objectweb.asm.ClassAdapter
Parameters:
version - The version
access - The access
name - The name
signature - The signature
superName - The super name
interfaces - The interfaces

visitEnd

public void visitEnd()
Specified by:
visitEnd in interface org.objectweb.asm.ClassVisitor
Overrides:
visitEnd in class org.objectweb.asm.ClassAdapter

visitMethod

public org.objectweb.asm.MethodVisitor visitMethod(int access,
                                                   String name,
                                                   String desc,
                                                   String signature,
                                                   String[] exceptions)
Override.

Specified by:
visitMethod in interface org.objectweb.asm.ClassVisitor
Overrides:
visitMethod in class org.objectweb.asm.ClassAdapter
Parameters:
access - The access
name - The name
desc - The desc
signature - The signature
exceptions - The exceptions
Returns:
The return

addMethodSignatureAnnotation

protected void addMethodSignatureAnnotation(org.objectweb.asm.MethodVisitor methodVisitor,
                                            MethodSignature methodSignature,
                                            String description,
                                            String signature)
Add annotation: WebMethod, Oneway, WebResult, WebParam.

Parameters:
methodVisitor - The method visitor
sig - the Method Signature
methodDescription - the bytecode method description

addParameterAnnotation

protected void addParameterAnnotation(org.objectweb.asm.MethodVisitor methodVisitor,
                                      MethodSignature sig)
This method is used to add the annotation to the method's parameters.

Parameters:
methodVisitor - The method visitor. If null the annotation is not added.
sig - The method's signature. If null the annotation is not added.

addAnnotationReturnName

protected void addAnnotationReturnName(org.objectweb.asm.MethodVisitor methodVisitor,
                                       String returnName)
This method is used to add an annotation to customize the name of the return element.

Parameters:
methodVisitor - A method visitor. If null the annotation is not added.
returnName - The new name. If null or empty the annotation is not added.

addAnnotationOperationName

protected void addAnnotationOperationName(org.objectweb.asm.MethodVisitor methodVisitor,
                                          String operationName)
This method is used to add an annotation to customize the operation name.

Parameters:
methodVisitor - A method visitor. If null the annotation is not added.
operationName - The new operation name. If null or empty the annotation is not added.

findFirstMethodSignature

protected MethodSignature findFirstMethodSignature(String methodName)
Find a method.

Parameters:
methodName - The finding key.
Returns:
The method signature of the first element with the name in input. If the name is null or if the elemente does not exist the method return null.

getExceptionsThrown

public Set<String> getExceptionsThrown()

changeHolderParameters

protected WebServiceAnnotationAdapter.SignatureDescription changeHolderParameters(MethodSignature sig,
                                                                                  String methodDescription,
                                                                                  String methodSignature)
Changes the method description and signature to change the method interface. For example, the
public String test(org.omg.CORBA.StringHolder arg, String nogeneric)
Must be changed in:
public String test(javax.xml.ws.Holder arg, String nogeneric)
To do so, the description must change in:
(Ljavax/xml/ws/Holder;Ljava/lang/String;)Ljava/lang/String;
And the Signature must be not null and:
(Ljavax/xml/ws/Holder;Ljava/lang/String;)Ljava/lang/String;

Parameters:
methodVisitor -
sig -
methodDescription -
methodSignature -


Copyright © 2005-2010 Imola Informatica. All Rights Reserved.