User: docodan
Date: 01/06/03 15:23:31
Modified: src/main/org/jboss/ejb StatefulSessionContainer.java
StatelessSessionContainer.java
Log:
Local entity w/ stateless session bean worked. (Exception handling not right; lots
of verifier errors.)
Revision Changes Path
1.25 +5 -3 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.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- StatefulSessionContainer.java 2001/06/03 21:19:52 1.24
+++ StatefulSessionContainer.java 2001/06/03 22:23:31 1.25
@@ -33,7 +33,7 @@
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
* @author Daniel OConnor ([EMAIL PROTECTED])
- * @version $Revision: 1.24 $
+ * @version $Revision: 1.25 $
*/
public class StatefulSessionContainer
extends Container
@@ -166,8 +166,10 @@
Thread.currentThread().setContextClassLoader(getClassLoader());
// Acquire classes from CL
- homeInterface = classLoader.loadClass(metaData.getHome());
- remoteInterface = classLoader.loadClass(metaData.getRemote());
+ if (metaData.getHome() != null)
+ homeInterface = classLoader.loadClass(metaData.getHome());
+ if (metaData.getRemote() != null)
+ remoteInterface = classLoader.loadClass(metaData.getRemote());
// Call default init
super.init();
1.19 +68 -14 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.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- StatelessSessionContainer.java 2001/06/03 21:19:52 1.18
+++ StatelessSessionContainer.java 2001/06/03 22:23:31 1.19
@@ -16,6 +16,8 @@
import javax.ejb.HomeHandle;
import javax.ejb.EJBObject;
import javax.ejb.EJBHome;
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EJBLocalHome;
import javax.ejb.EJBMetaData;
import javax.ejb.CreateException;
import javax.ejb.RemoveException;
@@ -30,7 +32,7 @@
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
* @author Daniel OConnor ([EMAIL PROTECTED])
-* @version $Revision: 1.18 $
+* @version $Revision: 1.19 $
*/
public class StatelessSessionContainer
extends Container
@@ -136,8 +138,10 @@
Thread.currentThread().setContextClassLoader(getClassLoader());
// Acquire classes from CL
- homeInterface = classLoader.loadClass(metaData.getHome());
- remoteInterface = classLoader.loadClass(metaData.getRemote());
+ if (metaData.getHome() != null)
+ homeInterface = classLoader.loadClass(metaData.getHome());
+ if (metaData.getRemote() != null)
+ remoteInterface = classLoader.loadClass(metaData.getRemote());
// Call default init
super.init();
@@ -312,7 +316,29 @@
{
return false; // TODO
}
+
+ // EJBLocalObject implementation
+
+ public EJBLocalHome getEJBLocalHome(MethodInvocation mi)
+ {
+ return localContainerInvoker.getEJBLocalHome();
+ }
+
+ // EJBLocalHome implementation
+ public EJBLocalObject createLocalHome()
+ throws CreateException
+ {
+ if (localContainerInvoker == null)
+ throw new IllegalStateException();
+ return localContainerInvoker.getStatelessSessionEJBLocalObject();
+ }
+ public void removeLocalHome(Object primaryKey)
+ {
+ // todo
+ }
+
+
// EJBHome implementation ----------------------------------------
public EJBObject createHome()
throws java.rmi.RemoteException, CreateException
@@ -356,25 +382,36 @@
{
Map map = new HashMap();
- Method[] m = homeInterface.getMethods();
- for (int i = 0; i < m.length; i++)
+ if (homeInterface != null)
{
- // Implemented by container
- Logger.debug("Mapping "+m[i].getName());
- map.put(m[i], getClass().getMethod(m[i].getName()+"Home",
m[i].getParameterTypes()));
+ Method[] m = homeInterface.getMethods();
+ for (int i = 0; i < m.length; i++)
+ {
+ // Implemented by container
+ Logger.debug("Mapping "+m[i].getName());
+ map.put(m[i], getClass().getMethod(m[i].getName()+"Home",
m[i].getParameterTypes()));
+ }
}
+ if (localHomeInterface != null)
+ {
+ Method[] m = localHomeInterface.getMethods();
+ for (int i = 0; i < m.length; i++)
+ {
+ // Implemented by container
+ Logger.debug("Mapping "+m[i].getName());
+ map.put(m[i], getClass().getMethod(m[i].getName()+"LocalHome",
m[i].getParameterTypes()));
+ }
+ }
homeMapping = map;
}
- protected void setupBeanMapping()
- throws NoSuchMethodException
+ 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++)
+ for (int i = 0; i < m.length; i++)
{
- if (!m[i].getDeclaringClass().getName().equals("javax.ejb.EJBObject"))
+ if (!m[i].getDeclaringClass().getName().equals(declaringClass))
{
// Implemented by bean
map.put(m[i], beanClass.getMethod(m[i].getName(),
m[i].getParameterTypes()));
@@ -396,6 +433,23 @@
}
}
+ }
+ }
+
+ 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;
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development