Example #1
0
 private void addBatchComponents() {
   add(
       DefaultResourceCreationLock.class,
       DefaultPersistenceManager.class,
       DependencyPersister.class,
       EventPersister.class,
       LinkPersister.class,
       MeasurePersister.class,
       MemoryOptimizer.class,
       DefaultResourcePermissions.class,
       DefaultResourcePersister.class,
       SourcePersister.class,
       DefaultNotificationManager.class,
       MetricProvider.class,
       ProjectExclusions.class,
       ProjectReactorReady.class,
       ProjectConfigurator.class,
       DefaultIndex.class,
       DefaultFileLinesContextFactory.class,
       ProjectLock.class,
       LastSnapshots.class,
       ScanGraph.create(),
       TestPlanBuilder.class,
       TestableBuilder.class,
       ScanPerspectives.class,
       ScanGraphStore.class);
 }
Example #2
0
  private Bucket doIndex(Resource resource, Resource parentReference) {
    Bucket bucket = buckets.get(resource);
    if (bucket != null) {
      return bucket;
    }

    checkLock(resource);

    Resource parent = null;
    if (!ResourceUtils.isLibrary(resource)) {
      // a library has no parent
      parent = (Resource) ObjectUtils.defaultIfNull(parentReference, currentProject);
    }

    Bucket parentBucket = getBucket(parent, true);
    if (parentBucket == null && parent != null) {
      LOG.warn("Resource ignored, parent is not indexed: " + resource);
      return null;
    }

    resource.setEffectiveKey(createUID(currentProject, resource));
    bucket = new Bucket(resource).setParent(parentBucket);
    buckets.put(resource, bucket);

    boolean excluded = checkExclusion(resource, parentBucket);
    if (!excluded) {
      Snapshot snapshot =
          persistence.saveResource(
              currentProject, resource, (parentBucket != null ? parentBucket.getResource() : null));
      if (ResourceUtils.isPersistable(resource)
          && !Qualifiers.LIBRARY.equals(resource.getQualifier())) {
        graph.addComponent(resource, snapshot);
      }
    }

    return bucket;
  }