Home » apache-openwebbeans-1.0.0-incubating-M3-sources » org.apache.webbeans.spi.se.deployer » [javadoc | source]

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements. See the NOTICE file distributed with this
    4    * work for additional information regarding copyright ownership. The ASF
    5    * licenses this file to You under the Apache License, Version 2.0 (the
    6    * "License"); you may not use this file except in compliance with the License.
    7    * You may obtain a copy of the License at
    8    * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
    9    * or agreed to in writing, software distributed under the License is
   10    * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   11    * KIND, either express or implied. See the License for the specific language
   12    * governing permissions and limitations under the License.
   13    */
   14   package org.apache.webbeans.spi.se.deployer;
   15   
   16   import java.io.IOException;
   17   
   18   import java.net.URL;
   19   import java.util.Enumeration;
   20   
   21   import org.apache.webbeans.spi.deployer.AbstractMetaDataDiscovery;
   22   import org.apache.webbeans.util.WebBeansUtil;
   23   
   24   import org.scannotation.ClasspathUrlFinder;
   25   
   26   public class MetaDataDiscoveryStandard extends AbstractMetaDataDiscovery
   27   {
   28       public MetaDataDiscoveryStandard()
   29       {
   30           super();
   31       }
   32   
   33       protected void configure() throws Exception
   34       {
   35           configureAnnotationDB();
   36       }
   37   
   38       private void configureAnnotationDB() throws Exception
   39       {
   40           ClassLoader loader = WebBeansUtil.getCurrentClassLoader();
   41   
   42           URL[] urls = ClasspathUrlFinder.findResourceBases("META-INF/beans.xml", loader);
   43           
   44           this.getAnnotationDB().scanArchives(urls);
   45   
   46           configureXML();
   47   
   48       }
   49   
   50       private void configureXML() throws Exception
   51       {
   52           try
   53           {
   54               Enumeration<URL> resources = getClass().getClassLoader().getResources("META-INF/beans.xml");
   55   
   56               while (resources.hasMoreElements())
   57               {
   58                   URL resource = resources.nextElement();
   59                   addWebBeansXmlLocation(resource);
   60               }
   61   
   62           }
   63           catch (IOException e)
   64           {
   65               throw e;
   66           }
   67       }
   68   
   69   
   70   }

Home » apache-openwebbeans-1.0.0-incubating-M3-sources » org.apache.webbeans.spi.se.deployer » [javadoc | source]