當前位置: 首頁>>代碼示例>>Java>>正文


Java Task.log方法代碼示例

本文整理匯總了Java中org.apache.tools.ant.Task.log方法的典型用法代碼示例。如果您正苦於以下問題:Java Task.log方法的具體用法?Java Task.log怎麽用?Java Task.log使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.tools.ant.Task的用法示例。


在下文中一共展示了Task.log方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toArgument

import org.apache.tools.ant.Task; //導入方法依賴的package包/類
/**
 * <p>toArgument.</p>
 *
 * @param task a {@link org.apache.tools.ant.Task} object.
 * @return a {@link java.lang.String} object.
 */
public String toArgument(Task task)
{
	task.log(String.format("System Under Development Class \"%s\"", className), Project.MSG_VERBOSE);

	StringBuilder argumentBuilder = new StringBuilder(className);

	for (TextData argument : arguments)
	{
		task.log(String.format("\tArgument \"%s\"", argument), Project.MSG_VERBOSE);

		argumentBuilder.append(";").append(escapeSemiColon(argument.getText()));
	}

	return argumentBuilder.toString();
}
 
開發者ID:strator-dev,項目名稱:greenpepper,代碼行數:22,代碼來源:SystemUnderDevelopmentElement.java

示例2: toArgument

import org.apache.tools.ant.Task; //導入方法依賴的package包/類
/**
 * <p>toArgument.</p>
 *
 * @param task a {@link org.apache.tools.ant.Task} object.
 * @return a {@link java.lang.String} object.
 */
public String toArgument(Task task)
{
	StringBuilder argumentBuilder = new StringBuilder();

	for(TextData include : includes) {

		if (argumentBuilder.length() > 0)
           {
			argumentBuilder.append(";");
		}

		argumentBuilder.append(include.getText());
		
		task.log(String.format("\tSection \"%s\"", include), Project.MSG_VERBOSE);
       }

	return argumentBuilder.toString();
}
 
開發者ID:strator-dev,項目名稱:greenpepper,代碼行數:25,代碼來源:SectionElement.java

示例3: toArgument

import org.apache.tools.ant.Task; //導入方法依賴的package包/類
/**
 * <p>toArgument.</p>
 *
 * @param task a {@link org.apache.tools.ant.Task} object.
 * @return a {@link java.lang.String} object.
 */
public String toArgument(Task task)
{
	task.log(String.format("Repository Class \"%s\"", className), Project.MSG_VERBOSE);

	StringBuilder argumentBuilder = new StringBuilder(className);

	for (TextData argument : arguments)
	{
		task.log(String.format("\tArgument \"%s\"", argument), Project.MSG_VERBOSE);

		argumentBuilder.append(";").append(escapeSemiColon(argument.getText()));
	}

	return argumentBuilder.toString();
}
 
開發者ID:strator-dev,項目名稱:greenpepper,代碼行數:22,代碼來源:RepositoryElement.java

示例4: runCommand

import org.apache.tools.ant.Task; //導入方法依賴的package包/類
/**
 * A utility method that runs an external command. Writes the output and
 * error streams of the command to the project log.
 *
 * @param task The task that the command is part of. Used for logging
 * @param cmdline The command to execute.
 * @throws BuildException if the command does not exit successfully.
 */
public static void runCommand(Task task, String... cmdline)
    throws BuildException {
    try {
        task.log(Commandline.describeCommand(cmdline),
                 Project.MSG_VERBOSE);
        Execute exe = new Execute(
            new LogStreamHandler(task, Project.MSG_INFO, Project.MSG_ERR));
        exe.setAntRun(task.getProject());
        exe.setCommandline(cmdline);
        int retval = exe.execute();
        if (isFailure(retval)) {
            throw new BuildException(cmdline[0]
                + " failed with return code " + retval, task.getLocation());
        }
    } catch (IOException exc) {
        throw new BuildException("Could not launch " + cmdline[0] + ": "
            + exc, task.getLocation());
    }
}
 
開發者ID:apache,項目名稱:ant,代碼行數:28,代碼來源:Execute.java

