Search in sources :

Example 1 with NifiFlowConnection

use of com.thinkbiganalytics.nifi.rest.model.flow.NifiFlowConnection in project kylo by Teradata.

the class NifiFlowCacheImpl method updateConnectionMap.

private void updateConnectionMap(Collection<ConnectionDTO> connections, boolean notifyClusterMembers) {
    Map<String, NifiFlowConnection> connectionIdToConnectionMap = new HashMap<>();
    if (connections != null) {
        connections.stream().forEach(connectionDTO -> {
            NifiFlowConnection nifiFlowConnection = NiFiFlowConnectionConverter.toNiFiFlowConnection(connectionDTO);
            if (nifiFlowConnection != null) {
                connectionIdToConnectionMap.put(nifiFlowConnection.getConnectionIdentifier(), nifiFlowConnection);
            }
        });
    }
    this.connectionIdToConnectionMap.putAll(toConnectionIdMap(connectionIdToConnectionMap.values()));
    if (connections != null) {
        Map<String, String> connectionIdToNameMap = connections.stream().collect(Collectors.toMap(conn -> conn.getId(), conn -> conn.getName()));
        connectionIdCacheNameMap.putAll(connectionIdToNameMap);
    }
    if (notifyClusterMembers) {
        if (nifiFlowCacheClusterManager.isClustered()) {
            nifiFlowCacheClusterManager.updateConnections(connections);
        }
        lastUpdated = DateTime.now();
    }
}
Also used : LoggerFactory(org.slf4j.LoggerFactory) ConnectionDTO(org.apache.nifi.web.api.dto.ConnectionDTO) NifiProcessUtil(com.thinkbiganalytics.nifi.rest.support.NifiProcessUtil) NifiFlowCacheSnapshot(com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheSnapshot) StringUtils(org.apache.commons.lang3.StringUtils) ProcessGroupDTO(org.apache.nifi.web.api.dto.ProcessGroupDTO) NifiConnectionUtil(com.thinkbiganalytics.nifi.rest.support.NifiConnectionUtil) Map(java.util.Map) NifiFlowProcessor(com.thinkbiganalytics.nifi.rest.model.flow.NifiFlowProcessor) MetadataAccess(com.thinkbiganalytics.metadata.api.MetadataAccess) NiFiProvenanceConstants(com.thinkbiganalytics.nifi.provenance.NiFiProvenanceConstants) KyloVersionProvider(com.thinkbiganalytics.metadata.api.app.KyloVersionProvider) ImmutableMap(com.google.common.collect.ImmutableMap) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ServicesApplicationStartup(com.thinkbiganalytics.app.ServicesApplicationStartup) NifiConnectionListener(com.thinkbiganalytics.feedmgr.nifi.NifiConnectionListener) Set(java.util.Set) Collectors(java.util.stream.Collectors) Executors(java.util.concurrent.Executors) NiFiFlowCacheConnectionData(com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheConnectionData) List(java.util.List) ProcessorDTO(org.apache.nifi.web.api.dto.ProcessorDTO) PostConstruct(javax.annotation.PostConstruct) NifiConnectionService(com.thinkbiganalytics.feedmgr.nifi.NifiConnectionService) ServicesApplicationStartupListener(com.thinkbiganalytics.app.ServicesApplicationStartupListener) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) NiFiFlowConnectionConverter(com.thinkbiganalytics.nifi.rest.model.flow.NiFiFlowConnectionConverter) Function(java.util.function.Function) ArrayList(java.util.ArrayList) Value(org.springframework.beans.factory.annotation.Value) HashSet(java.util.HashSet) Inject(javax.inject.Inject) Lists(com.google.common.collect.Lists) NiFiObjectCache(com.thinkbiganalytics.nifi.rest.NiFiObjectCache) NifiFlowProcessGroup(com.thinkbiganalytics.nifi.rest.model.flow.NifiFlowProcessGroup) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) RegisteredTemplate(com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate) Uninterruptibles(com.google.common.util.concurrent.Uninterruptibles) Logger(org.slf4j.Logger) DateTime(org.joda.time.DateTime) TemplateCreationHelper(com.thinkbiganalytics.nifi.feedmgr.TemplateCreationHelper) TimeUnit(java.util.concurrent.TimeUnit) AtomicLong(java.util.concurrent.atomic.AtomicLong) NiFiFlowCacheSync(com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheSync) NifiFlowConnection(com.thinkbiganalytics.nifi.rest.model.flow.NifiFlowConnection) Collections(java.util.Collections) LegacyNifiRestClient(com.thinkbiganalytics.nifi.rest.client.LegacyNifiRestClient) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) NifiFlowConnection(com.thinkbiganalytics.nifi.rest.model.flow.NifiFlowConnection)

Aggregations

ImmutableMap (com.google.common.collect.ImmutableMap)1 Lists (com.google.common.collect.Lists)1 Uninterruptibles (com.google.common.util.concurrent.Uninterruptibles)1 ServicesApplicationStartup (com.thinkbiganalytics.app.ServicesApplicationStartup)1 ServicesApplicationStartupListener (com.thinkbiganalytics.app.ServicesApplicationStartupListener)1 NifiConnectionListener (com.thinkbiganalytics.feedmgr.nifi.NifiConnectionListener)1 NifiConnectionService (com.thinkbiganalytics.feedmgr.nifi.NifiConnectionService)1 FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)1 RegisteredTemplate (com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate)1 MetadataAccess (com.thinkbiganalytics.metadata.api.MetadataAccess)1 KyloVersionProvider (com.thinkbiganalytics.metadata.api.app.KyloVersionProvider)1 NiFiFlowCacheConnectionData (com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheConnectionData)1 NiFiFlowCacheSync (com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheSync)1 NifiFlowCacheSnapshot (com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheSnapshot)1 TemplateCreationHelper (com.thinkbiganalytics.nifi.feedmgr.TemplateCreationHelper)1 NiFiProvenanceConstants (com.thinkbiganalytics.nifi.provenance.NiFiProvenanceConstants)1 NiFiObjectCache (com.thinkbiganalytics.nifi.rest.NiFiObjectCache)1 LegacyNifiRestClient (com.thinkbiganalytics.nifi.rest.client.LegacyNifiRestClient)1 NiFiFlowConnectionConverter (com.thinkbiganalytics.nifi.rest.model.flow.NiFiFlowConnectionConverter)1 NifiFlowConnection (com.thinkbiganalytics.nifi.rest.model.flow.NifiFlowConnection)1