01: package org.mockejb;
02:
03: import java.io.Serializable;
04:
05: /**
06: * Provides the information that MockEJB needs to "deploy" this EJB. This
07: * includes classes of EJB Home, business interface and implementation.
08: * {@link MockContainer} uses this data to create dynamic proxies acting as Home
09: * and EJBObject.
10: * This is the base class for concrete MDB, Session and Entity Descriptor implementations.
11: *
12: * @author Alexander Ananiev
13: */
14: public abstract class BasicEjbDescriptor implements Serializable {
15:
16: private Class homeClass;
17: private Class ifaceClass;
18: private Class beanClass;
19: private Object bean;
20: private String jndiName;
21:
22: /**
23: * Creates a new instance of the descriptor.
24: * @param jndiName jndiName to bind Home to. Note that MockEjb does not support
25: * bean-scoped context, so this name must be unique.
26: * @param homeClass class of the home interface
27: * @param ifaceClass class of the business interface, remote or local
28: * @param beanClass class of the implementation class
29: */
30: // TODO: Deprecate?
31: public BasicEjbDescriptor(String jndiName, Class homeClass,
32: Class ifaceClass, Class beanClass) {
33:
34: this .jndiName = jndiName;
35: this .homeClass = homeClass;
36: this .ifaceClass = ifaceClass;
37: this .beanClass = beanClass;
38: }
39:
40: /**
41: * Creates a new instance of the descriptor.
42: * @param jndiName jndiName to bind Home to. Note that MockEjb does not support
43: * bean-scoped context, so this name must be unique.
44: * @param homeClass class of the home interface
45: * @param ifaceClass class of the business interface, remote or local
46: * @param bean instance of a bean implementation class.
47: */
48: public BasicEjbDescriptor(String jndiName, Class homeClass,
49: Class ifaceClass, Object bean) {
50:
51: this .jndiName = jndiName;
52: this .homeClass = homeClass;
53: this .ifaceClass = ifaceClass;
54: this .bean = bean;
55: }
56:
57: public String getJndiName() {
58: return jndiName;
59: }
60:
61: public Class getHomeClass() {
62: return homeClass;
63: }
64:
65: public Class getBeanClass() {
66: return beanClass;
67: }
68:
69: public Object getBean() {
70: return bean;
71: }
72:
73: public Class getIfaceClass() {
74: return ifaceClass;
75: }
76:
77: }
|