Search in sources :

Example 6 with TopologyBranchRule

use of com.hortonworks.streamline.streams.catalog.TopologyBranchRule in project streamline by hortonworks.

the class StreamCatalogService method removeTopologyDependencies.

private void removeTopologyDependencies(Long topologyId, Long versionId) throws Exception {
    List<QueryParam> topologyIdVersionIdQueryParams = WSUtils.buildTopologyIdAndVersionIdAwareQueryParams(topologyId, versionId, null);
    // remove topology test histories
    Collection<TopologyTestRunHistory> runHistories = listTopologyTestRunHistory(topologyId, versionId);
    runHistories.forEach(history -> removeTopologyTestRunHistory(history.getId()));
    // remove topology test run case
    Collection<TopologyTestRunCase> runCases = listTopologyTestRunCase(topologyIdVersionIdQueryParams);
    for (TopologyTestRunCase runCase : runCases) {
        Collection<TopologyTestRunCaseSource> runCaseSources = listTopologyTestRunCaseSource(runCase.getId());
        Collection<TopologyTestRunCaseSink> runCaseSinks = listTopologyTestRunCaseSink(runCase.getId());
        // remove topology test run case source
        for (TopologyTestRunCaseSource runCaseSource : runCaseSources) {
            removeTopologyTestRunCaseSource(runCaseSource.getId());
        }
        // remove topology test run case sink
        for (TopologyTestRunCaseSink runCaseSink : runCaseSinks) {
            removeTopologyTestRunCaseSink(runCaseSink.getId());
        }
        removeTestRunCase(topologyId, runCase.getId());
    }
    // remove edges
    Collection<TopologyEdge> edges = listTopologyEdges(topologyIdVersionIdQueryParams);
    for (TopologyEdge edge : edges) {
        removeTopologyEdge(topologyId, edge.getId(), versionId);
    }
    // remove rules
    Collection<TopologyRule> topologyRules = listRules(topologyIdVersionIdQueryParams);
    for (TopologyRule topologyRule : topologyRules) {
        removeRule(topologyId, topologyRule.getId(), versionId);
    }
    // remove windowed rules
    Collection<TopologyWindow> topologyWindows = listWindows(topologyIdVersionIdQueryParams);
    for (TopologyWindow topologyWindow : topologyWindows) {
        removeWindow(topologyId, topologyWindow.getId(), versionId);
    }
    // remove branch rules
    Collection<TopologyBranchRule> topologyBranchRules = listBranchRules(topologyIdVersionIdQueryParams);
    for (TopologyBranchRule topologyBranchRule : topologyBranchRules) {
        removeBranchRule(topologyId, topologyBranchRule.getId(), versionId);
    }
    // remove sinks
    Collection<TopologySink> sinks = listTopologySinks(topologyIdVersionIdQueryParams);
    for (TopologySink sink : sinks) {
        removeTopologySink(topologyId, sink.getId(), versionId, false);
    }
    // remove processors
    Collection<TopologyProcessor> processors = listTopologyProcessors(topologyIdVersionIdQueryParams);
    for (TopologyProcessor processor : processors) {
        removeTopologyProcessor(topologyId, processor.getId(), versionId, false);
    }
    // remove sources
    Collection<TopologySource> sources = listTopologySources(topologyIdVersionIdQueryParams);
    for (TopologySource source : sources) {
        removeTopologySource(topologyId, source.getId(), versionId, false);
    }
    // remove output streams
    Collection<TopologyStream> topologyStreams = listStreamInfos(topologyIdVersionIdQueryParams);
    for (TopologyStream topologyStream : topologyStreams) {
        removeStreamInfo(topologyId, topologyStream.getId(), versionId);
    }
    // remove topology editor metadata
    removeTopologyEditorMetadata(topologyId, versionId);
}
Also used : TopologyBranchRule(com.hortonworks.streamline.streams.catalog.TopologyBranchRule) TopologySource(com.hortonworks.streamline.streams.catalog.TopologySource) TopologyTestRunHistory(com.hortonworks.streamline.streams.catalog.TopologyTestRunHistory) TopologyRule(com.hortonworks.streamline.streams.catalog.TopologyRule) BaseTopologyRule(com.hortonworks.streamline.streams.catalog.BaseTopologyRule) TopologyEdge(com.hortonworks.streamline.streams.catalog.TopologyEdge) TopologyTestRunCase(com.hortonworks.streamline.streams.catalog.TopologyTestRunCase) TopologyTestRunCaseSource(com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSource) TopologyProcessor(com.hortonworks.streamline.streams.catalog.TopologyProcessor) TopologyWindow(com.hortonworks.streamline.streams.catalog.TopologyWindow) TopologySink(com.hortonworks.streamline.streams.catalog.TopologySink) TopologyStream(com.hortonworks.streamline.streams.catalog.TopologyStream) TopologyTestRunCaseSink(com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink) QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam)

