當前位置: 首頁>>代碼示例>>Java>>正文


Java BeansXml類代碼示例

本文整理匯總了Java中org.jboss.weld.bootstrap.spi.BeansXml的典型用法代碼示例。如果您正苦於以下問題:Java BeansXml類的具體用法?Java BeansXml怎麽用?Java BeansXml使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BeansXml類屬於org.jboss.weld.bootstrap.spi包,在下文中一共展示了BeansXml類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readBeansXml

import org.jboss.weld.bootstrap.spi.BeansXml; //導入依賴的package包/類
private BeansXml readBeansXml(BeanArchive beanArchive, ClasspathResource resource) {
    try {
        final SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setValidating(true);
        factory.setNamespaceAware(true);
        final SAXParser parser = factory.newSAXParser();
        final InputSource source = new InputSource(new ByteArrayInputStream(resource.getBytes()));
        if (source.getByteStream().available() == 0) {
            // The file is just acting as a marker file
            return EMPTY_BEANS_XML;
        }
        final BeansXmlHandler handler = new BeansXmlHandler(beanArchive.getClasspathEntry().getURL());
        parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
        parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", loadXsds());
        parser.parse(source, handler);
        return handler.createBeansXml();
    } catch (final SAXException | ParserConfigurationException | IOException e) {
        throw new TestEEfiException(
                "Failed to parse META-INF/beans.xml in " + beanArchive.getClasspathEntry().getURL(),
                e
        );
    }
}
 
開發者ID:dajudge,項目名稱:testee.fi,代碼行數:24,代碼來源:BeanDeploymentArchiveImpl.java

示例2: beansXmlModifiers

import org.jboss.weld.bootstrap.spi.BeansXml; //導入依賴的package包/類
private BeansXmlModifier beansXmlModifiers() {
    final Set<BeansXmlModifier> modifiers = getInstancesOf(BeansXmlModifier.class, releaser);
    return beansXml -> {
        BeansXml ret = beansXml;
        for (final BeansXmlModifier modifier : modifiers) {
            ret = modifier.apply(ret);
        }
        return ret;
    };
}
 
開發者ID:dajudge,項目名稱:testee.fi,代碼行數:11,代碼來源:TestInstanceRealm.java

示例3: contribute

import org.jboss.weld.bootstrap.spi.BeansXml; //導入依賴的package包/類
@Override
public Collection<BeanDeploymentArchive> contribute(
        final ServiceRegistry serviceRegistry,
        final Supplier<Collection<BeanDeploymentArchive>> archives
) {
    return singletonList(new BeanDeploymentArchive() {

        @Override
        public Collection<BeanDeploymentArchive> getBeanDeploymentArchives() {
            return archives.get();
        }

        @Override
        public Collection<String> getBeanClasses() {
            return mockStore.getMockClasses().stream().map(Class::getCanonicalName).collect(toSet());
        }

        @Override
        public BeansXml getBeansXml() {
            return EMPTY_BEANS_XML;
        }

        @Override
        public Collection<EjbDescriptor<?>> getEjbs() {
            return emptySet();
        }

        @Override
        public ServiceRegistry getServices() {
            return serviceRegistry;
        }

        @Override
        public String getId() {
            return ID;
        }
    });
}
 
開發者ID:dajudge,項目名稱:testee.fi,代碼行數:39,代碼來源:MockingDynamicArchiveContributor.java

示例4: WeldContainer

