org.apache.cxf.service.factory
Class ReflectionServiceFactoryBean

java.lang.Object
  extended by org.apache.cxf.service.factory.AbstractServiceFactoryBean
      extended by org.apache.cxf.service.factory.ReflectionServiceFactoryBean
Direct Known Subclasses:
JaxWsServiceFactoryBean

public class ReflectionServiceFactoryBean
extends AbstractServiceFactoryBean

Introspects a class and builds a Service from it. If a WSDL URL is specified, a Service model will be directly from the WSDL and then metadata will be filled in from the service class. If no WSDL URL is specified, the Service will be constructed directly from the class structure.


Field Summary
static java.lang.String ELEMENT_NAME
           
static java.lang.String ENDPOINT_CLASS
           
static java.lang.String EXTRA_CLASS
           
static java.lang.String FORCE_TYPES
           
static java.lang.String GENERIC_TYPE
           
static java.lang.String HEADER
           
static java.lang.String HOLDER
           
static java.lang.String METHOD
           
static java.lang.String METHOD_ANNOTATIONS
           
static java.lang.String METHOD_PARAM_ANNOTATIONS
           
static java.lang.String MODE_INOUT
           
static java.lang.String MODE_OUT
           
static java.lang.String PARAM_ANNOTATION
           
static java.lang.String RAW_CLASS
           
protected  java.util.Map<java.lang.String,java.lang.String> schemaLocationMapping
           
protected  java.lang.Class<?> serviceClass
           
static java.lang.String WRAPPERGEN_NEEDED
           
protected  java.lang.String wsdlURL
           
 
Constructor Summary
ReflectionServiceFactoryBean()
           
 
Method Summary
protected  FaultInfo addFault(InterfaceInfo service, OperationInfo op, java.lang.Class exClass)
           
protected  void bindOperation(OperationInfo op, java.lang.reflect.Method m)
           
protected  void buildServiceFromClass()
           
protected  void buildServiceFromWSDL(java.lang.String url)
           
protected  void checkForElement(ServiceInfo serviceInfo, MessagePartInfo mpi)
           
protected  void checkServiceClassAnnotations(java.lang.Class<?> sc)
           
 Service create()
           
protected  void createBareMessage(ServiceInfo serviceInfo, OperationInfo opInfo, boolean isOut)
           
protected  DataBinding createDefaultDataBinding()
           
 Endpoint createEndpoint(EndpointInfo ei)
           
protected  void createEndpoints()
           
protected  void createFaultForException(java.lang.Class<?> exClass, FaultInfo fi)
           
protected  void createInputWrappedMessageParts(OperationInfo op, java.lang.reflect.Method method, MessageInfo inMsg)
           
protected  InterfaceInfo createInterface(ServiceInfo serviceInfo)
           
protected  Invoker createInvoker()
           
protected  void createMessageParts(InterfaceInfo intf, OperationInfo op, java.lang.reflect.Method method)
           
protected  OperationInfo createOperation(ServiceInfo serviceInfo, InterfaceInfo intf, java.lang.reflect.Method m)
           
protected  javax.xml.namespace.QName createOutputMessageName(OperationInfo op, java.lang.reflect.Method method)
           
protected  void createOutputWrappedMessageParts(OperationInfo op, java.lang.reflect.Method method, MessageInfo outMsg)
           
protected  ServiceInfo createServiceInfo(InterfaceInfo intf)
           
protected  void createWrappedSchema(ServiceInfo serviceInfo, AbstractMessageContainer wrappedMessage, AbstractMessageContainer unwrappedMessage, javax.xml.namespace.QName wrapperBeanName)
           
protected  java.lang.String getAction(OperationInfo op, java.lang.reflect.Method method)
           
 boolean getAnonymousWrapperTypes()
           
protected  java.lang.Class<?> getBeanClass(java.lang.Class<?> exClass)
           
 java.util.List<AbstractServiceConfiguration> getConfigurations()
           
 EndpointInfo getEndpointInfo()
           
 javax.xml.namespace.QName getEndpointName()
           
 javax.xml.namespace.QName getEndpointName(boolean lookup)
           
 java.util.concurrent.Executor getExecutor()
           
