blob: a9445e4f46c4646ee5ea4b51e679623fa7586b12 [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>OptimizePartsConfig.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.model</a> &gt; <span class="el_source">OptimizePartsConfig.java</span></div><h1>OptimizePartsConfig.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.model;
import java.util.*;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.apache.neethi.Assertion;
import org.apache.neethi.Constants;
import org.apache.neethi.PolicyComponent;
public class OptimizePartsConfig implements Assertion{
public final static String OPTIMIZE_PARTS_LN = RampartConfig.OPTIMISE_PARTS;
public final static String EXPRESSIONS_LN = &quot;expressions&quot;;
public final static String EXPRESSION_LN = &quot;expression&quot;;
public final static String NAMESPACES_LN = &quot;namespaces&quot;;
public final static String NAMESPACE_LN = &quot;namespace&quot;;
public final static String URI_ATTR = &quot;uri&quot;;
public final static String PREFIX_ATTR = &quot;prefix&quot;;
<span class="nc" id="L40"> private Map namespaces = null;</span>
<span class="nc" id="L41"> private List&lt;String&gt; expressions = null;</span>
<span class="nc" id="L43"> public OptimizePartsConfig(){</span>
<span class="nc" id="L44"> namespaces = new HashMap();</span>
<span class="nc" id="L45"> expressions = new ArrayList&lt;String&gt;();</span>
<span class="nc" id="L46"> }</span>
public void addExpression(String expression){
<span class="nc" id="L49"> expressions.add(expression);</span>
<span class="nc" id="L50"> }</span>
public void addNamespaces(String prefix, String ns){
<span class="nc" id="L53"> namespaces.put(prefix, ns);</span>
<span class="nc" id="L54"> }</span>
public List&lt;String&gt; getExpressions() {
<span class="nc" id="L57"> return expressions;</span>
}
public Map getNamespaces() {
<span class="nc" id="L61"> return namespaces;</span>
}
public short getType() {
<span class="nc" id="L65"> return Constants.TYPE_ASSERTION;</span>
}
public QName getName() {
<span class="nc" id="L69"> return new QName(RampartConfig.NS, OPTIMIZE_PARTS_LN);</span>
}
public void serialize(XMLStreamWriter writer) throws XMLStreamException {
<span class="nc" id="L73"> String prefix = writer.getPrefix(RampartConfig.NS);</span>
<span class="nc bnc" id="L75" title="All 2 branches missed."> if (prefix == null) {</span>
<span class="nc" id="L76"> prefix = RampartConfig.NS;</span>
<span class="nc" id="L77"> writer.setPrefix(prefix, RampartConfig.NS);</span>
}
<span class="nc" id="L80"> writer.writeStartElement(RampartConfig.NS, OPTIMIZE_PARTS_LN);</span>
<span class="nc bnc" id="L82" title="All 4 branches missed."> if((expressions != null) &amp;&amp; (expressions.size()&gt;0)){</span>
<span class="nc" id="L83"> writer.writeStartElement(RampartConfig.NS, EXPRESSIONS_LN);</span>
<span class="nc" id="L84"> Iterator ite = expressions.iterator();</span>
<span class="nc bnc" id="L85" title="All 2 branches missed."> while(ite.hasNext()){</span>
<span class="nc" id="L86"> writer.writeStartElement(RampartConfig.NS, EXPRESSION_LN);</span>
<span class="nc" id="L87"> String exp = (String)ite.next();</span>
<span class="nc" id="L88"> writer.writeCharacters(exp);</span>
<span class="nc" id="L89"> writer.writeEndElement();</span>
<span class="nc" id="L90"> }</span>
<span class="nc" id="L91"> writer.writeEndElement();</span>
}
<span class="nc bnc" id="L94" title="All 4 branches missed."> if((namespaces != null) &amp;&amp; (namespaces.size()&gt;0)){</span>
<span class="nc" id="L95"> writer.writeStartElement(RampartConfig.NS, NAMESPACES_LN);</span>
<span class="nc" id="L96"> Iterator ite = namespaces.keySet().iterator();</span>
<span class="nc bnc" id="L97" title="All 2 branches missed."> while(ite.hasNext()){</span>
<span class="nc" id="L98"> String strPrefix = (String)ite.next();</span>
<span class="nc" id="L99"> String strURI = (String) namespaces.get(strPrefix);</span>
<span class="nc" id="L100"> writer.writeStartElement(RampartConfig.NS, NAMESPACE_LN);</span>
<span class="nc" id="L101"> writer.writeAttribute(URI_ATTR , strURI);</span>
<span class="nc" id="L102"> writer.writeAttribute(PREFIX_ATTR, strPrefix);</span>
<span class="nc" id="L103"> writer.writeEndElement();</span>
<span class="nc" id="L104"> }</span>
<span class="nc" id="L105"> writer.writeEndElement();</span>
}
<span class="nc" id="L107"> writer.writeEndElement();</span>
<span class="nc" id="L108"> }</span>
public PolicyComponent normalize() {
//TODO
<span class="nc" id="L112"> throw new UnsupportedOperationException(&quot;TODO&quot;);</span>
}
public boolean isOptional() {
<span class="nc" id="L116"> throw new UnsupportedOperationException(&quot;Not relevant&quot;);</span>
}
public boolean isIgnorable() {
<span class="nc" id="L119"> throw new UnsupportedOperationException(&quot;Not relevant&quot;);</span>
}
public boolean equal(PolicyComponent arg0) {
<span class="nc" id="L122"> throw new UnsupportedOperationException(&quot;Not relevant&quot;);</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>