コード例 #1
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);
      }
    }
  }