protected  java.util.Set<java.lang.Class<?>> getExtraClass()
           
protected  javax.xml.namespace.QName getFaultName(InterfaceInfo service, OperationInfo o, java.lang.Class exClass, java.lang.Class beanClass)
           
 java.util.List<AbstractFeature> getFeatures()
           
 java.lang.reflect.Type getHolderType(java.lang.Class<?> cls, java.lang.reflect.Type type)
           
 java.util.List<java.lang.String> getIgnoredClasses()
           
 java.util.List<java.lang.reflect.Method> getIgnoredMethods()
           
protected  javax.xml.namespace.QName getInParameterName(OperationInfo op, java.lang.reflect.Method method, int paramNumber)
           
protected  javax.xml.namespace.QName getInPartName(OperationInfo op, java.lang.reflect.Method method, int paramNumber)
           
protected  javax.xml.namespace.QName getInputMessageName(OperationInfo op, java.lang.reflect.Method method)
           
protected  InterfaceInfo getInterfaceInfo()
           
 javax.xml.namespace.QName getInterfaceName()
           
 Invoker getInvoker()
           
protected  MethodDispatcher getMethodDispatcher()
           
protected  javax.xml.namespace.QName getOperationName(InterfaceInfo service, java.lang.reflect.Method method)
          Creates a name for the operation from the method name.
protected  javax.xml.namespace.QName getOutParameterName(OperationInfo op, java.lang.reflect.Method method, int paramNumber)
           
protected  javax.xml.namespace.QName getOutPartName(OperationInfo op, java.lang.reflect.Method method, int paramNumber)
           
 java.util.Map<java.lang.String,java.lang.Object> getProperties()
           
 boolean getQualifyWrapperSchema()
           
protected  java.lang.Class getRequestWrapper(java.lang.reflect.Method selected)
           
protected  java.lang.String getRequestWrapperClassName(java.lang.reflect.Method selected)
           
protected  java.lang.Class getResponseWrapper(java.lang.reflect.Method selected)
           
protected  java.lang.String getResponseWrapperClassName(java.lang.reflect.Method selected)
           
 java.lang.Class<?> getServiceClass()
           
 java.util.List<AbstractServiceConfiguration> getServiceConfigurations()
           
protected  java.lang.String getServiceName()
           
protected  java.lang.String getServiceNamespace()
           
 javax.xml.namespace.QName getServiceQName()
           
 javax.xml.namespace.QName getServiceQName(boolean lookup)
           
 java.lang.String getStyle()
           
 java.lang.Boolean getWrapped()
          Returns non-null if wrapped mode was explicitely disabled or enabled.
 long getWrapperPartMaxOccurs(MessagePartInfo mpi)
           
 long getWrapperPartMinOccurs(MessagePartInfo mpi)
           
 java.lang.String getWsdlURL()
           
protected  boolean hasOutMessage(java.lang.reflect.Method m)
           
 boolean hasWrappedMethods(InterfaceInfo interfaceInfo)
           
protected  boolean initializeClassInfo(OperationInfo o, java.lang.reflect.Method method, java.util.List<java.lang.String> paramOrder)
          set the holder generic type info into message part info
protected  void initializeDefaultInterceptors()
           
protected  void initializeFaultInterceptors()
           
protected  void initializeFaults(InterfaceInfo service, OperationInfo op, java.lang.reflect.Method method)
           
protected  void initializeParameter(MessagePartInfo part, java.lang.Class rawClass, java.lang.reflect.Type type)
           
protected  void initializeServiceConfigurations()
           
protected  void initializeServiceModel()
           
protected  void initializeWrappedSchema(ServiceInfo serviceInfo)
           
protected  void initializeWSDLOperation(InterfaceInfo intf, OperationInfo o, java.lang.reflect.Method method)
           
protected  void initializeWSDLOperations()
           
 boolean isAnonymousWrapperTypes()
           
