User: docodan
Date: 01/06/04 08:16:08
Modified: src/main/org/jboss/ejb ContainerInvokerContainer.java
EntityContainer.java MessageDrivenContainer.java
StatefulSessionContainer.java
StatefulSessionEnterpriseContext.java
StatelessSessionContainer.java
Log:
Lots of changes for stateful session beans to support local interface. (Exception
handling not right; lots of verifier errors.)
Revision Changes Path
1.4 +3 -1 jboss/src/main/org/jboss/ejb/ContainerInvokerContainer.java
Index: ContainerInvokerContainer.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/ContainerInvokerContainer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ContainerInvokerContainer.java 2001/06/02 19:30:27 1.3
+++ ContainerInvokerContainer.java 2001/06/04 15:16:08 1.4
@@ -22,7 +22,7 @@
* @see ContainerInvoker
* @author Rickard �berg ([EMAIL PROTECTED])
* @author Daniel OConnor ([EMAIL PROTECTED])
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public interface ContainerInvokerContainer
{
@@ -36,5 +36,7 @@
public Class getLocalClass();
public ContainerInvoker getContainerInvoker();
+
+ public LocalContainerInvoker getLocalContainerInvoker();
}
1.39 +6 -1 jboss/src/main/org/jboss/ejb/EntityContainer.java
Index: EntityContainer.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/EntityContainer.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- EntityContainer.java 2001/06/03 21:19:52 1.38
+++ EntityContainer.java 2001/06/04 15:16:08 1.39
@@ -37,7 +37,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
* @author Daniel OConnor ([EMAIL PROTECTED])
-* @version $Revision: 1.38 $
+* @version $Revision: 1.39 $
*/
public class EntityContainer
extends Container
@@ -89,6 +89,11 @@
{
return containerInvoker;
}
+
+ public LocalContainerInvoker getLocalContainerInvoker()
+ {
+ return localContainerInvoker;
+ }
public void setInstancePool(InstancePool ip)
{
1.5 +6 -1 jboss/src/main/org/jboss/ejb/MessageDrivenContainer.java
Index: MessageDrivenContainer.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/MessageDrivenContainer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MessageDrivenContainer.java 2001/06/02 19:30:27 1.4
+++ MessageDrivenContainer.java 2001/06/04 15:16:08 1.5
@@ -31,7 +31,7 @@
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
* @author Daniel OConnor ([EMAIL PROTECTED])
-* @version $Revision: 1.4 $
+* @version $Revision: 1.5 $
* extends StatelessSessionContainer
*/
public class MessageDrivenContainer
@@ -68,6 +68,11 @@
{
return containerInvoker;
}
+
+ public LocalContainerInvoker getLocalContainerInvoker()
+ {
+ return localContainerInvoker;
+ }
public void setInstancePool(InstancePool ip)
{
1.26 +85 -29 jboss/src/main/org/jboss/ejb/StatefulSessionContainer.java
Index: StatefulSessionContainer.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/StatefulSessionContainer.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- StatefulSessionContainer.java 2001/06/03 22:23:31 1.25
+++ StatefulSessionContainer.java 2001/06/04 15:16:08 1.26
@@ -18,6 +18,7 @@
import javax.ejb.Handle;
import javax.ejb.HomeHandle;
import javax.ejb.EJBObject;
+import javax.ejb.EJBLocalObject;
import javax.ejb.EJBHome;
import javax.ejb.EJBMetaData;
import javax.ejb.CreateException;
@@ -33,7 +34,7 @@
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
* @author Daniel OConnor ([EMAIL PROTECTED])
- * @version $Revision: 1.25 $
+ * @version $Revision: 1.26 $
*/
public class StatefulSessionContainer
extends Container
@@ -86,6 +87,11 @@
{
return containerInvoker;
}
+
+ public LocalContainerInvoker getLocalContainerInvoker()
+ {
+ return localContainerInvoker;
+ }
public void setInstanceCache(InstanceCache ic)
{
@@ -385,6 +391,21 @@
return
((StatefulSessionEnterpriseContext)mi.getEnterpriseContext()).getEJBObject();
}
+ // local home interface implementation
+
+ public void removeLocalHome(MethodInvocation mi)
+ throws java.rmi.RemoteException, RemoveException
+ {
+ throw new Error("Not Yet Implemented");
+ }
+
+ public EJBLocalObject createLocalHome(MethodInvocation mi)
+ throws Exception
+ {
+ getPersistenceManager().createSession(mi.getMethod(), mi.getArguments(),
(StatefulSessionEnterpriseContext)mi.getEnterpriseContext());
+ return
((StatefulSessionEnterpriseContext)mi.getEnterpriseContext()).getEJBLocalObject();
+ }
+
/**
* A method for the getEJBObject from the handle
*
@@ -434,19 +455,38 @@
{
Map map = new HashMap();
- Method[] m = homeInterface.getMethods();
- for (int i = 0; i < m.length; i++)
+ if (homeInterface != null)
{
- try
- {
- // Implemented by container
- map.put(m[i], getClass().getMethod(m[i].getName()+"Home", new
Class[] { MethodInvocation.class }));
- } catch (NoSuchMethodException e)
- {
- Logger.log(m[i].getName() + " in bean has not been mapped");
- }
+ Method[] m = homeInterface.getMethods();
+ for (int i = 0; i < m.length; i++)
+ {
+ try
+ {
+ // Implemented by container
+ map.put(m[i], getClass().getMethod(m[i].getName()+"Home", new
Class[] { MethodInvocation.class }));
+ } catch (NoSuchMethodException e)
+ {
+ Logger.log(m[i].getName() + " in bean has not been mapped");
+ }
+ }
}
+ if (localHomeInterface != null)
+ {
+ Method[] m = localHomeInterface.getMethods();
+ for (int i = 0; i < m.length; i++)
+ {
+ try
+ {
+ // Implemented by container
+ map.put(m[i], getClass().getMethod(m[i].getName()+"LocalHome",
new Class[] { MethodInvocation.class }));
+ } catch (NoSuchMethodException e)
+ {
+ Logger.log(m[i].getName() + " in bean has not been mapped");
+ }
+ }
+ }
+
try {
// Get getEJBObject from on Handle, first get the class
@@ -467,33 +507,49 @@
homeMapping = map;
}
- protected void setupBeanMapping()
+
+ private void setUpBeanMappingImpl( Map map, Method[] m, String declaringClass )
throws NoSuchMethodException
- {
- Map map = new HashMap();
-
- Method[] m = remoteInterface.getMethods();
- for (int i = 0; i < m.length; i++)
- {
- try
- {
- if (!m[i].getDeclaringClass().getName().equals("javax.ejb.EJBObject"))
+ {
+ for (int i = 0; i < m.length; i++)
+ {
+ if (!m[i].getDeclaringClass().getName().equals(declaringClass))
{
// Implemented by bean
map.put(m[i], beanClass.getMethod(m[i].getName(),
m[i].getParameterTypes()));
}
else
{
- // Implemented by container
- map.put(m[i], getClass().getMethod(m[i].getName(), new Class[] {
MethodInvocation.class }));
-
+ try
+ {
+ // Implemented by container
+ map.put(m[i], getClass().getMethod(m[i].getName(), new Class[]
{ MethodInvocation.class }));
+ } catch (NoSuchMethodException e)
+ {
+ // DEBUG Logger.exception(e);
+ Logger.error(m[i].getName() + " in bean has not been mapped");
+ }
}
- } catch (NoSuchMethodException e)
- {
- Logger.error(m[i].getName() + " in bean has not been mapped");
- }
+ }
+ }
+
+
+ protected void setupBeanMapping()
+ throws NoSuchMethodException
+ {
+ Map map = new HashMap();
+
+ if (remoteInterface != null)
+ {
+ Method[] m = remoteInterface.getMethods();
+ setUpBeanMappingImpl( map, m, "javax.ejb.EJBObject" );
}
-
+ if (localInterface != null)
+ {
+ Method[] m = localInterface.getMethods();
+ setUpBeanMappingImpl( map, m, "javax.ejb.EJBLocalObject" );
+ }
+
beanMapping = map;
}
1.8 +6 -1
jboss/src/main/org/jboss/ejb/StatefulSessionEnterpriseContext.java
Index: StatefulSessionEnterpriseContext.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/StatefulSessionEnterpriseContext.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- StatefulSessionEnterpriseContext.java 2001/04/20 23:01:47 1.7
+++ StatefulSessionEnterpriseContext.java 2001/06/04 15:16:08 1.8
@@ -12,6 +12,7 @@
import javax.ejb.EJBContext;
import javax.ejb.EJBHome;
import javax.ejb.EJBObject;
+import javax.ejb.EJBLocalObject;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
@@ -20,7 +21,8 @@
*
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
- * @version $Revision: 1.7 $
+ * @author Daniel OConnor ([EMAIL PROTECTED])
+ * @version $Revision: 1.8 $
*/
public class StatefulSessionEnterpriseContext
extends EnterpriseContext
@@ -30,6 +32,7 @@
// Attributes ----------------------------------------------------
private EJBObject ejbObject;
+ private EJBLocalObject ejbLocalObject;
private SessionContext ctx;
@@ -71,6 +74,8 @@
public void setEJBObject(EJBObject eo) { ejbObject = eo; }
public EJBObject getEJBObject() { return ejbObject; }
+ public void setEJBLocalObject(EJBLocalObject eo) { ejbLocalObject = eo; }
+ public EJBLocalObject getEJBLocalObject() { return ejbLocalObject; }
public SessionContext getSessionContext()
{
1.20 +6 -1 jboss/src/main/org/jboss/ejb/StatelessSessionContainer.java
Index: StatelessSessionContainer.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/StatelessSessionContainer.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- StatelessSessionContainer.java 2001/06/03 22:23:31 1.19
+++ StatelessSessionContainer.java 2001/06/04 15:16:08 1.20
@@ -32,7 +32,7 @@
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
* @author Daniel OConnor ([EMAIL PROTECTED])
-* @version $Revision: 1.19 $
+* @version $Revision: 1.20 $
*/
public class StatelessSessionContainer
extends Container
@@ -80,6 +80,11 @@
{
return containerInvoker;
}
+
+ public LocalContainerInvoker getLocalContainerInvoker()
+ {
+ return localContainerInvoker;
+ }
public void setInstancePool(InstancePool ip)
{
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development