KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > model > CallableEntryPoint


1 /*
2  * $Id: CallableEntryPoint.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.model;
12
13 import org.mule.umo.model.UMOEntryPoint;
14 import org.mule.umo.UMOEventContext;
15 import org.mule.umo.lifecycle.Callable;
16
17 /**
18  * A simple Entrypoint for the callable interface
19  *
20  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
21  * @version $Revision: 3798 $
22  */

23 public class CallableEntryPoint implements UMOEntryPoint
24 {
25     public Class JavaDoc[] getParameterTypes()
26     {
27         return Callable.class.getMethods()[0].getParameterTypes();
28     }
29
30     public Object JavaDoc invoke(Object JavaDoc component, UMOEventContext context) throws Exception JavaDoc
31     {
32         if (component instanceof Callable)
33         {
34             return ((Callable)component).onCall(context);
35         }
36         else
37         {
38             throw new NoSatisfiableMethodsException(component, UMOEventContext.class);
39         }
40     }
41
42     public boolean isVoid()
43     {
44         return false;
45     }
46
47     public String JavaDoc getMethodName()
48     {
49         return Callable.class.getMethods()[0].getName();
50     }
51 }
52
Popular Tags