protected  boolean isAsync(java.lang.reflect.Method method)
           
protected  boolean isFromWsdl()
           
 boolean isHeader(java.lang.reflect.Method method, int j)
           
 boolean isHolder(java.lang.Class<?> cls, java.lang.reflect.Type type)
           
protected  boolean isInParam(java.lang.reflect.Method method, int j)
           
protected  boolean isMatchOperation(java.lang.String methodNameInClass, java.lang.String methodNameInWsdl)
           
protected  boolean isOutParam(java.lang.reflect.Method method, int j)
           
 boolean isPopulateFromClass()
           
 boolean isQualifyWrapperSchema()
           
 boolean isRPC(java.lang.reflect.Method method)
           
protected  boolean isValidMethod(java.lang.reflect.Method method)
           
 boolean isWrapped()
           
protected  boolean isWrapped(java.lang.reflect.Method method)
           
 boolean isWrapperPartNillable(MessagePartInfo mpi)
           
 boolean isWrapperPartQualified(MessagePartInfo mpi)
           
 void setAnonymousWrapperTypes(boolean b)
           
 void setConfigurations(java.util.List<AbstractServiceConfiguration> configurations)
           
 void setEndpointName(javax.xml.namespace.QName en)
           
 void setExecutor(java.util.concurrent.Executor executor)
           
 void setFeatures(java.util.List<AbstractFeature> f)
           
 void setIgnoredClasses(java.util.List<java.lang.String> ignoredClasses)
           
 void setIgnoredMethods(java.util.List<java.lang.reflect.Method> ignoredMethods)
           
 void setInvoker(Invoker invoker)
           
protected  void setMethodDispatcher(MethodDispatcher m)
           
 void setPopulateFromClass(boolean fomClass)
           
 void setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
           
 void setQualifyWrapperSchema(boolean b)
           
 void setServiceClass(java.lang.Class<?> serviceClass)
           
 void setServiceConfigurations(java.util.List<AbstractServiceConfiguration> serviceConfigurations)
           
 void setServiceName(javax.xml.namespace.QName serviceName)
           
protected  void setServiceProperties()
           
 void setWrapped(boolean style)
           
 void setWsdlURL(java.lang.String wsdlURL)
           
 void setWsdlURL(java.net.URL wsdlURL)
           
 void updateBindingOperation(BindingOperationInfo boi)
           
 void validateServiceModel()
           
 
Methods inherited from class org.apache.cxf.service.factory.AbstractServiceFactoryBean
getBus, getDataBinding, getService, initializeDataBindings, setBus, setDataBinding, setService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENDPOINT_CLASS

public static final java.lang.String ENDPOINT_CLASS
See Also:
Constant Field Values

GENERIC_TYPE

public static final java.lang.String GENERIC_TYPE
See Also:
Constant Field Values

RAW_CLASS

public static final java.lang.String RAW_CLASS
See Also:
Constant Field Values

WRAPPERGEN_NEEDED

public static final java.lang.String WRAPPERGEN_NEEDED
See Also:
Constant Field Values

EXTRA_CLASS

public static final java.lang.String EXTRA_CLASS
See Also:
Constant Field Values

MODE_OUT

public static final java.lang.String MODE_OUT
See Also:
Constant Field Values

MODE_INOUT

public static final java.lang.String MODE_INOUT
See Also:
Constant Field Values

HOLDER

public static final java.lang.String HOLDER
See Also:
Constant Field Values

HEADER

public static final java.lang.String HEADER
See Also:
Constant Field Values

ELEMENT_NAME

public static final java.lang.String ELEMENT_NAME
See Also:
Constant Field Values

METHOD

public static final java.lang.String METHOD
See Also:
Constant Field Values

FORCE_TYPES

public static final java.lang.String FORCE_TYPES
See Also:
Constant Field Values

METHOD_PARAM_ANNOTATIONS

public static final java.lang.String METHOD_PARAM_ANNOTATIONS
See Also:
Constant Field Values

