本文整理匯總了Java中org.apache.camel.CamelContext.getComponent方法的典型用法代碼示例。如果您正苦於以下問題:Java CamelContext.getComponent方法的具體用法?Java CamelContext.getComponent怎麽用?Java CamelContext.getComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.camel.CamelContext
的用法示例。
在下文中一共展示了CamelContext.getComponent方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getComponentVerifierExtension
import org.apache.camel.CamelContext; //導入方法依賴的package包/類
private ComponentVerifierExtension getComponentVerifierExtension(CamelContext context, String scheme) {
if (verifierExtension == null) {
synchronized (this) {
if (verifierExtension == null) {
Component component = context.getComponent(scheme, true, false);
if (component == null) {
log.error("Component {} does not exist", scheme);
} else {
verifierExtension = component.getExtension(verifierExtensionClass).orElse(null);
if (verifierExtension == null) {
log.warn("Component {} does not support verifier extension", scheme);
}
}
}
}
}
return verifierExtension;
}
示例2: ping
import org.apache.camel.CamelContext; //導入方法依賴的package包/類
public void ping() throws Exception {
// need to create Camel
CamelContext camel = new DefaultCamelContext();
// get the connector to use
Component mention = camel.getComponent("salesforce-upsert-contact-connector");
Optional<ComponentVerifierExtension> ext = mention.getExtension(ComponentVerifierExtension.class);
// the connector must support ping check if its verifiable
if (ext.isPresent()) {
ComponentVerifierExtension verifier = ext.get();
Map<String, Object> parameters = loadParameters();
ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);
System.out.println("=============================================");
System.out.println("");
System.out.println("Ping check result: " + result.getStatus());
System.out.println("");
System.out.println("=============================================");
} else {
System.out.println("Component does not support ping check");
}
}
示例3: ping
import org.apache.camel.CamelContext; //導入方法依賴的package包/類
public void ping() throws Exception {
// need to create Camel
CamelContext camel = new DefaultCamelContext();
// get the connector to use
Component mention = camel.getComponent("twitter-mention-connector");
Optional<ComponentVerifierExtension> ext = mention.getExtension(ComponentVerifierExtension.class);
// the connector must support ping check if its verifiable
if (ext.isPresent()) {
ComponentVerifierExtension verifier = ext.get();
Map<String, Object> parameters = loadParameters();
ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);
System.out.println("=============================================");
System.out.println("");
System.out.println("Ping check result: " + result.getStatus());
System.out.println("");
System.out.println("=============================================");
} else {
System.out.println("Component does not support ping check");
}
}
示例4: ping
import org.apache.camel.CamelContext; //導入方法依賴的package包/類
public void ping() throws Exception {
// need to create Camel
CamelContext camel = new DefaultCamelContext();
// get the connector to use
Component get = camel.getComponent("http-get-connector");
Optional<ComponentVerifierExtension> ext = get.getExtension(ComponentVerifierExtension.class);
// the connector must support ping check if its verifiable
if (ext.isPresent()) {
ComponentVerifierExtension verifier = ext.get();
Map<String, Object> parameters = loadParameters();
ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);
System.out.println("=============================================");
System.out.println("");
System.out.println("Ping check result: " + result.getStatus());
System.out.println("");
System.out.println("=============================================");
} else {
System.out.println("Component does not support ping check");
}
}
示例5: initProperties
import org.apache.camel.CamelContext; //導入方法依賴的package包/類
private static void initProperties(CamelContext context,
IPropertiesAware applicationPropertiesAware,
IPropertiesAware servicePropertiesAware) {
try {
PropertiesComponent propertiesComponent = context.getComponent(
"properties", PropertiesComponent.class);
propertiesComponent.setIgnoreMissingLocation(true);
String applicationPrefix = applicationPropertiesAware.getpropertiesPrefix();
String servicePrefix = null;
if(servicePropertiesAware != null) {
servicePrefix = applicationPrefix + "." + servicePropertiesAware.getpropertiesPrefix();
}
Properties applicationProperties =
loadProperties(applicationPrefix, applicationPropertiesAware);
Properties serviceProperties =
loadProperties(servicePrefix, servicePropertiesAware);
Properties initialServiceProperties = new Properties();
if(servicePropertiesAware != null){
initialServiceProperties = MapUtils.prefixProperties(servicePrefix, servicePropertiesAware.getInitialProperties());
}
Properties initialApplicationProperties = new Properties();
if(servicePropertiesAware != null){
initialApplicationProperties = MapUtils.prefixProperties(applicationPrefix, applicationPropertiesAware.getInitialProperties());
}
Properties mergedProps = MapUtils.mergeProperties(
applicationProperties,
serviceProperties);
mergedProps = MapUtils.mergeProperties(
initialApplicationProperties,
mergedProps);
mergedProps =MapUtils.mergeProperties(
initialServiceProperties,
mergedProps);
propertiesComponent.setInitialProperties(mergedProps);
} catch (Exception ex) {
throw new RuntimeException("could not initialize application properties", ex);
}
}
示例6: ping
import org.apache.camel.CamelContext; //導入方法依賴的package包/類
public void ping() throws Exception {
// need to create Camel
CamelContext camel = new DefaultCamelContext();
camel.start();
// get the connector to use
Component sqlstored = camel.getComponent("sql-stored-connector");
// the connector must support ping check if its verifiable
Optional<SqlStoredConnectorVerifierExtension> vce = sqlstored.getExtension(SqlStoredConnectorVerifierExtension.class);
if (vce.isPresent()) {
ComponentVerifierExtension verifier = vce.get();
Map<String, Object> parameters = loadParameters();
ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.PARAMETERS, parameters);
System.out.println("=============================================");
System.out.println("");
System.out.println("Parameters check result: " + result.getStatus());
if (result.getStatus().equals(Result.Status.ERROR)) {
System.out.println(result.getErrors());
}
System.out.println("");
System.out.println("=============================================");
ComponentVerifierExtension.Result result2 = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);
System.out.println("=============================================");
System.out.println("");
System.out.println("Ping check result: " + result2.getStatus());
if (result2.getStatus().equals(Result.Status.ERROR)) {
System.out.println(result2.getErrors());
}
System.out.println("");
System.out.println("=============================================");
} else {
System.out.println("Component does not support ping check");
}
camel.stop();
}