コード例 #1
0
ファイル: Database.java プロジェクト: fedor4ever/linux_build
 public void log(String msg, int level) {
   if (task != null) {
     task.log(msg, level);
   } else if (debug) {
     project.log(msg, level);
   }
 }
コード例 #2
0
ファイル: XMLReport.java プロジェクト: saeg/experiments
 public void log(String message) {
   if (task == null) {
     // System.out.println(message);
   } else {
     task.log(message, Project.MSG_DEBUG);
   }
 }
コード例 #3
0
  public <InfoType> void processExisting(Task task, InfoType[] existing) {
    if (operation == null) {

      if (key != null) {
        InfoType found = null;
        if (existing != null) {
          for (InfoType info : existing) {
            try {
              Method getKey = info.getClass().getMethod("getKey");
              Object infoKey = getKey.invoke(info);
              if (key.equals(infoKey)) {
                found = info;
              }
            } catch (Exception ex) {
              throw new RuntimeException("Error getting key from info object", ex);
            }
          }
        }
        operation = found == null ? ArrayUpdateOperation.add : ArrayUpdateOperation.edit;
      } else {
        operation = ArrayUpdateOperation.add;
      }
      task.log(
          "Auto set "
              + operation
              + " array operation for "
              + spec.getClass().getSimpleName()
              + " key "
              + key);
      spec.setOperation(operation);
    }
  }
コード例 #4
0
 void handleExit(Task task, int sc, String message) {
   if (errorProperty != null) {
     task.getProject().setNewProperty(errorProperty, "true");
   }
   if (failOnError) {
     throw new BuildException(message, task.getLocation());
   } else {
     task.log(message, Project.MSG_ERR);
   }
 }
コード例 #5
0
  /**
   * transformation
   *
   * @throws BuildException exception if something goes wrong with the transformation.
   */
  public void transform() throws BuildException {
    checkOptions();
    Project project = task.getProject();

    TempFile tempFileTask = new TempFile();
    tempFileTask.bindToOwner(task);

    XSLTProcess xsltTask = new XSLTProcess();
    xsltTask.bindToOwner(task);

    xsltTask.setXslResource(getStylesheet());

    // acrobatic cast.
    xsltTask.setIn(((XMLResultAggregator) task).getDestinationFile());
    File outputFile = null;
    if (format.equals(FRAMES)) {
      String tempFileProperty = getClass().getName() + String.valueOf(counter++);
      File tmp =
          FILE_UTILS.resolveFile(project.getBaseDir(), project.getProperty("java.io.tmpdir"));
      tempFileTask.setDestDir(tmp);
      tempFileTask.setProperty(tempFileProperty);
      tempFileTask.execute();
      outputFile = new File(project.getProperty(tempFileProperty));
    } else {
      outputFile = new File(toDir, "junit-noframes.html");
    }
    xsltTask.setOut(outputFile);
    for (Iterator i = params.iterator(); i.hasNext(); ) {
      XSLTProcess.Param param = (XSLTProcess.Param) i.next();
      XSLTProcess.Param newParam = xsltTask.createParam();
      newParam.setProject(task.getProject());
      newParam.setName(param.getName());
      newParam.setExpression(param.getExpression());
    }
    XSLTProcess.Param paramx = xsltTask.createParam();
    paramx.setProject(task.getProject());
    paramx.setName("output.dir");
    paramx.setExpression(toDir.getAbsolutePath());
    final long t0 = System.currentTimeMillis();
    try {
      xsltTask.execute();
    } catch (Exception e) {
      throw new BuildException("Errors while applying transformations: " + e.getMessage(), e);
    }
    final long dt = System.currentTimeMillis() - t0;
    task.log("Transform time: " + dt + "ms");
    if (format.equals(FRAMES)) {
      Delete delete = new Delete();
      delete.bindToOwner(task);
      delete.setFile(outputFile);
      delete.execute();
    }
  }
コード例 #6
0
 /**
  * set the extension of the output files
  *
  * @param ext extension.
  */
 public void setExtension(String ext) {
   task.log("extension is not used anymore", Project.MSG_WARN);
 }
コード例 #7
0
 /* (non-Javadoc)
  * @see org.mybatis.generator.internal.NullProgressCallback#startTask(java.lang.String)
  */
 @Override
 public void startTask(String subTaskName) {
   if (verbose) {
     task.log(subTaskName, Project.MSG_VERBOSE);
   }
 }
コード例 #8
0
 /**
  * Log a message with <code>MSG_DEBUG</code> priority
  *
  * @param message the message to log
  */
 public void debug(final String message) {
   task.log(message, Project.MSG_DEBUG);
 }
コード例 #9
0
 /**
  * Log a message with <code>MSG_VERBOSE</code> priority
  *
  * @param message the message to log
  */
 public void verbose(final String message) {
   task.log(message, Project.MSG_VERBOSE);
 }
コード例 #10
0
 /**
  * Log a message with <code>MSG_WARN</code> priority
  *
  * @param message the message to log
  */
 public void warning(final String message) {
   task.log(message, Project.MSG_WARN);
 }
コード例 #11
0
 /**
  * Log a message with <code>MSG_ERR</code> priority
  *
  * @param message the message to log
  */
 public void error(final String message) {
   task.log(message, Project.MSG_ERR);
 }
コード例 #12
0
 /**
  * Log a message with <code>MSG_INFO</code> priority
  *
  * @param message the message to log
  */
 public void info(final String message) {
   task.log(message, Project.MSG_INFO);
 }