Re: AW: Adding a methof to StringUtils

2006-04-20 Thread Antoine Levy-Lambert
Matt Benson wrote:

 Kev: I've asked some stuff about FileUtils before...
 historically it was thought it might be pluggable,
 hence all the instance methods.  But that never
 happened so the static methods crept in.  I think it
 was Martijn who really pushed in the FileUtils
 singleton.  Most places in Ant's code don't
 instantiate their own FileUtils anymore, and if they
 do they shouldn't; they should use the singleton.

 -Matt
   

Hello Kev,

if you want to do some optimization work for copy,
can you have a look at this bug report :
http://issues.apache.org/bugzilla/show_bug.cgi?id=30094

Using nio for copy operations to network drives under Windows brings a
huge performance improvement.
I used it on Windows 2000 or 2003 and JDK 1.4, with as target some
drives automounted from a NAS box.

With NIO the copy speed is at least 4 times as big.

This type of progress dwarfs logging optimization.

Of course, this is mainly to be used (or only) in the case when one
copies 100% of the content of a file to another location,
no filtering takes place.

Regards,

Antoine

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 32884] - [PATCH] PathConvert on Windows should process forward and back slashes equivalently

2006-04-20 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=32884.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32884


[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEEDINFO|ASSIGNED




--- Additional Comments From [EMAIL PROTECTED]  2006-04-20 06:25 ---
The prefix is not removed on windows, because of:

- the file paths are returned in windows format, something like
C:\MyProjects\ProjectX\lib\somelib.jar

- the paths specified to search files and as the prefix usually I use something
like  ${basedir}/lib.

And when strings are compared, they do not match, because they use different
slashes. So prefix is not removed.
In my patch I added replace, making all slashes uniform.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r395510 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java

2006-04-20 Thread kevj
Author: kevj
Date: Wed Apr 19 23:44:38 2006
New Revision: 395510

URL: http://svn.apache.org/viewcvs?rev=395510view=rev
Log:
fix bug#32738, implement quiet check for every message logged

Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java?rev=395510r1=395509r2=395510view=diff
==
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java Wed Apr 
19 23:44:38 2006
@@ -490,7 +490,7 @@
 public void execute() throws BuildException {
 if (usedMatchingTask) {
 log(DEPRECATED - Use of the implicit FileSet is deprecated.  
-+ Use a nested fileset element instead.);
++ Use a nested fileset element instead., quiet ? 
Project.MSG_VERBOSE : verbosity);
 }
 
 if (file == null  dir == null  filesets.size() == 0  rcs == 
null) {
@@ -510,7 +510,7 @@
 if (file.isDirectory()) {
 log(Directory  + file.getAbsolutePath()
 +  cannot be removed using the file attribute.  
-+ Use dir instead.);
++ Use dir instead., quiet ? Project.MSG_VERBOSE : 
verbosity);
 } else {
 log(Deleting:  + file.getAbsolutePath());
 
@@ -520,8 +520,7 @@
 }
 } else {
 log(Could not find file  + file.getAbsolutePath()
-+  to delete.,
-Project.MSG_VERBOSE);
++  to delete., quiet ? Project.MSG_VERBOSE : verbosity);
 }
 }
 
@@ -545,7 +544,7 @@
 Resources filesetDirs = new Resources();
 filesetDirs.setProject(getProject());
 
