[webbeans-commits] Webbeans SVN: r2612 - in ri/trunk/impl/src/main/java/org/jboss/webbeans/xml: checker/beanchildren and 5 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Tue Apr 21 11:38:27 EDT 2009


Author: vitold
Date: 2009-04-21 11:38:27 -0400 (Tue, 21 Apr 2009)
New Revision: 2612

Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/BeanChildrenChecker.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/AbstractBeanChildrenChecker.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/NotSimpleBeanChildrenChecker.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/ResourceBeanChildrenChecker.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/SimpleBeanChildrenChecker.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/BeanElementRegistrator.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/JmsResourceElementRegistrator.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/NotSimpleBeanElementRegistrator.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/ResourceElementRegistrator.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/SessionBeanElementRegistrator.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/SimpleBeanElementRegistrator.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/impl/BeanElementRegistratorImpl.java
Log:
formatting code

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -29,28 +29,30 @@
 {
    public static boolean isJavaEeNamespace(Element element)
    {
-      return element.getNamespace().getURI().equalsIgnoreCase(XmlConstants.JAVA_EE_NAMESPACE);
+      return XmlConstants.JAVA_EE_NAMESPACE.equalsIgnoreCase(element.getNamespace().getURI());
    }
 
-   public static <T> AnnotatedClass<? extends T> loadElementClass(Element element, Class<T> expectedType, XmlEnvironment environment, Map<String, Set<String>> packagesMap)
+   public static <T> AnnotatedClass<? extends T> loadElementClass(Element element, Class<T> expectedType, XmlEnvironment environment, 
+                                                                     Map<String, Set<String>> packagesMap)
    {
       List<AnnotatedClass<? extends T>> classesList = tryLoadElementClass(element, expectedType, environment, packagesMap);
       String className = element.getName();
 
       if (classesList.size() == 0)
          throw new DefinitionException("Could not find '" + className + "'");
-      
+
       return classesList.get(0);
    }
-   
-   public static <T> List<AnnotatedClass<? extends T>> tryLoadElementClass(Element element, Class<T> expectedType, XmlEnvironment environment, Map<String, Set<String>> packagesMap)
+
+   public static <T> List<AnnotatedClass<? extends T>> tryLoadElementClass(Element element, Class<T> expectedType, XmlEnvironment environment, 
+                                                                              Map<String, Set<String>> packagesMap)
    {
       List<AnnotatedClass<? extends T>> classesList = new ArrayList<AnnotatedClass<? extends T>>();
       String prefix = element.getNamespacePrefix();
 
       for (Map.Entry<String, Set<String>> packagesEntry : packagesMap.entrySet())
       {
-         if (prefix.equalsIgnoreCase(packagesEntry.getKey()))
+         if (packagesEntry.getKey().equalsIgnoreCase(prefix))
          {
             Set<String> packages = packagesEntry.getValue();
             for (String packageName : packages)
@@ -67,14 +69,15 @@
             }
          }
       }
-      
-      if(classesList.size() > 1)
+
+      if (classesList.size() > 1)
          throw new DefinitionException("There are multiple packages containing a Java type with the same name '" + element.getName() + "'");
-      
+
       return classesList;
    }