METHOD_ANNOTATIONS

public static final java.lang.String METHOD_ANNOTATIONS
See Also:
Constant Field Values

PARAM_ANNOTATION

public static final java.lang.String PARAM_ANNOTATION
See Also:
Constant Field Values

wsdlURL

protected java.lang.String wsdlURL

serviceClass

protected java.lang.Class<?> serviceClass

schemaLocationMapping

protected final java.util.Map<java.lang.String,java.lang.String> schemaLocationMapping
Constructor Detail

ReflectionServiceFactoryBean

public ReflectionServiceFactoryBean()
Method Detail

createDefaultDataBinding

protected DataBinding createDefaultDataBinding()
Overrides:
createDefaultDataBinding in class AbstractServiceFactoryBean

create

public Service create()
Specified by:
create in class AbstractServiceFactoryBean

createEndpoints

protected void createEndpoints()

updateBindingOperation

public void updateBindingOperation(BindingOperationInfo boi)

createEndpoint

public Endpoint createEndpoint(EndpointInfo ei)
                        throws EndpointException
Throws:
EndpointException

initializeServiceConfigurations

protected void initializeServiceConfigurations()

setServiceProperties

protected void setServiceProperties()

buildServiceFromWSDL

protected void buildServiceFromWSDL(java.lang.String url)

buildServiceFromClass

protected void buildServiceFromClass()

hasWrappedMethods

public boolean hasWrappedMethods(InterfaceInfo interfaceInfo)

isFromWsdl

protected boolean isFromWsdl()

initializeServiceModel

protected void initializeServiceModel()

validateServiceModel

public void validateServiceModel()

isPopulateFromClass

public boolean isPopulateFromClass()

setPopulateFromClass

public void setPopulateFromClass(boolean fomClass)

getInterfaceInfo

protected InterfaceInfo getInterfaceInfo()

initializeWSDLOperations

protected void initializeWSDLOperations()

initializeWSDLOperation

protected void initializeWSDLOperation(InterfaceInfo intf,
                                       OperationInfo o,
                                       java.lang.reflect.Method method)

initializeClassInfo

protected boolean initializeClassInfo(OperationInfo o,
                                      java.lang.reflect.Method method,
                                      java.util.List<java.lang.String> paramOrder)
set the holder generic type info into message part info

Parameters:
o -
method -

createInvoker

protected Invoker createInvoker()

createServiceInfo

protected ServiceInfo createServiceInfo(InterfaceInfo intf)

createInterface

protected InterfaceInfo createInterface(ServiceInfo serviceInfo)

createOperation

protected OperationInfo createOperation(ServiceInfo serviceInfo,
                                        InterfaceInfo intf,
                                        java.lang.reflect.Method m)

bindOperation

protected void bindOperation(OperationInfo op,
                             java.lang.reflect.Method m)

initializeWrappedSchema

protected void initializeWrappedSchema(ServiceInfo serviceInfo)

checkForElement

protected void checkForElement(ServiceInfo serviceInfo,
                               MessagePartInfo mpi)

getAnonymousWrapperTypes

public boolean getAnonymousWrapperTypes()

isAnonymousWrapperTypes

public boolean isAnonymousWrapperTypes()

setAnonymousWrapperTypes

public void setAnonymousWrapperTypes(boolean b)

getQualifyWrapperSchema

public final boolean getQualifyWrapperSchema()

isQualifyWrapperSchema

public boolean isQualifyWrapperSchema()

setQualifyWrapperSchema

public void setQualifyWrapperSchema(boolean b)

createWrappedSchema

protected void createWrappedSchema(ServiceInfo serviceInfo,
                                   AbstractMessageContainer wrappedMessage,
                                   AbstractMessageContainer unwrappedMessage,
                                   javax.xml.namespace.QName wrapperBeanName)

createBareMessage

protected void createBareMessage(ServiceInfo serviceInfo,
                                 OperationInfo opInfo,
                                 boolean isOut)

createMessageParts

