本文整理了Java中org.apache.camel.spi.Registry.lookupByNameAndType
方法的一些代码示例,展示了Registry.lookupByNameAndType
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Registry.lookupByNameAndType
方法的具体详情如下:
包路径:org.apache.camel.spi.Registry
类名称:Registry
方法名:lookupByNameAndType
暂无
代码示例来源:origin: org.apache.camel/camel-spring
endpoint = camelContext.getRegistry().lookupByNameAndType(getServiceRef(), Endpoint.class);
} else {
endpoint = camelContext.getEndpoint(getServiceUrl());
代码示例来源:origin: OpenWiseSolutions/openhub-framework
@Override
public <T> T lookupByNameAndType(String name, Class<T> type) {
for (Registry registry : applicationContextsRegistry.values()) {
T result = registry.lookupByNameAndType(name, type);
if (result != null) {
return result;
}
}
return null;
}
代码示例来源:origin: camelinaction/camelinaction
public OrderCreateTable(CamelContext camelContext) {
DataSource ds = camelContext.getRegistry().lookupByNameAndType("myDataSource", DataSource.class);
JdbcTemplate jdbc = new JdbcTemplate(ds);
try {
jdbc.execute("drop table riders_order");
} catch (Exception e) {
// ignore as the table may not already exists
}
jdbc.execute("create table riders_order "
+ "( customer_id varchar(10), ref_no varchar(10), part_id varchar(10), amount varchar(10) )");
}
代码示例来源:origin: camelinaction/camelinaction2
public OrderCreateTable(CamelContext camelContext) {
DataSource ds = camelContext.getRegistry().lookupByNameAndType("myDataSource", DataSource.class);
JdbcTemplate jdbc = new JdbcTemplate(ds);
try {
jdbc.execute("drop table riders_order");
} catch (Exception e) {
// ignore as the table may not already exists
}
jdbc.execute("create table riders_order "
+ "( customer_id varchar(10), ref_no varchar(10), part_id varchar(10), amount varchar(10) )");
}
代码示例来源:origin: org.apache.camel/camel-metrics
MetricRegistry getMetricRegistryFromCamelRegistry(Registry camelRegistry, String registryName) {
MetricRegistry registry = camelRegistry.lookupByNameAndType(registryName, MetricRegistry.class);
if (registry != null) {
return registry;
} else {
Set<MetricRegistry> registries = camelRegistry.findByType(MetricRegistry.class);
if (registries.size() == 1) {
return registries.iterator().next();
}
}
return null;
}
代码示例来源:origin: org.apache.camel/camel-micrometer
public static MeterRegistry getMeterRegistryFromCamelRegistry(Registry camelRegistry, String registryName) {
MeterRegistry registry = camelRegistry.lookupByNameAndType(registryName, MeterRegistry.class);
if (registry != null) {
return registry;
} else {
Set<MeterRegistry> registries = camelRegistry.findByType(MeterRegistry.class);
if (registries.size() == 1) {
return registries.iterator().next();
}
}
return null;
}
代码示例来源:origin: org.apache.camel/camel-mongodb
/**
* Set the {@link WriteConcern} for write operations on MongoDB, passing in the bean ref to a custom WriteConcern which exists in the Registry.
* You can also use standard WriteConcerns by passing in their key. See the {@link #setWriteConcern(String) setWriteConcern} method.
*
* @param writeConcernRef the name of the bean in the registry that represents the WriteConcern to use
*/
public void setWriteConcernRef(String writeConcernRef) {
WriteConcern wc = this.getCamelContext().getRegistry().lookupByNameAndType(writeConcernRef, WriteConcern.class);
if (wc == null) {
String msg = "Camel MongoDB component could not find the WriteConcern in the Registry. Verify that the "
+ "provided bean name (" + writeConcernRef + ") is correct. Aborting initialization.";
throw new IllegalArgumentException(msg);
}
this.writeConcernRef = wc;
}
代码示例来源:origin: org.apache.camel/camel-crypto
/**
* Sets the reference name for a PrivateKey that can be fond in the registry.
*/
public void setPrivateKeyName(String privateKeyName) {
if (context != null && privateKeyName != null) {
PrivateKey pk = context.getRegistry().lookupByNameAndType(privateKeyName, PrivateKey.class);
if (pk != null) {
setPrivateKey(pk);
}
}
if (privateKeyName != null) {
this.privateKeyName = privateKeyName;
}
}
代码示例来源:origin: org.apache.camel/camel-blueprint
@Override
public DataFormat resolveDataFormat(String name, CamelContext context) {
DataFormat dataFormat = null;
DataFormatResolver resolver = context.getRegistry().lookupByNameAndType(".camelBlueprint.dataformatResolver." + name, DataFormatResolver.class);
if (resolver != null) {
LOG.debug("Found dataformat resolver: {} in registry: {}", name, resolver);
dataFormat = resolver.resolveDataFormat(name, context);
}
if (dataFormat == null) {
dataFormat = super.resolveDataFormat(name, context);
}
return dataFormat;
}
代码示例来源:origin: org.apache.camel/camel-blueprint
@Override
public DataFormat createDataFormat(String name, CamelContext context) {
DataFormatFactory factory = context.getRegistry().lookupByNameAndType(".camelBlueprint.dataformatFactory." + name, DataFormatFactory.class);
if (factory != null) {
LOG.debug("Found dataformat factory: {} in registry: {}", name, factory);
return factory.newInstance();
}
return super.createDataFormat(name, context);
}
}
代码示例来源:origin: camelinaction/camelinaction2
@Override
protected void afterStart() throws Exception {
BookOrderExample example = getCamelContexts().get(0).getRegistry().lookupByNameAndType("bookOrderExample", BookOrderExample.class);
example.orderSomeBooks();
}
}
代码示例来源:origin: camelinaction/camelinaction2
public void insertOrder(InputOrder order, Registry registry) {
DataSource ds = registry.lookupByNameAndType("myDataSource", DataSource.class);
JdbcTemplate jdbc = new JdbcTemplate(ds);
Object[] args = new Object[] { order.getCustomerId(), order.getRefNo(), order.getPartId(), order.getAmount()};
jdbc.update("insert into riders_order (customer_id, ref_no, part_id, amount) values (?, ?, ?, ?)", args);
}
代码示例来源:origin: camelinaction/camelinaction
public void insertOrder(InputOrder order, Registry registry) {
DataSource ds = registry.lookupByNameAndType("myDataSource", DataSource.class);
JdbcTemplate jdbc = new JdbcTemplate(ds);
Object[] args = new Object[] { order.getCustomerId(), order.getRefNo(), order.getPartId(), order.getAmount()};
jdbc.update("insert into riders_order (customer_id, ref_no, part_id, amount) values (?, ?, ?, ?)", args);
}
代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-core
/**
* Creates a new {@link ValidatorAdapter} that adapts a
* {@link Validator} Spring bean identified by name
* <code>validatorBeanName</code>.
*
* @param validatorBeanName
* name of the {@link Validator} bean.
* @return an adapted {@link Validator} bean.
*/
public ValidatorAdapter validator(String validatorBeanName) {
return new ValidatorAdapter(routeBuilder.getContext().getRegistry()
.lookupByNameAndType(validatorBeanName, Validator.class));
}
代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-core
/**
* Creates a new {@link ParserAdapter} that adapts a
* {@link Parser} Spring bean identified by name
* <code>parserBeanName</code>.
*
* @param parserBeanName
* name of the {@link Parser} bean.
* @return an adapted {@link Parser} bean.
*/
public ParserAdapter parser(String parserBeanName) {
return new ParserAdapter(routeBuilder.getContext().getRegistry()
.lookupByNameAndType(parserBeanName, Parser.class));
}
代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-core
/**
* Creates a new {@link PredicateAdapter} that adapts a {@link Predicate}
* Spring bean identified by name <code>predicateBeanName</code>.
*
* @param predicateBeanName
* name of the {@link Predicate} bean.
* @return an adapted {@link Predicate} bean.
*/
public PredicateAdapter predicate(String predicateBeanName) {
return new PredicateAdapter(routeBuilder.getContext().getRegistry()
.lookupByNameAndType(predicateBeanName, Predicate.class));
}
代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-core
/**
* Creates a new {@link ConverterAdapter} that adapts a
* {@link Converter} Spring bean identified by name
* <code>converterBeanName</code>.
*
* @param converterBeanName
* name of the {@link Converter} bean.
* @return an adapted {@link Converter} bean.
*/
public ConverterAdapter converter(String converterBeanName) {
return new ConverterAdapter(routeBuilder.getContext().getRegistry()
.lookupByNameAndType(converterBeanName, Converter.class));
}
代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-core
/**
* Creates a new {@link RendererAdapter} that adapts a
* {@link Renderer} Spring bean identified by name
* <code>rendererBeanName</code>.
*
* @param rendererBeanName
* name of the {@link Renderer} bean.
* @return an adapted {@link Renderer} bean.
*/
public RendererAdapter renderer(String rendererBeanName) {
return new RendererAdapter(routeBuilder.getContext().getRegistry()
.lookupByNameAndType(rendererBeanName, Renderer.class));
}
代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-core
/**
* Creates a new {@link AggregatorAdapter} that adapts a
* {@link Aggregator} Spring bean identified by name
* <code>aggregatorBeanName</code>.
*
* @param aggregatorBeanName
* name of the {@link Aggregator} bean.
* @return an adapted {@link Aggregator} bean.
*/
public AggregatorAdapter aggregationStrategy(String aggregatorBeanName) {
return new AggregatorAdapter(routeBuilder.getContext().getRegistry()
.lookupByNameAndType(aggregatorBeanName, Aggregator.class));
}
代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-core
/**
* Creates a new {@link TransmogrifierAdapter} that adapts a
* {@link Transmogrifier} Spring bean identified by name
* <code>transmogrifierBeanName</code>.
*
* @param transmogrifierBeanName
* name of the {@link Transmogrifier} bean.
* @return an adapted {@link Transmogrifier} bean.
*/
public TransmogrifierAdapter transmogrifier(String transmogrifierBeanName) {
return new TransmogrifierAdapter(routeBuilder.getContext().getRegistry()
.lookupByNameAndType(transmogrifierBeanName, Transmogrifier.class));
}
内容来源于网络,如有侵权,请联系作者删除!