Java Code Examples for org.apache.axiom.om.OMNode#PI_NODE

The following examples show how to use org.apache.axiom.om.OMNode#PI_NODE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: 103333429.java    From docs-apim with Apache License 2.0 5 votes vote down vote up
/**
    * This is an overloaded method for the digest generation for OMNode and request
    *
    * @param node              - OMNode to be subjected to the key generation
    * @param toAddress         - Request To address to be subjected to the key generation
    * @param headers           - Header parameters to be subjected to the key generation
    * @param digestAlgorithm   - digest algorithm as a String
    * @return byte[] representing the calculated digest over the provided node
    * @throws CachingException if there is an error in generating the digest
    */
public byte[] getDigest(OMNode node, String toAddress, Map<String, String> headers, 
		String digestAlgorithm) throws CachingException {

       if (node.getType() == OMNode.ELEMENT_NODE) {
           return getDigest((OMElement) node, toAddress, headers, digestAlgorithm);
       } else if (node.getType() == OMNode.TEXT_NODE) {
           return getDigest((OMText) node, digestAlgorithm);
       } else if (node.getType() == OMNode.PI_NODE) {
           return getDigest((OMProcessingInstruction) node, digestAlgorithm);
       } else {
           return new byte[0];
       }
   }
 
Example 2
Source File: HttpRequestHashGenerator.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * This is an overloaded method for the digest generation for OMNode.
 *
 * @param node            - OMNode to be subjected to the key generation
 * @param digestAlgorithm - digest algorithm as a String
 * @return byte[] c node
 * @throws CachingException if there is an error in generating the digest
 */
public byte[] getDigest(OMNode node, String digestAlgorithm) throws CachingException {

    if (node.getType() == OMNode.ELEMENT_NODE) {
        return getDigest(node, digestAlgorithm);
    } else if (node.getType() == OMNode.TEXT_NODE) {
        return getDigest((OMText) node, digestAlgorithm);
    } else if (node.getType() == OMNode.PI_NODE) {
        return getDigest((OMProcessingInstruction) node, digestAlgorithm);
    } else {
        return new byte[0];
    }
}
 
Example 3
Source File: HttpRequestHashGenerator.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * This is an overloaded method for the digest generation for OMNode and request.
 *
 * @param node            - OMNode to be subjected to the key generation
 * @param toAddress       - Request To address to be subjected to the key generation
 * @param headers         - Header parameters to be subjected to the key generation
 * @param digestAlgorithm - digest algorithm as a String
 * @return byte[] representing the calculated digest over the provided node
 * @throws CachingException if there is an error in generating the digest
 */
public byte[] getDigest(OMNode node, String toAddress, Map<String, String> headers,
                        String digestAlgorithm) throws CachingException {

    if (node.getType() == OMNode.ELEMENT_NODE) {
        return getDigest((OMElement) node, toAddress, headers, digestAlgorithm);
    } else if (node.getType() == OMNode.TEXT_NODE) {
        return getDigest((OMText) node, digestAlgorithm);
    } else if (node.getType() == OMNode.PI_NODE) {
        return getDigest((OMProcessingInstruction) node, digestAlgorithm);
    } else {
        return new byte[0];
    }
}
 
Example 4
Source File: DOMHASHGenerator.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * This is an overloaded method for the digest generation for OMNode.
 *
 * @param node            - OMNode to be subjected to the key generation
 * @param digestAlgorithm - digest algorithm as a String
 * @return byte[] representing the calculated digest over the provided node
 * @throws CachingException if there is an error in generating the digest
 */
public byte[] getDigest(OMNode node, String digestAlgorithm) throws CachingException {

    if (node.getType() == OMNode.ELEMENT_NODE) {
        return getDigest((OMElement) node, digestAlgorithm);
    } else if (node.getType() == OMNode.TEXT_NODE) {
        return getDigest((OMText) node, digestAlgorithm);
    } else if (node.getType() == OMNode.PI_NODE) {
        return getDigest((OMProcessingInstruction) node, digestAlgorithm);
    } else {
        return new byte[0];
    }
}
 
Example 5
Source File: DOMHASHGenerator.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the valid element collection of an OMDocument. This returns only the OMElement and OMProcessingInstruction
 * nodes
 *
 * @param document - OMDocument of which the valid elements to be retrieved
 * @return the collection of OMProcessingInstructions and OMElements in the provided document
 */
public Collection getValidElements(OMDocument document) {

    ArrayList list = new ArrayList();
    Iterator itr = document.getChildren();
    while (itr.hasNext()) {
        OMNode node = (OMNode) itr.next();
        if (node.getType() == OMNode.ELEMENT_NODE || node.getType() == OMNode.PI_NODE) {
            list.add(node);
        }
    }

    return list;
}
 
Example 6
Source File: REQUESTHASHGenerator.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * This is an overloaded method for the digest generation for OMNode and request.
 *
 * @param node            - OMNode to be subjected to the key generation
 * @param toAddress       - Request To address to be subjected to the key generation
 * @param headers         - Header parameters to be subjected to the key generation
 * @param digestAlgorithm - digest algorithm as a String
 * @return byte[] representing the calculated digest over the provided node
 * @throws CachingException if there is an error in generating the digest
 */
public byte[] getDigest(OMNode node, String toAddress, Map<String, String> headers,
                        String digestAlgorithm) throws CachingException {

    if (node.getType() == OMNode.ELEMENT_NODE) {
        return getDigest((OMElement) node, toAddress, headers, digestAlgorithm);
    } else if (node.getType() == OMNode.TEXT_NODE) {
        return getDigest((OMText) node, digestAlgorithm);
    } else if (node.getType() == OMNode.PI_NODE) {
        return getDigest((OMProcessingInstruction) node, digestAlgorithm);
    } else {
        return new byte[0];
    }
}