Java Code Examples for org.apache.axiom.om.OMElement#setNamespace()
The following examples show how to use
org.apache.axiom.om.OMElement#setNamespace() .
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: WSXACMLEntitlementServiceClient.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Format the sent in request as required by OpenSAML * * @param xacmlRequest : received XACML request * @return formatted request * @throws Exception */ private String formatRequest(String xacmlRequest) throws EntitlementProxyException { xacmlRequest = xacmlRequest.replace("\n", ""); OMElement omElemnt = null; try { omElemnt = AXIOMUtil.stringToOM(xacmlRequest); omElemnt.setNamespace(xacmlContextNS); Iterator childIterator = omElemnt.getChildElements(); setXACMLNamespace(childIterator); return omElemnt.toString(); } catch (Exception e) { log.error("Error occurred while formatting the XACML request", e); throw new EntitlementProxyException("Error occurred while formatting the XACML request", e); } }
Example 2
Source File: WSXACMLMessageReceiver.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
/** * Format the sent in response as required by OpenSAML * * @param xacmlResponse : received XACML response * @return formatted response */ private String formatResponse(String xacmlResponse) throws Exception { xacmlResponse = xacmlResponse.replace("\n", ""); OMElement omElemnt; try { omElemnt = org.apache.axiom.om.util.AXIOMUtil.stringToOM(xacmlResponse); omElemnt.setNamespace(xacmlContextNS); if (omElemnt.getChildren() != null) { Iterator childIterator = omElemnt.getChildElements(); setXACMLNamespace(childIterator); } } catch (Exception e) { log.error("Error while generating the OMElement from the XACML request.", e); throw new Exception("Error while generating the OMElement from the XACML request.", e); } return omElemnt.toString(); }
Example 3
Source File: QueryAggregator.java From openxds with Apache License 2.0 | 6 votes |
protected void addResult(OMElement result, String homeId) throws XdsInternalException { OMElement registry_object_list = MetadataSupport.firstChildWithLocalName(result, "RegistryObjectList"); for (Iterator it=registry_object_list.getChildElements(); it.hasNext(); ) { OMElement registry_object = (OMElement) it.next(); OMElement registry_object_2 = Util.deep_copy(registry_object); if (log.isDebugEnabled()) { log.debug("registry_object2 is \n" + registry_object_2.toString()); } registry_object_2.setNamespace(MetadataSupport.ebRIMns3); String objectHome = registry_object_2.getAttributeValue(MetadataSupport.home_qname); if (objectHome == null || objectHome.equals("")) registry_object_2.addAttribute("home", homeId, null); else if (!homeId.equals(objectHome)) { response.error("Invalid home returned " + objectHome +", expected home is " + homeId); } response.addQueryResults(registry_object_2); } }
Example 4
Source File: RetrieveAggregator.java From openxds with Apache License 2.0 | 6 votes |
protected void addResult(OMElement result, String homeId) throws XdsInternalException { List<OMElement> docResponseList = MetadataSupport.childrenWithLocalName(result, "DocumentResponse"); for (OMElement docResponse : docResponseList) { if (log.isDebugEnabled()) { log.debug("docResponse is \n" + docResponse.toString()); } docResponse.setNamespace(MetadataSupport.xdsB); OMElement elemHome = MetadataSupport.firstChildWithLocalName(docResponse, "HomeCommunityId"); if (elemHome == null || elemHome.getText() == null || elemHome.getText().equals("")) MetadataSupport.addChild("HomeCommunityId", MetadataSupport.xdsB, docResponse); else if (!homeId.equals(elemHome.getText())) { response.error("Invalid home returned " + elemHome +", expected home is " + homeId); } rdsResponse.addDocumentResponse(docResponse); } }
Example 5
Source File: WSXACMLMessageReceiver.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * Format the sent in response as required by OpenSAML * * @param xacmlResponse : received XACML response * @return formatted response */ private String formatResponse(String xacmlResponse) throws Exception { xacmlResponse = xacmlResponse.replace("\n", ""); OMElement omElemnt; try { omElemnt = org.apache.axiom.om.util.AXIOMUtil.stringToOM(xacmlResponse); omElemnt.setNamespace(xacmlContextNS); if (omElemnt.getChildren() != null) { Iterator childIterator = omElemnt.getChildElements(); setXACMLNamespace(childIterator); } } catch (Exception e) { log.error("Error while generating the OMElement from the XACML request.", e); throw new Exception("Error while generating the OMElement from the XACML request.", e); } return omElemnt.toString(); }
Example 6
Source File: WSXACMLEntitlementServiceClient.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * Format the sent in request as required by OpenSAML * * @param xacmlRequest : received XACML request * @return formatted request * @throws Exception */ private String formatRequest(String xacmlRequest) throws EntitlementProxyException { xacmlRequest = xacmlRequest.replace("\n", ""); OMElement omElemnt = null; try { omElemnt = org.apache.axiom.om.util.AXIOMUtil.stringToOM(xacmlRequest); omElemnt.setNamespace(xacmlContextNS); Iterator childIterator = omElemnt.getChildElements(); setXACMLNamespace(childIterator); return omElemnt.toString(); } catch (Exception e) { log.error("Error occurred while formatting the XACML request", e); throw new EntitlementProxyException("Error occurred while formatting the XACML request", e); } }
Example 7
Source File: WSXACMLEntitlementServiceClient.java From micro-integrator with Apache License 2.0 | 5 votes |
/** * Set relevant xacml namespace to all the children in the given iterator. * * @param iterator: Iterator for all children inside OMElement */ private static void setXACMLNamespace(Iterator iterator) { while (iterator.hasNext()) { OMElement omElemnt2 = (OMElement) iterator.next(); omElemnt2.setNamespace(xacmlContextNS); if (omElemnt2.getChildElements().hasNext()) { setXACMLNamespace(omElemnt2.getChildElements()); } } }
Example 8
Source File: WSXACMLMessageReceiver.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
/** * Set relevant xacml namespace to all the children in the given iterator. * * * @param iterator: Iterator for all children inside OMElement */ private static void setXACMLNamespace(Iterator iterator) { while (iterator.hasNext()) { OMElement omElement2 = (OMElement) iterator.next(); omElement2.setNamespace(xacmlContextNS); if (omElement2.getChildElements().hasNext()) { setXACMLNamespace(omElement2.getChildElements()); } } }
Example 9
Source File: Metadata.java From openxds with Apache License 2.0 | 5 votes |
void fix_v2_ns_recursive(OMElement ele, OMNamespace ns) { ele.setNamespace(ns); for (Iterator it = ele.getAllAttributes(); it.hasNext();) { OMAttribute a = (OMAttribute) it.next(); if (a.getLocalName().equals("lang")) a.setOMNamespace(MetadataSupport.xml_namespace); } for (Iterator it = ele.getChildElements(); it.hasNext();) { OMElement child = (OMElement) it.next(); fix_v2_ns_recursive(child, MetadataSupport.ebRIMns2); } }
Example 10
Source File: RegistryErrorList.java From openxds with Apache License 2.0 | 5 votes |
public void addRegistryErrorList(OMElement rel, LogMessage log_message) throws XdsInternalException { for (Iterator it=rel.getChildElements(); it.hasNext(); ) { OMElement registry_error = (OMElement) it.next(); if (log_message != null) { HashMap<String, String> err = getErrorDetails(registry_error); try { log_message.addErrorParam("Error", err.get("codeContext")); } catch (LoggerException e) { throw new XdsInternalException(ExceptionUtil.exception_details(e)); } } OMElement registry_error_2 = Util.deep_copy(registry_error); logger.error("registry_error2 is \n" + registry_error_2.toString()); if (this.getVersion() == RegistryErrorList.version_3) registry_error_2.setNamespace(MetadataSupport.ebRSns3); registryErrorList().addChild(registry_error_2); String severity = registry_error.getAttributeValue(MetadataSupport.severity_qname); severity = new Metadata().stripNamespace(severity); if (severity.equals("Error")) has_errors = true; else has_warnings = true; } }
Example 11
Source File: WSXACMLMessageReceiver.java From carbon-identity with Apache License 2.0 | 5 votes |
/** * Set relevant xacml namespace to all the children in the given iterator. * * * @param iterator: Iterator for all children inside OMElement */ private static void setXACMLNamespace(Iterator iterator) { while (iterator.hasNext()) { OMElement omElement2 = (OMElement) iterator.next(); omElement2.setNamespace(xacmlContextNS); if (omElement2.getChildElements().hasNext()) { setXACMLNamespace(omElement2.getChildElements()); } } }
Example 12
Source File: WSXACMLEntitlementServiceClient.java From carbon-identity with Apache License 2.0 | 5 votes |
/** * Set relevant xacml namespace to all the children in the given iterator. * * @param iterator: Iterator for all children inside OMElement */ private static void setXACMLNamespace(Iterator iterator) { while (iterator.hasNext()) { OMElement omElemnt2 = (OMElement) iterator.next(); omElemnt2.setNamespace(xacmlContextNS); if (omElemnt2.getChildElements().hasNext()) { setXACMLNamespace(omElemnt2.getChildElements()); } } }