Changes between Initial Version and Version 1 of rfc12_filemanagement


Ignore:
Timestamp:
Apr 29, 2007, 9:48:08 PM (17 years ago)
Author:
warmerdam
Comment:

very preliminary draft.

Legend:

Unmodified
Added
Removed
Modified
  • rfc12_filemanagement

    v1 v1  
     1= RFC 12: Improved File Management =
     2
     3Author: Frank Warmerdam[[BR]]
     4Contact: warmerdam@pobox.com[[BR]]
     5Status: Development
     6
     7== Summary ==
     8
     9Some applications using GDAL have a requirement to provide file management operations through the GUI.  This includes deleting, renaming, moving and packaging up datasets which often requires operations on several associated files.  This RFC introduces an operation on a GDALDataset to identify all the dataset files, and operations move, and rename them.
     10
     11== GetFileList() ==
     12
     13The following new virtual method is added on the GDALDataset class, with an analygous C function.
     14
     15{{{
     16   virtual char   **GDALDataset::GetFileList(void);
     17}}}
     18
     19The method is intended to return a list of files associated with this open dataset.  The return is a NULL terminated string list which becomes owned by the caller and should be deallocated with CSLDestroy().  The default implementation tests the name of the datasource to see if it is a file, and if so it is returned otherwise an empty list is returned.
     20
     21The GDALPamDataset::GetFileList() method will add the ability to find .aux and .aux.xml files associated with a dataset to the core default behavior.
     22
     23== pfnRename() ==
     24
     25The following new function is added to the GDALDriver class.
     26
     27{{{
     28    CPLErr       (*pfnRename)( const char *pszOldName, const char *pszNewName );
     29}}}
     30
     31Also a corresponding function is added to the C API.
     32
     33{{{
     34    CPLErr        GDALRenameDataset( GDALDriverH hDriver, const char *pszOldName, const char *pszNewName );
     35}}}
     36
     37Note that renaming is done by the driver, but the dataset to be operated on should '''not''' be open at the time. GDALRenameDataset() will invoke pfnRename if it is non-NULL. 
     38
     39If pfnRename is NULL the default implementation will be used which will open the dataset, fetch the file list, close the dataset, and then try to rename all the files (based on shared basenames).  The default rename operation will fail if it is unable to establish a relationship between the files (ie. a common basename or stem) to indicate how the group of files should be rename to the new pattern.  The default rename operation will use VSIRename() to rename the files, so this function may only be suitable if they remain in the same filesystem or even directory.
     40
     41Optionally a NULL hDriver argument may be passed in, in which case the appropriate driver will be selected by first opening the datasource.
     42
     43== pfnMove() ==
     44
     45... similar to rename, but uses CPLCopyFile() to move files allowing cross filesystem operations.
     46
     47== pfnDelete() ==
     48
     49The delete operations default implementation will be extended to use the GetFileList() results.
     50
     51== Supporting Functions ==
     52
     53Some sort of supporting functions should be provided to make it easy to identify worldfiles, .aux files and .prj files associated with a file.