-   
-   public static <T extends Annotation> Class<? extends T> loadAnnotationClass(Element element, Class<T> expectedType, XmlEnvironment environment, Map<String, Set<String>> packagesMap)
+
+   public static <T extends Annotation> Class<? extends T> loadAnnotationClass(Element element, Class<T> expectedType, XmlEnvironment environment, 
+                                                                                 Map<String, Set<String>> packagesMap)
    {
       List<Class<? extends T>> classesList = new ArrayList<Class<? extends T>>();
       String className = element.getName();
@@ -82,7 +85,7 @@
 
       for (Map.Entry<String, Set<String>> packagesEntry : packagesMap.entrySet())
       {
-         if (prefix.equalsIgnoreCase(packagesEntry.getKey()))
+         if (packagesEntry.getKey().equalsIgnoreCase(prefix))
          {
             Set<String> packages = packagesEntry.getValue();
             for (String packageName : packages)
@@ -94,7 +97,7 @@
                }
                catch (ResourceLoadingException e)
                {
-                  //work with this when 'classesList.size() == 0'
+                  // work with this when 'classesList.size() == 0'
                }
                catch (ClassCastException e)
                {
@@ -130,7 +133,7 @@
             {
                urn = attrVal;
                URL namespaceFile = environment.loadFileByUrn(urn, XmlConstants.NAMESPACE_FILE_NAME);
-               
+
                if (namespaceFile != null)
                {
                   packagesSet.addAll(parseNamespaceFile(namespaceFile));
@@ -141,11 +144,13 @@
                   packagesSet.add(packageName);
                }
             }
-            if (attribute.getName().equalsIgnoreCase(XmlConstants.SCHEMA_LOCATION) && attrVal.startsWith(XmlConstants.HTTP_PREFIX) && urn.trim().length() > 0)
+            if (XmlConstants.SCHEMA_LOCATION.equalsIgnoreCase(attribute.getName()) && 
+                  attrVal.startsWith(XmlConstants.HTTP_PREFIX) && urn.trim().length() > 0)
             {
                URL schemaUrl = environment.loadFileByUrn(urn, XmlConstants.SCHEMA_FILE_NAME);
                if (schemaUrl == null)
-                  throw new DefinitionException("Could not find '" + XmlConstants.SCHEMA_FILE_NAME + "' file according to specified URN '" + urn + "'");
+                  throw new DefinitionException("Could not find '" + XmlConstants.SCHEMA_FILE_NAME + 
+                        "' file according to specified URN '" + urn + "'");
                validateXmlWithXsd(xmlUrl, schemaUrl);
             }
          }
@@ -162,15 +167,15 @@
          Namespace namespace = (Namespace) namespacesIterator.next();
          String prefix = namespace.getPrefix();
          String uri = namespace.getURI();
-         
+
          if (uri.startsWith(XmlConstants.URN_PREFIX))
          {
             Set<String> packagesSet = new HashSet<String>();
 
             URL schemaUrl = environment.loadFileByUrn(uri, XmlConstants.SCHEMA_FILE_NAME);
-            if(schemaUrl != null)
+            if (schemaUrl != null)
                validateXmlWithXsd(xmlUrl, schemaUrl);
-            
+
             URL namespaceFile = environment.loadFileByUrn(uri, XmlConstants.NAMESPACE_FILE_NAME);
             if (namespaceFile != null)
             {
@@ -186,9 +191,9 @@
          }
       }
    }
-   
+
    private static void validateXmlWithXsd(URL xmlUrl, URL schemaUrl)
-   {      
+   {
       try
       {
          final StreamSource stream = new StreamSource(xmlUrl.toExternalForm());
@@ -197,12 +202,12 @@
          final Validator validator = schema.newValidator();
          validator.validate(stream);
       }
-      catch(SAXException e)
+      catch (SAXException e)
       {
          String message = "SAXException while validate " + xmlUrl + " with " + schemaUrl;
          throw new DefinitionException(message, e);
       }
-      catch(IOException e)
+      catch (IOException e)
       {
          String message = "IOException while validate " + xmlUrl + " with " + schemaUrl;
          throw new DefinitionException(message, e);
@@ -213,22 +218,22 @@
    {
       String elementPrefix = "";
       String elementUri = XmlConstants.JAVA_EE_NAMESPACE;
-      
+
       return findElements(elementParent, elementName, elementPrefix, elementUri);
    }
-   
+
    public static List<Element> findElements(Element elementParent, String elementName, String elementPrefix, String elementUri)
    {
       List<Element> elements = new ArrayList<Element>();
       Namespace elementNamespace = new Namespace(elementPrefix, elementUri);
       QName qName = new QName(elementName, elementNamespace);
       Iterator<?> elementIterator = elementParent.elementIterator(qName);
-      while(elementIterator.hasNext())
+      while (elementIterator.hasNext())
       {
-         Element element = (Element)elementIterator.next();
+         Element element = (Element) elementIterator.next();
          elements.add(element);
       }
-      
+
       return elements;
    }
 
@@ -271,11 +276,12 @@
          packagesMap.put(prefix, packagesSet);
       }
    }
-   
-   public static void checkForUniqueElements(List<Class<? extends Annotation>> list){
+
+   public static void checkForUniqueElements(List<Class<? extends Annotation>> list)
+   {
       Set<Class<? extends Annotation>> set = new HashSet<Class<? extends Annotation>>(list);
-      if(list.size() != set.size())
-         throw new DefinitionException("A certain annotation type is declared more than once as a binding type, " +
-         		"interceptor binding type or stereotype using XML");
+      if (list.size() != set.size())
+         throw new DefinitionException("A certain annotation type is declared more than once as a binding type, " + 
+               "interceptor binding type or stereotype using XML");
    }
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -7,11 +7,11 @@
    public static final String DEPLOY = "Deploy";
 
    public static final String INTERCEPTORS = "Interceptors";
-   
+
    public static final String INTERCEPTOR = "Interceptor";
 
    public static final String DECORATORS = "Decorators";
-   
+
    public static final String DECORATOR = "Decorator";
 
    public static final String BINDING_TYPE = "BindingType";
@@ -29,11 +29,11 @@
    public static final String EJB = "EJB";
 
    public static final String EJB_NAME = "ejbName";
-   
+
    public static final String EJB_LINK = "ejbLink";
 
    public static final String WEB_SERVICE_REF = "WebServiceRef";
-   
+
    public static final String WSDL_LOCATION = "wsdlLocation";
 
    public static final String TOPIC = "Topic";
@@ -41,32 +41,32 @@
    public static final String QUEUE = "Queue";
 
    public static final String URN_PREFIX = "urn:java:";
-   
+
    public static final String HTTP_PREFIX = "http://";
-   
+
    public static final String SCHEMA_LOCATION = "schemaLocation";
 
    public static final String MAPPED_NAME = "mappedName";
-   
+
    public static final String UNIT_NAME = "unitName";
 
    public static final String STANDARD = "Standard";
 
    public static final String NAMESPACE_FILE_NAME = "namespace";
-   
+
    public static final String SCHEMA_FILE_NAME = "schema.xsd";
-   
+
    public static final String NAMESPACE_FILE_DELIMETER = " ";
-   
+
    public static final String PRODUCES = "Produces";
-   
+
    public static final String VALUE = "value";
-   
+
    public static final String ARRAY = "Array";
-   
+
    public static final String JNDI_NAME = "name";
-   
+
    public static final String JAVA_GLOBAL = "java:global/";
-   
+
    public static final String JAVA_APP = "java:app/";
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -37,20 +37,20 @@
 public class XmlParser
 {
    private static Log log = Logging.getLog(XmlParser.class);
-   
+
    private final XmlEnvironment environment;
-   
+
    private List<BeanElementRegistrator> beanElementRegistrators = new ArrayList<BeanElementRegistrator>();
-   
+
    private boolean haveAnyDeployElement = false;
-   
+
    private Map<String, Set<String>> packagesMap = new HashMap<String, Set<String>>();
-   
+
    public XmlParser(XmlEnvironment environment)
    {
-      this.environment = environment;      
+      this.environment = environment;
    }
-   
+
    public void parse()
    {
       for (URL url : environment.getBeansXmlUrls())
@@ -65,52 +65,53 @@
          }
       }
    }
-   
+
    private void parseForArrays(Document document)
    {
       Element root = document.getRootElement();
       checkChildrenForArray(root);
    }
-   
+
    private void checkChildrenForArray(Element element)
    {
       Iterator<?> childIterator = element.elementIterator();
-      while(childIterator.hasNext())
+      while (childIterator.hasNext())
       {
-         Element child = (Element)childIterator.next();
-         
-         if(child.getName().equalsIgnoreCase(XmlConstants.ARRAY))
+         Element child = (Element) childIterator.next();
+
+         if (XmlConstants.ARRAY.equalsIgnoreCase(child.getName()))
          {
             boolean haveNotAnnotation = false;
             Iterator<?> arrayIterator = child.elementIterator();
-            while(arrayIterator.hasNext())
+            while (arrayIterator.hasNext())
             {
-               Element arrayChild = (Element)arrayIterator.next();
-               AnnotatedClass<?> arrayChildType = ParseXmlHelper.loadElementClass(arrayChild, Object.class, environment, packagesMap); 
+               Element arrayChild = (Element) arrayIterator.next();
+               AnnotatedClass<?> arrayChildType = ParseXmlHelper.loadElementClass(arrayChild, Object.class, environment, packagesMap);
                boolean isAnnotation = arrayChildType.getRawType().isAnnotation();
-               if(!isAnnotation)
+               if (!isAnnotation)
                {
-                  if(haveNotAnnotation)
-                     throw new DefinitionException("<Array> element have second child which is not annotation, it is '" + arrayChild.getName() + "'");
+                  if (haveNotAnnotation)
+                     throw new DefinitionException("<Array> element have second child which is not annotation, it is '" + 
+                           arrayChild.getName() + "'");
                   haveNotAnnotation = true;
                }
             }
-            if(!haveNotAnnotation)
+            if (!haveNotAnnotation)
                throw new DefinitionException("<Array> element must have one child elemen which is not annotation");
          }
          else
             checkChildrenForArray(child);
       }
    }
-   
+
    private void parseForAnnotationTypes(Document document)
    {
-      Element root = document.getRootElement();         
-      
+      Element root = document.getRootElement();
+
       List<Class<? extends Annotation>> bindingTypes = new ArrayList<Class<? extends Annotation>>();
       List<Class<? extends Annotation>> interceptorBindingTypes = new ArrayList<Class<? extends Annotation>>();
       List<Class<? extends Annotation>> stereotypes = new ArrayList<Class<? extends Annotation>>();
-      
+
       Iterator<?> elIterator = root.elementIterator();
       while (elIterator.hasNext())
       {
@@ -118,18 +119,18 @@
          boolean isBindingType = ParseXmlHelper.findElementsInEeNamespace(element, XmlConstants.BINDING_TYPE).size() > 0;
          boolean isInterceptorBindingType = ParseXmlHelper.findElementsInEeNamespace(element, XmlConstants.INTERCEPTOR_BINDING_TYPE).size() > 0;
          boolean isStereotype = ParseXmlHelper.findElementsInEeNamespace(element, XmlConstants.STEREOTYPE).size() > 0;
-         
-         if(isBindingType || isInterceptorBindingType || isStereotype)
+
+         if (isBindingType || isInterceptorBindingType || isStereotype)
          {
             Class<? extends Annotation> annotationType = ParseXmlHelper.loadAnnotationClass(element, Annotation.class, environment, packagesMap);
-            if(isBindingType)
+            if (isBindingType)
                bindingTypes.add(annotationType);
-            if(isInterceptorBindingType)
+            if (isInterceptorBindingType)
             {
                interceptorBindingTypes.add(annotationType);
                checkForInterceptorBindingTypeChildren(element);
             }
-            if(isStereotype)
+            if (isStereotype)
             {
                stereotypes.add(annotationType);
                checkForStereotypeChildren(element);
@@ -140,31 +141,30 @@
       ParseXmlHelper.checkForUniqueElements(interceptorBindingTypes);
       ParseXmlHelper.checkForUniqueElements(stereotypes);
    }
-         
+
    private void parseForBeans(Document document)
    {
-      List<Element> beanElements = findBeans(document);      
+      List<Element> beanElements = findBeans(document);
       for (Element beanElement : beanElements)
       {
          AnnotatedClass<?> beanClass = ParseXmlHelper.loadElementClass(beanElement, Object.class, environment, packagesMap);
          checkBeanElement(beanElement, beanClass);
       }
    }
-   
+
    private void parseForDeploy(Document document)
-   {      
-      Element root = document.getRootElement();         
-            
+   {
+      Element root = document.getRootElement();
+
       Iterator<?> elIterator = root.elementIterator();
       while (elIterator.hasNext())
       {
          Element element = (Element) elIterator.next();
-         if (ParseXmlHelper.isJavaEeNamespace(element) && 
-               element.getName().equalsIgnoreCase(XmlConstants.DEPLOY))
+         if (ParseXmlHelper.isJavaEeNamespace(element) && XmlConstants.DEPLOY.equalsIgnoreCase(element.getName()))
             environment.getEnabledDeploymentTypes().addAll(obtainDeploymentTypes(element));
       }
-   }   
-      
+   }
+
    private Document createDocument(URL url)
    {
       try
@@ -194,38 +194,37 @@
          throw new DefinitionException(message, e);
       }
    }
-   
+
    private void checkForInterceptorBindingTypeChildren(Element element)
    {
       Iterator<?> elIterator = element.elementIterator();
       while (elIterator.hasNext())
       {
-         Element child = (Element)elIterator.next();
+         Element child = (Element) elIterator.next();
          Class<? extends Annotation> clazz = ParseXmlHelper.loadAnnotationClass(child, Annotation.class, environment, packagesMap);
-         if(!child.getName().equalsIgnoreCase(XmlConstants.INTERCEPTOR_BINDING_TYPE) && 
+         if (!XmlConstants.INTERCEPTOR_BINDING_TYPE.equalsIgnoreCase(child.getName()) && 
                !clazz.isAnnotationPresent(InterceptorBindingType.class))
-            throw new DefinitionException("Direct child <" + child.getName() + "> of interceptor binding type <" + element.getName() + 
-                  "> declaration must be interceptor binding type");
-         
+            throw new DefinitionException("Direct child <" + child.getName() + "> of interceptor binding type <" + 
+                  element.getName() + "> declaration must be interceptor binding type");
+
       }
    }
-   
+
    private void checkForStereotypeChildren(Element stereotypeElement)
    {
       Iterator<?> elIterator = stereotypeElement.elementIterator();
       while (elIterator.hasNext())
       {
-         Element stereotypeChild = (Element)elIterator.next();
+         Element stereotypeChild = (Element) elIterator.next();
          Class<? extends Annotation> stereotypeClass = ParseXmlHelper.loadAnnotationClass(stereotypeChild, Annotation.class, environment, packagesMap);
-         if(stereotypeChild.getName().equalsIgnoreCase(XmlConstants.STEREOTYPE) || 
+         if (XmlConstants.STEREOTYPE.equalsIgnoreCase(stereotypeChild.getName()) || 
                stereotypeClass.isAnnotationPresent(ScopeType.class) || 
                stereotypeClass.isAnnotationPresent(DeploymentType.class) || 
-               stereotypeClass.isAnnotationPresent(InterceptorBindingType.class) || 
+               stereotypeClass.isAnnotationPresent(InterceptorBindingType.class) ||
                stereotypeClass.isAnnotationPresent(Named.class))
             continue;
          throw new DefinitionException("Direct child <" + stereotypeChild.getName() + "> of stereotype <" + stereotypeElement.getName() + 
                "> declaration must be scope type, or deployment type, or interceptor binding type, or javax.annotation.Named");
-         
       }
    }
 
@@ -239,25 +238,23 @@
       while (elIterator.hasNext())
       {
          Element element = (Element) elIterator.next();
-         if (checkBeanElementName(element) && 
-               checkBeanElementChildrenNames(element))
+         if (checkBeanElementName(element) && checkBeanElementChildrenNames(element))
             beans.add(element);
       }
 
       return beans;
-   }   
+   }
 
    private boolean checkBeanElementName(Element element)
    {
       if (ParseXmlHelper.isJavaEeNamespace(element) && 
-            (element.getName().equalsIgnoreCase(XmlConstants.DEPLOY) || 
-                  element.getName().equalsIgnoreCase(XmlConstants.INTERCEPTORS) || 
-                  element.getName().equalsIgnoreCase(XmlConstants.DECORATORS)))
+            (XmlConstants.DEPLOY.equalsIgnoreCase(element.getName()) || 
+                  XmlConstants.INTERCEPTORS.equalsIgnoreCase(element.getName()) || 
+                  XmlConstants.DECORATORS.equalsIgnoreCase(element.getName())))
          return false;
       return true;
    }
 
-
    private boolean checkBeanElementChildrenNames(Element element)
    {
       Iterator<?> elIterator = element.elementIterator();
@@ -265,14 +262,14 @@
       {
          Element child = (Element) elIterator.next();
          if (ParseXmlHelper.isJavaEeNamespace(child) && 
-               (child.getName().equalsIgnoreCase(XmlConstants.BINDING_TYPE) || 
-                     child.getName().equalsIgnoreCase(XmlConstants.INTERCEPTOR_BINDING_TYPE) || 
-                     child.getName().equalsIgnoreCase(XmlConstants.STEREOTYPE)))
+               (XmlConstants.BINDING_TYPE.equalsIgnoreCase(child.getName()) || 
+                     XmlConstants.INTERCEPTOR_BINDING_TYPE.equalsIgnoreCase(child.getName()) || 
+                     XmlConstants.STEREOTYPE.equalsIgnoreCase(child.getName())))
             return false;
       }
       return true;
    }
-   
+
    // TODO Make this object orientated
    private List<Class<? extends Annotation>> obtainDeploymentTypes(Element element)
    {
@@ -281,57 +278,57 @@
 
       List<Element> standardElements = ParseXmlHelper.findElementsInEeNamespace(element, XmlConstants.STANDARD);
       if (standardElements.size() == 0)
-         throw new DeploymentException("The @Standard deployment type must be declared"); 
-      
+         throw new DeploymentException("The @Standard deployment type must be declared");
+
       List<Class<? extends Annotation>> deploymentClasses = new ArrayList<Class<? extends Annotation>>();
       Iterator<?> deployIterator = element.elementIterator();
-      while(deployIterator.hasNext())
+      while (deployIterator.hasNext())
       {
-         Element deploymentElement = (Element)deployIterator.next();
-         
+         Element deploymentElement = (Element) deployIterator.next();
+
          String elementName = deploymentElement.getName();
          String elementPrefix = deploymentElement.getNamespacePrefix();
          String elementUri = deploymentElement.getNamespaceURI();
          List<Element> deploymentElements = ParseXmlHelper.findElements(element, elementName, elementPrefix, elementUri);
-         if(deploymentElements.size() != 1)
+         if (deploymentElements.size() != 1)
             throw new DefinitionException("The same deployment type '" + deploymentElement.getName() + "' is declared more than once");
-         
+
          Class<? extends Annotation> deploymentClass = ParseXmlHelper.loadAnnotationClass(deploymentElement, Annotation.class, environment, packagesMap);
-         
-         if(!deploymentClass.isAnnotationPresent(DeploymentType.class))
+
+         if (!deploymentClass.isAnnotationPresent(DeploymentType.class))
             throw new DefinitionException("<Deploy> child '" + deploymentElement.getName() + "' must be a deployment type");
-                  
+
          deploymentClasses.add(deploymentClass);
       }
       haveAnyDeployElement = true;
       return deploymentClasses;
    }
-   
+
    private void checkBeanElement(Element beanElement, AnnotatedClass<?> beanClass)
    {
       beanElementRegistrators.add(new JmsResourceElementRegistrator(new NotSimpleBeanChildrenChecker(environment, packagesMap)));
       beanElementRegistrators.add(new ResourceElementRegistrator(new ResourceBeanChildrenChecker(environment, packagesMap)));
       beanElementRegistrators.add(new SessionBeanElementRegistrator(new NotSimpleBeanChildrenChecker(environment, packagesMap), environment.getEjbDescriptors()));
       beanElementRegistrators.add(new SimpleBeanElementRegistrator(new SimpleBeanChildrenChecker(environment, packagesMap), environment.getEjbDescriptors()));
-      
+
       boolean isValidType = false;
-      for(BeanElementRegistrator beanElementRegistrator : beanElementRegistrators)
+      for (BeanElementRegistrator beanElementRegistrator : beanElementRegistrators)
       {
-         if(beanElementRegistrator.accept(beanElement, beanClass))
+         if (beanElementRegistrator.accept(beanElement, beanClass))
          {
             beanElementRegistrator.registerBeanElement(beanElement, beanClass);
             isValidType = true;
             break;
          }
       }
-      
-      if(!isValidType)
+
+      if (!isValidType)
          throw new DefinitionException("Can't determine type of bean element <" + beanElement.getName() + ">");
    }
-   
+
    private void fullFillPackagesMap(Document document, URL xmlUrl)
    {
-      Element root = document.getRootElement();      
+      Element root = document.getRootElement();
       ParseXmlHelper.checkRootAttributes(root, packagesMap, environment, xmlUrl);
       ParseXmlHelper.checkRootDeclaredNamespaces(root, packagesMap, environment, xmlUrl);
    }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/BeanChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/BeanChildrenChecker.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/BeanChildrenChecker.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -8,10 +8,10 @@
 import org.jboss.webbeans.xml.XmlEnvironment;
 
 public interface BeanChildrenChecker
-{   
+{
    void checkChildren(Element beanElement, AnnotatedClass<?> beanClass);
-   
+
    XmlEnvironment getXmlEnvironment();
-   
+
    Map<String, Set<String>> getPackagesMap();
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/AbstractBeanChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/AbstractBeanChildrenChecker.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/AbstractBeanChildrenChecker.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -37,75 +37,75 @@
 
 public abstract class AbstractBeanChildrenChecker extends BeanChildrenCheckerImpl
 {
-   
+
    private Set<AnnotatedField<?>> beanFields;
-   
-   private List<Method> beanMethods; 
-   
+
+   private List<Method> beanMethods;
+
    private boolean haveBeanDeploymentTypeDeclaration = false;
-   
+
    private boolean haveBeanScopeTypeDeclaration = false;
-   
+
    protected boolean haveBeanInterceptorDeclaration = false;
-   
+
    protected boolean haveBeanDecoratorDeclaration = false;
-   
+
    protected List<AnnotatedClass<?>> constructorParameters = new ArrayList<AnnotatedClass<?>>();
-         
+
    protected abstract void checkForInterceptorChild(Element beanElement);
-   
+
    protected abstract void checkForDecoratorChild(Element beanElement);
-   
+
    protected abstract void checkChildForInterceptorType(Element beanElement);
-   
+
    protected abstract void checkChildForDecoratorType(Element beanElement);
-   
+
    protected abstract void checkForConstructor(Element beanElement, AnnotatedClass<?> beanClass);
-   
+
    protected abstract void checkRIBean(Element beanElement, AnnotatedClass<?> beanClass);
-   
+
    protected AbstractBeanChildrenChecker(XmlEnvironment environment, Map<String, Set<String>> packagesMap)
    {
       super(environment, packagesMap);
    }
-   
+
    public void checkChildren(Element beanElement, AnnotatedClass<?> beanClass)
    {
       beanFields = beanClass.getFields();
       beanMethods = Arrays.asList(beanClass.getRawType().getDeclaredMethods());
-      
+
       checkForInterceptorChild(beanElement);
       checkForDecoratorChild(beanElement);
-      
+
       haveBeanDeploymentTypeDeclaration = false;
       haveBeanScopeTypeDeclaration = false;
       haveBeanInterceptorDeclaration = ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.INTERCEPTOR).size() > 0;
       haveBeanDecoratorDeclaration = ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.DECORATOR).size() > 0;
-      
+
       Iterator<?> beanIterator = beanElement.elementIterator();
-      while(beanIterator.hasNext())
+      while (beanIterator.hasNext())
       {
-         Element beanChildElement = (Element)beanIterator.next();
+         Element beanChildElement = (Element) beanIterator.next();
          checkBeanChild(beanChildElement, beanClass);
       }
       checkForConstructor(beanElement, beanClass);
    }
-   
+
    private void checkBeanChild(Element beanChildElement, AnnotatedClass<?> beanClass)
    {
-      if(beanChildElement.getName().equalsIgnoreCase(XmlConstants.ARRAY))
+      if (XmlConstants.ARRAY.equalsIgnoreCase(beanChildElement.getName()))
          return;
-      
+
       List<AnnotatedClass<?>> beanChildClassList = ParseXmlHelper.tryLoadElementClass(beanChildElement, Object.class, environment, packagesMap);
-      
-      if(beanChildClassList.size() == 0)
-      {            
+
+      if (beanChildClassList.size() == 0)
+      {
          Element beanElement = beanChildElement.getParent();
          Namespace beanNamespace = beanElement.getNamespace();
          Namespace beanChildNamespace = beanChildElement.getNamespace();
-         if(beanChildNamespace.equals(beanNamespace))
+         if (beanChildNamespace.equals(beanNamespace))
          {
-            //bean child element declaring a method or field of the bean.
+            // bean child element declaring a method or field of the bean.
             checkFieldOrMethodChild(beanChildElement, beanClass);
             return;
          }
@@ -116,137 +116,131 @@
          Class<?> beanChildType = beanChildClass.getRawType();
          boolean isJavaClass = !beanChildType.isEnum() && !beanChildType.isPrimitive() && !beanChildType.isInterface();
          boolean isInterface = beanChildType.isInterface() && !beanChildType.isAnnotation();
-         if(beanChildType.isAnnotation())
+         if (beanChildType.isAnnotation())
          {
-            //bean child element declaring type-level metadata
+            // bean child element declaring type-level metadata
             checkAnnotationChild(beanChildElement, beanChildClass, beanClass);
             return;
          }
-         if(isJavaClass || isInterface)
+         if (isJavaClass || isInterface)
          {
-            //bean child element declaring a parameter of the bean constructor
+            // bean child element declaring a parameter of the bean constructor
             constructorParameters.add(beanChildClass);
             return;
          }
       }
-      
-      throw new DefinitionException("Can't determine type of element <" + beanChildElement.getName() + "> in bean '" + 
-            beanChildElement.getParent().getName() + "'");
+
+      throw new DefinitionException("Can't determine type of element <" + beanChildElement.getName() + "> in bean '" + beanChildElement.getParent().getName() + "'");
    }
-   
+
    private void checkAnnotationChild(Element beanChildElement, AnnotatedClass<?> beanChildClass, AnnotatedClass<?> beanClass)
    {
-      if(beanChildClass.isAnnotationPresent(DeploymentType.class))
+      if (beanChildClass.isAnnotationPresent(DeploymentType.class))
       {
-         if(haveBeanDeploymentTypeDeclaration)
-            throw new DefinitionException("Only one deployment type declaration allowed for bean '" + 
-                  beanChildElement.getParent().getName() + "'");
+         if (haveBeanDeploymentTypeDeclaration)
+            throw new DefinitionException("Only one deployment type declaration allowed for bean '" + beanChildElement.getParent().getName() + "'");
          haveBeanDeploymentTypeDeclaration = true;
          return;
       }
-      if(beanChildClass.isAnnotationPresent(ScopeType.class))
+      if (beanChildClass.isAnnotationPresent(ScopeType.class))
       {
-         if(haveBeanScopeTypeDeclaration)
-            throw new DefinitionException("Only one scope type declaration allowed for bean '" + 
-                  beanChildElement.getParent().getName() + "'");
+         if (haveBeanScopeTypeDeclaration)
+            throw new DefinitionException("Only one scope type declaration allowed for bean '" + beanChildElement.getParent().getName() + "'");
          haveBeanScopeTypeDeclaration = true;
          return;
       }
-      if(beanChildClass.isAnnotationPresent(Interceptor.class))
+      if (beanChildClass.isAnnotationPresent(Interceptor.class))
       {
          checkChildForInterceptorType(beanChildElement);
          return;
       }
-      if(beanChildClass.isAnnotationPresent(Decorator.class))
+      if (beanChildClass.isAnnotationPresent(Decorator.class))
       {
          checkChildForDecoratorType(beanChildElement);
          return;
       }
-      if(beanChildClass.isAnnotationPresent(BindingType.class) || beanChildClass.isAnnotationPresent(InterceptorBindingType.class) || 
+      if (beanChildClass.isAnnotationPresent(BindingType.class) || beanChildClass.isAnnotationPresent(InterceptorBindingType.class) || 
             beanChildClass.isAnnotationPresent(Stereotype.class) || beanChildClass.isAnnotationPresent(Named.class) || 
-            beanChildClass.isAnnotationPresent(Specializes.class) || beanChildClass.isAnnotationPresent(Realizes.class) ||
+            beanChildClass.isAnnotationPresent(Specializes.class) || beanChildClass.isAnnotationPresent(Realizes.class) || 
             beanChildClass.getRawType().equals(BindingType.class) || beanChildClass.getRawType().equals(InterceptorBindingType.class) || 
             beanChildClass.getRawType().equals(Stereotype.class) || beanChildClass.getRawType().equals(Named.class) || 
-            beanChildClass.getRawType().equals(Specializes.class) || beanChildClass.getRawType().equals(Realizes.class) ||
-            beanChildClass.isAnnotationPresent(Resource.class) || beanChildClass.isAnnotationPresent(EJB.class) || 
+            beanChildClass.getRawType().equals(Specializes.class) || beanChildClass.getRawType().equals(Realizes.class) || 
+            beanChildClass.isAnnotationPresent(Resource.class) || beanChildClass.isAnnotationPresent(EJB.class)|| 
             beanChildClass.isAnnotationPresent(WebServiceRef.class) || beanChildClass.isAnnotationPresent(PersistenceContext.class) || 
             beanChildClass.isAnnotationPresent(PersistenceUnit.class))
          return;
-      if(beanChildClass.getRawType().equals(Resource.class) || beanChildClass.getRawType().equals(EJB.class) || 
+      if (beanChildClass.getRawType().equals(Resource.class) || beanChildClass.getRawType().equals(EJB.class) || 
             beanChildClass.getRawType().equals(WebServiceRef.class) || beanChildClass.getRawType().equals(PersistenceContext.class) || 
             beanChildClass.getRawType().equals(PersistenceUnit.class))
       {
          checkRIBean(beanChildElement.getParent(), beanClass);
          return;
-      }         
-      
-      throw new DefinitionException("Can't determine annotation type of <" + beanChildElement.getName() + "> element in bean '" + 
-            beanChildElement.getParent().getName() + "'");
+      }
+
+      throw new DefinitionException("Can't determine annotation type of <" + beanChildElement.getName() + "> element in bean '" + beanChildElement.getParent().getName() + "'");
    }
-   
+
    private void checkFieldOrMethodChild(Element beanChildElement, AnnotatedClass<?> beanClass)
-   {  //TODO: not finished    
+   { // TODO: not finished
       boolean isField = false;
       boolean isMethod = false;
-      
-      for(AnnotatedField<?> field : beanFields)
+
+      for (AnnotatedField<?> field : beanFields)
       {
-         if(beanChildElement.getName().equalsIgnoreCase(field.getName()))
+         if (field.getName().equalsIgnoreCase(beanChildElement.getName()))
          {
-            if(isField)
-               throw new DefinitionException("Bean class '" + beanClass.getName() + "' does not have exactly one field " +
-               		"with the specified name '" + beanChildElement.getName() + "'");
+            if (isField)
+               throw new DefinitionException("Bean class '" + beanClass.getName() + "' does not have exactly one field " + "with the specified name '" + beanChildElement.getName() + "'");
             isField = true;
          }
       }
-      
-      for(Method method : beanMethods)
+
+      for (Method method : beanMethods)
       {
-         if(beanChildElement.getName().equalsIgnoreCase(method.getName()))
+         if (method.getName().equalsIgnoreCase(beanChildElement.getName()))
             isMethod = true;
       }
-      
-      if(isField && isMethod)
+
+      if (isField && isMethod)
          throw new DefinitionException("The name of the child element <" + beanChildElement.getName() + 
                "> matches the name of both a method and a field of the bean class '" + beanClass.getName() + "'");
-      
-      if(isField)
+
+      if (isField)
       {
          checkFieldChild(beanChildElement, beanClass);
          return;
       }
-      
-      if(isMethod)
+
+      if (isMethod)
       {
          checkMethodChild(beanChildElement, beanClass);
          return;
       }
-      
+
       throw new DefinitionException("The name of the child element <" + beanChildElement.getName() + 
             "> not matches the name of a method or a field of the bean class '" + beanClass.getName() + "'");
    }
-   
+
    private void checkFieldChild(Element beanChildElement, AnnotatedClass<?> beanClass)
-   {//TODO: not finished
+   {// TODO: not finished
       Element elementParent = beanChildElement.getParent();
       String elementName = beanChildElement.getName();
       String elementPrefix = beanChildElement.getNamespacePrefix();
       String elementUri = beanChildElement.getNamespaceURI();
-      
-      if(ParseXmlHelper.findElements(elementParent, elementName, elementPrefix, elementUri).size() > 1)
+
+      if (ParseXmlHelper.findElements(elementParent, elementName, elementPrefix, elementUri).size() > 1)
          throw new DefinitionException("More than one child element of a bean '" + elementParent.getName() + 
                "' declaration represents the same field'" + elementName + "'");
-      
-      if(beanChildElement.elements().size() > 1 && 
+
+      if (beanChildElement.elements().size() > 1 && 
             beanChildElement.elements().size() != ParseXmlHelper.findElementsInEeNamespace(beanChildElement, XmlConstants.VALUE).size())
-         throw new DefinitionException("Declaration of a field '" + beanChildElement.getName() + "' has more than one direct child element, " +
-         		"and at least one of these elements is something other than a <value> element in the Java EE namespace");
-      
-      
+         throw new DefinitionException("Declaration of a field '" + beanChildElement.getName() + "' has more than one direct child element, " + 
+               "and at least one of these elements is something other than a <value> element in the Java EE namespace");
+
    }
-   
+
    private void checkMethodChild(Element beanChildElement, AnnotatedClass<?> beanClass)
    {
-      //TODO: not finished
+      // TODO: not finished
    }
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/NotSimpleBeanChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/NotSimpleBeanChildrenChecker.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/NotSimpleBeanChildrenChecker.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -20,36 +20,37 @@
 
    protected void checkForInterceptorChild(Element beanElement)
    {
-      if(ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.INTERCEPTOR).size() > 1)
+      if (ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.INTERCEPTOR).size() > 1)
          throw new DefinitionException("Not a simple bean '" + beanElement.getName() + "' contains direct child <" + 
-               XmlConstants.INTERCEPTOR + ">");            
+               XmlConstants.INTERCEPTOR + ">");
    }
-   
+
    protected void checkForDecoratorChild(Element beanElement)
    {
-      if(ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.DECORATOR).size() > 1)
+      if (ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.DECORATOR).size() > 1)
          throw new DefinitionException("Not a simple bean '" + beanElement.getName() + "' contains direct child <" + 
                XmlConstants.DECORATOR + ">");
    }
-   
+
    protected void checkChildForInterceptorType(Element beanChildElement)
    {
       throw new DefinitionException("Declaration of not a simple bean '" + beanChildElement.getParent().getName() + 
-         "' contains a child <" + beanChildElement.getName() + "> which type is javax.interceptor.Interceptor");
+            "' contains a child <" + beanChildElement.getName() + "> which type is javax.interceptor.Interceptor");
    }
-   
+
    protected void checkChildForDecoratorType(Element beanChildElement)
    {
       throw new DefinitionException("Declaration of not a simple bean '" + beanChildElement.getParent().getName() + 
-         "' contains a child <" + beanChildElement.getName() + "> which type is javax.decorator.Decorator");
+            "' contains a child <" + beanChildElement.getName() + "> which type is javax.decorator.Decorator");
    }
-   
+
    protected void checkForConstructor(Element beanElement, AnnotatedClass<?> beanClass)
    {
-      //There is nothing to validate
+      // There is nothing to validate
    }
-   
-   protected void checkRIBean(Element beanElement, AnnotatedClass<?> beanClass){
+
+   protected void checkRIBean(Element beanElement, AnnotatedClass<?> beanClass)
+   {
       throw new DefinitionException("It is impossible determine some kind of resource in not Resource Bean");
    }
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/ResourceBeanChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/ResourceBeanChildrenChecker.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/ResourceBeanChildrenChecker.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -22,130 +22,130 @@
    protected void checkRIBean(Element beanElement, AnnotatedClass<?> beanClass)
    {
       List<Element> resourceElements = ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.RESOURCE);
-      if(resourceElements.size() > 0)
+      if (resourceElements.size() > 0)
       {
          checkResourceElements(resourceElements);
          return;
       }
-      
+
       List<Element> persContextElements = ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.PERSISTENCE_CONTEXT);
-      if(persContextElements.size() > 0)
+      if (persContextElements.size() > 0)
       {
          checkPersContextElements(persContextElements);
          return;
       }
-         
+
       List<Element> persUnitElements = ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.PERSISTENCE_UNIT);
