Java Code Examples for org.apache.axiom.om.OMNode#ELEMENT_NODE
The following examples show how to use
org.apache.axiom.om.OMNode#ELEMENT_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 |
/** * 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 |
/** * 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 |
/** * 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 |
/** * 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 |
/** * 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 |
/** * 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 7
Source File: IaasProviderConfigParser.java From attic-stratos with Apache License 2.0 | 4 votes |
public static IaasProvider getIaasProvider(final String fileName, final OMElement elt, final OMNode item, List<IaasProvider> iaases) { IaasProvider iaas = null; if (item.getType() == OMNode.ELEMENT_NODE) { OMElement iaasElt = (OMElement) item; if (iaases != null) { // check whether this is a reference to a predefined IaaS. for (IaasProvider iaasProvider : iaases) { if (iaasProvider.getType() .equals(iaasElt.getAttribute(new QName( CloudControllerConstants.TYPE_ATTR)) .getAttributeValue())) { iaas = new IaasProvider(iaasProvider); break; } } } if (iaas == null) { iaas = new IaasProvider(); } if (iaas.getType() == null) { iaas.setType(iaasElt.getAttribute(new QName(CloudControllerConstants.TYPE_ATTR)) .getAttributeValue()); } if ("".equals(iaas.getType())) { String msg = "'" + CloudControllerConstants.IAAS_PROVIDER_ELEMENT + "' element's '" + CloudControllerConstants.TYPE_ATTR + "' attribute should be specified!"; handleException(msg); } // this is not mandatory String name = (iaasElt.getAttribute(new QName(CloudControllerConstants.NAME_ATTR)) == null) ? iaas.getName() : iaasElt.getAttributeValue(new QName( CloudControllerConstants.NAME_ATTR)); iaas.setName(name); String xpath = CloudControllerConstants.IAAS_PROVIDER_ELEMENT_XPATH; // load other elements loadClassName(fileName, iaas, iaasElt); loadProvider(fileName, iaas, iaasElt); loadProperties(fileName, iaasElt, iaas.getProperties()); loadTemplate(fileName, iaas, iaasElt); loadIdentity(fileName, elt, iaas, iaasElt); loadCredentials(fileName, elt, iaas, iaasElt, xpath); } return iaas; }
Example 8
Source File: AxiomXpathParserUtil.java From attic-stratos with Apache License 2.0 | 3 votes |
private static OMElement getElement(final Object obj) { OMNode node; if ((obj instanceof OMNode) && (node = (OMNode) obj).getType() == OMNode.ELEMENT_NODE) { OMElement element = (OMElement) node; return element; } return null; }