Skip to main content

routee_compass/plugin/output/default/uuid/
builder.rs

1use super::plugin::UUIDOutputPlugin;
2use crate::{
3    app::compass::CompassComponentError,
4    plugin::{
5        output::{OutputPlugin, OutputPluginBuilder},
6        PluginError,
7    },
8};
9use routee_compass_core::config::ConfigJsonExtensions;
10use std::sync::Arc;
11
12pub struct UUIDOutputPluginBuilder {}
13
14impl OutputPluginBuilder for UUIDOutputPluginBuilder {
15    fn build(
16        &self,
17        parameters: &serde_json::Value,
18    ) -> Result<Arc<dyn OutputPlugin>, CompassComponentError> {
19        let uuid_filename = parameters.get_config_path(&"uuid_input_file", &"uuid")?;
20
21        let uuid_plugin = UUIDOutputPlugin::from_file(&uuid_filename).map_err(|e| {
22            let pe = PluginError::OutputPluginFailed { source: e };
23            CompassComponentError::PluginError(pe)
24        })?;
25        Ok(Arc::new(uuid_plugin))
26    }
27}