Title: [2434] branches/v2_0/openejb2/modules/openejb-builder/src/java/org/openejb/deployment: More validation for CORBA EJBs
Revision
2434
Author
ammulder
Date
2006-02-09 23:17:01 -0500 (Thu, 09 Feb 2006)

Log Message

More validation for CORBA EJBs
 - Must have JNDI name
 - Must have remote interface
GERONIMO-1617 GERONIMO-1590

Modified Paths

Diff

Modified: branches/v2_0/openejb2/modules/openejb-builder/src/java/org/openejb/deployment/CMPEntityBuilder.java (2433 => 2434)

--- branches/v2_0/openejb2/modules/openejb-builder/src/java/org/openejb/deployment/CMPEntityBuilder.java	2006-02-10 04:01:41 UTC (rev 2433)
+++ branches/v2_0/openejb2/modules/openejb-builder/src/java/org/openejb/deployment/CMPEntityBuilder.java	2006-02-10 04:17:01 UTC (rev 2434)
@@ -185,7 +185,14 @@
         builder.setFrontEndCacheDelegate(cacheDelegate);
 
         try {
-            GBeanData gbean = builder.createConfiguration(containerObjectName, earContext.getTransactionContextManagerObjectName(), earContext.getConnectionTrackerObjectName(), getTssBeanObjectName(openejbEntityBean, earContext));
+            ObjectName tssBeanObjectName = getTssBeanObjectName(openejbEntityBean, earContext);
+            if(tssBeanObjectName != null && openejbEntityBean.getJndiNameArray().length == 0) {
+                throw new DeploymentException("Cannot expose an entity bean via CORBA unless a JNDI name is set (that's also used as the CORBA naming service name)");
+            }
+            if(tssBeanObjectName != null && (!entityBean.isSetRemote() || !entityBean.isSetHome())) {
+                throw new DeploymentException("An entity bean without a remote interface cannot be exposed via CORBA");
+            }
+            GBeanData gbean = builder.createConfiguration(containerObjectName, earContext.getTransactionContextManagerObjectName(), earContext.getConnectionTrackerObjectName(), tssBeanObjectName);
             return gbean;
         } catch (Throwable e) {
             throw new DeploymentException("Unable to initialize EJB named '" + ejbName + "': "+e.getMessage(), e);

Modified: branches/v2_0/openejb2/modules/openejb-builder/src/java/org/openejb/deployment/EntityBuilder.java (2433 => 2434)

--- branches/v2_0/openejb2/modules/openejb-builder/src/java/org/openejb/deployment/EntityBuilder.java	2006-02-10 04:01:41 UTC (rev 2433)
+++ branches/v2_0/openejb2/modules/openejb-builder/src/java/org/openejb/deployment/EntityBuilder.java	2006-02-10 04:17:01 UTC (rev 2434)
@@ -136,6 +136,12 @@
         processEnvironmentRefs(builder, earContext, ejbModule, entityBean, openejbEntityBean, null, cl);
 
         ObjectName tssBeanObjectName = getTssBeanObjectName(openejbEntityBean, earContext);
+        if(tssBeanObjectName != null && openejbEntityBean.getJndiNameArray().length == 0) {
+            throw new DeploymentException("Cannot expose an entity bean via CORBA unless a JNDI name is set (that's also used as the CORBA naming service name)");
+        }
+        if(tssBeanObjectName != null && (!entityBean.isSetRemote() || !entityBean.isSetHome())) {
+            throw new DeploymentException("An entity bean without a remote interface cannot be exposed via CORBA");
+        }
 
         try {
             GBeanData gbean = builder.createConfiguration(containerObjectName, earContext.getTransactionContextManagerObjectName(), earContext.getConnectionTrackerObjectName(), tssBeanObjectName);

Modified: branches/v2_0/openejb2/modules/openejb-builder/src/java/org/openejb/deployment/SessionBuilder.java (2433 => 2434)

--- branches/v2_0/openejb2/modules/openejb-builder/src/java/org/openejb/deployment/SessionBuilder.java	2006-02-10 04:01:41 UTC (rev 2433)
+++ branches/v2_0/openejb2/modules/openejb-builder/src/java/org/openejb/deployment/SessionBuilder.java	2006-02-10 04:17:01 UTC (rev 2434)
@@ -325,6 +325,12 @@
 
             }
         }
+        if(tssBeanObjectName != null && openejbSessionBean.getJndiNameArray().length == 0) {
+            throw new DeploymentException("Cannot expose a session bean via CORBA unless a JNDI name is set (that's also used as the CORBA naming service name)");
+        }
+        if(tssBeanObjectName != null && (!sessionBean.isSetRemote() || !sessionBean.isSetHome())) {
+            throw new DeploymentException("A session bean without a remote interface cannot be exposed via CORBA");
+        }
 
         GBeanData sessionGBean;
         try {

Reply via email to