public void echo(final String msg) { assert msg != null; Echo echo = (Echo)createTask("echo"); echo.setMessage(msg); echo.execute(); } }
private void appendDeliveryList(String msg) { Echo echo = (Echo) getProject().createTask("echo"); echo.setOwningTarget(getOwningTarget()); echo.init(); echo.setFile(deliveryList); echo.setMessage(msg + "\n"); echo.setAppend(true); echo.perform(); }
private Echo createEcho(final String message, final Project project, final String logLevel) { final Echo echo = new Echo(); echo.setProject(project); final Echo.EchoLevel level = new Echo.EchoLevel(); level.setValue(logLevel); echo.setLevel(level); echo.setMessage(message); return echo; }
private void installInternationalizationKeys(String webFramework) { createLoadFileTask("src/main/resources/" + pojoName + "-ApplicationResources.properties", "i18n.file").execute(); File existingFile = new File(destinationDirectory + "/src/main/resources/ApplicationResources.properties"); // if ApplicationResources doesn't exist, assume appfuse-light and use messages instead if (!existingFile.exists()) { if ("wicket".equalsIgnoreCase(webFramework)) { existingFile = new File(destinationDirectory + "/src/main/java/" + project.getGroupId().replace(".", "/") + "/webapp/pages/AbstractWebPage.properties"); } else { existingFile = new File(destinationDirectory + "/src/main/resources/messages.properties"); } } parsePropertiesFile(existingFile, pojoName); Echo echoTask = (Echo) antProject.createTask("echo"); echoTask.setFile(existingFile); echoTask.setAppend(true); echoTask.setMessage(antProject.getProperty("i18n.file")); echoTask.execute(); }
/** * @see org.apache.tools.ant.Task#execute() */ public void execute() throws BuildException { validateTaskConfiguration(); // because <echo> task lets you have the message in the XML text node, we need to trim all newlines and whitespace message = message.replaceAll( "\r\n", "" ).replaceAll( "\n", "" ).trim(); // let's get the arguments // let's convert the message (which is only a bundle key right now) to the actual localized message message = Msg.createMsg( m_bundle, m_locale, message, m_arguments.toArray() ).toString(); // if property is set, put the message text in that property, otherwise, we echo the message if ( m_property != null ) { Project proj = getOwningTarget().getProject(); proj.setNewProperty( m_property, message ); } else { super.execute(); } return; }
@Override public void messageLogged(BuildEvent event) { //By Default echo is WARN level, but we want to have it as INFO if(event.getTask() instanceof Echo){ Echo echo = (Echo)event.getTask(); if(event.getPriority() == MSG_WARN){ echo.setLevel(ECHO_LEVEL_INFO); BuildEvent newevent = new BuildEvent(echo); newevent.setMessage(event.getMessage(), MSG_INFO); event = newevent; } } super.messageLogged(event); } }
/** * Does the work. * * @exception BuildException if something goes wrong with the build */ public void execute() throws BuildException { String i18nKey = this.getKey(); String bundleBase = this.getBundle(); String msg = null; if ( i18nKey != null ) { msg = loadMessageFromBundle(bundleBase, i18nKey, getArguments()); } if ( msg != null ) { this.setMessage(msg); } // do actual echo super.execute(); }
public void echo(final String msg) { assert msg != null; Echo echo = (Echo)createTask("echo"); echo.setMessage(msg); echo.execute(); } }