class ProcessControlImplementation implements ProcessControl {

  @Override
  public void startWorkerProcessesWithDistributedFiles(
    final Directory distributionDirectory,
    final GrinderProperties properties) throws ConsoleException {

    // Check that the script file in the supplied properties belongs to
    // the current distribution directory. The file may not exist.
    final File configuredScript =
        properties.getFile(GrinderProperties.SCRIPT,
                           GrinderProperties.DEFAULT_SCRIPT);

    final File resolvedScript =
        properties.resolveRelativeFile(configuredScript);

    final File path = distributionDirectory.relativeFile(resolvedScript, true);

    // Allow the path to not be a child of the directory if it is absolute,
    // since it is fairly obvious to the user what is going on.
    if (path == null && !configuredScript.isAbsolute()) {
      throw new DisplayMessageConsoleException(
        m_resources,
        "scriptNotInDirectoryError.text");
    }

    GrinderProperties propertiesToSend = properties;

    final File associatedFile = properties.getAssociatedFile();

    if (associatedFile != null) {
      // If the properties refer to a file, rebase it to the
      // distribution directory so relative script paths can be
      // resolved based on the properties file location.
      final File relativeFile =
          distributionDirectory.relativeFile(associatedFile, true);

      if (relativeFile != null && !relativeFile.equals(associatedFile)) {
        // Copy, to avoid modifying the parameter.
        propertiesToSend = new GrinderProperties();
        propertiesToSend.putAll(properties);
        propertiesToSend.setAssociatedFile(relativeFile);
      }
    }

    startWorkerProcesses(propertiesToSend);
  }

  public  ProcessControlImplementation(
    final Timer timer,
    final ConsoleCommunication consoleCommunication,
    final Resources resources);

}