Example 7 with TopologyBranchRule

use of com.hortonworks.streamline.streams.catalog.TopologyBranchRule in project streamline by hortonworks.

the class TopologyExportVisitor method createRuleHandlerMap.

private Map<String, RulesHandler> createRuleHandlerMap() {
    ImmutableMap.Builder<String, RulesHandler> rulesHandlerBuilder = ImmutableMap.builder();
    RulesHandler rulesHandler = new RulesHandler() {

        @Override
        public void handle(Rule rule) throws Exception {
            TopologyRule topologyRule = streamCatalogService.getRule(topologyId, rule.getId());
            topologyData.addRule(topologyRule);
        }
    };
    rulesHandlerBuilder.put(ComponentTypes.RULE, rulesHandler);
    rulesHandlerBuilder.put(ComponentTypes.PROJECTION, rulesHandler);
    rulesHandlerBuilder.put(ComponentTypes.BRANCH, new RulesHandler() {

        @Override
        public void handle(Rule rule) throws Exception {
            TopologyBranchRule topologyBranchRule = streamCatalogService.getBranchRule(topologyId, rule.getId());
            topologyData.addBranch(topologyBranchRule);
        }
    });
    rulesHandlerBuilder.put(ComponentTypes.WINDOW, new RulesHandler() {

        @Override
        public void handle(Rule rule) throws Exception {
            TopologyWindow topologyWindow = streamCatalogService.getWindow(topologyId, rule.getId());
            topologyData.addWindow(topologyWindow);
        }
    });
    return rulesHandlerBuilder.build();
}
Also used : TopologyWindow(com.hortonworks.streamline.streams.catalog.TopologyWindow) TopologyBranchRule(com.hortonworks.streamline.streams.catalog.TopologyBranchRule) Rule(com.hortonworks.streamline.streams.layout.component.rule.Rule) TopologyBranchRule(com.hortonworks.streamline.streams.catalog.TopologyBranchRule) TopologyRule(com.hortonworks.streamline.streams.catalog.TopologyRule) TopologyRule(com.hortonworks.streamline.streams.catalog.TopologyRule) ImmutableMap(com.google.common.collect.ImmutableMap)

Example 8 with TopologyBranchRule

use of com.hortonworks.streamline.streams.catalog.TopologyBranchRule in project streamline by hortonworks.

the class StreamCatalogService method getBranchRule.

public TopologyBranchRule getBranchRule(Long topologyId, Long ruleId, Long versionId) {
    TopologyBranchRule topologyBranchRule = new TopologyBranchRule();
    topologyBranchRule.setId(ruleId);
    topologyBranchRule.setVersionId(versionId);
    topologyBranchRule = dao.get(new StorableKey(TOPOLOGY_BRANCHRULEINFO_NAMESPACE, topologyBranchRule.getPrimaryKey()));
    if (topologyBranchRule == null || !topologyBranchRule.getTopologyId().equals(topologyId)) {
        return null;
    }
    topologyBranchRule.setVersionTimestamp(getVersionTimestamp(versionId));
    return topologyBranchRule;
}
Also used : StorableKey(com.hortonworks.registries.storage.StorableKey) TopologyBranchRule(com.hortonworks.streamline.streams.catalog.TopologyBranchRule)

Example 9 with TopologyBranchRule

use of com.hortonworks.streamline.streams.catalog.TopologyBranchRule in project streamline by hortonworks.

the class StreamCatalogService method doImportTopology.

