KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > ioc > component > TestComponentB


1 /* JFox, the OpenSource J2EE Application Server
2  *
3  * Distributable under GNU LGPL license by gun.org
4  * more details please visit http://www.huihoo.org/jfox
5  */

6
7 package org.jfox.ioc.component;
8
9 import java.lang.reflect.Method JavaDoc;
10
11 import org.jfox.ioc.Component;
12 import org.jfox.ioc.ComponentContext;
13 import org.jfox.ioc.ext.InterceptableComponent;
14
15 /**
16  * Test component interceptable and injection constructor
17  *
18  * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a>
19  */

20
21 public class TestComponentB implements InterceptableComponent, TestComponent {
22     private String JavaDoc name = "Hello,World!";
23
24     private ComponentContext ctx;
25
26     public TestComponentB() {
27     }
28
29     public TestComponentB(String JavaDoc name) {
30         this.name = name;
31     }
32
33     public String JavaDoc getName() {
34         return name;
35     }
36
37     public void setName(String JavaDoc name) {
38         this.name = name;
39     }
40
41     public void preInvoke(Method JavaDoc method, Object JavaDoc[] params) {
42         System.out.println("preInvoke: " + method.getName());
43     }
44
45     public Object JavaDoc postInvoke(Method JavaDoc method, Object JavaDoc result) {
46         System.out.println("postInvoke: " + method.getName());
47         return result;
48     }
49
50     public String JavaDoc getComponentDir(){
51         return ctx.getModuleDir();
52     }
53
54     public void setComponentContext(ComponentContext ctx) {
55         this.ctx = ctx;
56     }
57
58
59     public Component afterInstantiate(Component component) {
60         System.out.println("afterInstantiate: Component " + this + " created.");
61         return component;
62     }
63
64     public static void main(String JavaDoc[] args) {
65
66     }
67 }
68
69
Popular Tags