You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by David Jencks <da...@yahoo.com> on 2010/06/02 09:59:39 UTC

Please review changes for geronimo no-interface view support.

I was having some trouble getting the proxy binding name and jndi lookup name to match for no-interface view beans in geronimo.  I made a couple changes that make it work but would appreciate review.

rev  950405  container/openejb-core/src/main/java/org/apache/openejb/config/JndiEncInfoBuilder.java

Index: container/openejb-core/src/main/java/org/apache/openejb/config/JndiEncInfoBuilder.java
===================================================================
--- container/openejb-core/src/main/java/org/apache/openejb/config/JndiEncInfoBuilder.java	(revision 950390)
+++ container/openejb-core/src/main/java/org/apache/openejb/config/JndiEncInfoBuilder.java	(working copy)
@@ -205,7 +205,7 @@
             if (ref.getRefType() == EjbReference.Type.UNKNOWN) {
                 EnterpriseBeanInfo otherBean = ejbResolver.getEnterpriseBeanInfo(deploymentId);
                 if (otherBean != null) {
-                    if (otherBean.businessLocal.contains(ref.getInterface())) {
+                    if (otherBean.businessLocal.contains(ref.getInterface()) || otherBean.ejbClass.equals(ref.getInterface())) {
                         ref.setRefType(EjbReference.Type.LOCAL);
                         jndiConsumer.getEjbRef().remove(ref);
                         jndiConsumer.getEjbLocalRef().add(new EjbLocalRef(ref));
@@ -432,7 +432,7 @@
     private EnterpriseBeanInfo getInterfaceBeanInfo(String moduleId, String interfaceClassName) {
         List<EjbJarInfo> ejbJars = appInfo.ejbJars;
         for (EjbJarInfo ejbJar : ejbJars) {
-            if (!ejbJar.moduleId.equals(moduleId)) continue;
+            if (!ejbJar.moduleId.equals(moduleId) && !(moduleId == null && appInfo.ejbJars.size() == 1)) continue;
 
             List<EnterpriseBeanInfo> enterpriseBeans = ejbJar.enterpriseBeans;
             for (EnterpriseBeanInfo enterpriseBean : enterpriseBeans) {


The first change says that if the ejb ref's interface is the same as the ejb class then it's an ejb-local-ref.  This seems consistent with no-interface-view beans being local-only (if I read the spec correctly).

The second change says that if there's only one module and you don't know the moduleId, then look in it.

thanks
david jencks


Re: Please review changes for geronimo no-interface view support.

Posted by Jonathan Gallimore <jo...@gmail.com>.
Hi David,

I've just had quick glance at these, and they look good to me. I'll grab an
update and give it a spin this evening.

Jon

On Wed, Jun 2, 2010 at 8:59 AM, David Jencks <da...@yahoo.com> wrote:

> I was having some trouble getting the proxy binding name and jndi lookup
> name to match for no-interface view beans in geronimo.  I made a couple
> changes that make it work but would appreciate review.
>
> rev  950405
>  container/openejb-core/src/main/java/org/apache/openejb/config/JndiEncInfoBuilder.java
>
> Index:
> container/openejb-core/src/main/java/org/apache/openejb/config/JndiEncInfoBuilder.java
> ===================================================================
> ---
> container/openejb-core/src/main/java/org/apache/openejb/config/JndiEncInfoBuilder.java
>      (revision 950390)
> +++
> container/openejb-core/src/main/java/org/apache/openejb/config/JndiEncInfoBuilder.java
>      (working copy)
> @@ -205,7 +205,7 @@
>             if (ref.getRefType() == EjbReference.Type.UNKNOWN) {
>                 EnterpriseBeanInfo otherBean =
> ejbResolver.getEnterpriseBeanInfo(deploymentId);
>                 if (otherBean != null) {
> -                    if
> (otherBean.businessLocal.contains(ref.getInterface())) {
> +                    if
> (otherBean.businessLocal.contains(ref.getInterface()) ||
> otherBean.ejbClass.equals(ref.getInterface())) {
>                         ref.setRefType(EjbReference.Type.LOCAL);
>                         jndiConsumer.getEjbRef().remove(ref);
>                         jndiConsumer.getEjbLocalRef().add(new
> EjbLocalRef(ref));
> @@ -432,7 +432,7 @@
>     private EnterpriseBeanInfo getInterfaceBeanInfo(String moduleId, String
> interfaceClassName) {
>         List<EjbJarInfo> ejbJars = appInfo.ejbJars;
>         for (EjbJarInfo ejbJar : ejbJars) {
> -            if (!ejbJar.moduleId.equals(moduleId)) continue;
> +            if (!ejbJar.moduleId.equals(moduleId) && !(moduleId == null &&
> appInfo.ejbJars.size() == 1)) continue;
>
>             List<EnterpriseBeanInfo> enterpriseBeans =
> ejbJar.enterpriseBeans;
>             for (EnterpriseBeanInfo enterpriseBean : enterpriseBeans) {
>
>
> The first change says that if the ejb ref's interface is the same as the
> ejb class then it's an ejb-local-ref.  This seems consistent with
> no-interface-view beans being local-only (if I read the spec correctly).
>
> The second change says that if there's only one module and you don't know
> the moduleId, then look in it.
>
> thanks
> david jencks
>
>