Search in sources :

Example 1 with ProjectHelperImpl

use of org.apache.tools.ant.helper.ProjectHelperImpl in project iaf by ibissource.

the class FileSender method runAntScript.

private void runAntScript() {
    Project ant = new Project();
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    ant.addBuildListener(consoleLogger);
    // iterate over appConstants and add them as properties
    AppConstants appConstants = AppConstants.getInstance();
    @SuppressWarnings("unchecked") Enumeration<String> enums = (Enumeration<String>) appConstants.propertyNames();
    while (enums.hasMoreElements()) {
        String key = enums.nextElement();
        ant.setProperty(key, appConstants.getResolvedProperty(key));
    }
    ant.init();
    ProjectHelper helper = new ProjectHelperImpl();
    helper.parse(ant, new File(filename));
    ant.executeTarget(ant.getDefaultTarget());
}
Also used : Project(org.apache.tools.ant.Project) ProjectHelper(org.apache.tools.ant.ProjectHelper) Enumeration(java.util.Enumeration) ProjectHelperImpl(org.apache.tools.ant.helper.ProjectHelperImpl) DefaultLogger(org.apache.tools.ant.DefaultLogger) File(java.io.File) AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 2 with ProjectHelperImpl

use of org.apache.tools.ant.helper.ProjectHelperImpl in project ant by apache.

the class Description method addText.

/**
 * Adds descriptive text to the project.
 *
 * @param text the descriptive text
 */
public void addText(String text) {
    ProjectHelper ph = getProject().getReference(ProjectHelper.PROJECTHELPER_REFERENCE);
    if (!(ph instanceof ProjectHelperImpl)) {
        // will be evaluated in Project.getDescription()
        return;
    }
    String currentDescription = getProject().getDescription();
    if (currentDescription == null) {
        getProject().setDescription(text);
    } else {
        getProject().setDescription(currentDescription + text);
    }
}
Also used : ProjectHelper(org.apache.tools.ant.ProjectHelper) ProjectHelperImpl(org.apache.tools.ant.helper.ProjectHelperImpl)

Aggregations

ProjectHelper (org.apache.tools.ant.ProjectHelper)2 ProjectHelperImpl (org.apache.tools.ant.helper.ProjectHelperImpl)2 File (java.io.File)1 Enumeration (java.util.Enumeration)1 AppConstants (nl.nn.adapterframework.util.AppConstants)1 DefaultLogger (org.apache.tools.ant.DefaultLogger)1 Project (org.apache.tools.ant.Project)1