KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > webservice > server > InvokerProviderSimple


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.webservice.server;
8
9 // $Id: InvokerProviderSimple.java,v 1.1.2.3 2005/04/12 16:07:49 starksm Exp $
10

11 import org.jboss.axis.Handler;
12 import org.jboss.axis.MessageContext;
13 import org.jboss.axis.providers.java.RPCProvider;
14
15 import javax.xml.rpc.holders.IntHolder JavaDoc;
16 import java.lang.reflect.Method JavaDoc;
17
18 /**
19  * A very simple reflection provider that invokes the method on the object
20  * that is given in the constructor of this provider.
21  *
22  * @author thomas.diesler@jboss.org
23  * @version $Revision: 1.1.2.3 $
24  */

25 public class InvokerProviderSimple extends RPCProvider
26 {
27    /** @since 4.0.2 */
28    static final long serialVersionUID = 6368971333868010325L;
29    private Object JavaDoc targetService;
30
31    /** Creates new InvokerProviderSimple
32     */

33    public InvokerProviderSimple(Object JavaDoc targetService)
34    {
35       this.targetService = targetService;
36    }
37
38    /**
39     * This method encapsulates the method invocation.
40     *
41     * @param msgContext MessageContext
42     * @param method the target method.
43     * @param obj the target object
44     * @param argValues the method arguments
45     */

46    protected java.lang.Object JavaDoc invokeMethod(MessageContext msgContext, Method JavaDoc method, java.lang.Object JavaDoc obj, java.lang.Object JavaDoc[] argValues) throws Exception JavaDoc
47    {
48       return method.invoke(obj, argValues);
49    }
50
51    /**
52     * Get the service object whose method actually provides the service.
53     * May look up in session table.
54     */

55    public java.lang.Object JavaDoc getServiceObject(MessageContext msgContext, Handler service, String JavaDoc clsName, IntHolder JavaDoc scopeHolder) throws Exception JavaDoc
56    {
57       return targetService;
58    }
59
60    /**
61     * Return the class name of the service
62     */

63    protected String JavaDoc getServiceClassName(Handler service)
64    {
65       return targetService.getClass().getName();
66    }
67 }
68
Popular Tags