Package org.eobjects.analyzer.descriptors

Examples of org.eobjects.analyzer.descriptors.ClasspathScanDescriptorProvider


    if (!_loaded) {
      if (!(descriptorProvider instanceof ClasspathScanDescriptorProvider)) {
        throw new IllegalStateException(
            "Can only load user extensions when descriptor provider is of classpath scanner type.");
      }
      ClasspathScanDescriptorProvider classpathScanner = (ClasspathScanDescriptorProvider) descriptorProvider;

      ClassLoader classLoader = ResourceManager.getInstance().createClassLoader(_files);

      int analyzersBefore = classpathScanner.getAnalyzerBeanDescriptors().size();
      int transformersBefore = classpathScanner.getTransformerBeanDescriptors().size();
      int filtersBefore = classpathScanner.getFilterBeanDescriptors().size();

      classpathScanner.scanPackage(_scanPackage, _scanRecursive, classLoader);

      _loadedAnalyzers = classpathScanner.getAnalyzerBeanDescriptors().size() - analyzersBefore;
      _loadedTransformers = classpathScanner.getTransformerBeanDescriptors().size() - transformersBefore;
      _loadedFilters = classpathScanner.getFilterBeanDescriptors().size() - filtersBefore;

      _loaded = true;

      logger.info("Succesfully loaded extension '{}' containing {} analyzers, {} transformers, {} filters",
          new Object[] { getName(), getLoadedAnalyzers(), getLoadedTransformers(), getLoadedFilters() });
View Full Code Here


    ExtensionPackage extensionPackage = new ExtensionPackage("foobar plugin", "foo.bar", true, new File[] { file });

    assertFalse(extensionPackage.isLoaded());

    ClasspathScanDescriptorProvider descriptorProvider = new ClasspathScanDescriptorProvider();
    extensionPackage.loadExtension(descriptorProvider);

    assertTrue(extensionPackage.isLoaded());
    assertEquals(1, extensionPackage.getLoadedAnalyzers());
    assertEquals(1, extensionPackage.getLoadedTransformers());
    assertEquals(1, extensionPackage.getLoadedFilters());

    assertEquals("[AnnotationBasedAnalyzerBeanDescriptor[foo.bar.analyzer.BazAnalyzer]]", descriptorProvider
        .getAnalyzerBeanDescriptors().toString());
    assertEquals("[AnnotationBasedTransformerBeanDescriptor[foo.bar.transformer.BazTransformer]]", descriptorProvider
        .getTransformerBeanDescriptors().toString());
    assertEquals("[AnnotationBasedFilterBeanDescriptor[foo.bar.filter.BazFilter]]", descriptorProvider
        .getFilterBeanDescriptors().toString());
  }
View Full Code Here

TOP

Related Classes of org.eobjects.analyzer.descriptors.ClasspathScanDescriptorProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.