private Topology doImportTopology(Topology newTopology, TopologyData topologyData) throws Exception {
    List<TopologySource> topologySources = topologyData.getSources();
    Map<Long, Long> oldToNewComponentIds = new HashMap<>();
    Map<Long, Long> oldToNewRuleIds = new HashMap<>();
    Map<Long, Long> oldToNewWindowIds = new HashMap<>();
    Map<Long, Long> oldToNewBranchRuleIds = new HashMap<>();
    Map<Long, Long> oldToNewStreamIds = new HashMap<>();
    // import source streams
    for (TopologySource topologySource : topologySources) {
        topologySource.setOutputStreamIds(importOutputStreams(newTopology.getId(), oldToNewStreamIds, topologySource.getOutputStreams()));
        topologySource.setOutputStreams(null);
    }
    // import processor streams
    for (TopologyProcessor topologyProcessor : topologyData.getProcessors()) {
        topologyProcessor.setOutputStreamIds(importOutputStreams(newTopology.getId(), oldToNewStreamIds, topologyProcessor.getOutputStreams()));
        topologyProcessor.setOutputStreams(null);
    }
    // import rules
    for (TopologyRule rule : topologyData.getRules()) {
        Long currentId = rule.getId();
        rule.setId(null);
        TopologyRule addedRule = addRule(newTopology.getId(), rule);
        oldToNewRuleIds.put(currentId, addedRule.getId());
    }
    // import windowed rules
    for (TopologyWindow window : topologyData.getWindows()) {
        Long currentId = window.getId();
        window.setId(null);
        TopologyWindow addedWindow = addWindow(newTopology.getId(), window);
        oldToNewWindowIds.put(currentId, addedWindow.getId());
    }
    // import branch rules
    for (TopologyBranchRule branchRule : topologyData.getBranchRules()) {
        Long currentId = branchRule.getId();
        branchRule.setId(null);
        TopologyBranchRule addedBranchRule = addBranchRule(newTopology.getId(), branchRule);
        oldToNewBranchRuleIds.put(currentId, addedBranchRule.getId());
    }
    // import sources
    for (TopologySource topologySource : topologySources) {
        Long oldComponentId = topologySource.getId();
        topologySource.setId(null);
        topologySource.setTopologyId(newTopology.getId());
        TopologyComponentBundle bundle = getCurrentTopologyComponentBundle(TopologyComponentBundle.TopologyComponentType.SOURCE, topologyData.getBundleIdToType().get(topologySource.getTopologyComponentBundleId().toString()));
        topologySource.setTopologyComponentBundleId(bundle.getId());
        addTopologySource(newTopology.getId(), topologySource);
        oldToNewComponentIds.put(oldComponentId, topologySource.getId());
    }
    // import processors
    for (TopologyProcessor topologyProcessor : topologyData.getProcessors()) {
        Long oldComponentId = topologyProcessor.getId();
        topologyProcessor.setId(null);
        topologyProcessor.setTopologyId(newTopology.getId());
        TopologyComponentBundle bundle;
        String subType = topologyData.getBundleIdToType().get(topologyProcessor.getTopologyComponentBundleId().toString());
        if (TopologyLayoutConstants.JSON_KEY_CUSTOM_PROCESSOR_SUB_TYPE.equals(subType)) {
            QueryParam queryParam = new QueryParam(CustomProcessorInfo.NAME, topologyProcessor.getConfig().get(CustomProcessorInfo.NAME));
            Collection<TopologyComponentBundle> result = listCustomProcessorBundlesWithFilter(Collections.singletonList(queryParam));
            if (result.size() != 1) {
                throw new IllegalStateException("Not able to find topology component bundle for custom processor :" + topologyProcessor.getConfig().get(CustomProcessorInfo.NAME));
            }
            bundle = result.iterator().next();
        } else {
            bundle = getCurrentTopologyComponentBundle(TopologyComponentBundle.TopologyComponentType.PROCESSOR, subType);
        }
        topologyProcessor.setTopologyComponentBundleId(bundle.getId());
        Optional<Object> ruleListObj = topologyProcessor.getConfig().getAnyOptional(RulesProcessor.CONFIG_KEY_RULES);
        ruleListObj.ifPresent(ruleList -> {
            List<Long> ruleIds = new ObjectMapper().convertValue(ruleList, new TypeReference<List<Long>>() {
            });
            List<Long> updatedRuleIds = new ArrayList<>();
            if (ComponentTypes.RULE.equals(bundle.getSubType()) || ComponentTypes.PROJECTION.equals(bundle.getSubType())) {
                ruleIds.forEach(ruleId -> updatedRuleIds.add(oldToNewRuleIds.get(ruleId)));
            } else if (bundle.getSubType().equals(ComponentTypes.BRANCH)) {
                ruleIds.forEach(ruleId -> updatedRuleIds.add(oldToNewBranchRuleIds.get(ruleId)));
            } else if (bundle.getSubType().equals(ComponentTypes.WINDOW)) {
                ruleIds.forEach(ruleId -> updatedRuleIds.add(oldToNewWindowIds.get(ruleId)));
            }
            topologyProcessor.getConfig().setAny(RulesProcessor.CONFIG_KEY_RULES, updatedRuleIds);
        });
        addTopologyProcessor(newTopology.getId(), topologyProcessor);
        oldToNewComponentIds.put(oldComponentId, topologyProcessor.getId());
    }
    // import sinks
    for (TopologySink topologySink : topologyData.getSinks()) {
        topologySink.setTopologyId(newTopology.getId());
        Long currentId = topologySink.getId();
        topologySink.setId(null);
        TopologyComponentBundle bundle = getCurrentTopologyComponentBundle(TopologyComponentBundle.TopologyComponentType.SINK, topologyData.getBundleIdToType().get(topologySink.getTopologyComponentBundleId().toString()));
        topologySink.setTopologyComponentBundleId(bundle.getId());
        if (bundle.getSubType().equals(NOTIFICATION)) {
            updateNotifierJarFileName(topologySink);
        }
        addTopologySink(newTopology.getId(), topologySink);
        oldToNewComponentIds.put(currentId, topologySink.getId());
    }
    // import edges
    for (TopologyEdge topologyEdge : topologyData.getEdges()) {
        List<StreamGrouping> streamGroupings = topologyEdge.getStreamGroupings();
        for (StreamGrouping streamGrouping : streamGroupings) {
            Long newStreamId = oldToNewStreamIds.get(streamGrouping.getStreamId());
            streamGrouping.setStreamId(newStreamId);
        }
        topologyEdge.setId(null);
        topologyEdge.setTopologyId(newTopology.getId());
        topologyEdge.setFromId(oldToNewComponentIds.get(topologyEdge.getFromId()));
        topologyEdge.setToId(oldToNewComponentIds.get(topologyEdge.getToId()));
        addTopologyEdge(newTopology.getId(), topologyEdge);
    }
    // import topology editor metadata
    TopologyEditorMetadata topologyEditorMetadata = topologyData.getTopologyEditorMetadata();
    topologyEditorMetadata.setTopologyId(newTopology.getId());
    if (topologyEditorMetadata.getData() != null) {
        TopologyUIData topologyUIData = new ObjectMapper().readValue(topologyEditorMetadata.getData(), TopologyUIData.class);
        topologyUIData.getSources().forEach(c -> c.setId(oldToNewComponentIds.get(c.getId())));
        topologyUIData.getProcessors().forEach(c -> c.setId(oldToNewComponentIds.get(c.getId())));
        topologyUIData.getSinks().forEach(c -> c.setId(oldToNewComponentIds.get(c.getId())));
        topologyEditorMetadata.setData(new ObjectMapper().writeValueAsString(topologyUIData));
    } else {
        topologyEditorMetadata.setData(StringUtils.EMPTY);
    }
    addTopologyEditorMetadata(newTopology.getId(), topologyData.getTopologyEditorMetadata());
    return newTopology;
}
Also used : Topology(com.hortonworks.streamline.streams.catalog.Topology) TopologyProcessorStreamMap(com.hortonworks.streamline.streams.catalog.TopologyProcessorStreamMap) Rule(com.hortonworks.streamline.streams.layout.component.rule.Rule) MLModelRegistryClient(com.hortonworks.streamline.registries.model.client.MLModelRegistryClient) UDAF(com.hortonworks.streamline.streams.rule.UDAF) Notifier(com.hortonworks.streamline.streams.catalog.Notifier) StringUtils(org.apache.commons.lang.StringUtils) Arrays(java.util.Arrays) Utils(com.hortonworks.streamline.common.util.Utils) QueryParam(com.hortonworks.registries.common.QueryParam) FileStorage(com.hortonworks.registries.common.util.FileStorage) UDAF2(com.hortonworks.streamline.streams.rule.UDAF2) Collections2(com.google.common.collect.Collections2) ComponentUISpecification(com.hortonworks.streamline.common.ComponentUISpecification) TopologyDag(com.hortonworks.streamline.streams.layout.component.TopologyDag) StreamGrouping(com.hortonworks.streamline.streams.catalog.TopologyEdge.StreamGrouping) ComponentConfigException(com.hortonworks.streamline.common.exception.ComponentConfigException) Matcher(java.util.regex.Matcher) TopologyEditorMetadata(com.hortonworks.streamline.streams.catalog.TopologyEditorMetadata) Map(java.util.Map) RuleParser(com.hortonworks.streamline.streams.catalog.rule.RuleParser) TopologyComponentBundle(com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) TopologyData(com.hortonworks.streamline.streams.catalog.topology.TopologyData) Set(java.util.Set) NOTIFICATION(com.hortonworks.streamline.common.ComponentTypes.NOTIFICATION) CURRENT_VERSION(com.hortonworks.streamline.common.util.WSUtils.CURRENT_VERSION) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) CustomProcessorInfo(com.hortonworks.streamline.streams.catalog.processor.CustomProcessorInfo) StorableKey(com.hortonworks.registries.storage.StorableKey) TopologyProcessor(com.hortonworks.streamline.streams.catalog.TopologyProcessor) Joiner(com.google.common.base.Joiner) TopologyState(com.hortonworks.streamline.streams.catalog.topology.state.TopologyState) ArrayList(java.util.ArrayList) Lists(com.google.common.collect.Lists) TopologySourceStreamMap(com.hortonworks.streamline.streams.catalog.TopologySourceStreamMap) Projection(com.hortonworks.streamline.streams.catalog.Projection) TopologyOutputComponent(com.hortonworks.streamline.streams.catalog.TopologyOutputComponent) TopologyRule(com.hortonworks.streamline.streams.catalog.TopologyRule) Nullable(javax.annotation.Nullable) TopologyVersion(com.hortonworks.streamline.streams.catalog.TopologyVersion) UDF(com.hortonworks.streamline.streams.catalog.UDF) IOException(java.io.IOException) TopologyTestRunCaseSource(com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSource) TopologyWindow(com.hortonworks.streamline.streams.catalog.TopologyWindow) TreeMap(java.util.TreeMap) File(com.hortonworks.streamline.streams.catalog.File) DigestInputStream(java.security.DigestInputStream) Preconditions(com.google.common.base.Preconditions) TopologyDagBuilder(com.hortonworks.streamline.streams.catalog.topology.component.TopologyDagBuilder) BiFunction(java.util.function.BiFunction) UDF4(com.hortonworks.streamline.streams.rule.UDF4) LoggerFactory(org.slf4j.LoggerFactory) UDF3(com.hortonworks.streamline.streams.rule.UDF3) UDF2(com.hortonworks.streamline.streams.rule.UDF2) UDF7(com.hortonworks.streamline.streams.rule.UDF7) UDF6(com.hortonworks.streamline.streams.rule.UDF6) RulesProcessor(com.hortonworks.streamline.streams.layout.component.impl.RulesProcessor) UDF5(com.hortonworks.streamline.streams.rule.UDF5) StreamlineEvent(com.hortonworks.streamline.streams.StreamlineEvent) BaseTopologyRule(com.hortonworks.streamline.streams.catalog.BaseTopologyRule) TopologyEdge(com.hortonworks.streamline.streams.catalog.TopologyEdge) WSUtils(com.hortonworks.streamline.common.util.WSUtils) TypeReference(com.fasterxml.jackson.core.type.TypeReference) TopologyStream(com.hortonworks.streamline.streams.catalog.TopologyStream) StorageUtils(com.hortonworks.registries.storage.util.StorageUtils) Function(com.google.common.base.Function) ImmutableSet(com.google.common.collect.ImmutableSet) TopologySink(com.hortonworks.streamline.streams.catalog.TopologySink) FileUtil(com.hortonworks.streamline.common.util.FileUtil) Collection(java.util.Collection) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) TopologySource(com.hortonworks.streamline.streams.catalog.TopologySource) List(java.util.List) Optional(java.util.Optional) Pattern(java.util.regex.Pattern) StorageManager(com.hortonworks.registries.storage.StorageManager) TopologyTestRunCaseSink(com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink) TopologyTestRunCase(com.hortonworks.streamline.streams.catalog.TopologyTestRunCase) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) TopologyLayoutConstants(com.hortonworks.streamline.streams.layout.TopologyLayoutConstants) MessageDigest(java.security.MessageDigest) TopologyUIData(com.hortonworks.streamline.streams.catalog.TopologyEditorMetadata.TopologyUIData) TopologyEditorToolbar(com.hortonworks.streamline.streams.catalog.TopologyEditorToolbar) HashMap(java.util.HashMap) Hex(org.apache.commons.codec.binary.Hex) ComponentTypes(com.hortonworks.streamline.common.ComponentTypes) Schema(com.hortonworks.registries.common.Schema) HashSet(java.util.HashSet) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) ImmutableList(com.google.common.collect.ImmutableList) CustomProcessorRuntime(com.hortonworks.streamline.streams.runtime.CustomProcessorRuntime) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam) TopologyExportVisitor(com.hortonworks.streamline.streams.catalog.topology.component.TopologyExportVisitor) Logger(org.slf4j.Logger) Stream(com.hortonworks.streamline.streams.layout.component.Stream) ProxyUtil(com.hortonworks.streamline.common.util.ProxyUtil) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) FileInputStream(java.io.FileInputStream) StorageException(com.hortonworks.registries.storage.exception.StorageException) TopologyBranchRule(com.hortonworks.streamline.streams.catalog.TopologyBranchRule) TopologyTestRunHistory(com.hortonworks.streamline.streams.catalog.TopologyTestRunHistory) TopologyComponent(com.hortonworks.streamline.streams.catalog.TopologyComponent) FluxComponent(com.hortonworks.streamline.streams.layout.storm.FluxComponent) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Collections(java.util.Collections) InputStream(java.io.InputStream) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) TopologyBranchRule(com.hortonworks.streamline.streams.catalog.TopologyBranchRule) TopologySource(com.hortonworks.streamline.streams.catalog.TopologySource) TopologyRule(com.hortonworks.streamline.streams.catalog.TopologyRule) BaseTopologyRule(com.hortonworks.streamline.streams.catalog.BaseTopologyRule) TopologyEdge(com.hortonworks.streamline.streams.catalog.TopologyEdge) TopologyUIData(com.hortonworks.streamline.streams.catalog.TopologyEditorMetadata.TopologyUIData) ArrayList(java.util.ArrayList) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) TopologyProcessor(com.hortonworks.streamline.streams.catalog.TopologyProcessor) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) StreamGrouping(com.hortonworks.streamline.streams.catalog.TopologyEdge.StreamGrouping) TopologyWindow(com.hortonworks.streamline.streams.catalog.TopologyWindow) TopologySink(com.hortonworks.streamline.streams.catalog.TopologySink) TopologyEditorMetadata(com.hortonworks.streamline.streams.catalog.TopologyEditorMetadata) QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam) TopologyComponentBundle(com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle)

