Return-Path: Delivered-To: apmail-ant-notifications-archive@locus.apache.org Received: (qmail 18247 invoked from network); 16 Jul 2008 19:20:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Jul 2008 19:20:23 -0000 Received: (qmail 72345 invoked by uid 500); 16 Jul 2008 19:20:23 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 72291 invoked by uid 500); 16 Jul 2008 19:20:23 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 72282 invoked by uid 99); 16 Jul 2008 19:20:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jul 2008 12:20:23 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jul 2008 19:19:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 20FB223889C0; Wed, 16 Jul 2008 12:20:03 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r677383 - in /ant/core/trunk: WHATSNEW docs/manual/CoreTasks/sql.html src/main/org/apache/tools/ant/taskdefs/SQLExec.java Date: Wed, 16 Jul 2008 19:20:02 -0000 To: notifications@ant.apache.org From: mbenson@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080716192003.20FB223889C0@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mbenson Date: Wed Jul 16 12:20:02 2008 New Revision: 677383 URL: http://svn.apache.org/viewvc?rev=677383&view=rev Log: "output" attribute now supports any Resource in addition to a file. Modified: ant/core/trunk/WHATSNEW ant/core/trunk/docs/manual/CoreTasks/sql.html ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java Modified: ant/core/trunk/WHATSNEW URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=677383&r1=677382&r2=677383&view=diff ============================================================================== --- ant/core/trunk/WHATSNEW (original) +++ ant/core/trunk/WHATSNEW Wed Jul 16 12:20:02 2008 @@ -190,6 +190,8 @@ * supports an "output" Resource attribute as an alternative to "file". + * "output" attribute now supports any Resource in addition to a file. + Changes from Ant 1.7.0 TO Ant 1.7.1 ============================================= Modified: ant/core/trunk/docs/manual/CoreTasks/sql.html URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/sql.html?rev=677383&r1=677382&r2=677383&view=diff ============================================================================== --- ant/core/trunk/docs/manual/CoreTasks/sql.html (original) +++ ant/core/trunk/docs/manual/CoreTasks/sql.html Wed Jul 16 12:20:02 2008 @@ -117,7 +117,10 @@ output - Output file for result sets (defaults to System.out) + Output file for result sets (defaults to System.out) + Since Ant 1.8 can specify any Resource that supports output (see + note). + No (print to System.out by default) Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java?rev=677383&r1=677382&r2=677383&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java Wed Jul 16 12:20:02 2008 @@ -25,10 +25,12 @@ import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Resource; import org.apache.tools.ant.types.ResourceCollection; +import org.apache.tools.ant.types.resources.FileProvider; import org.apache.tools.ant.types.resources.FileResource; import org.apache.tools.ant.types.resources.Union; import java.io.File; +import java.io.OutputStream; import java.io.PrintStream; import java.io.BufferedOutputStream; import java.io.FileOutputStream; @@ -153,10 +155,9 @@ private boolean showtrailers = true; /** - * Results Output file. + * Results Output Resource. */ - private File output = null; - + private Resource output = null; /** * Action to perform if an error is found @@ -392,6 +393,15 @@ * @param output the output file to use for logging messages. */ public void setOutput(File output) { + setOutput(new FileResource(getProject(), output)); + } + + /** + * Set the output Resource; + * optional, defaults to the Ant log. + * @param output the output Resource to store results. + */ + public void setOutput(Resource output) { this.output = output; } @@ -556,9 +566,17 @@ PrintStream out = System.out; try { if (output != null) { - log("Opening PrintStream to output file " + output, Project.MSG_VERBOSE); - out = new PrintStream(new BufferedOutputStream( - new FileOutputStream(output.getAbsolutePath(), append))); + log("Opening PrintStream to output Resource " + output, Project.MSG_VERBOSE); + OutputStream os; + if (output instanceof FileProvider) { + os = new FileOutputStream(((FileProvider) output).getFile(), append); + } else { + os = output.getOutputStream(); + if (append) { + log("Ignoring append=true for non-file resource " + output, Project.MSG_WARN); + } + } + out = new PrintStream(new BufferedOutputStream(os)); } // Process all transactions