| 1 | = !MapGuide RFC 2 - Unmanaged Data APIs = |
| 2 | |
| 3 | This page contains an change request (RFC) for the !MapGuide Open Source project. |
| 4 | More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page. |
| 5 | |
| 6 | |
| 7 | == Status == |
| 8 | |
| 9 | ||RFC Template Version||(1.0)|| |
| 10 | ||Submission Date||1 November 2006|| |
| 11 | ||Last Modified||Tony Fang [[Timestamp]]|| |
| 12 | ||Author||Tony Fang|| |
| 13 | ||RFC Status||adopted|| |
| 14 | ||Implementation Status||under development|| |
| 15 | ||Proposed Milestone||1.2|| |
| 16 | ||Assigned PSC guide(s)||(when determined)|| |
| 17 | ||'''Voting History'''||Dec 18, 2006|| |
| 18 | ||+1||Tom, Jason, Andy, Bruce, Haris, Paul, Bob|| |
| 19 | ||+0|| || |
| 20 | ||-0|| || |
| 21 | ||-1|| || |
| 22 | |
| 23 | == Overview == |
| 24 | |
| 25 | Managed data is data contained inside the server's data repository. Unmanaged data is any data outside of the server's data repository. |
| 26 | |
| 27 | We want to add server/web functionality and APIs which will allow Studio to create feature sources from unmanaged data. To accomplish this, directories accessible by the server machine can be specified as unmanaged data directories. APIs will be added which will enumerate the available unmanaged data files from the specified unmanaged data directories. |
| 28 | |
| 29 | !WebStudio can also make use of these APIs to create unmanaged feature sources. |
| 30 | |
| 31 | == Motivation == |
| 32 | |
| 33 | When Studio is used to create a feature source (e.g. using Load Procedure), the data files (e.g. sdf, shp, raster, dwf, odbc) are uploaded to the server's repository (managed data). This is not an issue when the data files are small. If Studio and Server are on the same machine, this uploading is an unnecessary duplication of the data file. If the data file is really large, the copying is slow and it consumes unnecessary hard-drive space. |
| 34 | |
| 35 | Currently, a feature source which references unmanaged data can be created. But it must be done manually. The exact path to the data file on the server machine must be known. Then the Feature Source XML must be manually edited and uploaded to the server via the web tier. This is a cumbersome process. |
| 36 | |
| 37 | We want to automate this workaround in Studio. To do this, additional APIs and functionality will be added to the server/web. Directories accessible by the server machine can be specified as unmanaged data directories. APIs will be added which will enumerate the available unmanaged data files. Thus direct access to the server machine's file system will no longer be required. Creation of unmanaged data feature sources can now be created remotely. |
| 38 | |
| 39 | The API will only enumerate data files contained in the directories and subdirectories specified by the server. For security reasons we do not want to allow the API to return data files in directories which are not specified. For windows, specified directories can be physical drives or network paths. For linux, it can be any accessible path. |
| 40 | |
| 41 | == Proposed Solution == |
| 42 | |
| 43 | The server's unmanaged data directories will be specified using the serverconfig.ini. A new section defining directory mappings will be used to specify the unmanaged data directories. This section can be edited using the Server Admin API. |
| 44 | |
| 45 | For windows, it may look like this: |
| 46 | {{{ |
| 47 | [UnmanagedDataMappings] |
| 48 | SomeSdfFiles = c:\mydata\sdf |
| 49 | Some Shp Files = d:\otherdata\shp |
| 50 | BigArseImages = \\some_other_machine\data\images |
| 51 | Some 很大中文 DwfFiles = c:\mydata\很大中文Dwf |
| 52 | 大きい sdf = c:\mydata\bigsdf |
| 53 | }}} |
| 54 | For linux, it may look like this: |
| 55 | {{{ |
| 56 | [UnmanagedDataMappings] |
| 57 | SomeSdfFiles = /usr/mydata/sdf |
| 58 | Some Shp Files = /usr/otherdata/shp |
| 59 | BigArseImages = /mnt/some_other_machine/data/images |
| 60 | Some 很大中文 DwfFiles = /usr/mydata/很大中文Dwf |
| 61 | 大きい sdf = /usr/mydata/bigsdf |
| 62 | }}} |
| 63 | Unicode characters are supported in the mapping names. Spaces in the mappings are also supported. Square brackets [ and ] are not allowed. They are reserved characters for the serverconfig.ini section titles. |
| 64 | |
| 65 | We will add API methods to return the unmanaged data mappings, set the mappings, and also verify that the mappings are valid and accessible. |
| 66 | |
| 67 | We will add an API to enumerate the unmanaged data files available on the server machine. The files will be prefaced with their mapping names. You may enumerate all files from all the available drive mappings, or you may select a single drive mapping. |
| 68 | |
| 69 | A returned list from all available drive mappings may look like this: |
| 70 | {{{ |
| 71 | [SomeSdfFiles]world.sdf |
| 72 | [Some Shp Files]ecuador.shp |
| 73 | [Some 很大中文 DwfFiles]large.dwf |
| 74 | [Some 很大中文 DwfFiles]subdir/Big.dwf |
| 75 | [大きい sdf]reallybig.sdf |
| 76 | }}} |
| 77 | |
| 78 | The server will not be locked down such that it is restricted to those files in the Unmanaged Data Mappings. In other words, this means that a feature source can still reference a file that is not in one of the subdirectories specified by the mappings. The reason we don't have to restrict to those subdirectories is because we can use the operating system's or network's built-in security to limit access to files. It will be dependent upon the administrator to allow access to the files in the Unmanaged Data Mappings, otherwise they won't be very useful. Thus manually created unmanaged features sources and those created by webstudio will continue to work. |
| 79 | |
| 80 | For cross platform compatibilities (i.e. Linux only supports ‘/’s while Windows supports both ‘/’s and ‘\’s), pathnames referenced in XML documents should always contain forward slashes (‘/’s) instead of backward slashes (‘\’s). |
| 81 | |
| 82 | === Technical === |
| 83 | |
| 84 | The following API functions will be added to the Resource Service: |
| 85 | |
| 86 | {{{ |
| 87 | virtual MgStringCollection * MgResourceService::EnumerateUnmanagedData(CREFSTRING mappingName, CREFSTRING dataTypeFilter, INT32 depth); |
| 88 | |
| 89 | Enumerates the available unmanaged data from the server. |
| 90 | |
| 91 | Parameters: |
| 92 | |
| 93 | mappingName specifies which mapping to use to return the unmanaged data. When set to empty string, it will use all mappings. |
| 94 | |
| 95 | dataTypeFilter is a filter on the returned data. E.g. SHP, SDF, DWF, RASTER, FOLDER. When set to empty string, it will return all data types. FOLDER returns a list of subfolders. |
| 96 | |
| 97 | depth is how many levels of subfolders it should search for data. -1 to search all depths, 0 to search only the top level, 1 to search 1 level, 2 to search 2 levels, etc. |
| 98 | |
| 99 | Returns: |
| 100 | |
| 101 | Returns an MgStringCollection containing the available unmanaged data files. |
| 102 | |
| 103 | |
| 104 | virtual MgStringCollection * MgResourceService::EnumerateUnmanagedDataMappings(); |
| 105 | |
| 106 | Enumerates the unmanaged data mappings. |
| 107 | |
| 108 | Parameters: |
| 109 | |
| 110 | None. |
| 111 | |
| 112 | Returns: |
| 113 | |
| 114 | Returns an MgStringCollection containing only the mapping names. |
| 115 | }}} |
| 116 | |
| 117 | == Implications == |
| 118 | |
| 119 | API documentation will need to be updated. |
| 120 | |
| 121 | == Test Plan == |
| 122 | |
| 123 | * Add webtier test pages which use the new API methods. |
| 124 | * Add unit tests which test the new API methods. |
| 125 | |
| 126 | == Funding/Resources == |
| 127 | |
| 128 | Autodesk to supply the resources to make the required changes. |