-      if(persUnitElements.size() > 0)
+      if (persUnitElements.size() > 0)
       {
          checkPersUnitElements(persUnitElements);
          return;
       }
-         
+
       List<Element> ejbElements = ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.EJB);
-      if(ejbElements.size() > 0)
+      if (ejbElements.size() > 0)
       {
          checkEjbElements(ejbElements);
          return;
       }
-         
+
       List<Element> webServiceRefElements = ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.WEB_SERVICE_REF);
-      if(webServiceRefElements.size() > 0)
+      if (webServiceRefElements.size() > 0)
       {
          checkWebServiceRefElements(webServiceRefElements);
          return;
-      }         
+      }
    }
-   
+
    private void checkResourceElements(List<Element> resourceElements)
    {
       Element resourceElement = resourceElements.get(0);
-      
-      if(resourceElements.size() > 1)
+
+      if (resourceElements.size() > 1)
          throw new DefinitionException("There is more than one <Resource> elements in '" + resourceElement.getParent().getName() + "'");
-                  
+
       List<Element> nameElements = ParseXmlHelper.findElementsInEeNamespace(resourceElement, XmlConstants.JNDI_NAME);
       List<Element> mappedNameElements = ParseXmlHelper.findElementsInEeNamespace(resourceElement, XmlConstants.MAPPED_NAME);
-      
-      if(nameElements.size() + mappedNameElements.size() != 1)
-         throw new DefinitionException("For a Java EE resource '" + resourceElement.getParent().getName() + "', JNDI name " +
+
+      if (nameElements.size() + mappedNameElements.size() != 1)
+         throw new DefinitionException("For a Java EE resource '" + resourceElement.getParent().getName() + "', JNDI name " + 
                "or mapped name must be specified using the <name> or <mappedName> child elements of the <Resource> element");
-      
-      if(nameElements.size() == 1)
+
+      if (nameElements.size() == 1)
          checkJndiNameElementValue(nameElements.get(0));
    }
-   
+
    private void checkPersContextElements(List<Element> persContextElements)
    {
       Element persContextElement = persContextElements.get(0);
-      
-      if(persContextElements.size() > 1)
+
+      if (persContextElements.size() > 1)
          throw new DefinitionException("There is more than one <PersistenceContext> elements in '" + 
                persContextElement.getParent().getName() + "'");
-      
+
       List<Element> unitNameElements = ParseXmlHelper.findElementsInEeNamespace(persContextElement, XmlConstants.UNIT_NAME);
-      
-      if(unitNameElements.size() != 1)
-         throw new DefinitionException("For a persistence context '" + persContextElement.getParent().getName() + "', " +
+
+      if (unitNameElements.size() != 1)
+         throw new DefinitionException("For a persistence context '" + persContextElement.getParent().getName() + "', " + 
                "a persistence unit name must be specified using the <unitName> child element of the <PersistenceContext> element");
    }
-   
+
    private void checkPersUnitElements(List<Element> persUnitElements)
    {
       Element persUnitElement = persUnitElements.get(0);
-      
-      if(persUnitElements.size() > 1)
+
+      if (persUnitElements.size() > 1)
          throw new DefinitionException("There is more than one <PersistenceUnit> elements in '" + persUnitElement.getParent().getName() + "'");
-      
+
       List<Element> unitNameElements = ParseXmlHelper.findElementsInEeNamespace(persUnitElement, XmlConstants.UNIT_NAME);
-      if(unitNameElements.size() != 1)
-         throw new DefinitionException("For a persistence unit '" + persUnitElement.getParent().getName() + "', " +
+      if (unitNameElements.size() != 1)
+         throw new DefinitionException("For a persistence unit '" + persUnitElement.getParent().getName() + "', " + 
                "a persistence unit name must be specified using the <unitName> child element of the <PersistenceUnit> element");
    }
-   
+
    private void checkEjbElements(List<Element> ejbElements)
    {
       Element ejbElement = ejbElements.get(0);
-      
-      if(ejbElements.size() > 1)
+
+      if (ejbElements.size() > 1)
          throw new DefinitionException("There is more than one <EJB> elements in '" + ejbElement.getParent().getName() + "'");
-      
+
       List<Element> nameElements = ParseXmlHelper.findElementsInEeNamespace(ejbElement, XmlConstants.JNDI_NAME);
       List<Element> mappedNameElements = ParseXmlHelper.findElementsInEeNamespace(ejbElement, XmlConstants.MAPPED_NAME);
       List<Element> ejbLinkElements = ParseXmlHelper.findElementsInEeNamespace(ejbElement, XmlConstants.EJB_LINK);
-      
-      if(nameElements.size() + mappedNameElements.size() + ejbLinkElements.size() != 1)
-         throw new DefinitionException("For a remote EJB '" + ejbElement.getParent().getName() + "', JNDI name, mapped name or EJB link " +
+
+      if (nameElements.size() + mappedNameElements.size() + ejbLinkElements.size() != 1)
+         throw new DefinitionException("For a remote EJB '" + ejbElement.getParent().getName() + "', JNDI name, mapped name or EJB link " + 
                "must be specified using the <name>, <mappedName> or <ejbLink> child elements of the <EJB> element");
-      
-      if(nameElements.size() == 1)
+
+      if (nameElements.size() == 1)
          checkJndiNameElementValue(nameElements.get(0));
    }
-   
+
    private void checkWebServiceRefElements(List<Element> webServiceRefElements)
    {
       Element webServiceRefElement = webServiceRefElements.get(0);
-      
-      if(webServiceRefElements.size() > 1)
-         throw new DefinitionException("There is more than one <WebServiceRef> elements in '" + 
-               webServiceRefElement.getParent().getName() + "'");
-      
+
+      if (webServiceRefElements.size() > 1)
+         throw new DefinitionException("There is more than one <WebServiceRef> elements in '" + webServiceRefElement.getParent().getName() + "'");
+
       List<Element> nameElements = ParseXmlHelper.findElementsInEeNamespace(webServiceRefElement, XmlConstants.JNDI_NAME);
       List<Element> mappedNameElements = ParseXmlHelper.findElementsInEeNamespace(webServiceRefElement, XmlConstants.MAPPED_NAME);
-      
-      if(nameElements.size() == 0 && mappedNameElements.size() == 0)
-         throw new DefinitionException("For a web service '" + webServiceRefElement.getParent().getName() + "', JNDI name " +
+
+      if (nameElements.size() == 0 && mappedNameElements.size() == 0)
+         throw new DefinitionException("For a web service '" + webServiceRefElement.getParent().getName() + "', JNDI name " + 
                "or mapped name must be specified using the <name> or <mappedName> child elements of the <WebServiceRef> element");
-      
-      if(nameElements.size() == 1)
+
+      if (nameElements.size() == 1)
          checkJndiNameElementValue(nameElements.get(0));
    }
-   
+
    private void checkJndiNameElementValue(Element nameElement)
    {
       String nameValue = nameElement.getData().toString();
-      if(!nameValue.startsWith(XmlConstants.JAVA_GLOBAL) && !nameValue.startsWith(XmlConstants.JAVA_APP))
-         throw new DefinitionException("The JNDI name specified by the <name> element in <" + nameElement.getParent().getName() + "> for '" +
-         		nameElement.getParent().getParent().getName() + "' must be a name in the global java:global or application java:app naming context");
+      if (!nameValue.startsWith(XmlConstants.JAVA_GLOBAL) && !nameValue.startsWith(XmlConstants.JAVA_APP))
+         throw new DefinitionException("The JNDI name specified by the <name> element in <" + nameElement.getParent().getName() + 
+               "> for '" + nameElement.getParent().getParent().getName() + 
+               "' must be a name in the global java:global or application java:app naming context");
    }
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/SimpleBeanChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/SimpleBeanChildrenChecker.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/SimpleBeanChildrenChecker.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -24,73 +24,74 @@
 
    protected void checkForDecoratorChild(Element beanElement)
    {
-      if(ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.INTERCEPTOR).size() > 1)
+      if (ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.INTERCEPTOR).size() > 1)
          throw new DefinitionException("A simple bean element <" + beanElement.getName() + "> has more than one direct child <" + 
-               XmlConstants.INTERCEPTOR + ">");            
+               XmlConstants.INTERCEPTOR + ">");
    }
-   
+
    protected void checkForInterceptorChild(Element beanElement)
    {
-      if(ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.DECORATOR).size() > 1)
+      if (ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.DECORATOR).size() > 1)
          throw new DefinitionException("A simple bean element <" + beanElement.getName() + "> has more than one direct child <" + 
                XmlConstants.DECORATOR + ">");
    }
