public AggregationOptions setDiscoveryConfig( final DiscoveryConfig dc ) { this.dc = dc; this.discoverySource = dc.getDiscoverySource(); this.discoveryEnabled = dc.isEnabled(); this.discoveryTimeoutMillis = dc.getTimeoutMillis(); return this; }
public static DiscoveryConfig getDisabledConfig() { return new DiscoveryConfig(); }
public DiscoveryConfig getDiscoveryConfig() { return dc == null ? new DiscoveryConfig( discoverySource ).setEnabled( discoveryEnabled ) .setTimeoutMillis( discoveryTimeoutMillis ) : dc; }
public DiscoveryConfig( final DiscoveryConfig discoveryConfig ) { Collection<String> enabledPatchers = discoveryConfig.getEnabledPatchers(); if ( enabledPatchers == null ) { enabledPatchers = new HashSet<String>(); } else { enabledPatchers = new HashSet<String>( enabledPatchers ); } this.patchers = enabledPatchers; this.enabled = discoveryConfig.isEnabled(); this.timeoutMillis = discoveryConfig.getTimeoutMillis(); this.discoverySource = discoveryConfig.getDiscoverySource(); this.discoveryLocations = discoveryConfig.getLocations(); this.storeRelationships = discoveryConfig.isStoreRelationships(); this.includeBuildSection = discoveryConfig.isIncludeBuildSection(); this.includeManagedDependencies = discoveryConfig.isIncludeManagedDependencies(); this.includeManagedPlugins = discoveryConfig.isIncludeManagedPlugins(); }
public DiscoveryConfig createDiscoveryConfig( final Map<String, String[]> params, final URI source, final DiscoverySourceManager sourceFactory ) throws CartoDataException { DiscoveryConfig result = null; if ( getBooleanParamWithDefault( params, "discover", false ) ) { URI s = source; if ( s == null ) { s = sourceFactory.createSourceURI( getStringParamWithDefault( params, "from", null ) ); } final DiscoveryConfig c = new DiscoveryConfig( s ); result = c; c.setEnabled( true ); c.setTimeoutMillis( getLongParamWithDefault( params, "timeout", c.getTimeoutMillis() ) ); } return result == null ? DiscoveryConfig.getDisabledConfig() : result; }
public DiscoveryResult( final URI source, final DiscoveryResult original, final Set<ProjectRelationship<?, ?>> newlyRejected ) { this.source = source; this.selected = original.getSelectedRef(); this.discovered = original.getAllDiscoveredRelationships(); if ( this.discovered != null ) { this.discovered = new HashSet<ProjectRelationship<?, ?>>( this.discovered ); } this.rejected = new HashSet<ProjectRelationship<?, ?>>(); rejected.addAll( original.getRejectedRelationships() ); rejected.addAll( newlyRejected ); }
public List<? extends Location> resolveDiscoveryLocations( final DiscoveryConfig config, final URI discoverySource ) throws CartoDataException { List<? extends Location> locations = config.getLocations(); if ( locations == null || locations.isEmpty() ) { locations = sourceManager.createLocations( discoverySource ); config.setLocations( locations ); } return locations; }
@Override public ProjectVersionRef resolveSpecificVersion( final ProjectVersionRef ref, final DiscoveryConfig discoveryConfig ) throws CartoDataException { final List<? extends Location> locations = discoveryConfig.getLocations(); try { return artifactManager.resolveVariableVersion( locations, ref ); } catch ( final TransferException e ) { throw new CartoDataException( "Failed to graph variable version for: {}. Reason: {}", e, ref, e.getMessage() ); } }
private void markMissing( final DiscoveryRunnable runnable, final Set<ProjectVersionRef> missing, final int pass ) { final int index = runnable.getIndex(); final ProjectVersionRef originalRef = runnable.getTodo() .getRef(); logger.debug( "{}.{}. MISSING(1) += {}", pass, index, originalRef ); missing.add( originalRef ); final DiscoveryResult result = runnable.getResult(); if ( result != null ) { final ProjectVersionRef selectdRef = result.getSelectedRef(); if ( !originalRef.equals( selectdRef ) ) { logger.debug( "{}.{}. MISSING(2) += {}", pass, index, selectdRef ); missing.add( selectdRef ); } } }
public DiscoveryConfig( final DiscoveryConfig discoveryConfig ) { Collection<String> enabledPatchers = discoveryConfig.getEnabledPatchers(); if ( enabledPatchers == null ) { enabledPatchers = new HashSet<String>(); } else { enabledPatchers = new HashSet<String>( enabledPatchers ); } this.patchers = enabledPatchers; this.enabled = discoveryConfig.isEnabled(); this.timeoutMillis = discoveryConfig.getTimeoutMillis(); this.discoverySource = discoveryConfig.getDiscoverySource(); this.discoveryLocations = discoveryConfig.getLocations(); this.storeRelationships = discoveryConfig.isStoreRelationships(); this.includeBuildSection = discoveryConfig.isIncludeBuildSection(); this.includeManagedDependencies = discoveryConfig.isIncludeManagedDependencies(); this.includeManagedPlugins = discoveryConfig.isIncludeManagedPlugins(); }
public DiscoveryConfig getDiscoveryConfig() { return dc == null ? new DiscoveryConfig( discoverySource ).setEnabled( discoveryEnabled ) .setTimeoutMillis( discoveryTimeoutMillis ) : dc; }
public AggregationOptions setDiscoveryConfig( final DiscoveryConfig dc ) { this.dc = dc; this.discoverySource = dc.getDiscoverySource(); this.discoveryEnabled = dc.isEnabled(); this.discoveryTimeoutMillis = dc.getTimeoutMillis(); return this; }
public DiscoveryResult( final URI source, final DiscoveryResult original, final Set<ProjectRelationship<?, ?>> newlyRejected ) { this.source = source; this.selected = original.getSelectedRef(); this.discovered = original.getAllDiscoveredRelationships(); if ( this.discovered != null ) { this.discovered = new HashSet<ProjectRelationship<?, ?>>( this.discovered ); } this.rejected = new HashSet<ProjectRelationship<?, ?>>(); rejected.addAll( original.getRejectedRelationships() ); rejected.addAll( newlyRejected ); }
public List<? extends Location> resolveDiscoveryLocations( final DiscoveryConfig config, final URI discoverySource ) throws CartoDataException { List<? extends Location> locations = config.getLocations(); if ( locations == null || locations.isEmpty() ) { locations = sourceManager.createLocations( discoverySource ); config.setLocations( locations ); } return locations; }
@Override public ProjectVersionRef resolveSpecificVersion( final ProjectVersionRef ref, final DiscoveryConfig discoveryConfig ) throws CartoDataException { final List<? extends Location> locations = discoveryConfig.getLocations(); try { return artifactManager.resolveVariableVersion( locations, ref ); } catch ( final TransferException e ) { throw new CartoDataException( "Failed to graph variable version for: {}. Reason: {}", e, ref, e.getMessage() ); } }
public static DiscoveryConfig getDisabledConfig() { return new DiscoveryConfig(); }
private void markMissing( final DiscoveryRunnable runnable, final Set<ProjectVersionRef> missing, final int pass ) { final int index = runnable.getIndex(); final ProjectVersionRef originalRef = runnable.getTodo() .getRef(); logger.debug( "{}.{}. MISSING(1) += {}", pass, index, originalRef ); missing.add( originalRef ); final DiscoveryResult result = runnable.getResult(); if ( result != null ) { final ProjectVersionRef selectdRef = result.getSelectedRef(); if ( !originalRef.equals( selectdRef ) ) { logger.debug( "{}.{}. MISSING(2) += {}", pass, index, selectdRef ); missing.add( selectdRef ); } } }
private void resolveVersionSelections( final AbstractGraphRequest recipe ) throws CartoRequestException { final List<ProjectVersionRef> injectedBOMs = recipe.getInjectedBOMs(); if ( injectedBOMs != null ) { final List<? extends Location> locations = recipe.getDiscoveryConfig() .getLocations(); final Map<ProjectRef, ProjectVersionRef> injectedDepMgmt = recipe.getVersionSelections(); readDepMgmtToVersionMap( injectedBOMs, locations, injectedDepMgmt ); recipe.setVersionSelections( injectedDepMgmt ); } }
private void resolveVersionSelections( final AbstractGraphRequest recipe ) throws CartoRequestException { final List<ProjectVersionRef> injectedBOMs = recipe.getInjectedBOMs(); if ( injectedBOMs != null ) { final List<? extends Location> locations = recipe.getDiscoveryConfig() .getLocations(); final Map<ProjectRef, ProjectVersionRef> injectedDepMgmt = recipe.getVersionSelections(); readDepMgmtToVersionMap( injectedBOMs, locations, injectedDepMgmt ); recipe.setVersionSelections( injectedDepMgmt ); } }
@Override public ProjectVersionRef resolveSpecificVersion( final ProjectVersionRef ref, final DiscoveryConfig discoveryConfig ) throws CartoDataException { setLocation( discoveryConfig ); try { return artifactManager.resolveVariableVersion( discoveryConfig.getLocations(), ref, new EventMetadata() ); } catch ( final TransferException e ) { throw new CartoDataException( "Failed to graph variable version for: {}. Reason: {}", e, ref, e.getMessage() ); } }