KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > dream > control > lifecycle > LifeCycleInterceptorGenerator


1 /**
2  * Dream
3  * Copyright (C) 2003-2004 INRIA Rhone-Alpes
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: dream@objectweb.org
20  *
21  * Initial developer(s): Vivien Quema
22  * Contributor(s):
23  */

24
25 package org.objectweb.dream.control.lifecycle;
26
27 import java.lang.reflect.Method JavaDoc;
28
29 import org.objectweb.fractal.julia.asm.InterceptorCodeAdapter;
30 import org.objectweb.fractal.julia.asm.SimpleCodeGenerator;
31
32 /**
33  * Interceptor generator for lifecycle interceptor. Use
34  * {@link SimpleCodeGenerator }pre and post method are implemented by
35  * <code>lifecycle-controller</code>. Pre and post method have the following
36  * signature :<code>int addCurrentThread(String s)</code> and
37  * <code>void removeCurrentThread(String s, int i)</code>.
38  */

39 public class LifeCycleInterceptorGenerator extends SimpleCodeGenerator
40 {
41
42   /**
43    * @see SimpleCodeGenerator#getControllerInterfaceName()
44    */

45   protected String JavaDoc getControllerInterfaceName()
46   {
47     return "lifecycle-controller";
48   }
49
50   /**
51    * @see SimpleCodeGenerator#getPreMethodName()
52    */

53   protected String JavaDoc getPreMethodName()
54   {
55     return "addCurrentThread";
56   }
57
58   /**
59    * @see SimpleCodeGenerator#getPostMethodName()
60    */

61   protected String JavaDoc getPostMethodName()
62   {
63     return "removeCurrentThread";
64   }
65
66   /**
67    * @see SimpleCodeGenerator#getContextType()
68    */

69   protected Class JavaDoc getContextType()
70   {
71     return Integer.TYPE;
72   }
73
74   /**
75    * @see SimpleCodeGenerator#getMethodName(Method)
76    */

77   protected String JavaDoc getMethodName(Method JavaDoc m)
78   {
79     return "";
80   }
81
82   /**
83    * @see org.objectweb.fractal.julia.asm.AbstractCodeGenerator#getInterceptionType(Method)
84    */

85   protected int getInterceptionType(Method JavaDoc m)
86   {
87     return InterceptorCodeAdapter.FINALLY;
88   }
89 }
Popular Tags