public void echo(final String msg) { assert msg != null; Echo echo = (Echo)createTask("echo"); echo.setMessage(msg); echo.execute(); } }
public void echo(final String msg) { assert msg != null; Echo echo = (Echo)createTask("echo"); echo.setMessage(msg); echo.execute(); } }
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; }
/** * 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(); }