-   
+
    protected void checkChildForInterceptorType(Element beanChildElement)
    {
-      if(haveBeanInterceptorDeclaration)
+      if (haveBeanInterceptorDeclaration)
          throw new DefinitionException("There is second element of interceptor type <" + beanChildElement.getName() + 
                "> in bean '" + beanChildElement.getParent().getName() + "'");
-         haveBeanInterceptorDeclaration = true;
+      haveBeanInterceptorDeclaration = true;
    }
-   
+
    protected void checkChildForDecoratorType(Element beanChildElement)
    {
-      if(haveBeanDecoratorDeclaration)
+      if (haveBeanDecoratorDeclaration)
          throw new DefinitionException("There is second element of decorator type <" + beanChildElement.getName() + 
                "> in bean '" + beanChildElement.getParent().getName() + "'");
-         haveBeanDecoratorDeclaration = true;
+      haveBeanDecoratorDeclaration = true;
    }
-   
+
    protected void checkForConstructor(Element beanElement, AnnotatedClass<?> beanClass)
    {
-      if(constructorParameters.size() == 0)
+      if (constructorParameters.size() == 0)
          return;
-      
-      List<AnnotatedConstructor<?>> matchableConstructors = new ArrayList<AnnotatedConstructor<?>>(); 
-      
-      for(AnnotatedConstructor<?> constructor : beanClass.getConstructors())
+
+      List<AnnotatedConstructor<?>> matchableConstructors = new ArrayList<AnnotatedConstructor<?>>();
+
+      for (AnnotatedConstructor<?> constructor : beanClass.getConstructors())
       {
-         List<? extends AnnotatedParameter<?>>  parameters = constructor.getParameters();
-         
-         if(parameters.size() != constructorParameters.size())
+         List<? extends AnnotatedParameter<?>> parameters = constructor.getParameters();
+
+         if (parameters.size() != constructorParameters.size())
             continue;
-         
+
          boolean isMacthable = true;
-         
-         for(int i = 0; i < parameters.size(); i++)
+
+         for (int i = 0; i < parameters.size(); i++)
          {
-            if(!parameters.get(i).isAssignableFrom(constructorParameters.get(i)))
+            if (!parameters.get(i).isAssignableFrom(constructorParameters.get(i)))
             {
                isMacthable = false;
                break;
-            }            
+            }
          }
-         
-         if(isMacthable)
+
+         if (isMacthable)
             matchableConstructors.add(constructor);
       }