import org.jboss.weld.bootstrap.spi.BeansXml; //導入依賴的package包/類
WeldContainer(Bundle toExtend) {
    boot = new WeldBootstrap();
    String contextName = "osgi-cdi:" + toExtend.getBundleId();
    // Construct our extension which does the main of the work.
    BundleContext context = toExtend.getBundleContext();
    List<Extension> extensions = new ArrayList<>(Arrays.asList(
            new ScopeExtension(context),
            new ServiceExtension(context),
            new ComponentExtension()));
    ServiceLoader<Extension> loader = ServiceLoader.load(Extension.class,
            DelegatingClassLoader.from(toExtend));
    loader.forEach((l) -> extensions.add(l));
    BeansXml beansXml = BeansXml.EMPTY_BEANS_XML;
    URL url = toExtend.getEntry("/META-INF/beans.xml");
    if (url != null) {
        beansXml = boot.parse(url);
    }
    deployment = new OurDeployment(toExtend, beansXml,
            extensions.stream().map((e) -> new OurMetaData<>(e.getClass().getName(), e)).collect(Collectors.toList()));
    // Start the container. Needs to be called now because otherwise no bean manager is returned from the bootstrap.
    boot.startContainer(contextName, new OurEnvironment(), deployment);
    // Takes care of the extension initialization. We would want to do this inside the separate
    // thread, but this causes some exception breakpoints because our extensions are not proxyable.
    boot.startInitialization();
    // The remainder is done in a separate thread.
    Runnable runner = () -> {
        // Go through the bootstrap sequence. This automatically fires the
        // events to our extensions.
        boot.deployBeans();
        boot.validateBeans();
        boot.endInitialization();
    };
    new Thread(runner).start();
}
 
開發者ID:arievanwi,項目名稱:osgi.ee,代碼行數:35,代碼來源:WeldContainer.java

示例5: apply

import org.jboss.weld.bootstrap.spi.BeansXml; //導入依賴的package包/類
@Override
public BeansXml apply(final BeansXml beansXml) {
    return new WrappedBeansXml(beansXml);
}
 
開發者ID:dajudge,項目名稱:testee.fi,代碼行數:5,代碼來源:NoPostConstructBeansXmlModifier.java

示例6: WrappedBeansXml

import org.jboss.weld.bootstrap.spi.BeansXml; //導入依賴的package包/類
public WrappedBeansXml(final BeansXml beansXml) {
    this.beansXml = beansXml;
}
 
開發者ID:dajudge,項目名稱:testee.fi,代碼行數:4,代碼來源:WrappedBeansXml.java

示例7: getBeansXml

import org.jboss.weld.bootstrap.spi.BeansXml; //導入依賴的package包/類
@Override
public BeansXml getBeansXml() {
    return modifier.apply(delegate.getBeansXml());
}
 
開發者ID:dajudge,項目名稱:testee.fi,代碼行數:5,代碼來源:WrappedBeanDeploymentArchive.java

示例8: getBeansXml

import org.jboss.weld.bootstrap.spi.BeansXml; //導入依賴的package包/類
@Override
public BeansXml getBeansXml() {
    return beansXml;
}
 
開發者ID:dajudge,項目名稱:testee.fi,代碼行數:5,代碼來源:BeanDeploymentArchiveImpl.java

示例9: BundleBeanDeploymentArchive

import org.jboss.weld.bootstrap.spi.BeansXml; //導入依賴的package包/類
public BundleBeanDeploymentArchive(Bundle b, BeansXml beanFiles) {
    this.bundle = b;
    services.add(ResourceLoader.class, new BundleResourceLoader(bundle));
    this.beanFiles = (beanFiles == null) ? BeansXml.EMPTY_BEANS_XML : beanFiles;
}
 
開發者ID:arievanwi,項目名稱:osgi.ee,代碼行數:6,代碼來源:BundleBeanDeploymentArchive.java

示例10: getBeansXml

import org.jboss.weld.bootstrap.spi.BeansXml; //導入依賴的package包/類
@Override
public BeansXml getBeansXml() {
    return beanFiles;
}
 
開發者ID:arievanwi,項目名稱:osgi.ee,代碼行數:5,代碼來源:BundleBeanDeploymentArchive.java

示例11: OurDeployment

import org.jboss.weld.bootstrap.spi.BeansXml; //導入依賴的package包/類
/**
 * Construct this deployment.
 * 
 * @param toExtend The bundle we are extending
 * @param beansXml The beans file definition
 * @param extensions The extensions to return
 */
OurDeployment(Bundle toExtend, BeansXml beansXml, Iterable<Metadata<Extension>> extensions) {
    this.extensions = extensions;
    services = new SimpleServiceRegistry();
    services.add(ProxyServices.class, new BundleProxyService(toExtend));
    archive = new BundleBeanDeploymentArchive(toExtend, beansXml);
}
 
開發者ID:arievanwi,項目名稱:osgi.ee,代碼行數:14,代碼來源:OurDeployment.java


注:本文中的org.jboss.weld.bootstrap.spi.BeansXml類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。