Re: [vfs] proposal: FileUtils

2005-02-02 Thread Mario Ivankovits
B. K. Oxley (binkley) wrote: I'm curious what you find out about Commons Transactions. When I looked it over, it seemd to me designed with primitives for us to use to make our own transactions. I missed any ready-to-use code for this purpose. After 2 hours of copy/paste their FileResourceMan

Re: [vfs] proposal: FileUtils

2005-02-02 Thread B. K. Oxley (binkley)
Mario Ivankovits wrote: JDK5: Dont forget, our target is jdk1.3 (even if I use 1.5 since it is out) You cant imagine how fast the first user shouted after I used (by mistake) a jdk 1.4 method. JDK 1.3!? I had no earthly idea. -

Re: [vfs] proposal: FileUtils

2005-02-02 Thread Mario Ivankovits
Hello! I'm curious what you find out about Commons Transactions. When I looked it over, it seemd to me designed with primitives for us to use to make our own transactions. I missed any ready-to-use code for this purpose. I wonder how much overlap there is with java.util.concurrent in the ne

Re: [vfs] proposal: FileUtils

2005-02-02 Thread B. K. Oxley (binkley)
Mario Ivankovits wrote: In pseudo code: UndoStack tx = new UndoStack(); try { Backup(tx, ...) Copy(tx, ...) Move(tx, ...) } catch (Exception) { tx.rollback(); <- process undo-stack } This looks ok. I still prefer each command to handle it's own cleanup (try/catch/finally in part existing for thi

Re: [vfs] proposal: FileUtils

2005-02-02 Thread Mario Ivankovits
What do you think, if the commands do not chain the next command, but if they create a Undo-Command which will be put on a stack and - in case of an exception can be processed to "rollback" all commands. I havent though about it in every detail, but if it is possible it is easier to handle - and

Re: [vfs] proposal: FileUtils

2005-02-02 Thread Mario Ivankovits
Hello! Sorry for being late, but I have had an appointment day with one of our customers. public abstract class Backup implements IOOperation { protected Backup(final FuPolicy policy) { And two implementations: public class NoBackup extends Backup { public class SimpleBackup extends Backup {

Re: [vfs] proposal: FileUtils

2005-02-01 Thread B. K. Oxley (binkley)
Continuing the command pattern, I rejiggered the Save command to use a Backup command rather than hard-coding the backup policy: public class Save implements IOOperation { private final Backup backup; private final InputStream newContents; private final FuFile original; public Sav

Re: [vfs] proposal: FileUtils

2005-01-31 Thread B. K. Oxley (binkley)
I looked over the problem again and think I'd prefer a command object approach: public interface Operation { void execute() throws E; } And: public interface IOOperation extends Operation { } (Excess abstraction, I know. I had a hard time resisting the coolness of generic exceptions.) And

Re: [vfs] proposal: FileUtils

2005-01-31 Thread Mario Ivankovits
Hello! void save(final OutputStream newContents, final FileObject dest) throws FileSystemException; void saveAndOverwrite(final OutputStream newContents, final FileObject dest) throws FileSystemException; How strong is your preference? Doesnt lead such a design to have tons of saveAnd methods.

Re: [vfs] proposal: FileUtils

2005-01-31 Thread B. K. Oxley (binkley)
Mario Ivankovits wrote: Where do you think to implement this FileOperation interface? I miss the "source" fileobject -a s I said, I dont want to implement the interface in the FileObject and thus thought about something like this: DefaultFileOperations.get().copy(FileObject src, FileObject dest

Re: [vfs] proposal: FileUtils

2005-01-30 Thread Mario Ivankovits
Hello! How is this for an interface for file operations? Where do you think to implement this FileOperation interface? I miss the "source" fileobject -a s I said, I dont want to implement the interface in the FileObject and thus thought about something like this: DefaultFileOperations.get().copy(

Re: [vfs] proposal: FileUtils

2005-01-30 Thread B. K. Oxley (binkley)
How is this for an interface for file operations? public interface FileOperation { void save(final InputStream newContents) throws FileSystemException; void saveAndBackup(final InputStream newContents) throws FileSystemException; void copyTo(final FileName newLoc

Re: [vfs] proposal: FileUtils

2005-01-25 Thread Mario Ivankovits
Hi Brian! Sorry for the long delay. I was in an delivery period and therefore out of time. After the next week I should have more time again. I am not sure we should implement a "poor-man's transaction" if we could have more ([transaction] ) for free. Hmmm, I would like to have a depper look on

Re: [vfs] proposal: FileUtils

2005-01-21 Thread B. K. Oxley (binkley)
Mario Ivankovits wrote: About transactionality :- care should be taken to not reimplement something like [transaction], they already implemented such a beast using java.io.File. Maybe we can adopt it. I'll have to look at it, but it looked like overkill for what I had in mind. I've been toying wi

Re: [vfs] proposal: FileUtils

2005-01-21 Thread Mario Ivankovits
Damn good work! I think we should introduce a FileUtils class, I dont want to bloat the FileObject with "utility functions". About transactionality :- care should be taken to not reimplement something like [transaction], they already implemented such a beast using java.io.File. Maybe we can ado