org.codehaus.xfire.service.binding
Class ObjectInvoker

java.lang.Object
  extended byorg.codehaus.xfire.service.binding.ObjectInvoker
All Implemented Interfaces:
Invoker
Direct Known Subclasses:
BeanInvoker

public class ObjectInvoker
extends java.lang.Object
implements Invoker

An invoker which instantiates classes automatically based on the Service's scope. The default scope is SCOPE_APPLICATION, which creates once instance to use for the lifetime of the invoker.

Since:
Nov 16, 2004
Author:
Dan Diephouse

Field Summary
static int SCOPE_APPLICATION
          Scope to denote that a single implementation instance should exist for the lifetime of this invoker and should be reused for every request.
static int SCOPE_REQUEST
          Scope to denote that a new instance of the service implementation should be created on every call.
static int SCOPE_SESSION
          Scope for storing one object per session.
static java.lang.String SERVICE_IMPL_CLASS
          Constant to denote the implementation class for the service.
 
Constructor Summary
ObjectInvoker()
           
 
Method Summary
 java.lang.Object createServiceObject(Service service)
          Override this method to control how XFire creates the service object.
 java.lang.reflect.Method getMostSpecificMethod(java.lang.reflect.Method method, java.lang.Class targetClass)
          Given a method, which may come from an interface, and a targetClass used in the current AOP invocation, find the most specific method if there is one.
 int getScope()
           
 java.lang.Object getServiceObject(MessageContext context)
          Creates and returns a service object depending on the scope.
 java.lang.Object invoke(java.lang.reflect.Method method, java.lang.Object[] params, MessageContext context)
           
 boolean isJdkDynamicProxy(java.lang.Object object)
          Return whether the given object is a J2SE dynamic proxy.
 void setScope(int scope)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCOPE_APPLICATION

public static final int SCOPE_APPLICATION
Scope to denote that a single implementation instance should exist for the lifetime of this invoker and should be reused for every request.

See Also:
Constant Field Values

SCOPE_REQUEST

public static final int SCOPE_REQUEST
Scope to denote that a new instance of the service implementation should be created on every call.

See Also:
Constant Field Values

SCOPE_SESSION

public static final int SCOPE_SESSION
Scope for storing one object per session. An example of a session implementation is an http session, whereby one object is created per session and stored in the session scope.

See Also:
Constant Field Values

SERVICE_IMPL_CLASS

public static final java.lang.String SERVICE_IMPL_CLASS
Constant to denote the implementation class for the service.

See Also:
Constant Field Values
Constructor Detail

ObjectInvoker

public ObjectInvoker()
Method Detail

invoke

public java.lang.Object invoke(java.lang.reflect.Method method,
                               java.lang.Object[] params,
                               MessageContext context)
                        throws XFireFault
Specified by:
invoke in interface Invoker
Throws:
XFireFault

getServiceObject

public java.lang.Object getServiceObject(MessageContext context)
                                  throws XFireFault
Creates and returns a service object depending on the scope.

Throws:
XFireFault

createServiceObject

public java.lang.Object createServiceObject(Service service)
                                     throws XFireFault
Override this method to control how XFire creates the service object.

Parameters:
service -
Returns:
Throws:
XFireFault

isJdkDynamicProxy

public boolean isJdkDynamicProxy(java.lang.Object object)
Return whether the given object is a J2SE dynamic proxy.

Parameters:
object - the object to check
See Also:
Proxy.isProxyClass(java.lang.Class)

getMostSpecificMethod

public java.lang.reflect.Method getMostSpecificMethod(java.lang.reflect.Method method,
                                                      java.lang.Class targetClass)
Given a method, which may come from an interface, and a targetClass used in the current AOP invocation, find the most specific method if there is one. E.g. the method may be IFoo.bar() and the target class may be DefaultFoo. In this case, the method may be DefaultFoo.bar(). This enables attributes on that method to be found.

Parameters:
method - method to be invoked, which may come from an interface
targetClass - target class for the curren invocation. May be null or may not even implement the method.
Returns:
the more specific method, or the original method if the targetClass doesn't specialize it or implement it or is null

getScope

public int getScope()

setScope

public void setScope(int scope)


Copyright © 2004-2006 null. All Rights Reserved.