be.re.repo
Interface XMLMergeDocument


public interface XMLMergeDocument

The interface for external modules to perform a three-way merge of an XML document. It will be called when a version on one branch has to be merged with a version on another. This decision is taken based on the structure of the version tree and on the outcome of the XMLTestDifference module that applies to the document format. Such modules are declared in /configuration/maps.xml using the merge element as * in the following example:

 <merge>
   <mime-type>text/xml</mime-type>
   <!-- Additional mime-type elements can come here. -->
   <!-- Several path elements can come here. -->
   <class>
     <name>be.re.repo.mod.XMLCopyMerge</name>
     <!-- Optional URL relative to maps.xml.
     <jar>modules/my_module.jar</jar>
   </class>
 </merge>
 
 

Author:
Werner Donné
See Also:
XMLTestDifference

Method Summary
 void complete(XMLEventReader in, XMLEventWriter out, String mimeType, Context context)
          This method is called to perform completion on the contents of a version when the shouldComplete method returns true.
 boolean merge(XMLEventReader base, XMLEventReader source, XMLEventReader target, XMLEventWriter out, String mimeType, Context context)
          This method calculates the merge and detects possible conflicts.
 boolean shouldComplete(String mimeType)
           
 boolean storeWithConflicts(String mimeType)
           
 

Method Detail

complete

void complete(XMLEventReader in,
              XMLEventWriter out,
              String mimeType,
              Context context)
              throws IOException
This method is called to perform completion on the contents of a version when the shouldComplete method returns true. The method can take into account the conflict resolution actions the user may have done on the version.

Parameters:
in - the XML-stream of the version.
out - the XML-stream into which the completed version should be written.
mimeType - the MIME type of the document.
context - the repository context.
Throws:
IOException

merge

boolean merge(XMLEventReader base,
              XMLEventReader source,
              XMLEventReader target,
              XMLEventWriter out,
              String mimeType,
              Context context)
              throws IOException,
                     XMLStreamException
This method calculates the merge and detects possible conflicts.

Parameters:
base - the XML-stream of the version that is a common ancestor of source and target in the version tree.
source - the XML-stream of the version on the branch that is to be merged into the other branch.
target - the XML-stream of the version on the branch into which the merge is being done.
out - the XML-stream into which the merged result should be written.
mimeType - the MIME type of the document.
context - the repository context.
Returns:
true if the merge is automatic, false if there are conflicts.
Throws:
IOException
XMLStreamException

shouldComplete

boolean shouldComplete(String mimeType)
Parameters:
mimeType - the MIME type of the document.
Returns:
true if the contents of the version should be subjected to a completion process.

storeWithConflicts

boolean storeWithConflicts(String mimeType)
Parameters:
mimeType - the MIME type of the document.
Returns:
true if it is OK to store the result despite the presence of conflicts, false otherwise.