blob: 9162ccc18cc9bcde3a63c25043ca0857de412005 [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>RampartConfigBuilder.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.rampart.policy.builders</a> &gt; <span class="el_source">RampartConfigBuilder.java</span></div><h1>RampartConfigBuilder.java</h1><pre class="source lang-java linenums">/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed 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.rampart.policy.builders;
import javax.xml.namespace.QName;
import org.apache.axiom.om.OMElement;
import org.apache.neethi.Assertion;
import org.apache.neethi.AssertionBuilderFactory;
import org.apache.neethi.builders.AssertionBuilder;
import org.apache.rampart.policy.model.CryptoConfig;
import org.apache.rampart.policy.model.OptimizePartsConfig;
import org.apache.rampart.policy.model.RampartConfig;
import org.apache.rampart.policy.model.SSLConfig;
<span class="fc" id="L29">public class RampartConfigBuilder implements AssertionBuilder&lt;OMElement&gt; {</span>
public Assertion build(OMElement element, AssertionBuilderFactory factory)
throws IllegalArgumentException {
<span class="fc" id="L34"> RampartConfig rampartConfig = new RampartConfig();</span>
OMElement childElement;
<span class="fc" id="L38"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.USER_LN));
<span class="fc bfc" id="L40" title="All 2 branches covered."> if (childElement != null) {</span>
<span class="fc" id="L41"> rampartConfig.setUser(childElement.getText().trim());</span>
}
<span class="fc" id="L44"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.USER_CERT_ALIAS_LN));
<span class="fc bfc" id="L46" title="All 2 branches covered."> if (childElement != null) {</span>
<span class="fc" id="L47"> rampartConfig.setUserCertAlias(childElement.getText().trim());</span>
}
<span class="fc" id="L50"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.ENCRYPTION_USER_LN));
<span class="fc bfc" id="L52" title="All 2 branches covered."> if (childElement != null) {</span>
<span class="fc" id="L53"> rampartConfig.setEncryptionUser(childElement.getText().trim());</span>
}
<span class="fc" id="L56"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.STS_ALIAS_LN));
<span class="fc bfc" id="L58" title="All 2 branches covered."> if (childElement != null) {</span>
<span class="fc" id="L59"> rampartConfig.setStsAlias(childElement.getText().trim());</span>
}
<span class="fc" id="L62"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.PW_CB_CLASS_LN));
<span class="fc bfc" id="L64" title="All 2 branches covered."> if (childElement != null) {</span>
<span class="fc" id="L65"> rampartConfig.setPwCbClass(childElement.getText().trim());</span>
}
<span class="fc" id="L68"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.POLICY_VALIDATOR_CB_CLASS_LN));
<span class="pc bpc" id="L70" title="1 of 2 branches missed."> if (childElement != null) {</span>
<span class="nc" id="L71"> rampartConfig.setPolicyValidatorCbClass(childElement.getText().trim());</span>
}
<span class="fc" id="L74"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.RAMPART_CONFIG_CB_CLASS_LN));
<span class="fc bfc" id="L76" title="All 2 branches covered."> if (childElement != null) {</span>
<span class="fc" id="L77"> rampartConfig.setRampartConfigCbClass(childElement.getText().trim());</span>
}
// handle ssl config
<span class="fc" id="L81"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.SSL_CONFIG));
<span class="pc bpc" id="L83" title="1 of 2 branches missed."> if (childElement != null) { </span>
<span class="nc" id="L84"> SSLConfig sslConfig = (SSLConfig)new SSLConfigBuilder().</span>
build(childElement,
factory);
<span class="nc" id="L87"> rampartConfig.setSSLConfig(sslConfig);</span>
}
<span class="fc" id="L91"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.SIG_CRYPTO_LN));
<span class="fc bfc" id="L93" title="All 2 branches covered."> if (childElement != null) {</span>
<span class="fc" id="L94"> rampartConfig.setSigCryptoConfig((CryptoConfig) factory</span>
.build(childElement.getFirstElement()));
}
<span class="fc" id="L98"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.ENCR_CRYPTO_LN));
<span class="pc bpc" id="L100" title="1 of 2 branches missed."> if (childElement != null) {</span>
<span class="nc" id="L101"> rampartConfig.setEncrCryptoConfig((CryptoConfig) factory</span>
.build(childElement.getFirstElement()));
}
<span class="fc" id="L105"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.DEC_CRYPTO_LN));
<span class="pc bpc" id="L107" title="1 of 2 branches missed."> if (childElement != null) {</span>
<span class="nc" id="L108"> rampartConfig.setDecCryptoConfig((CryptoConfig) factory</span>
.build(childElement.getFirstElement()));
}
<span class="fc" id="L112"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.STS_CRYPTO_LN));
<span class="fc bfc" id="L114" title="All 2 branches covered."> if (childElement != null) {</span>
<span class="fc" id="L115"> rampartConfig.setStsCryptoConfig((CryptoConfig) factory</span>
.build(childElement.getFirstElement()));
}
<span class="fc" id="L119"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.TS_PRECISION_IN_MS_LN));
<span class="pc bpc" id="L121" title="1 of 2 branches missed."> if (childElement != null) {</span>
<span class="nc" id="L122"> rampartConfig.setTimestampPrecisionInMilliseconds(childElement.getText().trim());</span>
}
<span class="fc" id="L125"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.TS_TTL_LN));
<span class="pc bpc" id="L127" title="1 of 2 branches missed."> if (childElement != null) {</span>
<span class="nc" id="L128"> rampartConfig.setTimestampTTL(childElement.getText().trim());</span>
}
<span class="fc" id="L131"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.TS_MAX_SKEW_LN));
<span class="pc bpc" id="L133" title="1 of 2 branches missed."> if (childElement != null) {</span>
<span class="nc" id="L134"> rampartConfig.setTimestampMaxSkew(childElement.getText().trim());</span>
}
<span class="fc" id="L137"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.NONCE_LIFE_TIME));
<span class="pc bpc" id="L139" title="1 of 2 branches missed."> if (childElement != null) {</span>
<span class="nc" id="L140"> rampartConfig.setNonceLifeTime(childElement.getText().trim());</span>
}
<span class="fc" id="L143"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.TOKEN_STORE_CLASS_LN));
<span class="pc bpc" id="L145" title="1 of 2 branches missed."> if (childElement != null) {</span>
<span class="nc" id="L146"> rampartConfig.setTokenStoreClass(childElement.getText().trim());</span>
}
<span class="fc" id="L149"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.OPTIMISE_PARTS));
<span class="pc bpc" id="L151" title="1 of 2 branches missed."> if (childElement != null) {</span>
<span class="nc" id="L152"> OptimizePartsConfig config = (OptimizePartsConfig)new OptimizePartsBuilder().</span>
build(childElement, factory);
<span class="nc" id="L154"> rampartConfig.setOptimizeParts(config);</span>
}
<span class="fc" id="L157"> childElement = element.getFirstChildWithName(new QName(</span>
RampartConfig.NS, RampartConfig.TIMESTAMP_STRICT_LN));
<span class="pc bpc" id="L159" title="1 of 2 branches missed."> if (childElement != null) {</span>
<span class="nc" id="L160"> rampartConfig.setTimeStampStrict(childElement.getText().trim());</span>
}
<span class="fc" id="L163"> return rampartConfig;</span>
}
public QName[] getKnownElements() {
<span class="fc" id="L167"> return new QName[] {new QName(RampartConfig.NS, RampartConfig.RAMPART_CONFIG_LN)};</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>