org.mobicents.protocols.xml.patch
Interface XmlPatchOperationsBuilder<D,P,E,N>

Type Parameters:
D - the document type, defines what is the concrete type of XML documents used
P - the patching instruction type
E - the element type
N - the node type

public interface XmlPatchOperationsBuilder<D,P,E,N>

Builds XML Patch Ops (RFC 5261) patching instructions.

Author:
baranowb, martins

Nested Class Summary
static class XmlPatchOperationsBuilder.Pos
          possible "pos" attribute values
static class XmlPatchOperationsBuilder.Ws
          possible "ws" attribute values
 
Field Summary
static java.lang.String XML_PATCH_OPS_NAMESPACE
           
 
Method Summary
 P addAttribute(java.lang.String sel, java.lang.String attrName, java.lang.String attrValue, java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
          Builds the patching instruction for the creation of an attribute.
 P addElement(java.lang.String sel, E element, java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
          Builds the patching instruction for the creation of an element.
 P addNode(java.lang.String sel, XmlPatchOperationsBuilder.Pos pos, N node, java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
          Builds the patching instruction for the creation of a node.
 P addPrefixNamespaceDeclaration(java.lang.String sel, java.lang.String namespacePrefix, java.lang.String namespaceValue, java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
          Builds the patching instruction for the creation of a prefix namespace declaration.
 P[] buildPatchInstructions(D originalDocument, D patchedDocument)
          Builds a document patching instructions, by comparing two versions of a document.
 P removeAttribute(java.lang.String sel, java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
          Builds the patching instruction for the removal of an attribute.
 P removeElement(java.lang.String sel, XmlPatchOperationsBuilder.Ws ws, java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
          Builds the patching instruction for the removal of an element.
 P removeNode(java.lang.String sel, java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
          Builds the patching instruction for the removal of node.
 P removePrefixNamespaceDeclaration(java.lang.String sel, java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
          Builds the patching instruction for the removal of a prefix namespace declaration.
 P replaceAttribute(java.lang.String sel, java.lang.String attributeValue, java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
          Builds the patching instruction for the replacement of an attribute.
 P replaceElement(java.lang.String sel, E element, java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
          Builds the patching instruction for the replacement of an element.
 P replaceNode(java.lang.String sel, N node, java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
          Builds the patching instruction for the replacement of a node.
 P replacePrefixNamespaceDeclaration(java.lang.String sel, java.lang.String namespaceValue, java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
          Builds the patching instruction for the replacement of a prefix namespace declaration.
 

Field Detail

XML_PATCH_OPS_NAMESPACE

static final java.lang.String XML_PATCH_OPS_NAMESPACE
See Also:
Constant Field Values
Method Detail

addAttribute

P addAttribute(java.lang.String sel,
               java.lang.String attrName,
               java.lang.String attrValue,
               java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
               throws BuildPatchException
Builds the patching instruction for the creation of an attribute.

Parameters:
sel - the xpath selector, which points to the added attribute.
attrName - the attribute name
attrValue - the attribute value
namespaceBindings - namespace bindings for undeclared namespaces in type and sel
Returns:
Throws:
BuildPatchException - if an exception occurred while building the patch, the concrete exception is the exception's cause.

addElement

P addElement(java.lang.String sel,
             E element,
             java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
             throws BuildPatchException
Builds the patching instruction for the creation of an element.

Parameters:
sel - the xpath selector, which points to the added element.
element - the element
namespaceBindings - namespace bindings for undeclared namespaces in the element and sel
Returns:
Throws:
BuildPatchException - if an exception occurred while building the patch, the concrete exception is the exception's cause.

addNode

P addNode(java.lang.String sel,
          XmlPatchOperationsBuilder.Pos pos,
          N node,
          java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
          throws BuildPatchException
Builds the patching instruction for the creation of a node.

Parameters:
sel - the xpath selector, which points to the added node.
pos - the pos attribute
node - the node
namespaceBindings - namespace bindings for undeclared namespaces in the node and sel
Returns:
Throws:
BuildPatchException - if an exception occurred while building the patch, the concrete exception is the exception's cause.

addPrefixNamespaceDeclaration

P addPrefixNamespaceDeclaration(java.lang.String sel,
                                java.lang.String namespacePrefix,
                                java.lang.String namespaceValue,
                                java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
                                throws BuildPatchException
Builds the patching instruction for the creation of a prefix namespace declaration.

Parameters:
sel - the xpath selector, which points to the added prefix namespace declaration.
namespacePrefix - the namespace prefix
namespaceValue - the namespace value
namespaceBindings - namespace bindings for undeclared namespaces in sel
Returns:
Throws:
BuildPatchException - if an exception occurred while building the patch, the concrete exception is the exception's cause.

replaceAttribute

P replaceAttribute(java.lang.String sel,
                   java.lang.String attributeValue,
                   java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
                   throws BuildPatchException
Builds the patching instruction for the replacement of an attribute.

Parameters:
sel - the xpath selector, which points to the replaced attribute.
attrValue - the attribute value
namespaceBindings - namespace bindings for undeclared namespaces in sel
Returns:
Throws:
BuildPatchException - if an exception occurred while building the patch, the concrete exception is the exception's cause.

replaceElement

P replaceElement(java.lang.String sel,
                 E element,
                 java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
                 throws BuildPatchException
Builds the patching instruction for the replacement of an element.

Parameters:
sel - the xpath selector, which points to the replaced element.
element - the element
namespaceBindings - namespace bindings for undeclared namespaces in the element and sel
Returns:
Throws:
BuildPatchException - if an exception occurred while building the patch, the concrete exception is the exception's cause.

replaceNode

P replaceNode(java.lang.String sel,
              N node,
              java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
              throws BuildPatchException
Builds the patching instruction for the replacement of a node.

Parameters:
sel - the xpath selector, which points to the replaced node.
node - the node
namespaceBindings - namespace bindings for undeclared namespaces in the node and sel
Returns:
Throws:
BuildPatchException - if an exception occurred while building the patch, the concrete exception is the exception's cause.

replacePrefixNamespaceDeclaration

P replacePrefixNamespaceDeclaration(java.lang.String sel,
                                    java.lang.String namespaceValue,
                                    java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
                                    throws BuildPatchException
Builds the patching instruction for the replacement of a prefix namespace declaration.

Parameters:
sel - the xpath selector, which points to the replaced prefix namespace declaration.
namespaceValue - the namespace value
namespaceBindings - namespace bindings for undeclared namespaces in sel
Returns:
Throws:
BuildPatchException - if an exception occurred while building the patch, the concrete exception is the exception's cause.

removeAttribute

P removeAttribute(java.lang.String sel,
                  java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
                  throws BuildPatchException
Builds the patching instruction for the removal of an attribute.

Parameters:
sel - the xpath selector, which points to the removed attribute.
namespaceBindings - namespace bindings for undeclared namespaces in sel
Returns:
Throws:
BuildPatchException - if an exception occurred while building the patch, the concrete exception is the exception's cause.

removeElement

P removeElement(java.lang.String sel,
                XmlPatchOperationsBuilder.Ws ws,
                java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
                throws BuildPatchException
Builds the patching instruction for the removal of an element.

Parameters:
sel - the xpath selector, which points to the removed element.
ws - the ws.
namespaceBindings - namespace bindings for undeclared namespaces in sel
Returns:
Throws:
BuildPatchException - if an exception occurred while building the patch, the concrete exception is the exception's cause.

removeNode

P removeNode(java.lang.String sel,
             java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
             throws BuildPatchException
Builds the patching instruction for the removal of node.

Parameters:
sel - the xpath selector, which points to the removed node.
namespaceBindings - namespace bindings for undeclared namespaces in sel
Returns:
Throws:
BuildPatchException - if an exception occurred while building the patch, the concrete exception is the exception's cause.

removePrefixNamespaceDeclaration

P removePrefixNamespaceDeclaration(java.lang.String sel,
                                   java.util.Map<java.lang.String,java.lang.String> namespaceBindings)
                                   throws BuildPatchException
Builds the patching instruction for the removal of a prefix namespace declaration.

Parameters:
sel - the xpath selector, which points to the removed prefix namespace declaration.
namespaceBindings - namespace bindings for undeclared namespaces in sel
Returns:
Throws:
BuildPatchException - if an exception occurred while building the patch, the concrete exception is the exception's cause.

buildPatchInstructions

P[] buildPatchInstructions(D originalDocument,
                           D patchedDocument)
                           throws BuildPatchException
Builds a document patching instructions, by comparing two versions of a document. It requires documents to exist, that is this method should not be called for operations which add/remove document.

Parameters:
originalDocument -
patchedDocument -
Returns:
Throws:
BuildPatchException - if an exception occurred while building the patch, the concrete exception is the exception's cause.


Copyright © 2011. All Rights Reserved.