KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > ejb > EJBObjectFactory


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.ejb;
8
9 import javax.ejb.EnterpriseBean JavaDoc;
10
11 import org.jfox.pool.PoolableObject;
12 import org.jfox.pool.SimpleObjectFactory;
13
14
15 /**
16  * Éú³É EJBPoolableObject , EJBPoolableObject ·â×°ÁË EJBObject
17  *
18  * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a>
19  */

20
21 public class EJBObjectFactory extends SimpleObjectFactory {
22
23     // EJB bean class
24
private Bucket bucket = null;
25
26     /**
27      *
28      * @param classType EJBPoolableObject.class
29      * @param bucket
30      * @throws Exception
31      */

32     public EJBObjectFactory(Class JavaDoc classType, Bucket bucket) throws Exception JavaDoc {
33         super(classType);
34         this.bucket = bucket;
35     }
36
37     public PoolableObject makeObject() throws Exception JavaDoc {
38         EJBPoolableObject pobj = (EJBPoolableObject) super.makeObject();
39         EnterpriseBean JavaDoc bean = (EnterpriseBean JavaDoc) bucket.getBeanClass().newInstance();
40         pobj.setBeanInstance(bean);
41         return pobj;
42     }
43
44     public Bucket getBucket() {
45         return bucket;
46     }
47
48     public static void main(String JavaDoc[] args) {
49
50     }
51 }
52
Popular Tags