use of io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem in project camel-quarkus by apache.
the class PubnubProcessor method registerProxyInterfaces.
@BuildStep
void registerProxyInterfaces(BuildProducer<NativeImageProxyDefinitionBuildItem> proxyDefinitions, CombinedIndexBuildItem combinedIndex) {
IndexView index = combinedIndex.getIndex();
index.getKnownClasses().stream().map(classInfo -> classInfo.name().toString()).filter(name -> name.startsWith("com.pubnub.api.services")).map(NativeImageProxyDefinitionBuildItem::new).forEach(proxyDefinitions::produce);
}
use of io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem in project camel-quarkus by apache.
the class InjectionPointsProcessor method produceBeans.
void produceBeans(CamelRecorder recorder, List<CapabilityBuildItem> capabilities, BuildProducer<SyntheticBeanBuildItem> syntheticBeans, BuildProducer<NativeImageProxyDefinitionBuildItem> proxyDefinitions, AtomicReference<Boolean> beanCapabilityAvailable, AnnotationInstance annot, final DotName fieldType, String annotationTarget, DotName declaringClass) {
try {
Class<?> clazz = Class.forName(fieldType.toString(), false, Thread.currentThread().getContextClassLoader());
if (ProducerTemplate.class.isAssignableFrom(clazz)) {
syntheticBeans.produce(SyntheticBeanBuildItem.configure(fieldType).setRuntimeInit().scope(Singleton.class).supplier(recorder.createProducerTemplate(annot.value().asString())).addQualifier(annot).done());
/*
* Note that ProducerTemplate injection points not having @EndpointInject are produced via
* CamelProducers.camelProducerTemplate()
*/
} else if (FluentProducerTemplate.class.isAssignableFrom(clazz)) {
syntheticBeans.produce(SyntheticBeanBuildItem.configure(fieldType).setRuntimeInit().scope(Singleton.class).supplier(recorder.createFluentProducerTemplate(annot.value().asString())).addQualifier(annot).done());
/*
* Note that FluentProducerTemplate injection points not having @EndpointInject are produced via
* CamelProducers.camelFluentProducerTemplate()
*/
} else if (clazz.isInterface()) {
if (beanCapabilityAvailable.get() == null) {
beanCapabilityAvailable.set(capabilities.stream().map(CapabilityBuildItem::getName).anyMatch(feature -> CamelCapabilities.BEAN.equals(feature)));
}
if (!beanCapabilityAvailable.get()) {
throw new IllegalStateException("Add camel-quarkus-bean dependency to be able to use @org.apache.camel.Produce on fields with interface type: " + fieldType.toString() + " " + annotationTarget + " in " + declaringClass.toString());
}
proxyDefinitions.produce(new NativeImageProxyDefinitionBuildItem(fieldType.toString()));
syntheticBeans.produce(SyntheticBeanBuildItem.configure(fieldType).setRuntimeInit().scope(Singleton.class).supplier(recorder.produceProxy(clazz, annot.value().asString())).addQualifier(annot).done());
}
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
use of io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem in project camel-quarkus by apache.
the class XchangeProcessor method registerProxyClasses.
@BuildStep
void registerProxyClasses(BuildProducer<NativeImageProxyDefinitionBuildItem> nativeImageProxy, CombinedIndexBuildItem combinedIndexBuildItem) {
// Some xchange libraries use JAX-RS proxies to interact with the exchange APIs so we need to register them
IndexView index = combinedIndexBuildItem.getIndex();
index.getAnnotations(DotName.createSimple("javax.ws.rs.Path")).stream().map(AnnotationInstance::target).filter(target -> target.kind().equals(AnnotationTarget.Kind.CLASS)).map(AnnotationTarget::asClass).filter(classInfo -> Modifier.isInterface(classInfo.flags())).map(classInfo -> classInfo.name().toString()).filter(className -> className.startsWith("org.knowm.xchange")).map(NativeImageProxyDefinitionBuildItem::new).forEach(nativeImageProxy::produce);
}
use of io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem in project camel-quarkus by apache.
the class SpringRabbitmqProcessor method initProxies.
@BuildStep
void initProxies(BuildProducer<NativeImageProxyDefinitionBuildItem> proxies) {
proxies.produce(new NativeImageProxyDefinitionBuildItem(ChannelProxy.class.getCanonicalName()));
proxies.produce(new NativeImageProxyDefinitionBuildItem("org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer$ContainerDelegate", SpringProxy.class.getCanonicalName(), Advised.class.getCanonicalName(), DecoratingProxy.class.getCanonicalName()));
}
use of io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem in project quarkus-mybatis by quarkiverse.
the class MyBatisProcessor method addMyBatisMappers.
@BuildStep
@Overridable
void addMyBatisMappers(BuildProducer<MyBatisMapperBuildItem> mappers, BuildProducer<ReflectiveClassBuildItem> reflective, BuildProducer<NativeImageProxyDefinitionBuildItem> proxy, CombinedIndexBuildItem indexBuildItem) {
for (AnnotationInstance i : indexBuildItem.getIndex().getAnnotations(MYBATIS_MAPPER)) {
if (i.target().kind() == AnnotationTarget.Kind.CLASS) {
DotName dotName = i.target().asClass().name();
reflective.produce(new ReflectiveClassBuildItem(true, false, dotName.toString()));
proxy.produce(new NativeImageProxyDefinitionBuildItem(dotName.toString()));
Optional<AnnotationInstance> mapperDatasource = i.target().asClass().annotations().entrySet().stream().filter(entry -> entry.getKey().equals(MYBATIS_MAPPER_DATA_SOURCE)).map(Map.Entry::getValue).map(annotationList -> annotationList.get(0)).findFirst();
if (mapperDatasource.isPresent()) {
String dataSourceName = mapperDatasource.get().value().asString();
mappers.produce(new MyBatisMapperBuildItem(dotName, dataSourceName));
} else {
mappers.produce(new MyBatisMapperBuildItem(dotName, "<default>"));
}
}
}
}
Aggregations