本文整理汇总了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
);
}
}
示例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;
};
}
示例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;
}
});
}
示例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();
}
示例5: apply
import org.jboss.weld.bootstrap.spi.BeansXml; //导入依赖的package包/类
@Override
public BeansXml apply(final BeansXml beansXml) {
return new WrappedBeansXml(beansXml);
}
示例6: WrappedBeansXml
import org.jboss.weld.bootstrap.spi.BeansXml; //导入依赖的package包/类
public WrappedBeansXml(final BeansXml beansXml) {
this.beansXml = beansXml;
}
示例7: getBeansXml
import org.jboss.weld.bootstrap.spi.BeansXml; //导入依赖的package包/类
@Override
public BeansXml getBeansXml() {
return modifier.apply(delegate.getBeansXml());
}
示例8: getBeansXml
import org.jboss.weld.bootstrap.spi.BeansXml; //导入依赖的package包/类
@Override
public BeansXml getBeansXml() {
return beansXml;
}
示例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;
}
示例10: getBeansXml
import org.jboss.weld.bootstrap.spi.BeansXml; //导入依赖的package包/类
@Override
public BeansXml getBeansXml() {
return beanFiles;
}
示例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);
}