protected void createMessageParts(InterfaceInfo intf,
                                  OperationInfo op,
                                  java.lang.reflect.Method method)

createInputWrappedMessageParts

protected void createInputWrappedMessageParts(OperationInfo op,
                                              java.lang.reflect.Method method,
                                              MessageInfo inMsg)

createOutputWrappedMessageParts

protected void createOutputWrappedMessageParts(OperationInfo op,
                                               java.lang.reflect.Method method,
                                               MessageInfo outMsg)

initializeParameter

protected void initializeParameter(MessagePartInfo part,
                                   java.lang.Class rawClass,
                                   java.lang.reflect.Type type)

getServiceQName

public javax.xml.namespace.QName getServiceQName()

getServiceQName

public javax.xml.namespace.QName getServiceQName(boolean lookup)

getEndpointName

public javax.xml.namespace.QName getEndpointName()

getEndpointName

public javax.xml.namespace.QName getEndpointName(boolean lookup)

getEndpointInfo

public EndpointInfo getEndpointInfo()

setEndpointName

public void setEndpointName(javax.xml.namespace.QName en)

getServiceName

protected java.lang.String getServiceName()

getServiceNamespace

protected java.lang.String getServiceNamespace()

getInterfaceName

public javax.xml.namespace.QName getInterfaceName()

isValidMethod

protected boolean isValidMethod(java.lang.reflect.Method method)

isHolder

public boolean isHolder(java.lang.Class<?> cls,
                        java.lang.reflect.Type type)

getHolderType

public java.lang.reflect.Type getHolderType(java.lang.Class<?> cls,
                                            java.lang.reflect.Type type)

isWrapped

protected boolean isWrapped(java.lang.reflect.Method method)

isMatchOperation

protected boolean isMatchOperation(java.lang.String methodNameInClass,
                                   java.lang.String methodNameInWsdl)

isOutParam

protected boolean isOutParam(java.lang.reflect.Method method,
                             int j)

isInParam

protected boolean isInParam(java.lang.reflect.Method method,
                            int j)

getInputMessageName

protected javax.xml.namespace.QName getInputMessageName(OperationInfo op,
                                                        java.lang.reflect.Method method)

createOutputMessageName

protected javax.xml.namespace.QName createOutputMessageName(OperationInfo op,
                                                            java.lang.reflect.Method method)

hasOutMessage

protected boolean hasOutMessage(java.lang.reflect.Method m)

initializeFaults

protected void initializeFaults(InterfaceInfo service,
                                OperationInfo op,
                                java.lang.reflect.Method method)

initializeDefaultInterceptors

protected void initializeDefaultInterceptors()
Overrides:
initializeDefaultInterceptors in class AbstractServiceFactoryBean

initializeFaultInterceptors

protected void initializeFaultInterceptors()

addFault

protected FaultInfo addFault(InterfaceInfo service,
                             OperationInfo op,
                             java.lang.Class exClass)

createFaultForException

protected void createFaultForException(java.lang.Class<?> exClass,
                                       FaultInfo fi)

getBeanClass

protected java.lang.Class<?> getBeanClass(java.lang.Class<?> exClass)

getFaultName

protected javax.xml.namespace.QName getFaultName(InterfaceInfo service,
                                                 OperationInfo o,
                                                 java.lang.Class exClass,
                                                 java.lang.Class beanClass)

getAction

protected java.lang.String getAction(OperationInfo op,
                                     java.lang.reflect.Method method)

isHeader

public boolean isHeader(java.lang.reflect.Method method,
                        int j)

getOperationName

protected javax.xml.namespace.QName getOperationName(InterfaceInfo service,
                                                     java.lang.reflect.Method method)
Creates a name for the operation from the method name. If an operation with that name already exists, a name is create by appending an integer to the end. I.e. if there is already two methods named doSomething, the first one will have an operation name of "doSomething" and the second "doSomething1".

Parameters:
service -
method -

isAsync

protected boolean isAsync(java.lang.reflect.Method method)

getInPartName

