Class AbstractMetaDataDiscovery
- java.lang.Object
-
- org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery
-
- All Implemented Interfaces:
org.apache.webbeans.spi.BdaScannerService,org.apache.webbeans.spi.ScannerService
- Direct Known Subclasses:
DefaultScannerService,OpenWebBeansTestMetaDataDiscoveryService
public abstract class AbstractMetaDataDiscovery extends Object implements org.apache.webbeans.spi.BdaScannerService
-
-
Field Summary
Fields Modifier and Type Field Description protected CdiArchivearchiveprotected org.apache.webbeans.spi.BDABeansXmlScannerbdaBeansXmlScannerprotected OwbAnnotationFinderfinderprotected booleanisBDAScannerEnabledprotected ClassLoaderloaderprotected static Loggerloggerstatic StringMETA_INF_BEANS_XMLprotected String[]scanningExcludesprotected WebBeansContextwebBeansContext
-
Constructor Summary
Constructors Constructor Description AbstractMetaDataDiscovery()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddDeploymentUrl(String beansXml, URL cpUrl)Add an URL for a deployment later onprotected voidaddWebBeansXmlLocation(URL beanArchiveUrl)add the given beans.xml path to the locations listprotected abstract voidconfigure()protected voiddoAddWebBeansXmlLocation(URL beanArchiveUrl)protected voidfilterExcludedJars(Set<URL> classPathUrls)protected org.apache.xbean.finder.archive.ArchivegetAdditionalArchive()org.apache.webbeans.spi.BDABeansXmlScannergetBDABeansXmlScanner()protected Iterable<URL>getBeanArchiveUrls()Deprecated.just here for backward compat reasonsSet<Class<?>>getBeanClasses()Map<org.apache.webbeans.spi.BeanArchiveService.BeanArchiveInformation,Set<Class<?>>>getBeanClassesPerBda()This method only gets called if the initialisation is done already.Map<String,URL>getBeanDeploymentUrls()Set<URL>getBeanXmls()voidinit(Object object)protected org.apache.xbean.finder.AnnotationFinderinitFinder()voidinitScanningExcludes()booleanisBDABeansXmlScanningEnabled()protected booleanisBdaUrlEnabled(URL bdaUrl)This method could filter out known JARs or even JVM classpaths which shall not be considered bean archives.protected booleanisBeanAnnotatedClass(org.apache.xbean.finder.AnnotationFinder.ClassInfo classInfo)This method is called for classes from bean archives with bean-discovery-mode 'annotated'.protected booleanisBeanAnnotation(org.apache.xbean.finder.AnnotationFinder.AnnotationInfo annotationInfo)protected intisExcludedJar(String path)protected booleanisExcludedJar(URL url)protected voidregisterBeanArchives(ClassLoader loader)Since CDI-1.1 this is actually more a 'findBdaBases' as it also picks up jars without marker file.voidrelease()voidscan()Configure the Web Beans Container with deployment information and fills annotation database and beans.xml stream database.protected StringstripProtocol(String urlPath)Get rid of any protocol header from the url externalFormprotected Map<File,URL>toFiles(Set<URL> classPathUrls)protected WebBeansContextwebBeansContext()
-
-
-
Field Detail
-
logger
protected static final Logger logger
-
META_INF_BEANS_XML
public static final String META_INF_BEANS_XML
- See Also:
- Constant Field Values
-
scanningExcludes
protected String[] scanningExcludes
-
loader
protected ClassLoader loader
-
archive
protected CdiArchive archive
-
finder
protected OwbAnnotationFinder finder
-
isBDAScannerEnabled
protected boolean isBDAScannerEnabled
-
bdaBeansXmlScanner
protected org.apache.webbeans.spi.BDABeansXmlScanner bdaBeansXmlScanner
-
webBeansContext
protected WebBeansContext webBeansContext
-
-
Method Detail
-
initFinder
protected org.apache.xbean.finder.AnnotationFinder initFinder()
-
getAdditionalArchive
protected org.apache.xbean.finder.archive.Archive getAdditionalArchive()
-
getBeanArchiveUrls
protected Iterable<URL> getBeanArchiveUrls()
Deprecated.just here for backward compat reasons- Returns:
- list of beans.xml locations or implicit bean archives
-
getBeanDeploymentUrls
public Map<String,URL> getBeanDeploymentUrls()
- Returns:
- URLs of all classpath entries which
-
scan
public void scan() throws WebBeansDeploymentExceptionConfigure the Web Beans Container with deployment information and fills annotation database and beans.xml stream database.- Specified by:
scanin interfaceorg.apache.webbeans.spi.ScannerService- Throws:
WebBeansConfigurationException- if any run time exception occursWebBeansDeploymentException
-
configure
protected abstract void configure()
-
registerBeanArchives
protected void registerBeanArchives(ClassLoader loader)
Since CDI-1.1 this is actually more a 'findBdaBases' as it also picks up jars without marker file. This will register all 'explicit' Bean Archives, aka all META-INF/beans.xml resources on the classpath. Those will be added including the META-INF/beans.xml in the URL. We will also add all other classpath locations which do not have the beans.xml marker file, the 'implicit bean archives'. In this case the URL will point to the root of the classpath entry.- Parameters:
loader- the ClassLoader which should be used- See Also:
getBeanArchiveUrls(),getBeanDeploymentUrls()
-
stripProtocol
protected String stripProtocol(String urlPath)
Get rid of any protocol header from the url externalForm- Parameters:
urlPath-
-
isExcludedJar
protected boolean isExcludedJar(URL url)
-
isExcludedJar
protected int isExcludedJar(String path)
-
release
public void release()
- Specified by:
releasein interfaceorg.apache.webbeans.spi.ScannerService
-
addDeploymentUrl
protected void addDeploymentUrl(String beansXml, URL cpUrl)
Add an URL for a deployment later on- Parameters:
beansXml-cpUrl-
-
isBdaUrlEnabled
protected boolean isBdaUrlEnabled(URL bdaUrl)
This method could filter out known JARs or even JVM classpaths which shall not be considered bean archives.- Returns:
- whether the URL is a bean archive or not
-
init
public void init(Object object)
- Specified by:
initin interfaceorg.apache.webbeans.spi.ScannerService
-
initScanningExcludes
public void initScanningExcludes()
-
addWebBeansXmlLocation
protected void addWebBeansXmlLocation(URL beanArchiveUrl)
add the given beans.xml path to the locations list- Parameters:
beanArchiveUrl- location path
-
doAddWebBeansXmlLocation
protected void doAddWebBeansXmlLocation(URL beanArchiveUrl)
-
getBeanClassesPerBda
public Map<org.apache.webbeans.spi.BeanArchiveService.BeanArchiveInformation,Set<Class<?>>> getBeanClassesPerBda()
This method only gets called if the initialisation is done already. It will collect all the classes from all the BDAs it can find.- Specified by:
getBeanClassesPerBdain interfaceorg.apache.webbeans.spi.BdaScannerService
-
getBeanClasses
public Set<Class<?>> getBeanClasses()
- Specified by:
getBeanClassesin interfaceorg.apache.webbeans.spi.ScannerService
-
isBeanAnnotatedClass
protected boolean isBeanAnnotatedClass(org.apache.xbean.finder.AnnotationFinder.ClassInfo classInfo)
This method is called for classes from bean archives with bean-discovery-mode 'annotated'. This method is intended to be overwritten in integration scenarios and e.g. allows to add other criterias for keeping the class.- Parameters:
classInfo-- Returns:
- true if this class should be kept and further get picked up as CDI Bean
-
isBeanAnnotation
protected boolean isBeanAnnotation(org.apache.xbean.finder.AnnotationFinder.AnnotationInfo annotationInfo)
-
getBeanXmls
public Set<URL> getBeanXmls()
- Specified by:
getBeanXmlsin interfaceorg.apache.webbeans.spi.ScannerService
-
getBDABeansXmlScanner
public org.apache.webbeans.spi.BDABeansXmlScanner getBDABeansXmlScanner()
- Specified by:
getBDABeansXmlScannerin interfaceorg.apache.webbeans.spi.ScannerService
-
isBDABeansXmlScanningEnabled
public boolean isBDABeansXmlScanningEnabled()
- Specified by:
isBDABeansXmlScanningEnabledin interfaceorg.apache.webbeans.spi.ScannerService
-
webBeansContext
protected WebBeansContext webBeansContext()
-
-