示例5: readSingleDataFile

import org.apache.tools.ant.Task; //導入方法依賴的package包/類
/**
 * Reads a single data file.
 * 
 * @param task       The parent task
 * @param reader     The data reader
 * @param schemaFile The schema file
 */
private void readSingleDataFile(Task task, DdlUtilsDataHandling handling, File dataFile, Writer output)
{
    if (!dataFile.exists())
    {
        task.log("Could not find data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
    }
    else if (!dataFile.isFile())
    {
        task.log("Path "+dataFile.getAbsolutePath()+" does not denote a data file", Project.MSG_ERR);
    }
    else if (!dataFile.canRead())
    {
        task.log("Could not read data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
    }
    else
    {
        try
        {
            FileReader reader = new FileReader(dataFile.getAbsolutePath());

            handling.getInsertDataSql(reader, output);
            output.flush();
            output.close();
            task.log("Read data file "+dataFile.getAbsolutePath(), Project.MSG_INFO);
        }
        catch (Exception ex)
        {
            if (isFailOnError())
            {
                throw new BuildException("Could not read data file "+dataFile.getAbsolutePath(), ex);
            }
        }
    }
}
 
開發者ID:KualiCo,項目名稱:ojb,代碼行數:42,代碼來源:WriteDataSqlToFileCommand.java

示例6: execute

import org.apache.tools.ant.Task; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
public void execute(Task task, Database dbModel, DescriptorRepository objModel) throws BuildException
{
    if (_outputFile == null)
    {
        throw new BuildException("No output file specified");
    }
    if (_outputFile.exists() && !_outputFile.canWrite())
    {
        throw new BuildException("Cannot overwrite output file "+_outputFile.getAbsolutePath());
    }

    try
    {
        FileWriter           outputWriter = new FileWriter(_outputFile);
        DataDtdWriter        dtdWriter    = new DataDtdWriter();
        DdlUtilsDataHandling handling     = new DdlUtilsDataHandling();

        handling.setModel(dbModel, objModel);
        handling.getDataDTD(outputWriter);
        outputWriter.close();
        task.log("Written DTD to "+_outputFile.getAbsolutePath(), Project.MSG_INFO);
    }
    catch (Exception ex)
    {
        throw new BuildException("Failed to write to output file "+_outputFile.getAbsolutePath(), ex);
    }
}
 
開發者ID:KualiCo,項目名稱:ojb,代碼行數:31,代碼來源:WriteDtdToFileCommand.java

示例7: readSingleDataFile

import org.apache.tools.ant.Task; //導入方法依賴的package包/類
/**
 * Reads a single data file.
 * 
 * @param task       The parent task
 * @param reader     The data reader
 * @param schemaFile The schema file
 */
private void readSingleDataFile(Task task, DdlUtilsDataHandling handling, File dataFile)
{
    if (!dataFile.exists())
    {
        task.log("Could not find data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
    }
    else if (!dataFile.isFile())
    {
        task.log("Path "+dataFile.getAbsolutePath()+" does not denote a data file", Project.MSG_ERR);
    }
    else if (!dataFile.canRead())
    {
        task.log("Could not read data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
    }
    else
    {
        int batchSize = 1;

        if ((_useBatchMode != null) && _useBatchMode.booleanValue())
        {
            if (_batchSize != null)
            {
                batchSize = _batchSize.intValue();
            }
        }
        try
        {
            handling.insertData(new FileReader(dataFile), batchSize);
            task.log("Read data file "+dataFile.getAbsolutePath(), Project.MSG_INFO);
        }
        catch (Exception ex)
        {
            if (isFailOnError())
            {
                throw new BuildException("Could not read data file "+dataFile.getAbsolutePath(), ex);
            }
            else
            {
                task.log("Could not read data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
            }
        }
    }
}
 
開發者ID:KualiCo,項目名稱:ojb,代碼行數:51,代碼來源:WriteDataToDatabaseCommand.java


注:本文中的org.apache.tools.ant.Task.log方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。