blob: 0e22fd9b502983f3bebb3bcd939fc7432b7f6a4a [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_92) on Thu Jun 07 14:26:27 EDT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>XmlConfiguration (Jetty :: Project 9.3.24.v20180605 API)</title>
<meta name="date" content="2018-06-07">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="XmlConfiguration (Jetty :: Project 9.3.24.v20180605 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/XmlConfiguration.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/eclipse/jetty/xml/XmlAppendable.html" title="class in org.eclipse.jetty.xml"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/eclipse/jetty/xml/XmlParser.html" title="class in org.eclipse.jetty.xml"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/eclipse/jetty/xml/XmlConfiguration.html" target="_top">Frames</a></li>
<li><a href="XmlConfiguration.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.eclipse.jetty.xml</div>
<h2 title="Class XmlConfiguration" class="title">Class XmlConfiguration</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.eclipse.jetty.xml.XmlConfiguration</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">XmlConfiguration</span>
extends java.lang.Object</pre>
<div class="block"><p>Configures objects from XML.</p>
<p>This class reads an XML file conforming to the configure.dtd DTD
and uses it to configure and object by calling set, put or other methods on the object.</p>
<p>The actual XML file format may be changed (eg to spring XML) by implementing the
<a href="../../../../org/eclipse/jetty/xml/ConfigurationProcessorFactory.html" title="interface in org.eclipse.jetty.xml"><code>ConfigurationProcessorFactory</code></a> interface to be found by the
<code>ServiceLoader</code> by using the DTD and first tag element in the file.
Note that DTD will be null if validation is off.</p>
<p>
The configuration can be parameterised with properties that are looked up via the
Property XML element and set on the configuration via the map returned from
<a href="../../../../org/eclipse/jetty/xml/XmlConfiguration.html#getProperties--"><code>getProperties()</code></a></p>
<p>
The configuration can create and lookup beans by ID. If multiple configurations are used, then it
is good practise to copy the entries from the <a href="../../../../org/eclipse/jetty/xml/XmlConfiguration.html#getIdMap--"><code>getIdMap()</code></a> of a configuration to the next
configuration so that they can share an ID space for beans.</p></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/eclipse/jetty/xml/XmlConfiguration.html#XmlConfiguration-java.io.InputStream-">XmlConfiguration</a></span>(java.io.InputStream&nbsp;configuration)</code>
<div class="block">Reads and parses the XML configuration stream.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/eclipse/jetty/xml/XmlConfiguration.html#XmlConfiguration-java.lang.String-">XmlConfiguration</a></span>(java.lang.String&nbsp;configuration)</code>
<div class="block">Reads and parses the XML configuration string.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/eclipse/jetty/xml/XmlConfiguration.html#XmlConfiguration-java.net.URL-">XmlConfiguration</a></span>(java.net.URL&nbsp;configuration)</code>
<div class="block">Reads and parses the XML configuration file.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/jetty/xml/XmlConfiguration.html#configure--">configure</a></span>()</code>
<div class="block">Applies the XML configuration script.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/jetty/xml/XmlConfiguration.html#configure-java.lang.Object-">configure</a></span>(java.lang.Object&nbsp;obj)</code>
<div class="block">Applies the XML configuration script to the given object.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>java.util.Map&lt;java.lang.String,java.lang.Object&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/jetty/xml/XmlConfiguration.html#getIdMap--">getIdMap</a></span>()</code>
<div class="block">Get the map of ID String to Objects that is used to hold
and lookup any objects by ID.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>java.util.Map&lt;java.lang.String,java.lang.String&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/jetty/xml/XmlConfiguration.html#getProperties--">getProperties</a></span>()</code>
<div class="block">Get the map of properties used by the Property XML element
to parameterise configuration.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/jetty/xml/XmlConfiguration.html#initializeDefaults-java.lang.Object-">initializeDefaults</a></span>(java.lang.Object&nbsp;object)</code>
<div class="block">Initialize a new Object defaults.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/jetty/xml/XmlConfiguration.html#main-java.lang.String...-">main</a></span>(java.lang.String...&nbsp;args)</code>
<div class="block">Run the XML configurations as a main application.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="XmlConfiguration-java.net.URL-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>XmlConfiguration</h4>
<pre>public&nbsp;XmlConfiguration(java.net.URL&nbsp;configuration)
throws org.xml.sax.SAXException,
java.io.IOException</pre>
<div class="block">Reads and parses the XML configuration file.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>configuration</code> - the URL of the XML configuration</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code> - if the configuration could not be read</dd>
<dd><code>org.xml.sax.SAXException</code> - if the configuration could not be parsed</dd>
</dl>
</li>
</ul>
<a name="XmlConfiguration-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>XmlConfiguration</h4>
<pre>public&nbsp;XmlConfiguration(java.lang.String&nbsp;configuration)
throws org.xml.sax.SAXException,
java.io.IOException</pre>
<div class="block">Reads and parses the XML configuration string.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>configuration</code> - String of XML configuration commands excluding the normal XML preamble.
The String should start with a "&lt;Configure ....&gt;" element.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code> - if the configuration could not be read</dd>
<dd><code>org.xml.sax.SAXException</code> - if the configuration could not be parsed</dd>
</dl>
</li>
</ul>
<a name="XmlConfiguration-java.io.InputStream-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>XmlConfiguration</h4>
<pre>public&nbsp;XmlConfiguration(java.io.InputStream&nbsp;configuration)
throws org.xml.sax.SAXException,
java.io.IOException</pre>
<div class="block">Reads and parses the XML configuration stream.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>configuration</code> - An input stream containing a complete configuration file</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code> - if the configuration could not be read</dd>
<dd><code>org.xml.sax.SAXException</code> - if the configuration could not be parsed</dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getIdMap--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getIdMap</h4>
<pre>public&nbsp;java.util.Map&lt;java.lang.String,java.lang.Object&gt;&nbsp;getIdMap()</pre>
<div class="block">Get the map of ID String to Objects that is used to hold
and lookup any objects by ID.
<p>
A New, Get or Call XML element may have an
id attribute which will cause the resulting object to be placed into
this map. A Ref XML element will lookup an object from this map.</p>
<p>
When chaining configuration files, it is good practise to copy the
ID entries from the ID map to the map of the next configuration, so
that they may share an ID space
</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A modifiable map of ID strings to Objects</dd>
</dl>
</li>
</ul>
<a name="getProperties--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getProperties</h4>
<pre>public&nbsp;java.util.Map&lt;java.lang.String,java.lang.String&gt;&nbsp;getProperties()</pre>
<div class="block">Get the map of properties used by the Property XML element
to parameterise configuration.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A modifiable map of properties.</dd>
</dl>
</li>
</ul>
<a name="configure-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>configure</h4>
<pre>public&nbsp;java.lang.Object&nbsp;configure(java.lang.Object&nbsp;obj)
throws java.lang.Exception</pre>
<div class="block">Applies the XML configuration script to the given object.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>obj</code> - The object to be configured, which must be of a type or super type
of the class attribute of the &lt;Configure&gt; element.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the configured object</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.Exception</code> - if the configuration fails</dd>
</dl>
</li>
</ul>
<a name="configure--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>configure</h4>
<pre>public&nbsp;java.lang.Object&nbsp;configure()
throws java.lang.Exception</pre>
<div class="block">Applies the XML configuration script.
If the root element of the configuration has an ID, an object is looked up by ID and its type checked
against the root element's type.
Otherwise a new object of the type specified by the root element is created.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The newly created configured object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.Exception</code> - if the configuration fails</dd>
</dl>
</li>
</ul>
<a name="initializeDefaults-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>initializeDefaults</h4>
<pre>public&nbsp;void&nbsp;initializeDefaults(java.lang.Object&nbsp;object)</pre>
<div class="block">Initialize a new Object defaults.
<p>This method must be called by any <a href="../../../../org/eclipse/jetty/xml/ConfigurationProcessor.html" title="interface in org.eclipse.jetty.xml"><code>ConfigurationProcessor</code></a> when it
creates a new instance of an object before configuring it, so that a derived
XmlConfiguration class may inject default values.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>object</code> - the object to initialize defaults on</dd>
</dl>
</li>
</ul>
<a name="main-java.lang.String...-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>main</h4>
<pre>public static&nbsp;void&nbsp;main(java.lang.String...&nbsp;args)
throws java.lang.Exception</pre>
<div class="block">Run the XML configurations as a main application. The command line is used to obtain properties files (must be named '*.properties') and XmlConfiguration
files.
<p>
Any property file on the command line is added to a combined Property instance that is passed to each configuration file via
<a href="../../../../org/eclipse/jetty/xml/XmlConfiguration.html#getProperties--"><code>getProperties()</code></a>.
<p>
Each configuration file on the command line is used to create a new XmlConfiguration instance and the <a href="../../../../org/eclipse/jetty/xml/XmlConfiguration.html#configure--"><code>configure()</code></a> method is used
to create the configured object. If the resulting object is an instance of <a href="../../../../org/eclipse/jetty/util/component/LifeCycle.html" title="interface in org.eclipse.jetty.util.component"><code>LifeCycle</code></a>, then it is started.
<p>
Any IDs created in a configuration are passed to the next configuration file on the command line using <a href="../../../../org/eclipse/jetty/xml/XmlConfiguration.html#getIdMap--"><code>getIdMap()</code></a>.
This allows objects with IDs created in one config file to be referenced in subsequent config files on the command line.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>args</code> - array of property and xml configuration filenames or <a href="../../../../org/eclipse/jetty/util/resource/Resource.html" title="class in org.eclipse.jetty.util.resource"><code>Resource</code></a>s.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.Exception</code> - if the XML configurations cannot be run</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/XmlConfiguration.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/eclipse/jetty/xml/XmlAppendable.html" title="class in org.eclipse.jetty.xml"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/eclipse/jetty/xml/XmlParser.html" title="class in org.eclipse.jetty.xml"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/eclipse/jetty/xml/XmlConfiguration.html" target="_top">Frames</a></li>
<li><a href="XmlConfiguration.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 1995&#x2013;2018 <a href="http://webtide.com">Webtide</a>. All rights reserved.</small></p>
</body>
</html>