-      
-      if(matchableConstructors.size() == 0)
+
+      if (matchableConstructors.size() == 0)
          throw new DefinitionException("There is no constructor of the simple bean '" + beanElement.getName() + 
                "' with the same number and types of parameters as declared");
-      
-      if(matchableConstructors.size() > 1)
+
+      if (matchableConstructors.size() > 1)
          throw new DefinitionException("There is more than one constructor of the simple bean '" + beanElement.getName() + 
                "' with the same number and types of parameters as declared");
    }
-   
-   protected void checkRIBean(Element beanElement, AnnotatedClass<?> beanClass){
+
+   protected void checkRIBean(Element beanElement, AnnotatedClass<?> beanClass)
+   {
       throw new DefinitionException("It is impossible determine some kind of resource in not Resource Bean");
    }
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -9,20 +9,20 @@
 public abstract class BeanChildrenCheckerImpl implements BeanChildrenChecker
 {
    protected final XmlEnvironment environment;
-   
+
    protected final Map<String, Set<String>> packagesMap;
-   
+
    public BeanChildrenCheckerImpl(XmlEnvironment environment, Map<String, Set<String>> packagesMap)
    {
       this.environment = environment;
       this.packagesMap = packagesMap;
    }
-   
+
    public XmlEnvironment getXmlEnvironment()
    {
       return this.environment;
    }
-   
+
    public Map<String, Set<String>> getPackagesMap()
    {
       return this.packagesMap;

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/BeanElementRegistrator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/BeanElementRegistrator.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/BeanElementRegistrator.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -6,6 +6,6 @@
 public interface BeanElementRegistrator
 {
    boolean accept(Element beanElement, AnnotatedClass<?> beanClass);
-   
+
    void registerBeanElement(Element beanElement, AnnotatedClass<?> beanClass);
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/JmsResourceElementRegistrator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/JmsResourceElementRegistrator.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/JmsResourceElementRegistrator.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -16,8 +16,8 @@
    public boolean accept(Element beanElement, AnnotatedClass<?> beanClass)
    {
       if (ParseXmlHelper.isJavaEeNamespace(beanElement) && 
-            (beanElement.getName().equalsIgnoreCase(XmlConstants.TOPIC) || 
-                  beanElement.getName().equalsIgnoreCase(XmlConstants.QUEUE)))
+            (XmlConstants.TOPIC.equalsIgnoreCase(beanElement.getName()) || 
+                  XmlConstants.QUEUE.equalsIgnoreCase(beanElement.getName())))
          return true;
       return false;
    }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/NotSimpleBeanElementRegistrator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/NotSimpleBeanElementRegistrator.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/NotSimpleBeanElementRegistrator.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -11,9 +11,9 @@
    {
       super(childrenChecker);
    }
-   
+
    protected void checkElementDeclaration(Element beanElement, AnnotatedClass<?> beanClass)
    {
-      // There is nothing to validate      
+      // There is nothing to validate
    }
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/ResourceElementRegistrator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/ResourceElementRegistrator.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/ResourceElementRegistrator.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -43,63 +43,63 @@
    public boolean accept(Element beanElement, AnnotatedClass<?> beanClass)
    {
       if (ParseXmlHelper.isJavaEeNamespace(beanElement) && 
-            (beanElement.getName().equalsIgnoreCase(XmlConstants.TOPIC) || 
-                  beanElement.getName().equalsIgnoreCase(XmlConstants.QUEUE)))
+            (XmlConstants.TOPIC.equalsIgnoreCase(beanElement.getName()) || 
+                  XmlConstants.QUEUE.equalsIgnoreCase(beanElement.getName())))
          return false;
-      
+
       Iterator<?> elIterator = beanElement.elementIterator();
       while (elIterator.hasNext())
       {
          Element child = (Element) elIterator.next();
          if (ParseXmlHelper.isJavaEeNamespace(child) && 
-               (child.getName().equalsIgnoreCase(XmlConstants.RESOURCE) || 
-                     child.getName().equalsIgnoreCase(XmlConstants.PERSISTENCE_CONTEXT) || 
-                     child.getName().equalsIgnoreCase(XmlConstants.PERSISTENCE_UNIT) || 
-                     child.getName().equalsIgnoreCase(XmlConstants.EJB) || 
-                     child.getName().equalsIgnoreCase(XmlConstants.WEB_SERVICE_REF)))
+               (XmlConstants.RESOURCE.equalsIgnoreCase(child.getName()) || 
+                     XmlConstants.PERSISTENCE_CONTEXT.equalsIgnoreCase(child.getName()) || 
+                     XmlConstants.PERSISTENCE_UNIT.equalsIgnoreCase(child.getName()) || 
+                     XmlConstants.EJB.equalsIgnoreCase(child.getName()) || 
+                     XmlConstants.WEB_SERVICE_REF.equalsIgnoreCase(child.getName())))
             return true;
       }
       return false;
    }
-   
+
    protected void register(Element beanElement, AnnotatedClass<?> beanClass)
-   {            
+   {
       List<Element> resourceElements = ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.RESOURCE);
-      if(resourceElements.size() > 0)
+      if (resourceElements.size() > 0)
       {
          registerResourceBean(resourceElements.get(0), beanClass);
          return;
       }
-      
+
       List<Element> persContextElements = ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.PERSISTENCE_CONTEXT);
-      if(persContextElements.size() > 0)
+      if (persContextElements.size() > 0)
       {
          registerPersContextBean(persContextElements.get(0), beanClass);
          return;
       }
-         
+
       List<Element> persUnitElements = ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.PERSISTENCE_UNIT);
