Search in sources :

Example 1 with NiFiFlowCacheConnectionData

use of com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheConnectionData in project kylo by Teradata.

the class NifiFlowCacheImpl method connectionDTOtoConnectionIdMap.

private Map<String, NiFiFlowCacheConnectionData> connectionDTOtoConnectionIdMap(Collection<ConnectionDTO> connections) {
    Map<String, NiFiFlowCacheConnectionData> connectionMap = new HashMap<>();
    connections.stream().forEach(conn -> {
        connectionMap.put(conn.getId(), new NiFiFlowCacheConnectionData(conn.getId(), conn.getName(), conn.getSource() != null ? conn.getSource().getId() : null, conn.getDestination() != null ? conn.getDestination().getId() : null));
    });
    return connectionMap;
}
Also used : NiFiFlowCacheConnectionData(com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheConnectionData) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap)

Example 2 with NiFiFlowCacheConnectionData

use of com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheConnectionData in project kylo by Teradata.

the class NifiFlowCacheImpl method syncAndReturnUpdates.

private NiFiFlowCacheSync syncAndReturnUpdates(NiFiFlowCacheSync sync, boolean preview) {
    if (!preview) {
        lastSyncTimeMap.put(sync.getSyncId(), DateTime.now());
    }
    if (isKyloClustered()) {
        applyClusterUpdates();
    }
    if (sync.needsUpdate(lastUpdated)) {
        Map<String, String> processorIdToFeedNameMapCopy = ImmutableMap.copyOf(processorIdToFeedNameMap);
        Map<String, String> processorIdToFeedProcessGroupIdCopy = ImmutableMap.copyOf(processorIdToFeedProcessGroupId);
        Map<String, String> processorIdToProcessorNameCopy = ImmutableMap.copyOf(processorIdToProcessorName);
        Map<String, NiFiFlowCacheConnectionData> connectionDataMapCopy = ImmutableMap.copyOf(connectionIdToConnectionMap);
        // get feeds updated since last sync
        NifiFlowCacheSnapshot latest = new NifiFlowCacheSnapshot.Builder().withProcessorIdToFeedNameMap(processorIdToFeedNameMapCopy).withProcessorIdToFeedProcessGroupId(processorIdToFeedProcessGroupIdCopy).withProcessorIdToProcessorName(processorIdToProcessorNameCopy).withConnections(connectionDataMapCopy).withSnapshotDate(lastUpdated).build();
        return syncAndReturnUpdates(sync, latest, preview);
    } else {
        return NiFiFlowCacheSync.EMPTY(sync.getSyncId());
    }
}
Also used : NiFiFlowCacheConnectionData(com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheConnectionData) NifiFlowCacheSnapshot(com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheSnapshot)

Example 3 with NiFiFlowCacheConnectionData

use of com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheConnectionData in project kylo by Teradata.

the class NifiFlowCacheImpl method toConnectionIdMap.

private Map<String, NiFiFlowCacheConnectionData> toConnectionIdMap(Collection<NifiFlowConnection> connections) {
    Map<String, NiFiFlowCacheConnectionData> connectionMap = new HashMap<>();
    connections.stream().forEach(conn -> {
        connectionMap.put(conn.getConnectionIdentifier(), new NiFiFlowCacheConnectionData(conn.getConnectionIdentifier(), conn.getName(), conn.getSourceIdentifier(), conn.getDestinationIdentifier()));
    });
    return connectionMap;
}
Also used : NiFiFlowCacheConnectionData(com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheConnectionData) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap)

Aggregations

NiFiFlowCacheConnectionData (com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheConnectionData)3 HashMap (java.util.HashMap)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 NifiFlowCacheSnapshot (com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheSnapshot)1