Example 10 with TopologyBranchRule

use of com.hortonworks.streamline.streams.catalog.TopologyBranchRule in project streamline by hortonworks.

the class StreamCatalogService method removeBranchRule.

public TopologyBranchRule removeBranchRule(Long topologyId, Long id, Long versionId) throws Exception {
    TopologyBranchRule topologyBranchRule = getBranchRule(topologyId, id, versionId);
    if (topologyBranchRule != null) {
        topologyBranchRule = dao.remove(new StorableKey(TOPOLOGY_BRANCHRULEINFO_NAMESPACE, topologyBranchRule.getPrimaryKey()));
        topologyBranchRule.setVersionTimestamp(updateVersionTimestamp(versionId).getTimestamp());
    }
    return topologyBranchRule;
}
Also used : StorableKey(com.hortonworks.registries.storage.StorableKey) TopologyBranchRule(com.hortonworks.streamline.streams.catalog.TopologyBranchRule)

Aggregations

TopologyBranchRule (com.hortonworks.streamline.streams.catalog.TopologyBranchRule)12 Timed (com.codahale.metrics.annotation.Timed)5 TopologyRule (com.hortonworks.streamline.streams.catalog.TopologyRule)5 Path (javax.ws.rs.Path)5 TopologyWindow (com.hortonworks.streamline.streams.catalog.TopologyWindow)4 QueryParam (com.hortonworks.registries.common.QueryParam)3 StorableKey (com.hortonworks.registries.storage.StorableKey)3 WSUtils.buildEdgesFromQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam)3 WSUtils.buildEdgesToQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam)3 WSUtils.currentVersionQueryParam (com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam)3 WSUtils.versionIdQueryParam (com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam)3 BaseTopologyRule (com.hortonworks.streamline.streams.catalog.BaseTopologyRule)3 Rule (com.hortonworks.streamline.streams.layout.component.rule.Rule)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 TopologyEdge (com.hortonworks.streamline.streams.catalog.TopologyEdge)2 TopologyProcessor (com.hortonworks.streamline.streams.catalog.TopologyProcessor)2 TopologySink (com.hortonworks.streamline.streams.catalog.TopologySink)2 TopologySource (com.hortonworks.streamline.streams.catalog.TopologySource)2 TopologyTestRunCase (com.hortonworks.streamline.streams.catalog.TopologyTestRunCase)2 TopologyTestRunCaseSink (com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink)2