-      if(persUnitElements.size() > 0)
+      if (persUnitElements.size() > 0)
       {
          registerPersUnitBean(persUnitElements.get(0), beanClass);
          return;
       }
-         
+
       List<Element> ejbElements = ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.EJB);
-      if(ejbElements.size() > 0)
+      if (ejbElements.size() > 0)
       {
          registerEjbBean(ejbElements.get(0), beanClass);
          return;
       }
-         
+
       List<Element> webServiceRefElements = ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.WEB_SERVICE_REF);
-      if(webServiceRefElements.size() > 0)
+      if (webServiceRefElements.size() > 0)
       {
          registerWebServiceRefBean(webServiceRefElements.get(0), beanClass);
          return;
       }
    }
-   
+
    private void registerResourceBean(Element resourceElement, AnnotatedClass<?> beanClass)
    {
       Class<? extends Annotation> deploymentType = obtainDeploymentType(resourceElement.getParent());
@@ -107,43 +107,43 @@
       Class<?> type = beanClass.getRawType();
       String jndiName = obtainElementValue(resourceElement, XmlConstants.JNDI_NAME);
       String mappedName = obtainElementValue(resourceElement, XmlConstants.MAPPED_NAME);
-      
+
       RIBean<?> bean = new ResourceBean(environment.getManager(), deploymentType, bindings, type, jndiName, mappedName);
-      
+
       if (environment.getServices().contains(ResourceServices.class))
       {
          environment.getResourceBeans().add((AbstractJavaEEResourceBean<?>) bean);
       }
    }
