blob: ad8a7e728257399fc3e11f45cc73da341cbd747b [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>AxiomParserPool.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Coverage Report</a> &gt; <a href="index.source.html" class="el_package">org.apache.rahas.impl.util</a> &gt; <span class="el_source">AxiomParserPool.java</span></div><h1>AxiomParserPool.java</h1><pre class="source lang-java linenums">/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* &quot;License&quot;); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.rahas.impl.util;
import static org.apache.axiom.om.OMAbstractFactory.FEATURE_DOM;
import java.lang.reflect.Field;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.dom.DOMMetaFactory;
import org.opensaml.xml.parse.ParserPool;
import org.opensaml.xml.parse.StaticBasicParserPool;
/**
* Custom OpenSAML {@link ParserPool} implementation that uses a DOM aware Axiom implementation
* instead of requesting a {@link DocumentBuilderFactory} using JAXP.
*/
public class AxiomParserPool extends StaticBasicParserPool {
<span class="fc" id="L37"> public AxiomParserPool() {</span>
<span class="fc" id="L38"> DOMMetaFactory metaFactory = (DOMMetaFactory)OMAbstractFactory.getMetaFactory(FEATURE_DOM);</span>
<span class="fc" id="L39"> DocumentBuilderFactory dbf = metaFactory.newDocumentBuilderFactory();</span>
// Unfortunately, ParserPool doesn't allow to set the DocumentBuilderFactory, so that we
// have to use reflection here.
try {
<span class="fc" id="L43"> Field dbfField = StaticBasicParserPool.class.getDeclaredField(&quot;builderFactory&quot;);</span>
<span class="fc" id="L44"> dbfField.setAccessible(true);</span>
<span class="fc" id="L45"> dbfField.set(this, dbf);</span>
<span class="nc" id="L46"> } catch (IllegalAccessException ex) {</span>
<span class="nc" id="L47"> throw new IllegalAccessError(ex.getMessage());</span>
<span class="nc" id="L48"> } catch (NoSuchFieldException ex) {</span>
<span class="nc" id="L49"> throw new NoSuchFieldError(ex.getMessage());</span>
<span class="fc" id="L50"> }</span>
<span class="fc" id="L51"> }</span>
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.5.201505241946</span></div></body></html>