[webbeans-commits] Webbeans SVN: r2927 - in ri/trunk: tests/src/main/java/org/jboss/webbeans/mock and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Mon Jun 29 10:10:44 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-06-29 10:10:44 -0400 (Mon, 29 Jun 2009)
New Revision: 2927

Removed:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/ForwardingEjbDescriptor.java
Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/InternalEjbDescriptor.java
   ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java
Log:
Add BeanDeploymentArchive SPI

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java	2009-06-29 14:09:05 UTC (rev 2926)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java	2009-06-29 14:10:44 UTC (rev 2927)
@@ -31,9 +31,6 @@
  */
 public class EjbDescriptorCache
 {
-
-   // EJB name -> EJB descriptor map
-   private Map<String, InternalEjbDescriptor<?>> ejbsByName;
    // EJB implementation class -> EJB descriptors map
    private Map<Class<?>, Set<InternalEjbDescriptor<?>>> ejbsByBeanClass;
 
@@ -42,22 +39,10 @@
     */
    public EjbDescriptorCache()
    {
-      this.ejbsByName = new HashMap<String, InternalEjbDescriptor<?>>();
       this.ejbsByBeanClass = new HashMap<Class<?>, Set<InternalEjbDescriptor<?>>>();
    }
 
    /**
-    * Gets the EJB descriptor for a given name
-    * 
-    * @param ejbName The EJB name
-    * @return The EJB descriptor
-    */
-   public InternalEjbDescriptor<?> get(String ejbName)
-   {
-      return ejbsByName.get(ejbName);
-   }
-
-   /**
     * Gets an iterator to the EJB descriptors for an EJB implementation class
     * 
     * @param beanClass The EJB class
@@ -77,26 +62,14 @@
    public <T> void add(EjbDescriptor<T> ejbDescriptor)
    {
       InternalEjbDescriptor<T> internalEjbDescriptor = new InternalEjbDescriptor<T>(ejbDescriptor);
-      ejbsByName.put(ejbDescriptor.getEjbName(), internalEjbDescriptor);
-      if (!ejbsByBeanClass.containsKey(ejbDescriptor.getType()))
+      if (!ejbsByBeanClass.containsKey(ejbDescriptor.getBeanClass()))
       {
-         ejbsByBeanClass.put(ejbDescriptor.getType(), new CopyOnWriteArraySet<InternalEjbDescriptor<?>>());  
+         ejbsByBeanClass.put(ejbDescriptor.getBeanClass(), new CopyOnWriteArraySet<InternalEjbDescriptor<?>>());  
       }
-      ejbsByBeanClass.get(ejbDescriptor.getType()).add(internalEjbDescriptor);
+      ejbsByBeanClass.get(ejbDescriptor.getBeanClass()).add(internalEjbDescriptor);
    }
 
    /**
-    * Indicates if there are EJB descriptors available for an EJB name
-    * 
-    * @param ejbName The EJB name to match
-    * @return True if present, otherwise false
-    */
-   public boolean containsKey(String ejbName)
-   {
-      return ejbsByName.containsKey(ejbName);
-   }
-
-   /**
     * Indicates if there are EJB descriptors available for an EJB implementation
     * class
     * 
@@ -127,13 +100,12 @@
    public void clear()
    {
       ejbsByBeanClass.clear();
-      ejbsByName.clear();
    }
 
    @Override
    public String toString()
    {
-      return "EJB Descriptor cache has indexed " + ejbsByBeanClass.size() + " EJBs by class and " + ejbsByName + " by name";
+      return "EJB Descriptor cache has indexed " + ejbsByBeanClass.size() + " EJBs by class";
    }
 
 }

Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/ForwardingEjbDescriptor.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/ForwardingEjbDescriptor.java	2009-06-29 14:09:05 UTC (rev 2926)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/ForwardingEjbDescriptor.java	2009-06-29 14:10:44 UTC (rev 2927)
@@ -1,99 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.ejb;
-
-import java.lang.reflect.Method;
-
-import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-
-/**
- * Forwarding helper class for {@link EjbDescriptor} to support the decorator
- * pattern
- * 
- * @author Pete Muir
- *
- */
-public abstract class ForwardingEjbDescriptor<T> implements EjbDescriptor<T>
-{
-   
-   protected abstract EjbDescriptor<T> delegate();
-   
-   public String getEjbName()
-   {
-      return delegate().getEjbName();
-   }
-   
-   public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces()
-   {
-      return delegate().getLocalBusinessInterfaces();
-   }
-   
-   public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces()
-   {
-      return delegate().getRemoteBusinessInterfaces();
-   }
-   
-   public Iterable<Method> getRemoveMethods()
-   {
-      return delegate().getRemoveMethods();
-   }
-   
-   public Class<T> getType()
-   {
-      return delegate().getType();
-   }
-   
-   public boolean isMessageDriven()
-   {
-      return delegate().isMessageDriven();
-   }
-   
-   public boolean isSingleton()
-   {
-      return delegate().isSingleton();
-   }
-   
-   public boolean isStateful()
-   {
-      return delegate().isStateful();
-   }
-   
-   public boolean isStateless()
-   {
-      return delegate().isStateless();
-   }
-   
-   @Override
-   public String toString()
-   {
-      return delegate().toString();
-   }
-   
-   @Override
-   public int hashCode()
-   {
-      return delegate().hashCode();
-   }
-   
-   @Override
-   public boolean equals(Object obj)
-   {
-      return delegate().equals(obj);
-   }
-   
-}

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/InternalEjbDescriptor.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/InternalEjbDescriptor.java	2009-06-29 14:09:05 UTC (rev 2926)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/InternalEjbDescriptor.java	2009-06-29 14:10:44 UTC (rev 2927)
@@ -23,6 +23,7 @@
 
 import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
 import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+import org.jboss.webbeans.ejb.spi.helpers.ForwardingEjbDescriptor;
 import org.jboss.webbeans.introspector.MethodSignature;
 import org.jboss.webbeans.introspector.jlr.MethodSignatureImpl;
 

Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java	2009-06-29 14:09:05 UTC (rev 2926)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java	2009-06-29 14:10:44 UTC (rev 2927)
@@ -34,7 +34,7 @@
 
 public class MockEjbDescriptor<T> implements EjbDescriptor<T>
 {
-   private final Class<T> type;
+   private final Class<T> beanClass;
    private final String ejbName;
    private final List<BusinessInterfaceDescriptor<?>> localInterfaces;
    private final HashSet<Method> removeMethods;
@@ -46,7 +46,7 @@
 
    private MockEjbDescriptor(final Class<T> type)
    {
-      this.type = type;
+      this.beanClass = type;
       this.ejbName = type.getSimpleName();
       this.localInterfaces = new ArrayList<BusinessInterfaceDescriptor<?>>();
       
@@ -121,34 +121,34 @@
       return removeMethods;
    }
 
-   public Class<T> getType()
+   public Class<T> getBeanClass()
    {
-      return type;
+      return beanClass;
    }
 
    public boolean isMessageDriven()
    {
-      return type.isAnnotationPresent(MessageDriven.class);
+      return beanClass.isAnnotationPresent(MessageDriven.class);
    }
 
    public boolean isSingleton()
    {
-      return type.isAnnotationPresent(Singleton.class);
+      return beanClass.isAnnotationPresent(Singleton.class);
    }
 
    public boolean isStateful()
    {
-      return type.isAnnotationPresent(Stateful.class);
+      return beanClass.isAnnotationPresent(Stateful.class);
    }
 
    public boolean isStateless()
    {
-      return type.isAnnotationPresent(Stateless.class);
+      return beanClass.isAnnotationPresent(Stateless.class);
    }
    
    public String getLocalJndiName()
    {
-      return type.getSimpleName() + "/local";
+      return beanClass.getSimpleName() + "/local";
    }
    
    @Override
@@ -173,7 +173,7 @@
          builder.append(" (MDB)");
       }
       builder.append("remove methods; " + removeMethods + "; ");
-      builder.append("; BeanClass: " + getType() + "; Local Business Interfaces: " + getLocalBusinessInterfaces());
+      builder.append("; BeanClass: " + getBeanClass() + "; Local Business Interfaces: " + getLocalBusinessInterfaces());
       return builder.toString(); 
    }
    
@@ -183,7 +183,7 @@
       if (other instanceof EjbDescriptor)
       {
          EjbDescriptor<T> that = (EjbDescriptor<T>) other;
-         return this.getEjbName().equals(that.getEjbName());
+         return this.getBeanClass().equals(that.getBeanClass());
       }
       else
       {




More information about the weld-commits mailing list