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

package org.jfox.framework;

import java.lang.reflect.Method;

import org.jfox.framework.extra.InstantiatingInterceptable;
import org.jfox.framework.extra.Managable;
import org.jfox.framework.extra.ManagementInfo;
import org.jfox.framework.extra.MethodInterceptable;

/**
 * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
 */

public class TestComponentA implements Managable, InstantiatingInterceptable, MethodInterceptable, TestComponent {
    private String name = "Hello,World";

    private ComponentContext ctx;

    public TestComponentA() {
    }

    public TestComponentA(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setComponent(TestComponentC tc) {

    }

    public Component afterInstantiate(Component theComp, Registry registry) {
        System.out.println("Component " + TestComponentA.class.getName() + " instantiated.");
        return theComp;
    }

    public void preInvoke(Method method, Object[] params) {
        System.out.println("preInvoke " + method.getName());
    }

    public Object postInvoke(Method method, Object result) {
        System.out.println("postInvoke " + method.getName());
        return result;
    }

    public String getComponentDir(){
        return ctx.getModuleDir();
    }

    public void setComponentContext(ComponentContext ctx) {
        this.ctx = ctx;
    }

    public ManagementInfo getManagementInfo() {
        return ManagementInfo.exposePublic(this.getClass());
    }



    public static void main(String[] args) {

    }
}

