NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Before I get your dander up on the filename issue, does the "magic number" part make sense? I knew the filename method might cause a bit of discussion, but I can't see any good reason to separate the "magic number" functionality from the individual fileformat-specific FormNode classes. > > It'd sure be nice to push the logic from guessFormFromName() into the > > individual Form classes and augment that with code which recognizes > > the file type based on the first block. For example, FITS files always > > start with "SIMPLE = ", GIF files always start with "GIF87a" or "GIF89a", > > etc. > > When I designed the FormNode class I also thought about using naming > conventions. I decided not to put such a capability into the FormNode > class because I thought that a naming-convention capability was somewhat > orthogonal to the capabilities of the FormNode (or at least > complementary). Thus, I figured that such a capability would be better > off in a class in the user interface that made use of Repositories and > added naming convention capabilities. By "user interface", I hope you don't mean core VisAD user-interface helper classes, not user-developed code. I certainly wouldn't want to force every single user to develop a (slightly different) solution to something like this. The problem I have with your design is that it moves the implementation details of a file format into multiple places. With my two methods, everything about a file format is still concentrated in one single class. In fact, I'd propose adding a FormNode method like: String[] getDefaultSuffixes() return a list of default suffixes for this file format This could be used as a list of 0 or more defaults by your proposed classes. This new method would also allow us to implement a common FormNode.isThisType(String) method, so most file formats wouldn't need to implement it. > One thing I think would be crucial to this capability would be the > ability for the user to customize or modify the naming convention > (sort of like "mailcap(5)"). Or more appropriately, a reverse ".mime.types" file. > This would allow different users to have > different naming conventions. This would entail considerable more > effort than implementing FormNodes that lacked this capability, so I > decided to postpone it. OK, do you foresee implementing this anytime soon? I'm being optimistic and assuming we'll get a big bump in users after next week, all busily trying to crank out VisAD applications...
visad
archives: