Search in sources :

Example 1 with NetworkTargetProductServerDataProvider

use of com.mercedesbenz.sechub.domain.scan.NetworkTargetProductServerDataProvider in project sechub by mercedes-benz.

the class AbstractProductExecutor method configureNetworkTargetHandlingIfNecessary.

private void configureNetworkTargetHandlingIfNecessary(ProductExecutorData data) {
    if (!isUsingNetworkTargets()) {
        return;
    }
    /* check preconditions */
    NetworkTargetProductServerDataProvider networkTargetDataProvider = data.networkTargetDataProvider;
    if (networkTargetDataProvider == null) {
        throw new IllegalStateException("No network target data provider set, but necessary for scantype: " + scanType + "\nInject this at customize method inside " + getClass().getName());
    }
    NetworkLocationProvider networkLocationProvider = data.networkLocationProvider;
    if (networkLocationProvider == null) {
        throw new IllegalStateException("No network location provier set, but necessary for scantype: " + scanType + "\nInject this at customize method inside " + getClass().getName());
    }
    NetworkTargetProductServerDataSuppport networkTargetProductServerDataSupport = new NetworkTargetProductServerDataSuppport(networkTargetDataProvider);
    data.networkTargetProductServerDataSupport = networkTargetProductServerDataSupport;
    NetworkTargetInfoFactory targetInfoFactory = new NetworkTargetInfoFactory(targetResolver, getClass().getSimpleName());
    List<NetworkTargetInfo> targetRegistryInfoList = new ArrayList<>();
    for (NetworkTargetType networkTargetType : NetworkTargetType.values()) {
        if (!networkTargetType.isValid()) {
            continue;
        }
        NetworkTargetInfo infoForThisNetworkTargetType = targetInfoFactory.createInfo(networkTargetType, data.traceLogId, networkLocationProvider, networkTargetProductServerDataSupport);
        if (infoForThisNetworkTargetType.containsAtLeastOneTarget()) {
            targetRegistryInfoList.add(infoForThisNetworkTargetType);
        }
    }
    data.networkTargetInfoList = targetRegistryInfoList;
}
Also used : NetworkLocationProvider(com.mercedesbenz.sechub.domain.scan.NetworkLocationProvider) NetworkTargetType(com.mercedesbenz.sechub.domain.scan.NetworkTargetType) ArrayList(java.util.ArrayList) NetworkTargetProductServerDataProvider(com.mercedesbenz.sechub.domain.scan.NetworkTargetProductServerDataProvider) NetworkTargetInfoFactory(com.mercedesbenz.sechub.domain.scan.NetworkTargetInfoFactory) NetworkTargetProductServerDataSuppport(com.mercedesbenz.sechub.domain.scan.NetworkTargetProductServerDataSuppport) NetworkTargetInfo(com.mercedesbenz.sechub.domain.scan.NetworkTargetRegistry.NetworkTargetInfo)

Aggregations

NetworkLocationProvider (com.mercedesbenz.sechub.domain.scan.NetworkLocationProvider)1 NetworkTargetInfoFactory (com.mercedesbenz.sechub.domain.scan.NetworkTargetInfoFactory)1 NetworkTargetProductServerDataProvider (com.mercedesbenz.sechub.domain.scan.NetworkTargetProductServerDataProvider)1 NetworkTargetProductServerDataSuppport (com.mercedesbenz.sechub.domain.scan.NetworkTargetProductServerDataSuppport)1 NetworkTargetInfo (com.mercedesbenz.sechub.domain.scan.NetworkTargetRegistry.NetworkTargetInfo)1 NetworkTargetType (com.mercedesbenz.sechub.domain.scan.NetworkTargetType)1 ArrayList (java.util.ArrayList)1