dain 2005/01/26 18:27:59
Modified: modules/core/src/java/org/openejb/dispatch
SystemMethodIndices.java
Log:
ENC is now passed around as a Map instead of a jndi Context. This allows the
ejb container to modify it and inject the kernel and class loader into
references.
Changed Stateless and MDB containers to use system chain for ejbCreate and
ejbRemove invocations.
Added test to verify that ejbRemove is propertly called from the cache code.
Revision Changes Path
1.4 +29 -9
openejb/modules/core/src/java/org/openejb/dispatch/SystemMethodIndices.java
Index: SystemMethodIndices.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/dispatch/SystemMethodIndices.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SystemMethodIndices.java 20 Jul 2004 23:40:01 -0000 1.3
+++ SystemMethodIndices.java 26 Jan 2005 23:27:59 -0000 1.4
@@ -66,18 +66,22 @@
private final int ejbLoad;
private final int ejbPassivate;
private final int ejbStore;
+ private final int ejbCreate;
+ private final int ejbRemove;
+ private final int ejbTimeout;
private final int setContext;
private final int unsetContext;
- private final int ejbTimeout;
public static SystemMethodIndices
createSystemMethodIndices(InterfaceMethodSignature[] signatures, String
setContextName, String setContextType, String unsetContextName) {
int ejbActivate = -1;
int ejbLoad = -1;
int ejbPassivate = -1;
int ejbStore = -1;
+ int ejbTimeout = -1;
+ int ejbCreate = -1;
+ int ejbRemove = -1;
int setContext = -1;
int unsetContext = -1;
- int ejbTimeout = -1;
for (int i = 0; i < signatures.length; i++) {
InterfaceMethodSignature signature = signatures[i];
if (signature.getMethodName().equals("ejbActivate")) {
@@ -90,23 +94,29 @@
ejbStore = i;
} else if (signature.getMethodName().equals("ejbTimeout")) {
ejbTimeout = i;
+ } else if (signature.getMethodName().equals("ejbCreate") &&
signature.getParameterTypes().length == 0 && !signature.isHomeMethod() ) {
+ ejbCreate = i;
+ } else if (signature.getMethodName().equals("ejbRemove") &&
signature.getParameterTypes().length == 0 && !signature.isHomeMethod() ) {
+ ejbRemove = i;
} else if (signature.getMethodName().equals(setContextName) &&
signature.getParameterTypes().length == 1 &&
signature.getParameterTypes()[0].equals(setContextType)) {
setContext = i;
} else if (signature.getMethodName().equals(unsetContextName) &&
signature.getParameterTypes().length == 0) {
unsetContext = i;
}
}
- return new SystemMethodIndices(ejbActivate, ejbLoad, ejbPassivate,
ejbStore, setContext, unsetContext, ejbTimeout);
+ return new SystemMethodIndices(ejbActivate, ejbLoad, ejbPassivate,
ejbStore, ejbTimeout, ejbCreate, ejbRemove, setContext, unsetContext);
}
- public SystemMethodIndices(int ejbActivate, int ejbLoad, int
ejbPassivate, int ejbStore, int setContext, int unsetContext, int ejbTimeout) {
+ public SystemMethodIndices(int ejbActivate, int ejbLoad, int
ejbPassivate, int ejbStore, int ejbTimeout, int ejbCreate, int ejbRemove, int
setContext, int unsetContext) {
this.ejbActivate = ejbActivate;
this.ejbLoad = ejbLoad;
this.ejbPassivate = ejbPassivate;
this.ejbStore = ejbStore;
+ this.ejbTimeout = ejbTimeout;
+ this.ejbCreate = ejbCreate;
+ this.ejbRemove = ejbRemove;
this.setContext = setContext;
this.unsetContext = unsetContext;
- this.ejbTimeout = ejbTimeout;
}
public EJBInvocation getEjbActivateInvocation(EJBInstanceContext
instanceContext) {
@@ -125,6 +135,19 @@
return new EJBInvocationImpl(ejbStore, null, instanceContext);
}
+ public EJBInvocation getEJBTimeoutInvocation(Object id, TimerImpl timer)
{
+ return new EJBInvocationImpl(EJBInterfaceType.TIMEOUT, id,
ejbTimeout, new Object[] {timer});
+ }
+
+ public EJBInvocation getEJBCreateInvocation(EJBInstanceContext
instanceContext) {
+ return new EJBInvocationImpl(ejbCreate, null, instanceContext);
+ }
+
+ public EJBInvocation getEJBRemoveInvocation(EJBInstanceContext
instanceContext) {
+ return new EJBInvocationImpl(ejbRemove, null, instanceContext);
+
+ }
+
public EJBInvocation getSetContextInvocation(EJBInstanceContext
instanceContext, Object context) {
return new EJBInvocationImpl(setContext, new Object[] {context},
instanceContext);
}
@@ -133,8 +156,5 @@
return new EJBInvocationImpl(unsetContext, null, instanceContext);
}
- public EJBInvocation getEJBTimeoutInvocation(Object id, TimerImpl timer)
{
- return new EJBInvocationImpl(EJBInterfaceType.TIMEOUT, id,
ejbTimeout, new Object[] {timer});
- }
}