Spring Web Services Framework

org.springframework.ws.server.endpoint.mapping
Class AbstractMethodEndpointMapping<T>

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.ws.server.endpoint.mapping.AbstractEndpointMapping
          extended by org.springframework.ws.server.endpoint.mapping.AbstractMethodEndpointMapping<T>
All Implemented Interfaces:
Aware, ApplicationContextAware, Ordered, EndpointMapping
Direct Known Subclasses:
AbstractAnnotationMethodEndpointMapping, SimpleMethodEndpointMapping

public abstract class AbstractMethodEndpointMapping<T>
extends AbstractEndpointMapping

Abstract base class for MethodEndpoint mappings.

Subclasses typically implement BeanPostProcessor to look for beans that qualify as endpoint. The methods of this bean are then registered under a specific key with registerEndpoint(Object, MethodEndpoint).

Since:
1.0.0
Author:
Arjen Poutsma

Field Summary
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
AbstractMethodEndpointMapping()
           
 
Method Summary
protected  Class<?> getEndpointClass(Object endpoint)
          Return the class or interface to use for method reflection.
protected  Object getEndpointInternal(MessageContext messageContext)
          Lookup an endpoint for the given message.
protected abstract  T getLookupKeyForMessage(MessageContext messageContext)
          Returns the the endpoint keys for the given message context.
protected  T getLookupKeyForMethod(Method method)
          Returns the the endpoint keys for the given method.
protected  MethodEndpoint lookupEndpoint(T key)
          Looks up an endpoint instance for the given keys.
protected  void registerEndpoint(T key, MethodEndpoint endpoint)
          Register the given endpoint instance under the key.
protected  void registerMethods(Object endpoint)
          Helper method that registers the methods of the given bean.
protected  void registerMethods(String beanName)
          Helper method that registers the methods of the given class.
 
Methods inherited from class org.springframework.ws.server.endpoint.mapping.AbstractEndpointMapping
createEndpointInvocationChain, getDefaultEndpoint, getEndpoint, getInterceptors, getOrder, initApplicationContext, initInterceptors, resolveStringEndpoint, setDefaultEndpoint, setInterceptors, setOrder
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, isContextRequired, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMethodEndpointMapping

public AbstractMethodEndpointMapping()
Method Detail

getEndpointInternal

protected Object getEndpointInternal(MessageContext messageContext)
                              throws Exception
Lookup an endpoint for the given message. The extraction of the endpoint key is delegated to the concrete subclass.

Specified by:
getEndpointInternal in class AbstractEndpointMapping
Returns:
the looked up endpoint, or null
Throws:
Exception - if there is an error
See Also:
getLookupKeyForMessage(MessageContext)

getLookupKeyForMessage

protected abstract T getLookupKeyForMessage(MessageContext messageContext)
                                     throws Exception
Returns the the endpoint keys for the given message context.

Returns:
the registration keys
Throws:
Exception

lookupEndpoint

protected MethodEndpoint lookupEndpoint(T key)
Looks up an endpoint instance for the given keys. All keys are tried in order.

Parameters:
key - key the beans are mapped to
Returns:
the associated endpoint instance, or null if not found

registerEndpoint

protected void registerEndpoint(T key,
                                MethodEndpoint endpoint)
                         throws BeansException
Register the given endpoint instance under the key.

Parameters:
key - the lookup key
endpoint - the method endpoint instance
Throws:
BeansException - if the endpoint could not be registered

registerMethods

protected void registerMethods(Object endpoint)
Helper method that registers the methods of the given bean. This method iterates over the methods of the bean, and calls getLookupKeyForMethod(Method) for each. If this returns a string, the method is registered using registerEndpoint(Object, MethodEndpoint).

See Also:
getLookupKeyForMethod(Method)

registerMethods

protected void registerMethods(String beanName)
Helper method that registers the methods of the given class. This method iterates over the methods of the class, and calls getLookupKeyForMethod(Method) for each. If this returns a string, the method is registered using registerEndpoint(Object, MethodEndpoint).

See Also:
getLookupKeyForMethod(Method)

getLookupKeyForMethod

protected T getLookupKeyForMethod(Method method)
Returns the the endpoint keys for the given method. Returns null if the method is not to be registered, which is the default.

Parameters:
method - the method
Returns:
a registration key, or null if the method is not to be registered

getEndpointClass

protected Class<?> getEndpointClass(Object endpoint)
Return the class or interface to use for method reflection.

Default implementation delegates to AopUtils.getTargetClass(Object).

Parameters:
endpoint - the bean instance (might be an AOP proxy)
Returns:
the bean class to expose

Spring Web Services Framework

Copyright © 2005-2013 The Spring Web Services Framework. All Rights Reserved.