openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r738598 - in /incubator/openwebbeans/trunk: ./ webbeans-impl/ webbeans-impl/src/main/java/org/apache/webbeans/component/ webbeans-impl/src/main/java/org/apache/webbeans/config/ webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/ ...
Date Wed, 28 Jan 2009 19:49:55 GMT
Author: gerdogdu
Date: Wed Jan 28 19:49:55 2009
New Revision: 738598

URL: http://svn.apache.org/viewvc?rev=738598&view=rev
Log:
OWB-71 support PersistenceUnit JPA injection on behalf of Mark Struberg, thanks

Modified:
    incubator/openwebbeans/trunk/pom.xml
    incubator/openwebbeans/trunk/webbeans-impl/pom.xml
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jpa/JPAUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java

Modified: incubator/openwebbeans/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/pom.xml?rev=738598&r1=738597&r2=738598&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/pom.xml (original)
+++ incubator/openwebbeans/trunk/pom.xml Wed Jan 28 19:49:55 2009
@@ -352,6 +352,11 @@
 				<version>1.0.0-SNAPSHOT</version>
 			</dependency>
 			<dependency>
+			    <groupId>org.apache.geronimo.specs</groupId>
+			    <artifactId>geronimo-jaxws_2.1_spec</artifactId>
+			    <version>1.0</version>
+			</dependency>
+			<dependency>
 				<groupId>org.apache.geronimo.specs</groupId>
 				<artifactId>geronimo-servlet_2.5_spec</artifactId>
 				<version>1.2</version>

Modified: incubator/openwebbeans/trunk/webbeans-impl/pom.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/pom.xml?rev=738598&r1=738597&r2=738598&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/pom.xml (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/pom.xml Wed Jan 28 19:49:55 2009
@@ -36,6 +36,10 @@
 			<artifactId>log4j</artifactId>
 		</dependency>
 		<dependency>
+		    <groupId>org.apache.geronimo.specs</groupId>
+		    <artifactId>geronimo-jaxws_2.1_spec</artifactId>
+		</dependency>
+		<dependency>
 			<groupId>org.apache.geronimo.specs</groupId>
 			<artifactId>geronimo-servlet_2.5_spec</artifactId>
 		</dependency>
@@ -63,11 +67,7 @@
 			<groupId>net.sf.scannotation</groupId>
 			<artifactId>scannotation</artifactId>
 		</dependency>
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<scope>test</scope>
-		</dependency>
+
 		<dependency>
 			<groupId>javax.annotation</groupId>
 			<artifactId>jsr250-api</artifactId>
@@ -92,6 +92,25 @@
 			<groupId>org.apache.openwebbeans</groupId>
 			<artifactId>openwebbeans-api</artifactId>
 		</dependency>
+
+        <!-- the following dependencies are needed for tests only -->  
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>      
+        <dependency>
+            <groupId>org.apache.openjpa</groupId>
+            <artifactId>openjpa</artifactId>
+            <version>1.2.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>hsqldb</groupId>
+            <artifactId>hsqldb</artifactId>
+            <version>1.8.0.7</version>
+            <scope>test</scope>
+        </dependency>
 	</dependencies>
 
     <build>

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java?rev=738598&r1=738597&r2=738598&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java
Wed Jan 28 19:49:55 2009
@@ -125,19 +125,14 @@
     protected void injectFields(T instance)
     {
         Set<Field> fields = getInjectedFields();
-        Iterator<Field> it = fields.iterator();
-
-        while (it.hasNext())
+        for (Field field : fields)
         {
-            Field field = it.next();
             if (field.getAnnotation(Decorates.class) == null)
             {
                 InjectableField f = new InjectableField(field, instance, this);
                 f.doInjection();
             }
-
         }
-
     }
 
     /*
@@ -147,11 +142,10 @@
     protected void injectMethods(T instance)
     {
         Set<Method> methods = getInjectedMethods();
-        Iterator<Method> it = methods.iterator();
 
-        while (it.hasNext())
+        for (Method method : methods)
         {
-            InjectableMethods m = new InjectableMethods(it.next(), instance, this);
+            InjectableMethods m = new InjectableMethods(method, instance, this);
             m.doInjection();
         }
     }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=738598&r1=738597&r2=738598&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
Wed Jan 28 19:49:55 2009
@@ -467,20 +467,33 @@
             for (Field field : fields)
             {
                 Annotation[] anns = field.getAnnotations();
-                Annotation[] as = AnnotationUtil.getBindingAnnotations(anns);
 
-                // injected fields must define binding types.
-                if (as.length > 0)
+                Annotation[] bindingAnns = AnnotationUtil.getBindingAnnotations(anns);
+                Annotation[] resourceAnns = AnnotationUtil.getResourceAnnotations(anns);
+                
+                // bindingAnns and resourceAnns are not allowed at the same time!
+                if (bindingAnns.length > 0 && resourceAnns.length > 0)
                 {
-                    WebBeansUtil.checkForNewBindingForDeployment(field.getGenericType(),
clazz, field.getName(), anns);
-
+                    throw new WebBeansConfigurationException("Found binding and resource
injection at the same time for the field : " 
+                                                             + field.getName() + " in class
: " + clazz.getName());
+                }
+                
+                // injected fields must either be resources or define binding types, 
+                // otherwise it's binding &#x0040;Current.
+                if (bindingAnns.length > 0 || resourceAnns.length > 0)
+                {
+                    if (bindingAnns.length > 0)
+                    {
+                        WebBeansUtil.checkForNewBindingForDeployment(field.getGenericType(),
clazz, field.getName(), anns);
+                    }
+                    
                     int mod = field.getModifiers();
                     if (!Modifier.isStatic(mod) && !Modifier.isFinal(mod))
                     {
                         component.addInjectedField(field);
                     }
                 }
-
+                
             }
         }
 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java?rev=738598&r1=738597&r2=738598&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java
Wed Jan 28 19:49:55 2009
@@ -28,9 +28,8 @@
 
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.webbeans.decorator.WebBeansDecorator#initDelegate()
+    /**
+     * {@inheritDoc}
      */
     @Override
     protected void initDelegate()

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=738598&r1=738597&r2=738598&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
Wed Jan 28 19:49:55 2009
@@ -23,6 +23,8 @@
 import javax.inject.New;
 import javax.inject.manager.Bean;
 
+import javax.persistence.PersistenceUnit;
+
 import org.apache.webbeans.component.AbstractComponent;
 import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.container.ManagerImpl;
@@ -32,6 +34,8 @@
 import org.apache.webbeans.context.creational.CreationalContextImpl;
 import org.apache.webbeans.event.EventImpl;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.jpa.JPAUtil;
+import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.ClassUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 
@@ -71,6 +75,12 @@
                 isSetOnThis = true;
             }
 
