Changes between Initial Version and Version 1 of MapGuideRfc74


Ignore:
Timestamp:
Jul 7, 2009, 3:19:13 AM (15 years ago)
Author:
CXYS
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MapGuideRfc74

    v1 v1  
     1= !MapGuide RFC 74 - Move or rename resource avoid breaking links =
     2
     3This page contains an change request (RFC) for the !MapGuide Open Source project.
     4More !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||(July 7, 2009)||
     11||Last Modified||(Christine Bao Tue July 7 02:22:17 2009)||
     12||Author||Christine Bao||
     13||RFC Status||ready for review||
     14||Implementation Status||(under development)||
     15||Proposed Milestone||2.2||
     16||Assigned PSC guide(s)||Tom Fukushima||
     17||'''Voting History'''||||
     18||+1||||
     19||+0||||
     20||-0||||
     21||-1||||
     22||no vote|| ||
     23
     24== Overview ==
     25
     26This RFC changes the ResourceService API MoveResource to avoid breaking links.
     27
     28== Motivation ==
     29
     30Currently if move or rename resource, the other resources referencing to it are not updated and can't find the new location of the resource, thus they will not work anymore. For example, if move or rename a FeatureSource, the LayerDefinitions which reference to this FeatureSource are not updated to use the new FeatureSource URL, and they can't work properly.
     31This RFC modifies the ResourceService API MoveResource, adding a new parameter "bool cascade" to indicate whether update the referencing resources or not.
     32
     33== Proposed Solution ==
     34
     35The modified ResourceService API is:
     36{{{
     37    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     38    /// \brief
     39    /// Moves an existing resource to another location.
     40    ///
     41    /// \remarks
     42    /// You can also use this method to rename a resource.
     43    ///
     44    /// <!-- Syntax in .Net, Java, and PHP -->
     45    /// \htmlinclude DotNetSyntaxTop.html
     46    /// virtual void MoveResource(MgResourceIdentifier sourceResource, MgResourceIdentifier destResource, bool overwrite, bool cascade);
     47    /// \htmlinclude SyntaxBottom.html
     48    /// \htmlinclude JavaSyntaxTop.html
     49    /// virtual void MoveResource(MgResourceIdentifier sourceResource, MgResourceIdentifier destResource, boolean overwrite, boolean cascade);
     50    /// \htmlinclude SyntaxBottom.html
     51    /// \htmlinclude PHPSyntaxTop.html
     52    /// virtual void MoveResource(MgResourceIdentifier sourceResource, MgResourceIdentifier destResource, bool overwrite, bool cascade);
     53    /// \htmlinclude SyntaxBottom.html
     54    ///
     55    /// \param sourceResource (MgResourceIdentifier)
     56    /// Resource to be moved. This can be a document
     57    /// or folder.
     58    /// <ul>
     59    ///    <li>If it is a folder, this method also moves the contents of the folder and all folders below it.</li>
     60    ///    <li>If it is a folder, you must include the trailing slash in the identifier.</li>
     61    /// </ul>
     62    /// \param destResource (MgResourceIdentifier)
     63    /// Where the resource should be moved to.
     64    /// \param overwrite (boolean/bool)
     65    /// Flag to determine whether or not the
     66    /// destination resource should be overwritten if
     67    /// it exists.
     68    /// \param cascade (boolean/bool)
     69    /// Flag to determine whether or not the
     70    /// referencing resource content should be updated.
     71    ///
     72    /// \return
     73    /// Returns nothing.
     74    ///
     75    /// <!-- Example (PHP) -->
     76    /// \htmlinclude PHPExampleTop.html
     77    /// This example moves the file
     78    /// Library://Geography/World.MapDefinition to
     79    /// Library://Atlas/Oceans.MapDefinition:
     80    /// \code
     81    /// // Assuming $resourceService has already been initialized
     82    /// $oldPath = new MgResourceIdentifier("Library://Geography/World.MapDefinition");
     83    /// $newPath = new MgResourceIdentifier("Library://Atlas/Oceans.MapDefinition");
     84    /// $resourceService->MoveResource($oldPath, $newPath, true, false);
     85    /// \endcode
     86    ///
     87    /// This example moves the folder Library://Geography/ to
     88    /// Library://World Geography/:
     89    /// \code
     90    /// $oldPath = new MgResourceIdentifier("Library://Geography/");
     91    /// $newPath = new MgResourceIdentifier("Library://World Geography/");
     92    /// $resourceService->MoveResource($oldPath, $newPath, true, true);
     93    /// \endcode
     94    ///
     95    /// This example renames Oceans.MapDefinition to Pacific
     96    /// Ocean.MapDefinition:
     97    /// \code
     98    /// /**************************************************************************/
     99    /// $oldPath = new MgResourceIdentifier("Library://Atlas/Oceans.MapDefinition");
     100    /// $newPath = new MgResourceIdentifier("Library://Atlas/Pacific Ocean.MapDefinition");
     101    /// $resourceService->MoveResource($oldPath, $newPath, true, true);
     102    /// \endcode
     103    /// \htmlinclude ExampleBottom.html
     104    ///
     105    /// \exception MgResourceNotFoundException
     106    /// \exception MgDuplicateResourceException
     107    /// \exception MgInvalidRepositoryTypeException
     108    /// \exception MgInvalidRepositoryNameException
     109    /// \exception MgInvalidResourcePathException
     110    /// \exception MgInvalidResourceNameException
     111    /// \exception MgInvalidResourceTypeException
     112    ///
     113    /// \note
     114    /// When copying a folder with the "overwrite" flag turned on, if
     115    /// the destination folder already exists, then only the children
     116    /// in the destination folder that have the same names as those
     117    /// in the source folder are overwritten. The rest should are
     118    /// left intact.
     119    ///
     120    virtual void MoveResource(MgResourceIdentifier* sourceResource,
     121        MgResourceIdentifier* destResource, bool overwrite, bool cascade) = 0;
     122}}}
     123[[BR]]
     124
     125If cascade==true, not only this resource is moved, but also the referencing resources are found out and updated.[[BR]]
     126If cascade==false, it works exactly as what it's now.
     127
     128
     129Maestro keeps the link when move or rename resource, however it enumerates the referencing resources to client, and updates them one by one to server by a lot of individual requests. The disadvantage is obvious without a batch request:[[BR]]
     1301. Performance is bad.[[BR]]
     1312. The update may be incomplete if connection broken.
     132
     133
     134If cascade==false, which is the same as current behavior, it only needs to check whether user has permission for the moved resource. If cascade==true, before call this API it needs to check whether user has permission for both the moved resource and the referencing resources. The access permission is not checked during this API.
     135
     136== Implications ==
     137
     138After changing this API all the related applications should be updated.
     139
     140== Test Plan ==
     141
     142Test move or rename resource in Studio.
     143
     144== Funding/Resources ==
     145
     146Supplied by Autodesk.