pub mod commands;
mod security;
pub mod template;
use std::sync::Arc;
macro_rules! register_bundle_empty {
($ctx:expr, $Bundle:ty) => {{
let key = <$Bundle as camel_component_api::ComponentBundle>::config_key();
match <$Bundle as camel_component_api::ComponentBundle>::from_toml(
::toml::Value::Table(::toml::map::Map::new()),
) {
Ok(bundle) => {
<$Bundle as camel_component_api::ComponentBundle>::register_all(
bundle,
&mut *$ctx,
);
}
Err(err) => {
tracing::warn!(
bundle = %key,
error = %err,
"lint catalog: empty-config build failed; skipping bundle (surfaces as unverified-scheme)"
);
}
}
}};
}
macro_rules! register_datasource_bundle_empty {
($ctx:expr, $Bundle:ty, $catalog:expr) => {{
let key = <$Bundle as camel_component_api::ComponentBundle>::config_key();
match <$Bundle as camel_component_api::ComponentBundle>::from_toml(
::toml::Value::Table(::toml::map::Map::new()),
) {
Ok(bundle) => {
let bundle = bundle.with_catalog(::std::sync::Arc::clone(&$catalog));
<$Bundle as camel_component_api::ComponentBundle>::register_all(
bundle,
&mut *$ctx,
);
}
Err(err) => {
tracing::warn!(
bundle = %key,
error = %err,
"lint catalog: empty-config build failed; skipping datasource bundle (surfaces as unverified-scheme)"
);
}
}
}};
}
pub fn register_builtin_components_for_lint(ctx: &mut camel_core::CamelContext) {
use camel_api::datasource::DatasourceCatalog;
use camel_core::datasource::RuntimeDatasourceCatalog;
ctx.register_component(camel_component_timer::TimerComponent::new());
ctx.register_component(camel_component_cron::CronComponent::new());
ctx.register_component(camel_component_log::LogComponent::new());
ctx.register_component(camel_component_direct::DirectComponent::new());
ctx.register_component(camel_component_seda::SedaComponent::new());
ctx.register_component(camel_component_mock::MockComponent::new());
ctx.register_component(camel_component_controlbus::ControlBusComponent::new());
ctx.register_component(camel_component_validator::ValidatorComponent::new());
ctx.register_component(camel_xslt::XsltComponent::default());
ctx.register_component(camel_xj::XjComponent::default());
let datasource_catalog: Arc<dyn DatasourceCatalog> = Arc::new(RuntimeDatasourceCatalog::new(
std::collections::HashMap::new(),
));
register_bundle_empty!(ctx, camel_component_http::HttpBundle);
#[cfg(feature = "http-static")]
register_bundle_empty!(ctx, camel_component_http::HttpStaticBundle);
register_bundle_empty!(ctx, camel_component_ws::WsBundle);
register_bundle_empty!(ctx, camel_component_file::FileBundle);
register_bundle_empty!(ctx, camel_component_container::ContainerBundle);
register_bundle_empty!(ctx, camel_template::TemplateBundle);
register_bundle_empty!(ctx, camel_master::MasterBundle);
register_bundle_empty!(ctx, camel_component_opensearch::OpenSearchBundle);
register_bundle_empty!(ctx, camel_component_redis::RedisBundle);
register_bundle_empty!(ctx, camel_component_jms::JmsBundle);
register_bundle_empty!(ctx, camel_component_cxf::CxfBundle);
register_datasource_bundle_empty!(ctx, camel_component_sql::SqlBundle, datasource_catalog);
#[cfg(feature = "surrealdb")]
register_datasource_bundle_empty!(
ctx,
camel_component_surrealdb::SurrealDbBundle,
datasource_catalog
);
#[cfg(feature = "kafka")]
register_bundle_empty!(ctx, camel_component_kafka::KafkaBundle);
#[cfg(feature = "mqtt")]
register_bundle_empty!(ctx, camel_component_mqtt::MqttBundle);
#[cfg(feature = "grpc")]
register_bundle_empty!(ctx, camel_component_grpc::GrpcBundle);
#[cfg(feature = "llm")]
register_bundle_empty!(ctx, camel_component_llm::LlmBundle);
}