Search in sources :

Example 1 with Config

use of com.hortonworks.streamline.common.Config in project streamline by hortonworks.

the class StormTopologyDependenciesHandler method handleComponentMavenArtifactsConfigForStreamlineComponent.

private void handleComponentMavenArtifactsConfigForStreamlineComponent(StreamlineComponent streamlineComponent) {
    Config config = streamlineComponent.getConfig();
    if (config != null) {
        String componentMavenArtifacts = config.get(COMPONENT_CONFIG_KEY_MAVEN_ARTIFACTS, "");
        if (!componentMavenArtifacts.isEmpty()) {
            LOG.debug("Adding component dependency artifact: %s", componentMavenArtifacts);
            mavenArtifacts.add(componentMavenArtifacts);
        }
    }
}
Also used : Config(com.hortonworks.streamline.common.Config)

Example 2 with Config

use of com.hortonworks.streamline.common.Config in project streamline by hortonworks.

the class TopologyTestHelper method createStreamlineProcessor.

public static StreamlineProcessor createStreamlineProcessor(String id) {
    Stream stream = createDefaultStream();
    StreamlineProcessor processor = new StreamlineProcessor(Sets.newHashSet(stream));
    processor.setId(id);
    processor.setName("testProcessor_" + id);
    processor.setConfig(new Config());
    processor.setTransformationClass("dummyTransformation");
    return processor;
}
Also used : StreamlineProcessor(com.hortonworks.streamline.streams.layout.component.StreamlineProcessor) Config(com.hortonworks.streamline.common.Config) Stream(com.hortonworks.streamline.streams.layout.component.Stream)

Example 3 with Config

use of com.hortonworks.streamline.common.Config in project streamline by hortonworks.

the class TopologyTestHelper method createRulesProcessor.

public static RulesProcessor createRulesProcessor(String id) {
    RulesProcessor processor = new RulesProcessor();
    processor.setId(id);
    processor.setName("testRuleProcessor_" + id);
    processor.setConfig(new Config());
    processor.setTransformationClass("dummyTransformation");
    processor.setProcessAll(true);
    processor.setRules(Collections.emptyList());
    return processor;
}
Also used : RulesProcessor(com.hortonworks.streamline.streams.layout.component.impl.RulesProcessor) Config(com.hortonworks.streamline.common.Config)

Example 4 with Config

use of com.hortonworks.streamline.common.Config in project streamline by hortonworks.

the class TopologyComponentFactory method normalizationProcessorProvider.

private Map.Entry<String, Provider<StreamlineProcessor>> normalizationProcessorProvider() {
    Provider<StreamlineProcessor> provider = new Provider<StreamlineProcessor>() {

        @Override
        public StreamlineProcessor create(TopologyComponent component) {
            Config config = component.getConfig();
            Object typeObj = config.getAny(NormalizationProcessor.CONFIG_KEY_TYPE);
            Object normConfObj = config.getAny(NormalizationProcessor.CONFIG_KEY_NORMALIZATION);
            ObjectMapper objectMapper = new ObjectMapper();
            NormalizationProcessor.Type type = objectMapper.convertValue(typeObj, NormalizationProcessor.Type.class);
            Map<String, NormalizationConfig> normConfig = objectMapper.convertValue(normConfObj, new TypeReference<Map<String, NormalizationConfig>>() {
            });
            updateWithSchemas(component.getTopologyId(), component.getVersionId(), normConfig);
            Set<Stream> outputStreams;
            if (component instanceof TopologyOutputComponent) {
                outputStreams = createOutputStreams((TopologyOutputComponent) component);
            } else {
                throw new IllegalArgumentException("Component " + component + " must be an instance of TopologyOutputComponent");
            }
            if (outputStreams.size() != 1) {
                throw new IllegalArgumentException("Normalization component [" + component + "] must have only one output stream");
            }
            return new NormalizationProcessor(normConfig, outputStreams.iterator().next(), type);
        }
    };
    return new SimpleImmutableEntry<>(NORMALIZATION, provider);
}
Also used : TopologyComponent(com.hortonworks.streamline.streams.catalog.TopologyComponent) NormalizationConfig(com.hortonworks.streamline.streams.layout.component.impl.normalization.NormalizationConfig) Config(com.hortonworks.streamline.common.Config) NormalizationConfig(com.hortonworks.streamline.streams.layout.component.impl.normalization.NormalizationConfig) NormalizationProcessor(com.hortonworks.streamline.streams.layout.component.impl.normalization.NormalizationProcessor) StreamlineProcessor(com.hortonworks.streamline.streams.layout.component.StreamlineProcessor) TopologyOutputComponent(com.hortonworks.streamline.streams.catalog.TopologyOutputComponent) SimpleImmutableEntry(java.util.AbstractMap.SimpleImmutableEntry) TopologyStream(com.hortonworks.streamline.streams.catalog.TopologyStream) Stream(com.hortonworks.streamline.streams.layout.component.Stream) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 5 with Config

use of com.hortonworks.streamline.common.Config in project streamline by hortonworks.

the class TopologyComponent method setConfigData.

@JsonIgnore
public void setConfigData(String configData) throws Exception {
    if (!StringUtils.isEmpty(configData)) {
        ObjectMapper mapper = new ObjectMapper();
        config = mapper.readValue(configData, Config.class);
    }
}
Also used : Config(com.hortonworks.streamline.common.Config) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Aggregations

Config (com.hortonworks.streamline.common.Config)41 Cluster (com.hortonworks.streamline.streams.cluster.catalog.Cluster)25 Service (com.hortonworks.streamline.streams.cluster.catalog.Service)25 Test (org.junit.Test)24 ServiceConfiguration (com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration)15 ManualServiceRegistrar (com.hortonworks.streamline.streams.cluster.register.ManualServiceRegistrar)9 InputStream (java.io.InputStream)9 Component (com.hortonworks.streamline.streams.cluster.catalog.Component)8 Map (java.util.Map)8 ComponentProcess (com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 Constants (com.hortonworks.streamline.streams.cluster.Constants)5 ComponentPropertyPattern (com.hortonworks.streamline.streams.cluster.discovery.ambari.ComponentPropertyPattern)5 Collections (java.util.Collections)5 List (java.util.List)4 Collectors.toList (java.util.stream.Collectors.toList)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 ServiceConfigurations (com.hortonworks.streamline.streams.cluster.discovery.ambari.ServiceConfigurations)3 Stream (com.hortonworks.streamline.streams.layout.component.Stream)3 HashMap (java.util.HashMap)3