001: /*
002: * JFox - The most lightweight Java EE Application Server!
003: * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn.
004: *
005: * JFox is licenced and re-distributable under GNU LGPL.
006: */
007: package org.jfox.ejb3;
008:
009: import java.lang.reflect.Method;
010: import java.util.Collection;
011: import javax.ejb.TimerService;
012: import javax.naming.Context;
013: import javax.transaction.TransactionManager;
014:
015: import org.jfox.framework.annotation.Exported;
016: import org.jfox.framework.component.ActiveComponent;
017: import org.jfox.framework.component.Component;
018: import org.jfox.framework.component.ComponentInitialization;
019: import org.jfox.framework.component.ComponentUnregistration;
020: import org.jfox.framework.component.InterceptableComponent;
021: import org.jfox.framework.component.SingletonComponent;
022: import org.jfox.jms.MessageService;
023: import org.jfox.mvc.SessionContext;
024:
025: /**
026: * EJB3 容器
027: * è´Ÿè´£ load, unload ejb, and invoke ejb method
028: *
029: * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
030: */
031: @Exported
032: public interface EJBContainer extends Component,
033: InterceptableComponent, ComponentInitialization,
034: ActiveComponent, SingletonComponent, ComponentUnregistration {
035:
036: public static final String JAVA_COMP_ENV = "java:comp/env";
037:
038: /**
039: * 列表所有 EJB Bucket
040: */
041: Collection<EJBBucket> listBuckets();
042:
043: /**
044: * 返回 EJB Bucket
045: * @param name ejb name
046: */
047: EJBBucket getEJBBucket(String name);
048:
049: /**
050: * 通过接�类� EJBBucket,�解� @EJB 注入的时候�用到
051: * @param interfaceClass bean interface
052: */
053: Collection<EJBBucket> getEJBBucketByBeanInterface(
054: Class interfaceClass);
055:
056: /**
057: * 容器使用的事物处�器
058: */
059: TransactionManager getTransactionManager();
060:
061: /**
062: * 定时�务器
063: */
064: TimerService getTimerService();
065:
066: /**
067: * JNDI Naming Service
068: */
069: Context getNamingContext();
070:
071: /**
072: * JMS Message Service
073: */
074: MessageService getMessageService();
075:
076: /**
077: * get JTA Transaction Timeout
078: */
079: int getTransactionTimeout();
080:
081: /**
082: * set JTA Transaction Timeout
083: * @param timeout timeout in seconds
084: */
085: void setTransactionTimeout(int timeout);
086:
087: /**
088: * 调用EJB方法,通过方法拦截æ??供事务支æŒ?
089: * æž„é€ ejb invocation,并且获得 chain,然å?Žå?‘起调用
090: *
091: * @param ejbObjectId ejb object id
092: * @param method �执行的方法
093: * @param params å?‚æ•° @throws NoSuchEJBException if no such ejb
094: * @param sessionContext session context
095: * @throws Exception exception
096: * @return method result
097: */
098: Object invokeEJB(EJBObjectId ejbObjectId, Method method,
099: Object[] params, SessionContext sessionContext)
100: throws Exception;
101:
102: }
|