/**
  * Allows all runtime detectors to search through a directory for their runtime types.
  *
  * @param directory
  * @param runtimeCollector
  * @param depth
  * @param monitor
  */
 public void searchDirectory(
     File directory,
     List<RuntimeDefinition> runtimeCollector,
     int depth,
     IProgressMonitor monitor) {
   Set<IRuntimeDetector> runtimeDetectors =
       RuntimeCoreActivator.getDefault().getRuntimeDetectors();
   searchDirectory(directory, runtimeCollector, depth, runtimeDetectors, monitor);
 }
Ejemplo n.º 2
0
  @Override
  public void computeIncludedRuntimeDefinition(RuntimeDefinition runtimeDefinition) {
    runtimeDefinition.getIncludedRuntimeDefinitions().clear();
    List<RuntimeDefinition> runtimeDefinitions = runtimeDefinition.getIncludedRuntimeDefinitions();

    final File location = getLocation(runtimeDefinition);
    File[] directories =
        runtimeDefinition
            .getLocation()
            .listFiles(
                new FileFilter() {
                  public boolean accept(File file) {
                    if (!file.isDirectory() || file.equals(location)) {
                      return false;
                    }
                    return true;
                  }
                });
    List<RuntimeDefinition> definitions = new ArrayList<RuntimeDefinition>();
    JBossRuntimeLocator locator = new JBossRuntimeLocator();
    Set<IRuntimeDetector> seamDetectors = new HashSet<IRuntimeDetector>();
    Set<IRuntimeDetector> runtimeDetectors =
        RuntimeCoreActivator.getDefault().getRuntimeDetectors();
    for (IRuntimeDetector runtimeDetector : runtimeDetectors) {
      if (runtimeDetector instanceof RuntimeDetector) {
        IRuntimeDetectorDelegate delegate = ((RuntimeDetector) runtimeDetector).getDelegate();
        if (delegate instanceof SeamHandler) {
          seamDetectors.add(runtimeDetector);
          break;
        }
      }
    }
    for (File directory : directories) {
      locator.searchDirectory(directory, definitions, 1, seamDetectors, new NullProgressMonitor());
      for (RuntimeDefinition definition : definitions) {
        definition.setParent(runtimeDefinition);
      }
    }
    for (RuntimeDefinition definition : definitions) {
      if (!runtimeDefinitions.contains(definition)) {
        runtimeDefinitions.add(definition);
      }
    }
  }