01: package org.mockejb;
02:
03: import java.io.Serializable;
04:
05: import javax.ejb.*;
06:
07: /**
08: * Provides the implementation of <code>javax.ejb.EJBMetaData</code>
09: *
10: * @author Alexander Ananiev
11: */
12: public class MockEjbMetaData implements EJBMetaData, Serializable {
13:
14: private BasicEjbDescriptor descriptor;
15: private Object homeProxy;
16:
17: MockEjbMetaData(final BasicEjbDescriptor descriptor) {
18: this .descriptor = descriptor;
19: }
20:
21: void setHomeProxy(final Object homeProxy) {
22: this .homeProxy = homeProxy;
23: }
24:
25: /**
26: * @see javax.ejb.EJBMetaData#getEJBHome()
27: */
28: public EJBHome getEJBHome() {
29: return (EJBHome) homeProxy;
30: }
31:
32: /**
33: * @see javax.ejb.EJBMetaData#getHomeInterfaceClass()
34: */
35: public Class getHomeInterfaceClass() {
36: return descriptor.getHomeClass();
37: }
38:
39: /**
40: * @see javax.ejb.EJBMetaData#getRemoteInterfaceClass()
41: */
42: public Class getRemoteInterfaceClass() {
43: return descriptor.getIfaceClass();
44: }
45:
46: /**
47: * Currently this method always returns <code>null</code>
48: * @return <code>null</code>
49: * @see javax.ejb.EJBMetaData#getPrimaryKeyClass()
50: */
51: public Class getPrimaryKeyClass() {
52: return null;
53: }
54:
55: /**
56: * Checks if this bean is ths session bean.
57: * @return <code>true</code> if the bean this metadata associated with is a session bean
58: * @see javax.ejb.EJBMetaData#isSession()
59: */
60: public boolean isSession() {
61: return (descriptor instanceof SessionBeanDescriptor);
62: }
63:
64: /**
65: * @see javax.ejb.EJBMetaData#isStatelessSession()
66: */
67: public boolean isStatelessSession() {
68: return (descriptor instanceof SessionBeanDescriptor && !((SessionBeanDescriptor) descriptor)
69: .isStateful());
70: }
71:
72: }
|