Пример #1
0
  /** @param cmdline */
  private void requiredOptionOutputPath(CommandLine cmdline) {
    String outputPath = cmdline.getOptionValue('o');

    if (outputPath == null || outputPath.equals("") || outputPath.isEmpty()) {
      outputPath = ".";
      System.out.println(
          "No output path provided via option. Set output path to current directory!");
    }
    final boolean outputPathExits = FileUtils.dirExists(outputPath, "dir exits");
    if (!outputPathExits) {
      FileUtils.createDir(outputPath, "");
    }
    ProjectMetaData.getInstance().setOutputPath(FileUtils.getCanonicalPath(outputPath));
  }
Пример #2
0
  /** Option: writes log4j.properties to local filesystem */
  private static void optWriteLoggingProperties() {
    final String resource = ProjectMetaData.getLog4jFilenameWithPath();
    final InputStream is = MovsimCommandLine.class.getResourceAsStream(resource);
    FileUtils.resourceToFile(is, ProjectMetaData.getLog4jFilename());
    System.out.println("logger properties file written to " + ProjectMetaData.getLog4jFilename());

    System.exit(0);
  }
Пример #3
0
 /**
  * Option simulation.
  *
  * @param cmdline the cmdline
  */
 private void requiredOptionSimulation(CommandLine cmdline) {
   String filename = cmdline.getOptionValue('f');
   if (filename == null || filename.isEmpty()) {
     System.err.println(
         "No configuration file provided! Please specify a file via the option -f.");
     System.exit(-1);
   }
   if (!filename.endsWith(ProjectMetaData.getMovsimConfigFileEnding())) {
     filename = filename + ProjectMetaData.getMovsimConfigFileEnding();
   }
   if (!FileUtils.fileExists(filename)) {
     System.err.println("Configuration file \"" + filename + "\" not found!");
     System.exit(-1);
   }
   // final boolean isXml = FileNameUtils.validateFileName(filename,
   // ProjectMetaData.getMovsimConfigFileEnding());
   File file = new File(filename);
   final String name = file.getName();
   ProjectMetaData.getInstance()
       .setProjectName(
           name.substring(0, name.indexOf(ProjectMetaData.getMovsimConfigFileEnding())));
   ProjectMetaData.getInstance()
       .setPathToProjectXmlFile(FileUtils.getCanonicalPathWithoutFilename(filename));
 }