-for (int i = 0; i  filesets.size(); i++) {
+for (int i = 0, size = filesets.size(); i  size; i++) {
 FileSet fs = (FileSet) filesets.get(i);
 if (fs.getProject() == null) {
 log(Deleting fileset with no project specified;
@@ -617,7 +616,7 @@
 throw (e instanceof BuildException)
 ? (BuildException) e : new BuildException(e);
 }
-log(e.getMessage(), quiet ? Project.MSG_VERBOSE : Project.MSG_WARN);
+log(e.getMessage(), quiet ? Project.MSG_VERBOSE : verbosity);
 }
 
 /**
@@ -666,7 +665,7 @@
 if (f.isDirectory()) {
 removeDir(f);
 } else {
-log(Deleting  + f.getAbsolutePath(), verbosity);
+log(Deleting  + f.getAbsolutePath(), quiet ? 
Project.MSG_VERBOSE : verbosity);
 if (!delete(f)) {
 handle(Unable to delete file  + f.getAbsolutePath());
 }
@@ -688,10 +687,11 @@
 protected void removeFiles(File d, String[] files, String[] dirs) {
 if (files.length  0) {
 log(Deleting  + files.length +  files from 
-+ d.getAbsolutePath());
++ d.getAbsolutePath(), quiet ? Project.MSG_VERBOSE : 
verbosity);
 for (int j = 0; j  files.length; j++) {
 File f = new File(d, files[j]);
-log(Deleting  + f.getAbsolutePath(), verbosity);
+log(Deleting  + f.getAbsolutePath(), 
+quiet ? Project.MSG_VERBOSE : verbosity);
 if (!delete(f)) {
 handle(Unable to delete file  + f.getAbsolutePath());
 }
@@ -704,7 +704,8 @@
 File currDir = new File(d, dirs[j]);
 String[] dirFiles = currDir.list();
 if (dirFiles == null || dirFiles.length == 0) {
-log(Deleting  + currDir.getAbsolutePath(), verbosity);
+log(Deleting  + currDir.getAbsolutePath(), 
+quiet ? Project.MSG_VERBOSE : verbosity);
 if (!delete(currDir)) {
 handle(Unable to delete directory 
 + currDir.getAbsolutePath());
@@ -715,9 +716,11 @@
 }
 
 if (dirCount  0) {
-log(Deleted  + dirCount +  director
-+ (dirCount == 1 ? y : ies)
-+  from  + d.getAbsolutePath());
+log(Deleted 
+ + dirCount
+ +  director + (dirCount == 1 ? y : ies)
+ +  form  + d.getAbsolutePath(), 
+ quiet ? Project.MSG_VERBOSE : verbosity);
 }
 }
 }



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r395512 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java

2006-04-20 Thread kevj
Author: kevj
Date: Wed Apr 19 23:51:49 2006
New Revision: 395512

URL: http://svn.apache.org/viewcvs?rev=395512view=rev
Log:
use StringUtil.LINE_SEP

Modified:

ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java

Modified: 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java?rev=395512r1=395511r2=395512view=diff
==
--- 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
 (original)
+++ 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
 Wed Apr 19 23:51:49 2006
@@ -17,6 +17,9 @@
 
 package org.apache.tools.ant.taskdefs.compilers;
 
+//Java5 style
+//import static org.apache.tools.ant.util.StringUtils.LINE_SEP; 
+
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
@@ -30,6 +33,7 @@
 import org.apache.tools.ant.types.Commandline;
 import org.apache.tools.ant.types.Path;
 import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.util.StringUtils;
 import org.apache.tools.ant.util.JavaEnvUtils;
 import org.apache.tools.ant.taskdefs.condition.Os;
 
@@ -68,7 +72,7 @@
 protected String memoryMaximumSize;
 
 protected File[] compileList;
-protected static final String lSep = System.getProperty(line.separator);
+//protected static final String lSep = 
System.getProperty(line.separator);
 protected Javac attributes;
 
 
@@ -399,12 +403,12 @@
 }
 niceSourceList.append( to be compiled:);
 
-niceSourceList.append(lSep);
+niceSourceList.append(StringUtils.LINE_SEP);
 
 for (int i = 0; i  compileList.length; i++) {
 String arg = compileList[i].getAbsolutePath();
 cmd.createArgument().setValue(arg);
-niceSourceList.append( + arg + lSep);
+niceSourceList.append( + arg + StringUtils.LINE_SEP);
 }
 
 attributes.log(niceSourceList.toString(), Project.MSG_VERBOSE);



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 30094] - Performance enhancements using java.nio lazy calls

2006-04-20 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=30094.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30094





--- Additional Comments From [EMAIL PROTECTED]  2006-04-20 07:54 ---
(In reply to comment #13)
 It could be a compile-time-optional part of the runtime, something that is 
 only
 delegated to when the runtime is 1.4+. Which means that we'd need an
 interface/facade to the operations and then an original+nio implementation, 

(pushed here from Antoine on the dev list ...)

I've started looking into this and I can see that we need an interface of the
current FileUtils class (minus static methods) and then a factory to select the
implementation, and 2+ implementations, original/classic (ie what we have right
now), NioFileUtils (such as this code here in this bug report) and
Java6FileUtils (for all the file permission goodies).

I'm not sure how to resolve the problem that *a lot* of the current code
presumes a lot about FileUtils (ie that certain methods are static etc).  Since
we have to maintain bwc, this will probably have to mean that the interface
contains definitions of all instance methods, and the original FileUtils will
have to keep the static methods (as they are public) and any new implementation
will have to delegate to the original for these methods.

Is this a sensible strategy?
Kev

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r395534 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java

2006-04-20 Thread peterreilly
Author: peterreilly
Date: Thu Apr 20 01:42:25 2006
New Revision: 395534

URL: http://svn.apache.org/viewcvs?rev=395534view=rev
Log:
remove spurious system.out
change date to 2006

Modified:

ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java

Modified: 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java?rev=395534r1=395533r2=395534view=diff
==
--- 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
 (original)
+++ 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
 Thu Apr 20 01:42:25 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright  2001-2005 The Apache Software Foundation
+ * Copyright  2001-2006 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the License);
  *  you may not use this file except in compliance with the License.
@@ -63,7 +63,6 @@
 public static CompilerAdapter getCompiler(String compilerType, Task task)
 throws BuildException {
 boolean isClassicCompilerSupported = true;
-System.out.println(GetCompiler: compilerType is  + compilerType);
 //as new versions of java come out, add them to this test
 if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)
  !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) {



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r395539 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java

2006-04-20 Thread peterreilly
Author: peterreilly
Date: Thu Apr 20 01:53:50 2006
New Revision: 395539

URL: http://svn.apache.org/viewcvs?rev=395539view=rev
Log:
2006

Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java

Modified: 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java?rev=395539r1=395538r2=395539view=diff
==
--- 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java 
(original)
+++ 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java 
Thu Apr 20 01:53:50 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright  2005 The Apache Software Foundation
+ * Copyright  2005-2006 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the License);
  *  you may not use this file except in compliance with the License.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: AW: Adding a methof to StringUtils

2006-04-20 Thread Steve Loughran

Kev Jackson wrote:



If it came to it I'd -1 it too!  I don't like any of the solutions I 
could come up with yesterday, the one I showed was the 'least worst' 
that I could think of, with a semi-upgrade path to Java5 style varargs 
(use an object array).  I was mainly throwing the idea out to see what 
peoples reactions were - overall I don't think it's the right way to 
solve the problem - the real problem is that the level of logging cannot 
currently be determined and so any optimization (for memory or 
performance) is actually changing the behaviour of the code - which it 
shouldn't do.


The delete task was just an example - I was looking at it to fix 'delete 
task won't be quiet' bug in bugzilla, and I was also thinking about the 
problem with AppFuse, (which does use Delete a little, but not as much 
as Copy and other tasks), so it seemed like a handy guinea pig as I had 
the code open at the time.


I was also looking at Copy and saw that ResourceUtils.copyResource is a 
static method, but FileUtils.copyFile is not even though it delegates to 
copyResource, this means that in Copy there must be an instantiated 
fileUtils object, just to perform the copy, unfortunately the FileUtils 
interface/API is public so changing it would break bwc, but I'd like to 
add a static method for copyFile so that Copy wont need to instantiate 
FileUtils.


One thing I've always been curious about is how much speedup we'd get by 
turning off all logging. That is, if I modified log() to discard its 
contents, how much faster would everything be? We couldnt use the test 
suite as a benchmark, because  too many tests depend on the log, and it 
probably isnt realistic.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: AW: Adding a methof to StringUtils

2006-04-20 Thread Jan.Materne
One thing I've always been curious about is how much speedup 
we'd get by turning off all logging. That is, if I modified 
log() to discard its contents, how much faster would 
everything be? We couldnt use the test suite as a benchmark, 
because  too many tests depend on the log, and it probably 
isnt realistic.


We could use the buildfiles from the testcases. Just run as simple
builds and ignore their results. Just for having a bunch of buildfiles
;-)
Realistic? .

Jan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[patch] NioFileUtils, FileUtilsAdapter + factory (was Re: AW: Adding a methof to StringUtils)

2006-04-20 Thread Kev Jackson

Hi,

As promised, here's the code that I hacked together today at Antoine's 
suggestion regarding a patch in bugzilla [1].


Feel free to tear it to pieces and point out obvious problems.  I've 
patched my version of copy to use this code instead of FileUtils 
directly and so far there have been no problems with it.


Thanks
Kev

[1]http://issues.apache.org/bugzilla/show_bug.cgi?id=30094
Index: 
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/util/FileUtils.java
===
--- 
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/util/FileUtils.java
   (revision 395527)
+++ 
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/util/FileUtils.java
   (working copy)
@@ -46,7 +46,7 @@
  * their last modification time.
  *
  */
-public class FileUtils {
+public class FileUtils implements FileUtilsAdapter {
 
 private static final FileUtils PRIMARY_INSTANCE = new FileUtils();

Index: 
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/util/FileUtilsAdapter.java
===
/*
 * Copyright  2006 The Apache Software Foundation
 *
 *  Licensed under the Apache License, Version 2.0 (the License);
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an AS IS BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */

package org.apache.tools.ant.util;

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Vector;

import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.FilterSetCollection;

/**
 * An interface for the different types of FileUtils (classic, Nio, Java6+)
 *
 */
public interface FileUtilsAdapter {

/**
 * The granularity of timestamps under FAT.
 */
public static final long FAT_FILE_TIMESTAMP_GRANULARITY = 2000;

/**
 * The granularity of timestamps under Unix.
 */
public static final long UNIX_FILE_TIMESTAMP_GRANULARITY = 1000;

/**
 * The granularity of timestamps under the NT File System.
 * NTFS has a granularity of 100 nanoseconds, which is less
 * than 1 millisecond, so we round this up to 1 millisecond.
 */
public static final long NTFS_FILE_TIMESTAMP_GRANULARITY = 1;

/**
 * Get the URL for a file taking into account # characters.
 *
 * @param file the file whose URL representation is required.
 * @return The FileURL value.
 * @throws MalformedURLException if the URL representation cannot be
 *  formed.
 */
public URL getFileURL(File file) throws MalformedURLException;

/**
 * Convenience method to copy a file from a source to a destination.
 * No filtering is performed.
 *
 * @param sourceFile Name of file to copy from.
 *   Must not be codenull/code.
 * @param destFile Name of file to copy to.
 * Must not be codenull/code.
 *
 * @throws IOException if the copying fails.
 */
public void copyFile(String sourceFile, String destFile)
throws IOException;

/**
 * Convenience method to copy a file from a source to a destination
 * specifying if token filtering must be used.
 *
 * @param sourceFile Name of file to copy from.
 *   Must not be codenull/code.
 * @param destFile Name of file to copy to.
 * Must not be codenull/code.
 * @param filters the collection of filters to apply to this copy.
 *
 * @throws IOException if the copying fails.
 */
public void copyFile(String sourceFile, String destFile,
 FilterSetCollection filters)
throws IOException;

/**
 * Convenience method to copy a file from a source to a
 * destination specifying if token filtering must be used and if
 * source files may overwrite newer destination files.
 *
 * @param sourceFile Name of file to copy from.
 *   Must not be codenull/code.
 * @param destFile Name of file to copy to.
 * Must not be codenull/code.
 * @param filters the collection of filters to apply to this copy.
 * @param overwrite Whether or not the destination file should be
 *  overwritten if it already exists.
 *
 * @throws IOException if the copying fails.
 */
public void copyFile(String sourceFile, String destFile, 
FilterSetCollection filters,
 boolean overwrite) throws IOException;


Re: [patch] NioFileUtils, FileUtilsAdapter + factory (was Re: AW: Adding a methof to StringUtils)

2006-04-20 Thread Antoine Levy-Lambert
Hello Kevin,

NioFileUtils should go into another package
org.apache.tools.ant.util.java14 otherwise we are going to have build
problems under java 1.2
This should be entered in the build.xml (selector needs.jdk14+)
Therefore NioFileUtils would be packaged in ant-nodeps.jar

We need also a FileUtilsFactory. The FileUtilsFactory would instantiate
NioFileUtils if the java runtime is 1.4 or 1.5, the normal FileUtils
otherwise.
This should be developed along the lines of the RegexpFactory, which
means no imports of optional classes such as NioFileUtils or
Java16FileUtils.

Similarly, users of FileUtils would call
FileUtilsFactory.newFileUtils(Project p) instead of
FileUtils.newFileUtils() where a project member variable is available,
otherwise FileUtilsFactory.newFileUtils().

FileUtilsFactory would be the place where the right FileUtils
implementation is picked.

Regards,

Antoine

Kev Jackson wrote:
 Hi,

 As promised, here's the code that I hacked together today at Antoine's
 suggestion regarding a patch in bugzilla [1].

 Feel free to tear it to pieces and point out obvious problems.  I've
 patched my version of copy to use this code instead of FileUtils
 directly and so far there have been no problems with it.

 Thanks
 Kev

 [1]http://issues.apache.org/bugzilla/show_bug.cgi?id=30094
 

 Index: 
 D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/util/FileUtils.java
 ===
 --- 
 D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/util/FileUtils.java
  (revision 395527)
 +++ 
 D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/util/FileUtils.java
  (working copy)
 @@ -46,7 +46,7 @@
   * their last modification time.
   *
   */
 -public class FileUtils {
 +public class FileUtils implements FileUtilsAdapter {
  
  private static final FileUtils PRIMARY_INSTANCE = new FileUtils();

 Index: 
 D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/util/FileUtilsAdapter.java
 ===
 /*
  * Copyright  2006 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the License);
  *  you may not use this file except in compliance with the License.
  *  You may obtain a copy of the License at
  *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  *  Unless required by applicable law or agreed to in writing, software
  *  distributed under the License is distributed on an AS IS BASIS,
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *
  */

 package org.apache.tools.ant.util;

 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Vector;

 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.FilterSetCollection;

 /**
  * An interface for the different types of FileUtils (classic, Nio, Java6+)
  *
  */
 public interface FileUtilsAdapter {
 
 /**
  * The granularity of timestamps under FAT.
  */
 public static final long FAT_FILE_TIMESTAMP_GRANULARITY = 2000;

 /**
  * The granularity of timestamps under Unix.
  */
 public static final long UNIX_FILE_TIMESTAMP_GRANULARITY = 1000;

 /**
  * The granularity of timestamps under the NT File System.
  * NTFS has a granularity of 100 nanoseconds, which is less
  * than 1 millisecond, so we round this up to 1 millisecond.
  */
 public static final long NTFS_FILE_TIMESTAMP_GRANULARITY = 1;
 
 /**
  * Get the URL for a file taking into account # characters.
  *
  * @param file the file whose URL representation is required.
  * @return The FileURL value.
  * @throws MalformedURLException if the URL representation cannot be
  *  formed.
  */
 public URL getFileURL(File file) throws MalformedURLException;
 
 /**
  * Convenience method to copy a file from a source to a destination.
  * No filtering is performed.
  *
  * @param sourceFile Name of file to copy from.
  *   Must not be codenull/code.
  * @param destFile Name of file to copy to.
  * Must not be codenull/code.
  *
  * @throws IOException if the copying fails.
  */
 public void copyFile(String sourceFile, String destFile)
 throws IOException;
 
 /**
  * Convenience method to copy a file from a source to a destination
  * specifying if token filtering must be used.
  *
  * @param sourceFile Name of file to copy from.
  *   Must not be codenull/code.
  * @param destFile Name of file to copy to.
  * Must not be codenull/code.
  * @param filters the 

AW: AW: AW: Adding a methof to StringUtils

2006-04-20 Thread Jan.Materne
 We could use the buildfiles from the testcases. Just run as simple 
 builds and ignore their results. Just for having a bunch of 
buildfiles
 ;-)
 Realistic? .

still not that accurate as it doesnt represent real builds.  
Better to turn off logging for a day and see how much faster 
gump gets...


Yeah - would be a real-world-test.
Only our own testcases would fail (dependency on log output) - if we
dont provide a flag for switching on (default=off)

Jan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 32738] - Delete task won't be quiet

2006-04-20 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=32738.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32738


[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED




--- Additional Comments From [EMAIL PROTECTED]  2006-04-20 13:55 ---
Kev fixed in SVN HEAD.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [patch] NioFileUtils, FileUtilsAdapter + factory (was Re: AW: Adding a methof to StringUtils)

2006-04-20 Thread Matt Benson
--- Antoine Levy-Lambert [EMAIL PROTECTED] wrote:

 Hello Kevin,
 
 NioFileUtils should go into another package
 org.apache.tools.ant.util.java14 otherwise we are
 going to have build
 problems under java 1.2
 This should be entered in the build.xml (selector
 needs.jdk14+)
 Therefore NioFileUtils would be packaged in
 ant-nodeps.jar
 
I don't really care either way here, but couldn't we
explicitly exclude the file(s)?  Why must they live in
another directory?

 We need also a FileUtilsFactory. The
 FileUtilsFactory would instantiate
 NioFileUtils if the java runtime is 1.4 or 1.5, the
 normal FileUtils
 otherwise.
 This should be developed along the lines of the
 RegexpFactory, which
 means no imports of optional classes such as
 NioFileUtils or
 Java16FileUtils.

I found it in Kev's (long :) mail:

package org.apache.tools.ant.util;

public class FileUtilsAdapterFactory {

private FileUtilsAdapterFactory() {}

public static FileUtilsAdapter getFileUtils(final
String type) {
if (type.equals(nio)) {
//just print out to see if it's actually
picking up the correct class
System.out.println(Using nio fileutils);
return new NioFileUtils();
} else if (type.equals(java6)) {
System.out.println(Using java6
fileutils);
return new Java6FileUtils();
} else {
System.out.println(Using classic
fileutils);
return new FileUtils();
}
}

public static FileUtilsAdapter getBestFileUtils()
{
final int v =
JavaEnvUtils.getJavaVersionNumber();
if (v = 16) {
return getFileUtils(java6);
} else if (v =14) {
return getFileUtils(nio);
} else {
return new FileUtils();
}
}
}

Since the other impls will be conditionally compiled,
we should use Class.forInstance()...

 
 Similarly, users of FileUtils would call
 FileUtilsFactory.newFileUtils(Project p) instead of
 FileUtils.newFileUtils() where a project member
 variable is available,
 otherwise FileUtilsFactory.newFileUtils().

What would the Project reference be used for?

Kev: your mail showed:

public class NioFileUtils extends FileUtils implements
FileUtilsAdapter {...}

public class Java6FileUtils extends FileUtils
implements FileUtilsAdapter {...}


But shouldn't that actually be:

+public class FileUtils implements FileUtilsAdapter
{...}

public class NioFileUtils extends FileUtils {...}

public class Java6FileUtils extends NioFileUtils {...}

?

br,
Matt

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [patch] NioFileUtils, FileUtilsAdapter + factory (was Re: AW: Adding a methof to StringUtils)

2006-04-20 Thread Kevin Jackson
 I found it in Kev's (long :) mail:


Sorry it was rather long, but there were a few files packed in there!
 Since the other impls will be conditionally compiled,
 we should use Class.forInstance()...


ok, so we use dynamic class-loading to get the correct fileutils?  Is
there an example in the code already of how I should do this, (like in
the ComplilerAdapter code perhaps?)


 What would the Project reference be used for?

 Kev: your mail showed:

 public class NioFileUtils extends FileUtils implements
 FileUtilsAdapter {...}

 public class Java6FileUtils extends FileUtils
 implements FileUtilsAdapter {...}


 But shouldn't that actually be:

 +public class FileUtils implements FileUtilsAdapter
 {...}

 public class NioFileUtils extends FileUtils {...}

 public class Java6FileUtils extends NioFileUtils {...}


Probably yes, I think I cobbled it together in a hap-hazard fashion -
first the interface, then change the FileUtils etc, so I could
probably remove the implements FileUtilsAdapter from the subclasses, I
just wanted to make sure I wasn't 'polishing a turd', ie wasting time
getting every little thing right, if the overall direction of the code
was wrong.

Thanks for comments
Kev

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [patch] NioFileUtils, FileUtilsAdapter + factory (was Re: AW: Adding a methof to StringUtils)

2006-04-20 Thread Antoine Levy-Lambert

Kevin Jackson wrote:

I found it in Kev's (long :) mail:




  



Sorry it was rather long, but there were a few files packed in there!
  

No problem, I should have washed my glasses this morning, ...

Since the other impls will be conditionally compiled,
we should use Class.forInstance()...




ok, so we use dynamic class-loading to get the correct fileutils?  Is
there an example in the code already of how I should do this, (like in
the ComplilerAdapter code perhaps?)

  

in the RegexpFactory there is an example.

What would the Project reference be used for?


in the RegexpFactory, a project reference is used so that properties can 
be accessed, and that the user can direct ant to use a particular 
implementation.

Kev: your mail showed:

public class NioFileUtils extends FileUtils implements
FileUtilsAdapter {...}

public class Java6FileUtils extends FileUtils
implements FileUtilsAdapter {...}


But shouldn't that actually be:

+public class FileUtils implements FileUtilsAdapter
{...}

public class NioFileUtils extends FileUtils {...}

public class Java6FileUtils extends NioFileUtils {...}




Probably yes, I think I cobbled it together in a hap-hazard fashion -
first the interface, then change the FileUtils etc, so I could
probably remove the implements FileUtilsAdapter from the subclasses, I
just wanted to make sure I wasn't 'polishing a turd', ie wasting time
getting every little thing right, if the overall direction of the code
was wrong.
  
A last thing : I think that the default buffer size (variable 
TRANSFER_SIZE) should be reduced from 81920 to 32000 and should be 
configurable.
I used this nio copy before, and larger transfer sizes were sometimes 
creating exceptions (error messages coming from the operating system).



Thanks for comments
Kev

  

Antoine


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r395614 - /ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java

2006-04-20 Thread mbenson
Author: mbenson
Date: Thu Apr 20 08:09:41 2006
New Revision: 395614

URL: http://svn.apache.org/viewcvs?rev=395614view=rev
Log:
remove extra space

Modified:

ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java

Modified: 
ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java?rev=395614r1=395613r2=395614view=diff
==
--- 
ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java
 (original)
+++ 
ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java
 Thu Apr 20 08:09:41 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright  2000-2005 The Apache Software Foundation
+ * Copyright  2000-2006 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the License);
  *  you may not use this file except in compliance with the License.
@@ -104,7 +104,7 @@
 throws BuildException 
 {
 return (RegexpMatcher) ClasspathUtils.newInstance(className,
-RegexpMatcherFactory.class.getClassLoader(), RegexpMatcher 
.class);
+RegexpMatcherFactory.class.getClassLoader(), 
RegexpMatcher.class);
 }
 
 /**



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r395615 - /ant/core/trunk/src/main/org/apache/tools/ant/util/ClasspathUtils.java

2006-04-20 Thread mbenson
Author: mbenson
Date: Thu Apr 20 08:13:51 2006
New Revision: 395615

URL: http://svn.apache.org/viewcvs?rev=395615view=rev
Log:
remove extraneous javadoc block... Martijn!  :)

Modified:
ant/core/trunk/src/main/org/apache/tools/ant/util/ClasspathUtils.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/ClasspathUtils.java
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/util/ClasspathUtils.java?rev=395615r1=395614r2=395615view=diff
==
--- ant/core/trunk/src/main/org/apache/tools/ant/util/ClasspathUtils.java 
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/ClasspathUtils.java Thu 
Apr 20 08:13:51 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright  2003-2005 The Apache Software Foundation
+ * Copyright 2003-2006 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the License);
  *  you may not use this file except in compliance with the License.
@@ -299,23 +299,6 @@
 e);
 }
 }
-
-/**
- * Creates a fresh object instance of the specified classname.
- *
- * p This uses the userDefinedLoader to load the specified class,
- * and then makes an instance using the default no-argument constructor.
- * /p
- *
- * @param className the full qualified class name to load.
- * @param userDefinedLoader the classloader to use.
- * @param expectedType the Class that the result should be assignment
- * compatible with. (No ClassCastException will be thrown in case
- * the result of this method is casted to the expectedType) 
- * @return The fresh object instance
- * @throws BuildException when loading or instantiation failed.
- */
-
 
 /**
  * Obtains a delegate that helps out with classic classpath configuration.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 30094] - Performance enhancements using java.nio lazy calls

2006-04-20 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=30094.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30094





--- Additional Comments From [EMAIL PROTECTED]  2006-04-20 15:32 ---
Can static methods just execute non-static methods on util's singleton?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [patch] NioFileUtils, FileUtilsAdapter + factory (was Re: AW: Adding a methof to StringUtils)

2006-04-20 Thread Matt Benson
Another thought about the factory--it should cache an
instance of each FileUtils type to minimize object
creation.  We can either just have it be known that
FileUtilsAdapter impls should be stateless or have a
StatelessFileUtilsAdapter interface--if implemented,
cache, else don't.

thoughts?

-Matt

--- Matt Benson [EMAIL PROTECTED] wrote:

 --- Kevin Jackson [EMAIL PROTECTED] wrote:
 
   I found it in Kev's (long :) mail:
  
  
  Sorry it was rather long, but there were a few
 files
  packed in there!
 
 parenthetical smiley above.
 
   Since the other impls will be conditionally
  compiled,
   we should use Class.forInstance()...
  
  
  ok, so we use dynamic class-loading to get the
  correct fileutils?  Is
  there an example in the code already of how I
 should
  do this, (like in
  the ComplilerAdapter code perhaps?)
  
 That's the way I understand it.  Antoine cited
 Regexp
 factory stuff (o.a.t.a.util.regexp); it looks like
 the
 biggest lesson to take from here would be the use of
 ClasspathUtils:
 
 return (FileUtilsAdapter)
 ClasspathUtils.newInstance(className,
 FileUtilsAdapter.class.getClassLoader(),
 FileUtilsAdapter.class);
 
 -Matt
 
 [SNIP]
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam
 protection around 
 http://mail.yahoo.com 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [patch] NioFileUtils, FileUtilsAdapter + factory (was Re: AW: Adding a methof to StringUtils)

2006-04-20 Thread Antoine Levy-Lambert

Matt Benson wrote:

Another thought about the factory--it should cache an
instance of each FileUtils type to minimize object
creation.  We can either just have it be known that
FileUtilsAdapter impls should be stateless or have a
StatelessFileUtilsAdapter interface--if implemented,
cache, else don't.

  

I only know that the existing FileUtils implementations are stateless.
Maybe we can simply assume that this will be the case in the future.

Regards,

Antoine

thoughts?

-Matt

  




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 30094] - Performance enhancements using java.nio lazy calls

2006-04-20 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=30094.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30094





--- Additional Comments From [EMAIL PROTECTED]  2006-04-20 18:30 ---
(In reply to comment #15)
 Can static methods just execute non-static methods on util's singleton?

Definetely,

We could even use the singleton  / constructor as factory and turn the FileUtils
into a proxy with embedded factory.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [patch] NioFileUtils, FileUtilsAdapter + factory (was Re: AW: Adding a methof to StringUtils)

2006-04-20 Thread Martijn Kruithof
O by the way I am / was looking if FileUtils could be split into os 
dependend version this way, so I actually did some work on this as well.


Martijn Kruithof schreef:


I actually had a similar problem in my dtd work recently.

We had a class that applied one single strategy to determine something 
important for telecommunication systems, had some static methods, some 
nonstatic methods, was used by different components of which some 
could not be updated.
Backward compatibility was crucial, but at the same time it was 
important that every component would use the correct strategy.


What I did was turn the constructor into an factory (however still 
staying a constructor, just creating the destination class), and turn 
the class into a proxy, towards several implementations, one of which 
would be the singleton actually used (one of which having the original 
implementation in nonstatic methods only).


Maybe the same way can be used to replace the FileUtils as wel, make 
the FileUtils class a Proxy with built in Factory.


Martijn


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [patch] NioFileUtils, FileUtilsAdapter + factory (was Re: AW: Adding a methof to StringUtils)

2006-04-20 Thread Martijn Kruithof

Matt Benson schreef:


Another thought about the factory--it should cache an
instance of each FileUtils type to minimize object
creation.  We can either just have it be known that
FileUtilsAdapter impls should be stateless or have a
StatelessFileUtilsAdapter interface--if implemented,
cache, else don't.

thoughts?

-Matt

Well I am certainly in favour of keeping FileUtils stateless, by the 
way, didn't you move copying of files to ResourceUtils some time ago?


Martijn

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [patch] NioFileUtils, FileUtilsAdapter + factory (was Re: AW: Adding a methof to StringUtils)

2006-04-20 Thread Matt Benson
--- Martijn Kruithof [EMAIL PROTECTED] wrote:

 Matt Benson schreef:
 
 Another thought about the factory--it should cache
 an
 instance of each FileUtils type to minimize object
 creation.  We can either just have it be known that
 FileUtilsAdapter impls should be stateless or have
 a
 StatelessFileUtilsAdapter interface--if
 implemented,
 cache, else don't.
 
 thoughts?
 
 -Matt
 
 Well I am certainly in favour of keeping FileUtils
 stateless, by the 

My point was only that we can't really enforce that
FileUtilsAdapter (or whatever) impls are stateless. 
If we are making this factory-based we could allow
users to (theoretically) provide their own
implementation.  If such an impl was
stateful/non-threadsafe, singletons would misbehave. 
That's where my idea of a subinterface was coming
from.  Anyway...

 way, didn't you move copying of files to
 ResourceUtils some time ago?
 

viewcvs(svn) shows I did it 6.5 months ago...
apparently so.  Speaking of which, Kev (I think)
mentioned these are static in ResourceUtils, but as
they are unreleased we could change them to instance
methods.  The behavior there is fairly
straightforward, though, so I'm not sure if anything
would be gained by this...

-Matt

 Martijn
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r395688 - /ant/core/trunk/src/main/org/apache/tools/ant/types/resources/CompressedResource.java

2006-04-20 Thread stevel
Author: stevel
Date: Thu Apr 20 13:01:34 2006
New Revision: 395688

URL: http://svn.apache.org/viewcvs?rev=395688view=rev
Log:
Resource implements ResourceCollection, so this was a a needless entry unless 
it was a Remotable interface and we want rmic to generate proxies. Assuming we 
don't, I'm deleting it to make the UML cleaner

Modified:

ant/core/trunk/src/main/org/apache/tools/ant/types/resources/CompressedResource.java

Modified: 
ant/core/trunk/src/main/org/apache/tools/ant/types/resources/CompressedResource.java
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/CompressedResource.java?rev=395688r1=395687r2=395688view=diff
==
--- 
ant/core/trunk/src/main/org/apache/tools/ant/types/resources/CompressedResource.java
 (original)
+++ 
ant/core/trunk/src/main/org/apache/tools/ant/types/resources/CompressedResource.java
 Thu Apr 20 13:01:34 2006
@@ -35,8 +35,7 @@
  *
  * @since Ant 1.7
  */
-public abstract class CompressedResource extends Resource
-implements ResourceCollection {
+public abstract class CompressedResource extends Resource {
 
 private Resource resource;
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Additional SourceSafe (VSS) Tasks - Any Comments?

2006-04-20 Thread Paul Cager

Standard Ant contains a number of VSS tasks and I'm writing a couple
more for my own use (tasks relating to file / project properties, such
as shared versions). My questions are: should I submit these tasks for
possible inclusion in the standard Ant distribution? And if so, do you
have any advice on  the best way to do that? I've read the Task Design
Guidelines, by the way.

Having looked at the Dev mail archive, I've noticed that VSS tasks can 
be a bit of a problem for committers, since they don't (as a rule) have 
access to VSS to test the tasks. Any way I can help with that?


Thanks,
Paul



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [patch] NioFileUtils, FileUtilsAdapter + factory (was Re: AW: Adding a methof to StringUtils)

2006-04-20 Thread Martijn Kruithof

Matt Benson schreef:


viewcvs(svn) shows I did it 6.5 months ago...
apparently so.  Speaking of which, Kev (I think)
mentioned these are static in ResourceUtils, but as
they are unreleased we could change them to instance
methods.  The behavior there is fairly
straightforward, though, so I'm not sure if anything
would be gained by this...

-Matt
 

Whell it would mean that if we do it in FileUtils, we wouldn't benfit 
from it when Resources come into play. Futhermore, if introduce the nio 
copy under the responsibility of the ResourceUtils all users of 
FileUtils would benefit right away.


Martijn

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [patch] NioFileUtils, FileUtilsAdapter + factory (was Re: AW: Adding a methof to StringUtils)

2006-04-20 Thread Matt Benson
--- Martijn Kruithof [EMAIL PROTECTED] wrote:

 Matt Benson schreef:
 
 viewcvs(svn) shows I did it 6.5 months ago...
 apparently so.  Speaking of which, Kev (I think)
 mentioned these are static in ResourceUtils, but as
 they are unreleased we could change them to
 instance
 methods.  The behavior there is fairly
 straightforward, though, so I'm not sure if
 anything
 would be gained by this...
 
 -Matt
   
 
 Whell it would mean that if we do it in FileUtils,
 we wouldn't benfit 
 from it when Resources come into play. Futhermore,
 if introduce the nio 
 copy under the responsibility of the ResourceUtils
 all users of 
 FileUtils would benefit right away.

I'm afraid I've never studied nio in much detail... do
its performance enhancements extend to non-file-based
IO?

-Matt

 
 Martijn
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r395705 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java

2006-04-20 Thread antoine
Author: antoine
Date: Thu Apr 20 14:39:32 2006
New Revision: 395705

URL: http://svn.apache.org/viewcvs?rev=395705view=rev
Log:
Fix javadoc, remove a call to deprecated FileUtils.newUtils()

Modified:

ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java

Modified: 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java?rev=395705r1=395704r2=395705view=diff
==
--- 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java 
(original)
+++ 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java 
Thu Apr 20 14:39:32 2006
@@ -175,7 +175,9 @@
  * @param is the stream containing the stylesheet data.
  * @param infile the file that will be used for the systemid.
  * @return the configured source instance matching the stylesheet.
- * @throws Exception if there is a problem creating the source.
+ * @throws ParserConfigurationException if a parser cannot be created which
+ * satisfies the requested configuration.
+ * @throws SAXException in case of problem detected by the SAX parser.
  */
 private Source getSource(InputStream is, File infile)
 throws ParserConfigurationException, SAXException {
@@ -230,7 +232,6 @@
 
 /**
  * Create a new transformer based on the liaison settings
- * @return the newly created and configured transformer.
  * @throws Exception thrown if there is an error during creation.
  * @see #setStylesheet(java.io.File)
  * @see #addParam(java.lang.String, java.lang.String)
@@ -403,7 +404,7 @@
 if (systemid != null) {
 String url = systemid;
 if (url.startsWith(file:)) {
-url = FileUtils.newFileUtils().fromURI(url);
+url = FileUtils.getFileUtils().fromURI(url);
 }
 msg.append(url);
 } else {



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r395723 - in /ant/core/trunk: ./ docs/manual/ docs/manual/CoreTasks/ src/main/org/apache/tools/ant/taskdefs/ src/main/org/apache/tools/ant/taskdefs/optional/ src/testcases/org/apache/tools

2006-04-20 Thread antoine
Author: antoine
Date: Thu Apr 20 16:00:46 2006
New Revision: 395723

URL: http://svn.apache.org/viewcvs?rev=395723view=rev
Log:
Remove xslp usage from ant. 
Bugzilla 23455.

Removed:

ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/XslpLiaison.java

ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/optional/XslpLiaisonTest.java
Modified:
ant/core/trunk/WHATSNEW
ant/core/trunk/build.xml
ant/core/trunk/docs/manual/CoreTasks/style.html
ant/core/trunk/docs/manual/install.html
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java

Modified: ant/core/trunk/WHATSNEW
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/WHATSNEW?rev=395723r1=395722r2=395723view=diff
==
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Thu Apr 20 16:00:46 2006
@@ -74,6 +74,9 @@
 * A bug in SQLExec would prevent the execution of trailing,
   non-semicolon-delimited statements.  Bugzilla Report 37764.
 
+* support for the XSL:P XML parser has been removed.
+  Bugzilla Report 23455.
+
 Fixed bugs:
 ---
 

Modified: ant/core/trunk/build.xml
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/build.xml?rev=395723r1=395722r2=395723view=diff
==
--- ant/core/trunk/build.xml (original)
+++ ant/core/trunk/build.xml Thu Apr 20 16:00:46 2006
@@ -209,10 +209,6 @@
 /or
   /selector
 
-  selector id=needs.xslp
-filename name=${optional.package}/XslpLiaison*/
-  /selector
-
   selector id=needs.apache-resolver
 filename name=${apache.resolver.type.package}/**/
   /selector
@@ -419,9 +415,6 @@
 available 
resource=META-INF/services/javax.xml.transform.TransformerFactory/
   /or
 /condition
-available property=xslp.present
-  classname=com.kvisco.xsl.XSLProcessor
-  classpathref=classpath/
 available property=apache.resolver.present
   classname=org.apache.xml.resolver.tools.CatalogResolver
   classpathref=classpath/
@@ -682,7 +675,6 @@
 
 selector refid=needs.trax unless=trax.present/
 selector refid=needs.xalan1 unless=xalan.present/
-selector refid=needs.xslp unless=xslp.present/
 selector refid=needs.apache-resolver 
unless=apache.resolver.present/
 selector refid=needs.junit unless=junit.present/
 selector refid=needs.apache-regexp
@@ -865,7 +857,6 @@
   or
 selector refid=needs.trax/
 selector refid=needs.xalan1/
-selector refid=needs.xslp/
 selector refid=needs.apache-resolver/
 selector refid=needs.junit/
 selector refid=needs.apache-regexp/
@@ -913,7 +904,6 @@
 
 optional-jar dep=trax/
 optional-jar dep=xalan1/
-optional-jar dep=xslp/
 optional-jar dep=apache-resolver/
 optional-jar dep=junit/
 optional-jar dep=apache-regexp/
@@ -1736,8 +1726,6 @@
   exclude name=${optional.package}/XalanLiaisonTest.java
 unless=bsf.present/
   exclude name=${optional.package}/XalanLiaisonTest.java
-unless=xerces1.present/
-  exclude name=${optional.package}/XslpLiaisonTest.java
 unless=xerces1.present/
   exclude name=${ant.package}/IncludeTest.java
 unless=xerces1.present/

Modified: ant/core/trunk/docs/manual/CoreTasks/style.html
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/docs/manual/CoreTasks/style.html?rev=395723r1=395722r2=395723view=diff
==
--- ant/core/trunk/docs/manual/CoreTasks/style.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/style.html Thu Apr 20 16:00:46 2006
@@ -50,10 +50,7 @@
 pThis task supports the use of a nested codelt;paramgt;/code element 
which is used to pass values
   to an codelt;xsl:paramgt;/code declaration./p
 pThis task supports the use of a nested a 
href=../CoreTypes/xmlcatalog.htmlxmlcatalog/a
-element which is used to perform Entity and URI resolution/p
-picodelt;stylegt;/code and codelt;xsltgt;/code refer to the 
same Ant task and can be used interchangeably./i/p
-pIf you want to use Xalan-J 1 or XSL:P, you also Ant optional JARs,
-specifically ant-xalan1.jar and ant-xslp.jar/p
+element which is used to perform Entity and URI resolution./p
 h3Parameters/h3
 table border=1 cellpadding=2 cellspacing=0
   tr
@@ -83,9 +80,12 @@
   tr
 td valign=topstyle/td
 td valign=topname of the stylesheet to use - given either relative
-  to the project's basedir or as an absolute path
-  emstrongDEPRECATED/strong - can be specified as a path relative
-  to the basedir attribute of this task as well/em.
+  to the project's basedir or as an absolute path.br/
+  br/
+  emdeprecated variation :/em br/
+  If the stylesheet cannot be found, and if you have specified 

DO NOT REPLY [Bug 23455] - [PATCH] mark xlsp liaison as deprecated

2006-04-20 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=23455.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=23455


[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED
   Target Milestone|--- |1.7




--- Additional Comments From [EMAIL PROTECTED]  2006-04-20 23:02 ---
After a vote, I removed the code and documentation concerning xslp support. This
will make (temporarily) one jar less in our distro. :-)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [patch] NioFileUtils, FileUtilsAdapter + factory (was Re: AW: Adding a methof to StringUtils)

2006-04-20 Thread Kevin Jackson
 You do not gain by using nio when copying files to a local drive.

As far as I know, you do gain a little, in the flexibility offered
(memory mapped files, channels etc).  The code is also (usually) much
easier to maintain compared to standard IO.


 I do not know what in the implementation of nio allows to gain this
 performance.

When I first looked at it, I think it had something to do with the
blocking behaviour of standard IO, NIO is actually Non-(blocking) IO
in this respect.  Sort of how Apache 1 (used blocking threads), -
Apache 2 (uses non-blocking model), at least I think that's how the
performance is achieved.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: svn commit: r395742 - /ant/core/trunk/docs/manual/CoreTasks/style.html

2006-04-20 Thread Antoine Levy-Lambert
Hi,

I did a few indentation changes, because I realized that it was not at
all clear that the attributes described below Factory are nested
elements of the factory, which itself is a nested element of the xslt task.

The xslt task describes actually several types : factory, attribute,
outputproperty, param. I wonder whether for clarity they should not be
moved each to its own html file, for instance under Concept and Types.

In my previous change, I rewrote the documentation for the style
attribute of the xslt task itself. From the way it was written
previously, I thought that the style attribute was deprecated.
What was meant was only that the resolution of stylesheet relative to an
attribute basedir of the task is deprecated.

I never understood that before, but I saw nowhere an alternative to the
style attribute. I thought that the documentation meant that there is a
nested element which can replace the style attribute, which is not the case.

Regards,

Antoine


[EMAIL PROTECTED] wrote:
 ant/core/trunk/docs/manual/CoreTasks/style.html

   


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 39373] New: - scp task does not work for some sshd, which does not scp1 protocol.

2006-04-20 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=39373.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39373

   Summary: scp task does not work for some sshd, which does not
scp1 protocol.
   Product: Ant
   Version: 1.6.5
  Platform: All
OS/Version: other
Status: NEW
  Severity: normal
  Priority: P2
 Component: Optional Tasks
AssignedTo: dev@ant.apache.org
ReportedBy: [EMAIL PROTECTED]


In the current implementaion, scp task included in Apache Ant has been using 
scp1
protocol to transfer files, but some proprietary sshd[1] has not supported it 
anymore.

To resolve this problem, scp task should use sftp protocol[2], which must be 
supported by
almost of all ssh2 sshd.

[1] http://www.snailbook.com/faq/scp-ossh-to-ssh2.auto.html
[2] http://www.unix.org.ua/orelly/networking_2ndEd/ssh/ch03_08.htm

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 39373] - scp task does not work for some sshd, which does not scp1 protocol.

2006-04-20 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=39373.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39373





--- Additional Comments From [EMAIL PROTECTED]  2006-04-21 01:37 ---
Created an attachment (id=18147)
 -- (http://issues.apache.org/bugzilla/attachment.cgi?id=18147action=view)
a patch to use sftp protocol in scp task.

Attached patch will allow scp task to use sftp protocol instead of scp1
protocol.

If you add the attribute 'sftp=true', sftp protocol will be used and 
if 'sftp=false', scp1 protocol will be used.  
By the default, the attribute 'sftp' is false for backword compatibity.

To try this patch, jsch-0.1.27[1] is required.

[1] http://sourceforge.net/project/showfiles.php?group_id=64920


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[patch] NioFileUtils, Java6FileUtils, FileUtilsAdapter + factory, build.xml (was Re: AW: Adding a methof to StringUtils)

2006-04-20 Thread Kev Jackson

Ok, this is what I've managed to bash together this morning:

- NioFileUtils (uses Java1.4 NIO libraries, altered the TRANSFER_SIZE as 
suggested to 32000, currently no way to override that (yet))
- Java6FileUtils (currently has no implementation, but could be used in 
future for implementing Java6 features (file permisions etc))
- FileUtils (refactored to imlement interface, still needs to have all 
comments refactored into @see - interface)

- FileUtilsAdapter (interface of FileUtils)
- FileUtilsFactory (uses runtime class-loading to select correct 
version, also allows for selection of impl via system property or ant 
property (project.getProperty), as suggested, caches the instance of the 
FileUtilsAdapter on first use.  This assumes that during a build a user 
won't want to swap out FilUtils implementations.)

- build.xml (contains the selector code for [Nio|Java6]FileUtils)

Current problems:
I cannot get the current code to select the implementation based on the 
property I'm specifying - (I'm using .ant.properties and I've also tried 
-D style props).  Any hint as to how this mechanism works in general 
would be appreciated.
Code is just in util package, it would be nicer in it's own separate 
package - open to suggestions on this.
Not sure that the selector in the build is working - after bootstrap + 
build, the ant-nodeps.jar doesn't contain the Nio or the Java6FileUtils 
- should they be here?


Patch attached for consideration and comments.

Btw, swapping to NIO does help the AppFuse build to get past the copying 
- it now fails on HtmlUnit - which we can't do much about.  So 
(anecdotally anyway), NIO seems to use less memory than traditional IO.


Thanks
Kev
Index: 
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/MagicNames.java
===
--- 
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/MagicNames.java   
(revision 395527)
+++ 
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/MagicNames.java   
(working copy)
@@ -127,6 +127,14 @@
  * Value: [EMAIL PROTECTED]
  */
 public static final String REGEXP_IMPL = ant.regexp.regexpimpl;
+
+/**
+ * property for file utils implementation.
+ * default to classic/original
+ * @since Ant 1.7
+ * Value: [EMAIL PROTECTED]
+ */
+public static final String FILEUTILS_IMPL = ant.util.fileutilsimpl;
 
 /**
  * property that provides the default value for javac's and

Index: 
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/taskdefs/Copy.java
===
--- 
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/taskdefs/Copy.java
(revision 395527)
+++ 
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/taskdefs/Copy.java
(working copy)
@@ -28,25 +28,28 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Vector;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
+
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.types.Mapper;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
 import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.FilterChain;
 import org.apache.tools.ant.types.FilterSet;
-import org.apache.tools.ant.types.FilterChain;
 import org.apache.tools.ant.types.FilterSetCollection;
+import org.apache.tools.ant.types.Mapper;
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
 import org.apache.tools.ant.types.ResourceFactory;
 import org.apache.tools.ant.types.resources.FileResource;
+import org.apache.tools.ant.util.FileNameMapper;
 import org.apache.tools.ant.util.FileUtils;
-import org.apache.tools.ant.util.FileNameMapper;
+import org.apache.tools.ant.util.FileUtilsAdapter;
+import org.apache.tools.ant.util.FileUtilsFactory;
+import org.apache.tools.ant.util.FlatFileNameMapper;
 import org.apache.tools.ant.util.IdentityMapper;
 import org.apache.tools.ant.util.ResourceUtils;
 import org.apache.tools.ant.util.SourceFileScanner;
-import org.apache.tools.ant.util.FlatFileNameMapper;
 
 /**
  * Copies a file or directory to a new file
@@ -85,7 +88,7 @@
 protected Hashtable completeDirMap = new Hashtable();
 
 protected Mapper mapperElement = null;
-protected FileUtils fileUtils;
+protected FileUtilsAdapter fileUtils;
 private Vector filterChains = new Vector();
 private Vector filterSets = new Vector();
 private String inputEncoding = null;
@@ -96,7 +99,7 @@
  * Copy task constructor.
  */
 public Copy() {
-fileUtils = FileUtils.getFileUtils();
+fileUtils = FileUtilsFactory.getFileUtils();
 granularity = fileUtils.getFileTimestampGranularity();
 }
 
@@ -105,7 +108,7 @@
  * @return the fileutils object.
  */
 protected