Search in sources :

Example 46 with ConditionalOnClass

use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.

the class SalesforceUpsertContactConnectorAutoConfiguration method configureSalesforceUpsertContactComponent.

@Lazy
@Bean(name = "salesforce-upsert-contact-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(org.foo.salesforce.contact.SalesforceUpsertContactComponent.class)
public SalesforceUpsertContactComponent configureSalesforceUpsertContactComponent(CamelContext camelContext, SalesforceUpsertContactConnectorConfiguration configuration) throws Exception {
    SalesforceUpsertContactComponent connector = new SalesforceUpsertContactComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null, false);
    IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), connector, parameters);
    connector.setComponentOptions(parameters);
    return connector;
}
Also used : HashMap(java.util.HashMap) SalesforceUpsertContactComponent(org.foo.salesforce.contact.SalesforceUpsertContactComponent) Lazy(org.springframework.context.annotation.Lazy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 47 with ConditionalOnClass

use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.

the class TwitterMentionConnectorAutoConfiguration method configureTwitterMentionComponent.

@Lazy
@Bean(name = "twitter-mention-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(org.foo.mention.TwitterMentionComponent.class)
public TwitterMentionComponent configureTwitterMentionComponent(CamelContext camelContext, TwitterMentionConnectorConfiguration configuration) throws Exception {
    TwitterMentionComponent connector = new TwitterMentionComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null, false);
    IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), connector, parameters);
    connector.setComponentOptions(parameters);
    return connector;
}
Also used : HashMap(java.util.HashMap) TwitterMentionComponent(org.foo.mention.TwitterMentionComponent) Lazy(org.springframework.context.annotation.Lazy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 48 with ConditionalOnClass

use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.

the class ICalDataFormatAutoConfiguration method configureICalDataFormatFactory.

@Bean(name = "ical-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(ICalDataFormat.class)
public DataFormatFactory configureICalDataFormatFactory(final CamelContext camelContext, final ICalDataFormatConfiguration configuration) {
    return new DataFormatFactory() {

        public DataFormat newInstance() {
            ICalDataFormat dataformat = new ICalDataFormat();
            if (CamelContextAware.class.isAssignableFrom(ICalDataFormat.class)) {
                CamelContextAware contextAware = CamelContextAware.class.cast(dataformat);
                if (contextAware != null) {
                    contextAware.setCamelContext(camelContext);
                }
            }
            try {
                Map<String, Object> parameters = new HashMap<>();
                IntrospectionSupport.getProperties(configuration, parameters, null, false);
                IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), dataformat, parameters);
            } catch (Exception e) {
                throw new RuntimeCamelException(e);
            }
            return dataformat;
        }
    };
}
Also used : DataFormatFactory(org.apache.camel.spi.DataFormatFactory) CamelContextAware(org.apache.camel.CamelContextAware) HashMap(java.util.HashMap) ICalDataFormat(org.apache.camel.component.ical.ICalDataFormat) RuntimeCamelException(org.apache.camel.RuntimeCamelException) RuntimeCamelException(org.apache.camel.RuntimeCamelException) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 49 with ConditionalOnClass

use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.

the class InfluxDbComponentAutoConfiguration method configureInfluxDbComponent.

@Lazy
@Bean(name = "influxdb-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(InfluxDbComponent.class)
public InfluxDbComponent configureInfluxDbComponent(CamelContext camelContext) throws Exception {
    InfluxDbComponent component = new InfluxDbComponent();
    component.setCamelContext(camelContext);
    return component;
}
Also used : InfluxDbComponent(org.apache.camel.component.influxdb.InfluxDbComponent) Lazy(org.springframework.context.annotation.Lazy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 50 with ConditionalOnClass

use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.

the class IrcComponentAutoConfiguration method configureIrcComponent.

@Lazy
@Bean(name = "irc-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(IrcComponent.class)
public IrcComponent configureIrcComponent(CamelContext camelContext) throws Exception {
    IrcComponent component = new IrcComponent();
    component.setCamelContext(camelContext);
    return component;
}
Also used : IrcComponent(org.apache.camel.component.irc.IrcComponent) Lazy(org.springframework.context.annotation.Lazy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)296 Bean (org.springframework.context.annotation.Bean)296 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)295 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)290 Lazy (org.springframework.context.annotation.Lazy)223 HashMap (java.util.HashMap)183 Map (java.util.Map)106 CamelContextAware (org.apache.camel.CamelContextAware)69 RuntimeCamelException (org.apache.camel.RuntimeCamelException)45 DataFormatFactory (org.apache.camel.spi.DataFormatFactory)45 Scope (org.springframework.context.annotation.Scope)24 JavaScriptLanguage (org.apache.camel.builder.script.JavaScriptLanguage)1 PhpLanguage (org.apache.camel.builder.script.PhpLanguage)1 PythonLanguage (org.apache.camel.builder.script.PythonLanguage)1 RubyLanguage (org.apache.camel.builder.script.RubyLanguage)1 CoAPComponent (org.apache.camel.coap.CoAPComponent)1 AhcComponent (org.apache.camel.component.ahc.AhcComponent)1 WsComponent (org.apache.camel.component.ahc.ws.WsComponent)1 AMQPComponent (org.apache.camel.component.amqp.AMQPComponent)1 ApnsComponent (org.apache.camel.component.apns.ApnsComponent)1