-   
+
    private void registerPersContextBean(Element persContextElement, AnnotatedClass<?> beanClass)
    {
       Class<? extends Annotation> deploymentType = obtainDeploymentType(persContextElement.getParent());
       Set<Annotation> bindings = obtainBindings(persContextElement.getParent());
       String unitName = obtainElementValue(persContextElement, XmlConstants.UNIT_NAME);
-      
+
       RIBean<?> bean = new PersistenceContextBean(environment.getManager(), deploymentType, bindings, unitName);
-      
+
       if (environment.getServices().contains(JpaServices.class))
       {
          environment.getResourceBeans().add((AbstractJavaEEResourceBean<?>) bean);
-      }            
+      }
    }
-   
+
    private void registerPersUnitBean(Element persUnitElement, AnnotatedClass<?> beanClass)
    {
       Class<? extends Annotation> deploymentType = obtainDeploymentType(persUnitElement.getParent());
       Set<Annotation> bindings = obtainBindings(persUnitElement.getParent());
       String unitName = obtainElementValue(persUnitElement, XmlConstants.UNIT_NAME);
-      
+
       RIBean<?> bean = new PersistenceUnitBean(environment.getManager(), deploymentType, bindings, unitName);
-      
+
       if (environment.getServices().contains(JpaServices.class))
       {
          environment.getResourceBeans().add((AbstractJavaEEResourceBean<?>) bean);
       }
    }
-   
+
    private void registerEjbBean(Element ejbElement, AnnotatedClass<?> beanClass)
    {
       Class<? extends Annotation> deploymentType = obtainDeploymentType(ejbElement.getParent());
@@ -151,16 +151,17 @@
       Class<?> type = beanClass.getRawType();
       String jndiName = obtainElementValue(ejbElement, XmlConstants.JNDI_NAME);
       String mappedName = obtainElementValue(ejbElement, XmlConstants.MAPPED_NAME);
-      String ejbLink = obtainElementValue(ejbElement, XmlConstants.EJB_LINK);;
-      
+      String ejbLink = obtainElementValue(ejbElement, XmlConstants.EJB_LINK);
+      ;
+
       RIBean<?> bean = new RemoteEjbBean(environment.getManager(), deploymentType, bindings, type, jndiName, mappedName, ejbLink);
-      
+
       if (environment.getServices().contains(EjbServices.class))
       {
          environment.getResourceBeans().add((AbstractJavaEEResourceBean<?>) bean);
       }
    }
-   
+
    private void registerWebServiceRefBean(Element webServiceRefElement, AnnotatedClass<?> beanClass)
    {
       Class<? extends Annotation> deploymentType = obtainDeploymentType(webServiceRefElement.getParent());
@@ -169,15 +170,15 @@
       String jndiName = obtainElementValue(webServiceRefElement, XmlConstants.JNDI_NAME);
       String mappedName = obtainElementValue(webServiceRefElement, XmlConstants.MAPPED_NAME);
       String wsdlLocation = obtainElementValue(webServiceRefElement, XmlConstants.WSDL_LOCATION);
-      
+
       RIBean<?> bean = new WebServiceBean(environment.getManager(), deploymentType, bindings, type, jndiName, mappedName, wsdlLocation);
-      
+
       if (environment.getServices().contains(WebServices.class))
       {
          environment.getResourceBeans().add((AbstractJavaEEResourceBean<?>) bean);
       }
    }
-   
+
    private Class<? extends Annotation> obtainDeploymentType(Element beanElement)
    {
       Iterator<?> elIterator = beanElement.elementIterator();
@@ -185,26 +186,23 @@
       {
          Element childElement = (Element) elIterator.next();
          AnnotatedClass<?> childClass = ParseXmlHelper.loadElementClass(childElement, Object.class, environment, packagesMap);
-         if(childClass.getRawType().isAnnotation() && childClass.isAnnotationPresent(DeploymentType.class))
+         if (childClass.getRawType().isAnnotation() && childClass.isAnnotationPresent(DeploymentType.class))
             return ParseXmlHelper.loadAnnotationClass(childElement, Annotation.class, environment, packagesMap);
       }
-      
+
       return null;
    }
