User: fleury
Date: 00/08/11 15:11:26
Modified: src/main/org/jboss/ejb EnterpriseContext.java
EntityEnterpriseContext.java
Log:
Implementation for the getEJBObject methods in context
Revision Changes Path
1.5 +13 -4 jboss/src/main/org/jboss/ejb/EnterpriseContext.java
Index: EnterpriseContext.java
===================================================================
RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/ejb/EnterpriseContext.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- EnterpriseContext.java 2000/08/10 16:28:21 1.4
+++ EnterpriseContext.java 2000/08/11 22:11:26 1.5
@@ -34,7 +34,7 @@
* @see EntityEnterpriseContext
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public abstract class EnterpriseContext
{
@@ -56,7 +56,9 @@
// The principal associated with the call
Principal principal;
- Object id; // Not used for sessions
+ // Only StatelessSession beans have no Id, stateful and entity do
+ Object id;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -76,6 +78,8 @@
throws RemoteException;
public void setId(Object id) {
+ Exception e = new Exception();
+ e.printStackTrace();
this.id = id;
}
@@ -126,10 +130,15 @@
if (con instanceof EntityContainer)
{
return
((EntityContainer)con).getContainerInvoker().getEJBHome();
- } if (con instanceof StatelessSessionContainer)
+ }
+ else if (con instanceof StatelessSessionContainer)
{
return
((StatelessSessionContainer)con).getContainerInvoker().getEJBHome();
- } else
+ }
+ else if (con instanceof StatefulSessionContainer)
+ {
+ return
((StatefulSessionContainer)con).getContainerInvoker().getEJBHome();
+ }
{
// Should never get here
throw new EJBException("No EJBHome available (BUG!)");
1.5 +15 -1 jboss/src/main/org/jboss/ejb/EntityEnterpriseContext.java
Index: EntityEnterpriseContext.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/EntityEnterpriseContext.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- EntityEnterpriseContext.java 2000/08/10 16:28:21 1.4
+++ EntityEnterpriseContext.java 2000/08/11 22:11:26 1.5
@@ -21,7 +21,7 @@
* @see EnterpriseContext
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
-* @version $Revision: 1.4 $
+* @version $Revision: 1.5 $
*/
public class EntityEnterpriseContext
extends EnterpriseContext
@@ -66,6 +66,8 @@
public EJBObject getEJBObject()
{
+ // Context can have no EJBObject (created by finds) in which case we
need to wire it at call time
+
return ejbObject;
}
@@ -126,6 +128,18 @@
{
public EJBObject getEJBObject()
{
+ if (ejbObject == null) {
+
+ try {
+
+ ejbObject =
((EntityContainer)con).getContainerInvoker().getEntityEJBObject(id);
+ }
+ catch (RemoteException re) {
+ // ...
+ throw new IllegalStateException();
+ }
+ }
+
return ejbObject;
}