protected javax.xml.namespace.QName getInPartName(OperationInfo op,
                                                  java.lang.reflect.Method method,
                                                  int paramNumber)

getInParameterName

protected javax.xml.namespace.QName getInParameterName(OperationInfo op,
                                                       java.lang.reflect.Method method,
                                                       int paramNumber)

getOutParameterName

protected javax.xml.namespace.QName getOutParameterName(OperationInfo op,
                                                        java.lang.reflect.Method method,
                                                        int paramNumber)

getOutPartName

protected javax.xml.namespace.QName getOutPartName(OperationInfo op,
                                                   java.lang.reflect.Method method,
                                                   int paramNumber)

getResponseWrapper

protected java.lang.Class getResponseWrapper(java.lang.reflect.Method selected)

getResponseWrapperClassName

protected java.lang.String getResponseWrapperClassName(java.lang.reflect.Method selected)

getRequestWrapper

protected java.lang.Class getRequestWrapper(java.lang.reflect.Method selected)

getRequestWrapperClassName

protected java.lang.String getRequestWrapperClassName(java.lang.reflect.Method selected)

isWrapperPartQualified

public boolean isWrapperPartQualified(MessagePartInfo mpi)

isWrapperPartNillable

public boolean isWrapperPartNillable(MessagePartInfo mpi)

getWrapperPartMaxOccurs

public long getWrapperPartMaxOccurs(MessagePartInfo mpi)

getWrapperPartMinOccurs

public long getWrapperPartMinOccurs(MessagePartInfo mpi)

getMethodDispatcher

protected MethodDispatcher getMethodDispatcher()

setMethodDispatcher

protected void setMethodDispatcher(MethodDispatcher m)

getConfigurations

public java.util.List<AbstractServiceConfiguration> getConfigurations()

setConfigurations

public void setConfigurations(java.util.List<AbstractServiceConfiguration> configurations)

getServiceClass

public java.lang.Class<?> getServiceClass()

setServiceClass

public void setServiceClass(java.lang.Class<?> serviceClass)

checkServiceClassAnnotations

protected void checkServiceClassAnnotations(java.lang.Class<?> sc)

getWsdlURL

public java.lang.String getWsdlURL()

setWsdlURL

public void setWsdlURL(java.lang.String wsdlURL)

setWsdlURL

public void setWsdlURL(java.net.URL wsdlURL)

getServiceConfigurations

public java.util.List<AbstractServiceConfiguration> getServiceConfigurations()

setServiceConfigurations

public void setServiceConfigurations(java.util.List<AbstractServiceConfiguration> serviceConfigurations)

setServiceName

public void setServiceName(javax.xml.namespace.QName serviceName)

getInvoker

public Invoker getInvoker()

setInvoker

public void setInvoker(Invoker invoker)

getExecutor

public java.util.concurrent.Executor getExecutor()

setExecutor

public void setExecutor(java.util.concurrent.Executor executor)

getIgnoredClasses

public java.util.List<java.lang.String> getIgnoredClasses()

setIgnoredClasses

public void setIgnoredClasses(java.util.List<java.lang.String> ignoredClasses)

getExtraClass

protected java.util.Set<java.lang.Class<?>> getExtraClass()

isWrapped

public boolean isWrapped()

getStyle

public java.lang.String getStyle()

isRPC

public boolean isRPC(java.lang.reflect.Method method)

setWrapped

public void setWrapped(boolean style)

getWrapped

public java.lang.Boolean getWrapped()
Returns non-null if wrapped mode was explicitely disabled or enabled.


getProperties

public java.util.Map<java.lang.String,java.lang.Object> getProperties()

setProperties

public void setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)

getIgnoredMethods

public java.util.List<java.lang.reflect.Method> getIgnoredMethods()

setIgnoredMethods

public void setIgnoredMethods(java.util.List<java.lang.reflect.Method> ignoredMethods)

getFeatures

public java.util.List<AbstractFeature> getFeatures()

setFeatures

public void setFeatures(java.util.List<AbstractFeature> f)


Apache CXF