-   
+
    private Set<Annotation> obtainBindings(Element beanElement)
    {
       Set<Annotation> result = new HashSet<Annotation>();
-      
+
       Iterator<?> elIterator = beanElement.elementIterator();
       while (elIterator.hasNext())
       {
          Element childElement = (Element) elIterator.next();
          AnnotatedClass<?> childClass = ParseXmlHelper.loadElementClass(childElement, Object.class, environment, packagesMap);
-         if(childClass.getRawType().isAnnotation() && !childClass.isAnnotationPresent(DeploymentType.class) && 
-               !childClass.getRawType().equals(Resource.class) && !childClass.getRawType().equals(PersistenceContext.class) && 
-               !childClass.getRawType().equals(PersistenceUnit.class) && !childClass.getRawType().equals(EJB.class) && 
-               !childClass.getRawType().equals(WebServiceRef.class))
+         if (childClass.getRawType().isAnnotation() && !childClass.isAnnotationPresent(DeploymentType.class) && !childClass.getRawType().equals(Resource.class) && !childClass.getRawType().equals(PersistenceContext.class) && !childClass.getRawType().equals(PersistenceUnit.class) && !childClass.getRawType().equals(EJB.class) && !childClass.getRawType().equals(WebServiceRef.class))
          {
             Class<?> annotationClass = childClass.getRawType();
             Method[] annotationMethods = annotationClass.getDeclaredMethods();
@@ -212,22 +210,22 @@
             result.add(annotation);
          }
       }
-      
-      if(result.size() == 0)
-      {         
+
+      if (result.size() == 0)
+      {
          Class<?> annotationClass = Current.class;
          Method[] annotationMethods = annotationClass.getDeclaredMethods();
          AnnotationImpl annotation = new AnnotationImpl(annotationClass, annotationMethods);
          result.add(annotation);
       }
-      
+
       return result;
    }
-   
+
    private String obtainElementValue(Element elementParent, String elementName)
    {
       List<Element> elements = ParseXmlHelper.findElementsInEeNamespace(elementParent, elementName);
-      if(elements.size() > 0)
+      if (elements.size() > 0)
       {
          Element element = elements.get(0);
          return element.getData().toString();

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/SessionBeanElementRegistrator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/SessionBeanElementRegistrator.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/SessionBeanElementRegistrator.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -9,7 +9,7 @@
 public class SessionBeanElementRegistrator extends NotSimpleBeanElementRegistrator
 {
    private final EjbDescriptorCache ejbDescriptors;
-	
+
    public SessionBeanElementRegistrator(BeanChildrenChecker childrenChecker, EjbDescriptorCache ejbDescriptors)
    {
       super(childrenChecker);
@@ -18,7 +18,7 @@
 
    public boolean accept(Element beanElement, AnnotatedClass<?> beanClass)
    {
-      if (ejbDescriptors.containsKey(beanElement.getName()) ||
+      if (ejbDescriptors.containsKey(beanElement.getName()) || 
             beanElement.attribute(XmlConstants.EJB_NAME) != null)
       {
          return true;

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/SimpleBeanElementRegistrator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/SimpleBeanElementRegistrator.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/ext/SimpleBeanElementRegistrator.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -15,7 +15,7 @@
 public class SimpleBeanElementRegistrator extends BeanElementRegistratorImpl
 {
    private final EjbDescriptorCache ejbDescriptors;
-	
+
    public SimpleBeanElementRegistrator(BeanChildrenChecker childrenChecker, EjbDescriptorCache ejbDescriptors)
    {
       super(childrenChecker);
@@ -24,9 +24,8 @@
 
    public boolean accept(Element beanElement, AnnotatedClass<?> beanClass)
    {
-      boolean isSessionBean = ejbDescriptors.containsKey(beanElement.getName()) || 
-                                          beanElement.attribute(XmlConstants.EJB_NAME) != null;
-      
+      boolean isSessionBean = ejbDescriptors.containsKey(beanElement.getName()) || beanElement.attribute(XmlConstants.EJB_NAME) != null;
+
       if (!beanClass.isAbstract() && !isSessionBean && !beanClass.isParameterizedType())
       {
          return true;
@@ -37,18 +36,18 @@
 
    protected void checkElementDeclaration(Element beanElement, AnnotatedClass<?> beanClass)
    {
-      if(beanClass.isNonStaticMemberClass())
-         throw new DefinitionException("Bean class '" + beanClass.getName() + "' of a simple bean <" + beanElement.getName() + 
-               "> is a non static member class");
-      
-      if(beanClass.getRawType().isAnnotationPresent(Interceptor.class) && 
+      if (beanClass.isNonStaticMemberClass())
+         throw new DefinitionException("Bean class '" + beanClass.getName() + "' of a simple bean <" + 
+               beanElement.getName() + "> is a non static member class");
+
+      if (beanClass.getRawType().isAnnotationPresent(Interceptor.class) && 
             ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.INTERCEPTOR).size() != 1)
-         throw new DefinitionException("A simple bean defined in XML as <" + beanElement.getName() +  "> has a bean class '" + 
+         throw new DefinitionException("A simple bean defined in XML as <" + beanElement.getName() + "> has a bean class '" + 
                beanClass.getName() + "' annotated @Interceptor and is not declared as an interceptor in XML");
-      
-      if(beanClass.getRawType().isAnnotationPresent(Decorator.class) && 
+
+      if (beanClass.getRawType().isAnnotationPresent(Decorator.class) && 
             ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.DECORATOR).size() != 1)
-         throw new DefinitionException("A simple bean defined in XML as <" + beanElement.getName() +  "> has a bean class '" + 
+         throw new DefinitionException("A simple bean defined in XML as <" + beanElement.getName() + "> has a bean class '" + 
                beanClass.getName() + "' annotated @Decorator and is not declared as an decorator in XML");
    }
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/impl/BeanElementRegistratorImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/impl/BeanElementRegistratorImpl.java	2009-04-21 09:33:17 UTC (rev 2611)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/registrator/bean/impl/BeanElementRegistratorImpl.java	2009-04-21 15:38:27 UTC (rev 2612)
@@ -22,26 +22,25 @@
 import org.jboss.webbeans.xml.checker.beanchildren.BeanChildrenChecker;
 import org.jboss.webbeans.xml.registrator.bean.BeanElementRegistrator;
 
-
 public abstract class BeanElementRegistratorImpl implements BeanElementRegistrator
 {
    protected final BeanChildrenChecker childrenChecker;
-   
+
    protected final XmlEnvironment environment;
-   
+
    protected final Map<String, Set<String>> packagesMap;
-   
+
    protected BeanElementRegistratorImpl(BeanChildrenChecker childrenChecker)
    {
       this.childrenChecker = childrenChecker;
       this.environment = childrenChecker.getXmlEnvironment();
       this.packagesMap = childrenChecker.getPackagesMap();
    }
-   
+
    public abstract boolean accept(Element beanElement, AnnotatedClass<?> beanClass);
 
    protected abstract void checkElementDeclaration(Element beanElement, AnnotatedClass<?> beanClass);
-   
+
    public void registerBeanElement(Element beanElement, AnnotatedClass<?> beanClass)
    {
       checkElementDeclaration(beanElement, beanClass);
@@ -49,113 +48,115 @@
       checkProduces(beanElement, beanClass);
       register(beanElement, beanClass);
    }
-   
+
    protected void register(Element beanElement, AnnotatedClass<?> beanClass)
    {
       environment.getClasses().add(beanClass);
    }
-   
+
    private void checkProduces(Element beanElement, AnnotatedClass<?> beanClass)
-   {//TODO: will refactor
+   {// TODO: will refactor
       Iterator<?> beanIterator = beanElement.elementIterator();
-      while(beanIterator.hasNext())
+      while (beanIterator.hasNext())
       {
-         Element beanChild = (Element)beanIterator.next();  
+         Element beanChild = (Element) beanIterator.next();
          List<Element> producesElements = ParseXmlHelper.findElementsInEeNamespace(beanChild, XmlConstants.PRODUCES);
-         
-         if(producesElements.size() == 0)
+
+         if (producesElements.size() == 0)
             continue;
-         
-         if(producesElements.size() > 1)
-            throw new DefinitionException("There is more than one child <Produces> element for <" + beanChild.getName()  + "> element");
-         
+
+         if (producesElements.size() > 1)
+            throw new DefinitionException("There is more than one child <Produces> element for <" + beanChild.getName() + "> element");
+
          List<AnnotatedClass<?>> producesChildTypes = new ArrayList<AnnotatedClass<?>>();
-                  
+
          Element producesElement = producesElements.get(0);
          Iterator<?> producesIt = producesElement.elementIterator();
-         while(producesIt.hasNext())
+         while (producesIt.hasNext())
          {
-            Element producesChild = (Element)producesIt.next();
+            Element producesChild = (Element) producesIt.next();
             AnnotatedClass<?> producesChildClass = ParseXmlHelper.loadElementClass(producesChild, Object.class, environment, packagesMap);
             Class<?> producesChildType = producesChildClass.getRawType();
             boolean isJavaClass = !producesChildType.isEnum() && !producesChildType.isPrimitive() && !producesChildType.isInterface();
             boolean isInterface = producesChildType.isInterface() && !producesChildType.isAnnotation();
-            if(isJavaClass || isInterface)
+            if (isJavaClass || isInterface)
             {
                producesChildTypes.add(producesChildClass);
                continue;
             }
-            if(producesChildType.isAnnotation())
+            if (producesChildType.isAnnotation())
             {
-               if(producesChildClass.isAnnotationPresent(DeploymentType.class) || 
+               if (producesChildClass.isAnnotationPresent(DeploymentType.class) || 
                      producesChildClass.isAnnotationPresent(ScopeType.class) || 
-                     producesChildClass.isAnnotationPresent(Stereotype.class) ||
+                     producesChildClass.isAnnotationPresent(Stereotype.class) || 
                      producesChildClass.isAnnotationPresent(Named.class))
                   continue;
-                                             
-               throw new DefinitionException("<" + producesChild.getName() + "> direct child of <Produces> element for <" + beanChild.getName() 
-                     + "> in bean" + beanElement.getName() + "must be DeploymentType or ScopeType or Stereotype or Named");
+
+               throw new DefinitionException("<" + producesChild.getName() + "> direct child of <Produces> element for <" + 
+                     beanChild.getName() + "> in bean" + beanElement.getName() + "must be DeploymentType or ScopeType or Stereotype or Named");
             }
-            throw new DefinitionException("Only Java class, interface type and Java annotation type can be " +
+            throw new DefinitionException("Only Java class, interface type and Java annotation type can be " + 
                   "direct child of <Produces> element for <" + beanChild.getName() + "> in bean" + beanElement.getName() + 
                   ". Element <" + producesChild.getName() + "> is incorrect");
          }
-         
-         if(producesChildTypes.size() != 1)
-            throw new DefinitionException("More than one or no one child element of <Produces> element for <" + beanChild.getName() + 
-                  "> in bean" + beanElement.getName() + " represents a Java class or interface type");
-         
+
+         if (producesChildTypes.size() != 1)
+            throw new DefinitionException("More than one or no one child element of <Produces> element for <" + 
+                  beanChild.getName() + "> in bean" + beanElement.getName() + " represents a Java class or interface type");
+
          AnnotatedClass<?> expectedType = producesChildTypes.get(0);
-                  
-         Method beanMethod = null;         
+
+         Method beanMethod = null;
          AnnotatedField<?> beanField = beanClass.getDeclaredField(beanChild.getName(), expectedType);
 
          try
          {
             List<Class<?>> paramClassesList = new ArrayList<Class<?>>();
             Iterator<?> beanChildIt = beanChild.elementIterator();
-            while(beanChildIt.hasNext())
+            while (beanChildIt.hasNext())
             {
-               Element methodChild = (Element)beanChildIt.next();
-               if(methodChild.getName().equalsIgnoreCase(XmlConstants.PRODUCES))
+               Element methodChild = (Element) beanChildIt.next();
+               if (XmlConstants.PRODUCES.equalsIgnoreCase(methodChild.getName()))
                   continue;
                paramClassesList.add(ParseXmlHelper.loadElementClass(methodChild, Object.class, environment, packagesMap).getRawType());
             }
-            Class<?>[] paramClasses = (Class<?>[])paramClassesList.toArray(new Class[0]);
+            Class<?>[] paramClasses = (Class<?>[]) paramClassesList.toArray(new Class[0]);
             beanMethod = beanClass.getRawType().getDeclaredMethod(beanChild.getName(), paramClasses);
          }
          catch (SecurityException e)
-         {}
+         {
+         }
          catch (NoSuchMethodException e)
-         {}
-         
-         if(beanField != null && beanMethod != null)
+         {
+         }
+
+         if (beanField != null && beanMethod != null)
             throw new DefinitionException("Class '" + beanClass.getName() + "' has produser field and method with the same name '" + 
                   beanField.getName() + "'");
-         
-         if(beanField != null)
+
+         if (beanField != null)
          {
-            if(beanChild.elements().size() > 1)
+            if (beanChild.elements().size() > 1)
                throw new DefinitionException("There is more than one direct child element for producer field <" + beanChild.getName() + ">");
             continue;
          }
-         
-         if(beanMethod != null)
+
+         if (beanMethod != null)
          {
             Iterator<?> beanChildIt = beanChild.elementIterator();
-            while(beanChildIt.hasNext())
+            while (beanChildIt.hasNext())
             {
-               Element element = (Element)beanChildIt.next();
-               if(!element.getName().equalsIgnoreCase(XmlConstants.PRODUCES) && 
+               Element element = (Element) beanChildIt.next();
+               if (!XmlConstants.PRODUCES.equalsIgnoreCase(element.getName()) && 
                      ParseXmlHelper.findElementsInEeNamespace(beanChild, XmlConstants.INTERCEPTOR).size() == 0)
-                  throw new DefinitionException("Only Produces and interceptor binding types can be direct childs of a producer " +
+                  throw new DefinitionException("Only Produces and interceptor binding types can be direct childs of a producer " + 
                         "method '" + beanChild.getName() + "' declaration in bean '" + beanElement.getName() + "'");
             }
             continue;
          }
-         
-         throw new DefinitionException("A producer '" + beanChild.getName() + "' doesn't declared in '" + beanElement.getName() + 
-               "' class file as method or field");
-      }                  
+
+         throw new DefinitionException("A producer '" + beanChild.getName() + "' isn't declared in '" + beanClass.getName() + 
+               "' as method or field");
+      }
    }
 }




More information about the weld-commits mailing list