User: fleury
Date: 00/07/07 16:03:49
Modified: src/main/org/jboss/ejb EntityContainer.java
Log:
The new container does the create hookup for the EJB in the container stack not in
jaws anymore
Revision Changes Path
1.13 +44 -10 jboss/src/main/org/jboss/ejb/EntityContainer.java
Index: EntityContainer.java
===================================================================
RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/ejb/EntityContainer.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- EntityContainer.java 2000/07/06 07:49:37 1.12
+++ EntityContainer.java 2000/07/07 23:03:49 1.13
@@ -33,7 +33,7 @@
* @see EntityEnterpriseContext
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
- * @version $Revision: 1.12 $
+ * @version $Revision: 1.13 $
*/
public class EntityContainer
extends Container
@@ -365,20 +365,54 @@
return (EJBObject)containerInvoker.getEntityEJBObject(id);
}
}
-
- public EJBObject createHome(MethodInvocation mi)
- throws java.rmi.RemoteException, CreateException
- {
- getPersistenceManager().createEntity(mi.getMethod(), mi.getArguments(),
(EntityEnterpriseContext)mi.getEnterpriseContext());
- return ((EntityEnterpriseContext)mi.getEnterpriseContext()).getEJBObject();
- }
-
+
+ public EJBObject createHome(MethodInvocation mi)
+ throws java.rmi.RemoteException, CreateException
+ {
+
+ EntityEnterpriseContext ctx = (EntityEnterpriseContext)
mi.getEnterpriseContext();
+
+ try {
+
+ // Call ejbCreate
+ getBeanClass().getMethod("ejbCreate",
mi.getMethod().getParameterTypes())
+ .invoke(ctx.getInstance(),mi.getArguments());
+
+
+ // Lock instance in cache
+ getInstanceCache().insert(ctx);
+
+
+ // Deal with the persistence in the persistence manager
+ getPersistenceManager().createEntity(mi.getMethod(),
mi.getArguments(), ctx);
+
+ // Create EJBObject
+
ctx.setEJBObject(getContainerInvoker().getEntityEJBObject(mi.getId()));
+
+ // Invoke postCreate
+ getBeanClass().getMethod("ejbPostCreate",
mi.getMethod().getParameterTypes())
+ .invoke(ctx.getInstance(),mi.getArguments());
+
+ return ctx.getEJBObject();
+
+ } catch (InvocationTargetException e) {
+
+ throw new CreateException("Create failed:"+e);
+ } catch (NoSuchMethodException e) {
+
+ throw new CreateException("Create methods not found:"+e);
+ } catch (IllegalAccessException e) {
+
+ throw new CreateException("Could not create entity:"+e);
+ }
+ }
+
// EJBHome implementation ----------------------------------------
public void removeHome(MethodInvocation mi)
throws java.rmi.RemoteException, RemoveException
{
throw new Error("Not yet implemented");
- }
+ }
public EJBMetaData getEJBMetaDataHome(MethodInvocation mi)
throws java.rmi.RemoteException