From: Jesse E. <je...@re...> - 2004-04-22 23:14:52
|
I like your proposal Martin but I have one concern: The Readers and Writers have been given the responsibility for deciding how to use the Source object (This is written in the documentation for the Geotools GCExchange interface). I am thinking that perhaps we can further separate the responsibilities. For example a reader/writer pair will know how to interpret a byte stream from an inputstream and write formatted data to a outputstream. A separate IOManager would be responsible for creating an input/output stream out of the Source Object. A DBIOManager might be responsible for communication with a Database and a StreamIOManager would be responsible for communication with Files or streams. The GCExchange would create a Reader/Writer and pass to it the correct IOManager. A GCExchange connected to a Database would pass its Readers/Writers an DBIOManager . Jesse Martin Desruisseaux wrote: >My proposal is one singleton by database (exactly like database connection). In the case of file, we could see the whole file system as a kind of database. So there is one singleton for all GridCoverage reading from file or from InputStream. > >In other words, lets say: > > ==> One root instance > >Point. This singleton is used for reading and writting any kind of GridCoverage from an InputStream / OutputStream, or a filename. > >For DataBase, all I propose to do is to create an other implementation of GridCoverageExchange, which is permanently connected to a database. When invoking getReader(source), it just gets the InputStream for this source from the database and pass it to the root GridCoverageExchange. That should be a easy to implement. > > Martin. > > > |