org.codehaus.xfire.annotations
Class AnnotationServiceFactory

java.lang.Object
  extended by org.codehaus.xfire.service.object.ObjectServiceFactory
      extended by org.codehaus.xfire.annotations.AnnotationServiceFactory
All Implemented Interfaces:
ServiceFactory

public class AnnotationServiceFactory
extends ObjectServiceFactory
implements ServiceFactory

Annotations-bases implementation of the ServiceFactory interface.

Author:
Arjen Poutsma

Constructor Summary
AnnotationServiceFactory(WebAnnotations webAnnotations, TransportManager transportManager, TypeMappingRegistry registry)
          Initializes a new instance of the AnnotationServiceFactory with the given annotations facade, transport manager and type mapping registry.
 
Method Summary
 Service create(java.lang.Class clazz)
          Creates a service from the specified class.
 Service create(java.lang.Class clazz, SoapVersion version, java.lang.String style, java.lang.String use)
          Creates a service from the specified class, soap version, style and use.
protected  java.lang.String createPortType(java.lang.String serviceName, WebServiceAnnotation webServiceAnnotation)
           
protected  java.lang.String createServiceName(java.lang.Class clazz, WebServiceAnnotation webServiceAnnotation)
           
protected  java.lang.String createServiceNamespace(java.lang.Class clazz, WebServiceAnnotation webServiceAnnotation)
           
protected  java.lang.String getInParameterName(java.lang.reflect.Method method, int paramNumber, boolean doc)
           
protected  java.lang.String getOutParameterName(java.lang.reflect.Method method, boolean doc)
           
protected  boolean isAsync(java.lang.reflect.Method method)
           
protected  boolean isValidMethod(java.lang.reflect.Method method)
          Returns true if the specified method is valid for a SOAP operation.
protected  java.lang.Class loadClass(java.lang.String endpointInterface)
          Attempt to load a class first from this class's ClassLoader, then from the context classloader.
 
Methods inherited from class org.codehaus.xfire.service.object.ObjectServiceFactory
addOperation, create, create, initializeOperations, initializeTypeMapping, makeServiceNameFromClassName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.xfire.service.ServiceFactory
create, create
 

Constructor Detail

AnnotationServiceFactory

public AnnotationServiceFactory(WebAnnotations webAnnotations,
                                TransportManager transportManager,
                                TypeMappingRegistry registry)
Initializes a new instance of the AnnotationServiceFactory with the given annotations facade, transport manager and type mapping registry.

Parameters:
webAnnotations - the annotations facade
transportManager - the transport manager
registry - the registry
Method Detail

create

public Service create(java.lang.Class clazz)
Creates a service from the specified class. If the class has a SOAPBindingAnnotation, it will be used to define the style and use of the service. Otherwise, the default behaviour will be used.

Specified by:
create in interface ServiceFactory
Overrides:
create in class ObjectServiceFactory
Parameters:
clazz - The service class used to populate the operations and parameters.
Returns:
The service.

create

public Service create(java.lang.Class clazz,
                      SoapVersion version,
                      java.lang.String style,
                      java.lang.String use)
Creates a service from the specified class, soap version, style and use. If the class has a WebServiceAnnotation, it will be used to define the name, service name, target namespace. If the annotation defines an endpoint interface, all methods of that interface are exposed as operations. If no endpoint interface is defined, all methods that have the WebMethodAnnotation are exposed.

Specified by:
create in interface ServiceFactory
Overrides:
create in class ObjectServiceFactory
Parameters:
clazz - The service class used to populate the operations and parameters.
version - The soap version. If null, Soap11 will be used.
style - The service style. If null, SoapConstants.STYLE_WRAPPED will be used.
use - The service use. If null, SoapConstants.USE_LITERAL will be used.
Returns:
The service.
See Also:
SoapConstants, Soap11, Soap12, SoapVersion

loadClass

protected java.lang.Class loadClass(java.lang.String endpointInterface)
                             throws java.lang.ClassNotFoundException
Attempt to load a class first from this class's ClassLoader, then from the context classloader.

Parameters:
endpointInterface -
Returns:
Throws:
java.lang.ClassNotFoundException

createServiceNamespace

protected java.lang.String createServiceNamespace(java.lang.Class clazz,
                                                  WebServiceAnnotation webServiceAnnotation)

createServiceName

protected java.lang.String createServiceName(java.lang.Class clazz,
                                             WebServiceAnnotation webServiceAnnotation)

createPortType

protected java.lang.String createPortType(java.lang.String serviceName,
                                          WebServiceAnnotation webServiceAnnotation)

isValidMethod

protected boolean isValidMethod(java.lang.reflect.Method method)
Returns true if the specified method is valid for a SOAP operation.

Overrides:
isValidMethod in class ObjectServiceFactory
Parameters:
method - the method.
Returns:
true if valid; false otherwise.

getInParameterName

protected java.lang.String getInParameterName(java.lang.reflect.Method method,
                                              int paramNumber,
                                              boolean doc)
Overrides:
getInParameterName in class ObjectServiceFactory

getOutParameterName

protected java.lang.String getOutParameterName(java.lang.reflect.Method method,
                                               boolean doc)
Overrides:
getOutParameterName in class ObjectServiceFactory

isAsync

protected boolean isAsync(java.lang.reflect.Method method)
Overrides:
isAsync in class ObjectServiceFactory