+            if (isResource(annotations))
+            {
+                //X TODO do we need the args too?
+                return injectResource(type, annotations);
+            }
+            
             if (isNewBinding(annotations))
             {
                 return injectForNew(type, annotations);
@@ -110,6 +120,19 @@
 
     }
 
+    private boolean isResource(Annotation... annotations)
+    {
+        for (Annotation anno : annotations)
+        {
+            if (AnnotationUtil.isResourceAnnotation(anno.annotationType()))
+            {
+                return true;
+            }
+        }
+        
+        return false;
+    }
+
     private boolean isNewBinding(Annotation... annotations)
     {
         if (annotations.length == 1)
@@ -136,6 +159,29 @@
         return false;
     }
 
+    /**
+     * create the instance for injecting web beans resources.
+     * @see AnnotationUtil#isResourceAnnotation(Class)
+     * @param type the class type which should be created
+     * @param annotations which has been defined in the web bean
+     * @return the instance linked with the annotation
+     */
+    private Object injectResource(Type type, Annotation... annotations)
+    {
+        Object ret = null;
+        Annotation annot = AnnotationUtil.getAnnotation(annotations, PersistenceUnit.class);
+        if (annot != null)
+        {
+            PersistenceUnit pu = (PersistenceUnit) annot;
+            String unitName = pu.unitName();
+            
+            //X TODO what if the EntityManagerFactory is null?
+            return JPAUtil.getPersistenceUnit(unitName);
+        }
+        
+        return ret;
+    }
+    
     private Object injectForNew(Type type, Annotation... annotations)
     {
         Class<?> clazz = null;

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java?rev=738598&r1=738597&r2=738598&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
Wed Jan 28 19:49:55 2009
@@ -52,14 +52,15 @@
 
         Annotation[] annots = field.getAnnotations();
 
-        annots = AnnotationUtil.getBindingAnnotations(annots);
+        Annotation[] bindingAnnos = AnnotationUtil.getBindingAnnotations(annots);
+        Annotation[] resourceAnnos = AnnotationUtil.getResourceAnnotations(annots);
 
         try
         {
-            if (annots.length == 0)
+            if (bindingAnnos.length == 0)
             {
-                annots = new Annotation[1];
-                annots[0] = new CurrentLiteral();
+                bindingAnnos = new Annotation[1];
+                bindingAnnos[0] = new CurrentLiteral();
             }
 
             if (!ClassUtil.isPublic(field.getModifiers()))

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jpa/JPAUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jpa/JPAUtil.java?rev=738598&r1=738597&r2=738598&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jpa/JPAUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jpa/JPAUtil.java
Wed Jan 28 19:49:55 2009
@@ -13,7 +13,25 @@
  */
 package org.apache.webbeans.jpa;
 
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+/**
+ * Helper class which contains various static functions for accessing JPA functionality.
+ */
 public class JPAUtil
 {
 
+    /**
+     * 
+     * @param unitName JPA persistence unit name
+     * @return EntityManagerFactory or <code>null</code> if not found
+     */
+    public static EntityManagerFactory getPersistenceUnit(String unitName)
+    {
+        EntityManagerFactory emf = Persistence.createEntityManagerFactory(unitName);
+            
+        return emf;
+    }
+
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=738598&r1=738597&r2=738598&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
Wed Jan 28 19:49:55 2009
@@ -25,6 +25,12 @@
 import java.util.Set;
 import java.util.StringTokenizer;
 
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceUnit;
+import javax.xml.ws.WebServiceRef;
+
 import javax.annotation.NonBinding;
 import javax.annotation.Stereotype;
 import javax.inject.BindingType;
@@ -468,6 +474,33 @@
     }
 
     /**
+     * Gets the array of resource annotations on the given array.
+     * 
+     * @param annotations annotation array
+     * @return array containing resource type anns
+     */
+    public static Annotation[] getResourceAnnotations(Annotation... annotations)
+    {
+        Asserts.assertNotNull(annotations, "Annotations argument can not be null");
+
+        Set<Annotation> set = new HashSet<Annotation>();
+
+        for (Annotation annot : annotations)
+        {
+            if (AnnotationUtil.isResourceAnnotation(annot.annotationType()))
+            {
+                set.add(annot);
+            }
+        }
+
+        Annotation[] a = new Annotation[set.size()];
+        a = set.toArray(a);
+
+        return a;
+
+    }
+    
+    /**
      * Gets array of methods that has parameter with given annotation type.
      * 
      * @param clazz class for check
@@ -568,21 +601,30 @@
 
     public static boolean isAnnotationExist(Annotation[] anns, Class<? extends Annotation>
annotation)
     {
+        return getAnnotation(anns, annotation) != null;
+    }
+
+    /**
+     * get the annotation of the given type from the array. 
+     * @param anns
+     * @param annotation
+     * @return the Annotation with the given type or <code>null</code> if no
such found.
+     */
+    public static Annotation getAnnotation(Annotation[] anns, Class<? extends Annotation>
annotation)
+    {
         Asserts.assertNotNull(anns, "anns argument can not be null");
         Asserts.assertNotNull(annotation, "annotation argument can not be null");
-
         for (Annotation annot : anns)
         {
             if (annot.annotationType().equals(annotation))
             {
-                return true;
+                return annot;
             }
         }
 
-        return false;
-
+        return null;
     }
-
+    
     public static Annotation[] getMetaAnnotations(Annotation[] anns, Class<? extends Annotation>
metaAnnotation)
     {
         List<Annotation> annots = new ArrayList<Annotation>();
@@ -680,6 +722,48 @@
     }
 
     /**
+     * Returns true if the annotation is a valid WebBeans Resource,
+     * a resource defined in common annotations JSR-250, a remote EJB
+     * or a web service.
+     * The following annotations indicate resources
+     * <ol>
+     * <li>&#x0040;CustomerDataservice</li>
+     * <li>&#x0040;Resource</li>
+     * <li>&#x0040;PersistenceContext</li>
+     * <li>&#x0040;PersistenceUnit</li>
+     * <li>&#x0040;EJB</li>
+     * <li>&#x0040;WebServiceRef</li>
+     * <li>&#x0040;</li>
+     * </ol>
+     * 
+     * Please note that &#x0040;PersistenceContext(type=EXTENDED) 
+     * is not supported for simple beans.
+     * 
+     * @param clazz type of the annotation
+     * @return true if the annotation is defined in xml or annotated with
+     *         {@link BindingType} false otherwise
+     */
+    public static boolean isResourceAnnotation(Class<? extends Annotation> clazz)
+    {
+        Asserts.assertNotNull(clazz, "clazz parameter can not be null");
+        XMLAnnotationTypeManager manager = XMLAnnotationTypeManager.getInstance();
+        if (manager.isResourceExist(clazz))
+        {
+            return true;
+        }
+        else if (clazz.equals(Resource.class) ||
+                 clazz.equals(PersistenceContext.class) ||
+                 clazz.equals(PersistenceUnit.class) ||
+                 clazz.equals(EJB.class) ||
+                 clazz.equals(WebServiceRef.class) )
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
      * Returns true if the annotation is defined in xml or annotated with
      * {@link InterceptorBindingType} false otherwise.
      * 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=738598&r1=738597&r2=738598&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Wed Jan 28 19:49:55 2009
@@ -350,8 +350,11 @@
      * Check conditions for the new binding.
      * 
      * @param annotations annotations
+     * @return Annotation[] with all binding annotations
+     * @throws WebBeansConfigurationException if &x0040;New plus any other binding annotation
is set or
+     *         if &x0040;New is used for an Interface or an abstract class.
      */
-    public static void checkForNewBindingForDeployment(Type type, Class<?> clazz, String
name, Annotation... annotations)
+    public static Annotation[] checkForNewBindingForDeployment(Type type, Class<?>
clazz, String name, Annotation[] annotations)
     {
         Asserts.assertNotNull(type, "Type argument can not be null");
         Asserts.assertNotNull(clazz, "Clazz argument can not be null");
@@ -373,7 +376,8 @@
                 }
             }
         }
-
+        
+        return as;
     }
 
     /**

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java?rev=738598&r1=738597&r2=738598&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
Wed Jan 28 19:49:55 2009
@@ -198,6 +198,9 @@
                 addNewBindingType(child);
 
             }
+            
+            //X TODO <Resource> annotation element declaration */
+            
             /* <InterceptorBindingType> annotation element decleration */
             else if (XMLUtil.isElementInterceptorBindingTypeDecleration(child))
             {

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java?rev=738598&r1=738597&r2=738598&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java
Wed Jan 28 19:49:55 2009
@@ -30,6 +30,8 @@
 public class XMLAnnotationTypeManager
 {
     private Set<Class<? extends Annotation>> xmlBindingTypes = new CopyOnWriteArraySet<Class<?
extends Annotation>>();
+    
+    private Set<Class<? extends Annotation>> xmlResources = new CopyOnWriteArraySet<Class<?
extends Annotation>>();
 
     private Map<Class<? extends Annotation>, Set<Annotation>> xmlInterceptorBindingTypes
= new ConcurrentHashMap<Class<? extends Annotation>, Set<Annotation>>();
 
@@ -51,6 +53,11 @@
         xmlBindingTypes.add(bindingType);
     }
 
+    public void addResource(Class<? extends Annotation> resource)
+    {
+        xmlResources.add(resource);
+    }
+
     public boolean isBindingTypeExist(Class<? extends Annotation> bindingType)
     {
         if (xmlBindingTypes.contains(bindingType))
@@ -61,6 +68,16 @@
         return false;
     }
 
+    public boolean isResourceExist(Class<? extends Annotation> resource)
+    {
+        if (xmlResources.contains(resource))
+        {
+            return true;
+        }
+
+        return false;
+    }
+
     public void addStereoType(Class<? extends Annotation> stereoType, Element decleration,
String name, String errorMessage)
     {
         WebBeansUtil.checkStereoTypeClass(stereoType);
@@ -113,6 +130,11 @@
         return Collections.unmodifiableSet(xmlBindingTypes);
     }
 
+    public Set<Class<? extends Annotation>> getResources()
+    {
+        return Collections.unmodifiableSet(xmlResources);
+    }
+
     public Set<Annotation> getInterceptorBindingTypeInherites(Class<? extends Annotation>
interceptorBindingType)
     {
         return Collections.unmodifiableSet(xmlInterceptorBindingTypes.get(interceptorBindingType));



Mime
View raw message