diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java index 70962fc9616..982907a7c7c 100644 --- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java +++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java @@ -104,7 +104,7 @@ public class ScanningAppProviderRuntimeUpdatesTest } while(_scans.get() _xmlConfigurations; - private Map _properties = new HashMap(); + private Map _properties = new HashMap<>(); private Server _server; private int _serverPort; private String _scheme = HttpScheme.HTTP.asString(); @@ -64,7 +63,7 @@ public class XmlConfiguredJetty public XmlConfiguredJetty(TestingDir testdir) throws IOException { - _xmlConfigurations = new ArrayList(); + _xmlConfigurations = new ArrayList<>(); Properties properties = new Properties(); String jettyHomeBase = testdir.getDir().getAbsolutePath(); @@ -131,12 +130,12 @@ public class XmlConfiguredJetty FileOutputStream out = new FileOutputStream(testConfig); properties.store(out,"Generated by " + XmlConfiguredJetty.class.getName()); for (Object key:properties.keySet()) - _properties.put(String.valueOf(key),String.valueOf(properties.get(key))); + setProperty(String.valueOf(key),String.valueOf(properties.get(key))); } public void addConfiguration(File xmlConfigFile) throws MalformedURLException { - _xmlConfigurations.add(Resource.toURL(xmlConfigFile)); + addConfiguration(Resource.toURL(xmlConfigFile)); } public void addConfiguration(String testConfigName) throws MalformedURLException @@ -156,7 +155,7 @@ public class XmlConfiguredJetty { for (WebAppContext context : contexts) { - System.out.println("WebAppContext should not exist:\n" + context); + System.err.println("WebAppContext should not exist:\n" + context); } Assert.assertEquals("Contexts.size",0,contexts.size()); } @@ -183,7 +182,7 @@ public class XmlConfiguredJetty public void assertResponseContains(String path, String needle) throws IOException { - System.out.println("Issuing request to " + path); + System.err.println("Issuing request to " + path); String content = getResponse(path); Assert.assertTrue("Content should contain <" + needle + ">, instead got <" + content + ">",content.contains(needle)); } @@ -193,15 +192,15 @@ public class XmlConfiguredJetty List contexts = getWebAppContexts(); if (expectedContextPaths.length != contexts.size()) { - System.out.println("## Expected Contexts"); + System.err.println("## Expected Contexts"); for (String expected : expectedContextPaths) { - System.out.println(expected); + System.err.println(expected); } - System.out.println("## Actual Contexts"); + System.err.println("## Actual Contexts"); for (WebAppContext context : contexts) { - System.out.printf("%s ## %s%n",context.getContextPath(),context); + System.err.printf("%s ## %s%n",context.getContextPath(),context); } Assert.assertEquals("Contexts.size",expectedContextPaths.length,contexts.size()); } @@ -223,7 +222,7 @@ public class XmlConfiguredJetty public void copyContext(String srcName, String destName) throws IOException { - System.out.printf("Copying Context: %s -> %s%n",srcName,destName); + System.err.printf("Copying Context: %s -> %s%n",srcName,destName); File srcDir = MavenTestingUtils.getTestResourceDir("contexts"); File destDir = new File(_jettyHome,"contexts"); @@ -238,13 +237,13 @@ public class XmlConfiguredJetty PathAssert.assertFileExists(type + " File",srcFile); IO.copyFile(srcFile,destFile); PathAssert.assertFileExists(type + " File",destFile); - System.out.printf("Copy %s: %s%n To %s: %s%n",type,srcFile,type,destFile); - System.out.printf("Destination Exists: %s - %s%n",destFile.exists(),destFile); + System.err.printf("Copy %s: %s%n To %s: %s%n",type,srcFile,type,destFile); + System.err.printf("Destination Exists: %s - %s%n",destFile.exists(),destFile); } public void copyWebapp(String srcName, String destName) throws IOException { - System.out.printf("Copying Webapp: %s -> %s%n",srcName,destName); + System.err.printf("Copying Webapp: %s -> %s%n",srcName,destName); File srcDir = MavenTestingUtils.getTestResourceDir("webapps"); File destDir = new File(_jettyHome,"webapps"); @@ -256,33 +255,32 @@ public class XmlConfiguredJetty private void deleteContents(File dir) { - System.out.printf("Delete (dir) %s/%n",dir); + System.err.printf("Delete (dir) %s/%n",dir); if (!dir.exists()) { return; } - for (File file : dir.listFiles()) + File[] files = dir.listFiles(); + if (files != null) { - // Safety measure. only recursively delete within target directory. - if (file.isDirectory() && file.getAbsolutePath().contains("target" + File.separator)) + for (File file : files) { - deleteContents(file); - Assert.assertTrue("Delete failed: " + file.getAbsolutePath(),file.delete()); - } - else - { - System.out.printf("Delete (file) %s%n",file); - Assert.assertTrue("Delete failed: " + file.getAbsolutePath(),file.delete()); + // Safety measure. only recursively delete within target directory. + if (file.isDirectory() && file.getAbsolutePath().contains("target" + File.separator)) + { + deleteContents(file); + Assert.assertTrue("Delete failed: " + file.getAbsolutePath(),file.delete()); + } + else + { + System.err.printf("Delete (file) %s%n",file); + Assert.assertTrue("Delete failed: " + file.getAbsolutePath(),file.delete()); + } } } } - public DeploymentManager getActiveDeploymentManager() - { - return _server.getBean(DeploymentManager.class); - } - public File getJettyDir(String name) { return new File(_jettyHome,name); @@ -310,18 +308,18 @@ public class XmlConfiguredJetty public URI getServerURI() throws UnknownHostException { - StringBuffer uri = new StringBuffer(); - uri.append(this._scheme).append("://"); + StringBuilder uri = new StringBuilder(); + uri.append(getScheme()).append("://"); uri.append(InetAddress.getLocalHost().getHostAddress()); - uri.append(":").append(this._serverPort); + uri.append(":").append(getServerPort()); return URI.create(uri.toString()); } public List getWebAppContexts() { - List contexts = new ArrayList(); + List contexts = new ArrayList<>(); HandlerCollection handlers = (HandlerCollection)_server.getHandler(); - System.out.println(_server.dump()); + System.err.println(_server.dump()); Handler children[] = handlers.getChildHandlers(); for (Handler handler : children) @@ -347,9 +345,7 @@ public class XmlConfiguredJetty URL configURL = this._xmlConfigurations.get(i); XmlConfiguration configuration = new XmlConfiguration(configURL); if (last != null) - { configuration.getIdMap().putAll(last.getIdMap()); - } configuration.getProperties().putAll(_properties); obj[i] = configuration.configure(); last = configuration; @@ -425,7 +421,7 @@ public class XmlConfiguredJetty Assert.assertTrue("Server Port is between 1 and 65535. Actually <" + _serverPort + ">",(1 <= this._serverPort) && (this._serverPort <= 65535)); // Uncomment to have server start and continue to run (without exiting) - // System.out.printf("Listening to port %d%n",this.serverPort); + // System.err.printf("Listening to port %d%n",this.serverPort); // server.join(); } @@ -433,5 +429,4 @@ public class XmlConfiguredJetty { _server.stop(); } - } diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JettyWebXmlConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JettyWebXmlConfiguration.java index aab89c33ed1..db7eef6617b 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JettyWebXmlConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JettyWebXmlConfiguration.java @@ -18,7 +18,6 @@ package org.eclipse.jetty.webapp; -import java.util.HashMap; import java.util.Map; import org.eclipse.jetty.util.log.Log; @@ -28,12 +27,12 @@ import org.eclipse.jetty.xml.XmlConfiguration; /** - * - * JettyWebConfiguration. - * - * Looks for Xmlconfiguration files in WEB-INF. Searches in order for the first of jetty6-web.xml, jetty-web.xml or web-jetty.xml * - * + * JettyWebConfiguration. + * + * Looks for XmlConfiguration files in WEB-INF. Searches in order for the first of jetty6-web.xml, jetty-web.xml or web-jetty.xml + * + * * */ public class JettyWebXmlConfiguration extends AbstractConfiguration @@ -48,8 +47,8 @@ public class JettyWebXmlConfiguration extends AbstractConfiguration public static final String XML_CONFIGURATION = "org.eclipse.jetty.webapp.JettyWebXmlConfiguration"; public static final String JETTY_WEB_XML = "jetty-web.xml"; - - /** + + /** * Configure * Apply web-jetty.xml configuration * @see Configuration#configure(WebAppContext) @@ -63,9 +62,9 @@ public class JettyWebXmlConfiguration extends AbstractConfiguration LOG.debug("Cannot configure webapp after it is started"); return; } - + LOG.debug("Configuring web-jetty.xml"); - + Resource web_inf = context.getWebInf(); // handle any WEB-INF descriptors if(web_inf!=null&&web_inf.isDirectory()) @@ -79,16 +78,16 @@ public class JettyWebXmlConfiguration extends AbstractConfiguration if(jetty.exists()) { - // No server classes while configuring + // No server classes while configuring String[] old_server_classes = context.getServerClasses(); try { context.setServerClasses(null); if(LOG.isDebugEnabled()) LOG.debug("Configure: "+jetty); - + XmlConfiguration jetty_config = (XmlConfiguration)context.getAttribute(XML_CONFIGURATION); - + if (jetty_config==null) { jetty_config=new XmlConfiguration(jetty.getURL()); @@ -97,7 +96,7 @@ public class JettyWebXmlConfiguration extends AbstractConfiguration { context.removeAttribute(XML_CONFIGURATION); } - setupXmlConfiguration(context,jetty_config, web_inf); + setupXmlConfiguration(jetty_config, web_inf); try { jetty_config.configure(context); @@ -120,27 +119,12 @@ public class JettyWebXmlConfiguration extends AbstractConfiguration * Configures some well-known properties before the XmlConfiguration reads * the configuration. * @param jetty_config The configuration object. - */ - private void setupXmlConfiguration(WebAppContext context, XmlConfiguration jetty_config, Resource web_inf) - { - setupXmlConfiguration(jetty_config,web_inf); - } - - /** - * Configures some well-known properties before the XmlConfiguration reads - * the configuration. - * @param jetty_config The configuration object. + * @param web_inf the WEB-INF location */ private void setupXmlConfiguration(XmlConfiguration jetty_config, Resource web_inf) { - Map props = jetty_config.getProperties(); - if (props == null) - { - props = new HashMap(); - jetty_config.setProperties(props); - } - - // TODO - should this be an id rather than a property? - props.put(PROPERTY_THIS_WEB_INF_URL, String.valueOf(web_inf.getURL())); + Map props = jetty_config.getProperties(); + // TODO - should this be an id rather than a property? + props.put(PROPERTY_THIS_WEB_INF_URL, String.valueOf(web_inf.getURL())); } } diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java index f03020197a1..a7872a754bb 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java @@ -43,6 +43,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Queue; +import java.util.ServiceLoader; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; @@ -58,15 +59,14 @@ import org.eclipse.jetty.xml.XmlParser.Node; import org.xml.sax.InputSource; import org.xml.sax.SAXException; -/* ------------------------------------------------------------ */ /** - * Configure Objects from XML. 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. - * - *

- * The actual XML file format may be changed (eg to spring XML) by implementing the {@link ConfigurationProcessorFactory} interfaces to be found by the - * ServiceLoader by using the DTD and first tag element in the file. Note that DTD will be null if validation is off. - * + *

Configures objects from XML.

+ *

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.

+ *

The actual XML file format may be changed (eg to spring XML) by implementing the + * {@link ConfigurationProcessorFactory} interface to be found by the + * {@link ServiceLoader} by using the DTD and first tag element in the file. + * Note that DTD will be null if validation is off.

*/ public class XmlConfiguration { @@ -81,39 +81,8 @@ public class XmlConfiguration private static final Class[] __supportedCollections = {ArrayList.class, ArrayQueue.class, HashSet.class, Queue.class, List.class, Set.class, Collection.class,}; - private static final Iterable __factoryLoader; - + private static final Iterable __factoryLoader = ServiceLoader.load(ConfigurationProcessorFactory.class); private static final XmlParser __parser = initParser(); - - static - { - Iterable loader = null; - try - { - // Use reflection to look up 1.6 service loader - // loader=ServiceLoader.load(ConfigurationProcessorFactory.class); - Class slc = ClassLoader.getSystemClassLoader().loadClass("java.util.ServiceLoader"); - Method load = slc.getMethod("load",Class.class); - loader = (Iterable)load.invoke(null, ConfigurationProcessorFactory.class); - } - catch(Exception e) - { - LOG.ignore(e); - } - finally - { - __factoryLoader = loader; - } - } - - /* ------------------------------------------------------------ */ - private final Map _idMap = new HashMap<>(); - private final Map _propertyMap = new HashMap<>(); - private final URL _url; - private final String _dtd; - private ConfigurationProcessor _processor; - - /* ------------------------------------------------------------ */ private synchronized static XmlParser initParser() { XmlParser parser = new XmlParser(); @@ -146,7 +115,12 @@ public class XmlConfiguration return parser; } - /* ------------------------------------------------------------ */ + private final Map _idMap = new HashMap<>(); + private final Map _propertyMap = new HashMap<>(); + private final URL _url; + private final String _dtd; + private ConfigurationProcessor _processor; + /** * Reads and parses the XML configuration file. * @@ -164,7 +138,6 @@ public class XmlConfiguration } } - /* ------------------------------------------------------------ */ /** * Reads and parses the XML configuration string. * @@ -186,7 +159,6 @@ public class XmlConfiguration } } - /* ------------------------------------------------------------ */ /** * Reads and parses the XML configuration stream. * @@ -205,7 +177,6 @@ public class XmlConfiguration } } - /* ------------------------------------------------------------ */ private void setConfig(XmlParser.Node config) { if ("Configure".equals(config.getTag())) @@ -214,19 +185,9 @@ public class XmlConfiguration } else if (__factoryLoader!=null) { - for ( Object factory : __factoryLoader) + for (ConfigurationProcessorFactory factory : __factoryLoader) { - // use reflection to get 1.6 methods - Method gcp; - try - { - gcp = factory.getClass().getMethod("getConfigurationProcessor",String.class,String.class); - _processor = (ConfigurationProcessor) gcp.invoke(factory,_dtd,config.getTag()); - } - catch (Exception e) - { - LOG.warn(e); - } + _processor = factory.getConfigurationProcessor(_dtd, config.getTag()); if (_processor!=null) break; } @@ -241,44 +202,16 @@ public class XmlConfiguration _processor.init(_url,config,_idMap, _propertyMap); } - - /* ------------------------------------------------------------ */ public Map getIdMap() { return _idMap; } - /* ------------------------------------------------------------ */ - /** - * @param map the ID map - * @deprecated use {@link #getIdMap()}.put(...) - */ - @Deprecated - public void setIdMap(Map map) - { - _idMap.clear(); - _idMap.putAll(map); - } - - /* ------------------------------------------------------------ */ - /** - * @param map the properties map - * @deprecated use {@link #getProperties()}.putAll(...) - */ - @Deprecated - public void setProperties(Map map) - { - _propertyMap.clear(); - _propertyMap.putAll(map); - } - - /* ------------------------------------------------------------ */ public Map getProperties() { return _propertyMap; } - /* ------------------------------------------------------------ */ /** * Applies the XML configuration script to the given object. * @@ -292,7 +225,6 @@ public class XmlConfiguration return _processor.configure(obj); } - /* ------------------------------------------------------------ */ /** * 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 @@ -307,9 +239,6 @@ public class XmlConfiguration return _processor.configure(); } - /* ------------------------------------------------------------ */ - /* ------------------------------------------------------------ */ - /* ------------------------------------------------------------ */ private static class JettyXmlConfiguration implements ConfigurationProcessor { private String _url; @@ -325,7 +254,6 @@ public class XmlConfiguration _propertyMap=properties; } - /* ------------------------------------------------------------ */ public Object configure(Object obj) throws Exception { // Check the class of the object @@ -339,7 +267,6 @@ public class XmlConfiguration return obj; } - /* ------------------------------------------------------------ */ public Object configure() throws Exception { Class oClass = nodeClass(_config); @@ -347,13 +274,12 @@ public class XmlConfiguration String id = _config.getAttribute("id"); Object obj = id == null ? null : _idMap.get(id); - - - int index = _config.size(); + int index = 0; if (obj == null && oClass != null) { - Map namedArgMap = new HashMap(); - + index = _config.size(); + Map namedArgMap = new HashMap<>(); + List arguments = new LinkedList<>(); for (int i = 0; i < _config.size(); i++) { @@ -363,7 +289,7 @@ public class XmlConfiguration continue; } XmlParser.Node node = (XmlParser.Node)o; - + if (!(node.getTag().equals("Arg"))) { index = i; @@ -372,25 +298,19 @@ public class XmlConfiguration else { String namedAttribute = node.getAttribute("name"); - if ( namedAttribute != null ) - { + if (namedAttribute != null) namedArgMap.put(namedAttribute,value(obj,(XmlParser.Node)o)); - } - + arguments.add(value(obj, (XmlParser.Node)o)); } } try { - if ( namedArgMap.size() > 0 ) - { + if (namedArgMap.size() > 0) obj = TypeUtil.construct(oClass, arguments.toArray(), namedArgMap); - } else - { obj = TypeUtil.construct(oClass, arguments.toArray()); - } } catch (NoSuchMethodException x) { @@ -402,7 +322,6 @@ public class XmlConfiguration return obj; } - /* ------------------------------------------------------------ */ private static Class nodeClass(XmlParser.Node node) throws ClassNotFoundException { String className = node.getAttribute("class"); @@ -412,7 +331,6 @@ public class XmlConfiguration return Loader.loadClass(XmlConfiguration.class,className,true); } - /* ------------------------------------------------------------ */ /** * Recursive configuration routine. * This method applies the nested Set, Put, Call, etc. elements to the given object. @@ -476,7 +394,6 @@ public class XmlConfiguration } } - /* ------------------------------------------------------------ */ /* * Call a set method. This method makes a best effort to find a matching set method. The type of the value is used to find a suitable set method by 1. * Trying for a trivial type match. 2. Looking for a native type match. 3. Trying all correctly named methods for an auto conversion. 4. Attempting to @@ -555,7 +472,6 @@ public class XmlConfiguration Class[] paramTypes = sets[s].getParameterTypes(); if (name.equals(sets[s].getName()) && paramTypes.length == 1) { - // lets try it try { @@ -642,7 +558,6 @@ public class XmlConfiguration return collection; } - /* ------------------------------------------------------------ */ private static ArrayList convertArrayToArrayList(Object array) { int length = Array.getLength(array); @@ -652,7 +567,6 @@ public class XmlConfiguration return list; } - /* ------------------------------------------------------------ */ /* * Call a put method. * @@ -672,7 +586,6 @@ public class XmlConfiguration LOG.debug("XML " + obj + ".put(" + name + "," + value + ")"); } - /* ------------------------------------------------------------ */ /* * Call a get method. Any object returned from the call is passed to the configure method to consume the remaining elements. @param obj @param node * @@ -716,7 +629,6 @@ public class XmlConfiguration return obj; } - /* ------------------------------------------------------------ */ /* * Call a method. A method is selected by trying all methods with matching names and number of arguments. Any object returned from the call is passed to * the configure method to consume the remaining elements. Note that if this is a static call we consider only methods declared directly in the given @@ -736,7 +648,7 @@ public class XmlConfiguration throw new IllegalArgumentException(node.toString()); int size = 0; - int argi = node.size(); + int argIndex = node.size(); for (int i = 0; i < node.size(); i++) { Object o = node.get(i); @@ -744,7 +656,7 @@ public class XmlConfiguration continue; if (!((XmlParser.Node)o).getTag().equals("Arg")) { - argi = i; + argIndex = i; break; } size++; @@ -768,7 +680,7 @@ public class XmlConfiguration Object n= TypeUtil.call(oClass,method,obj,arg); if (id != null) _idMap.put(id,n); - configure(n,node,argi); + configure(n,node,argIndex); return n; } catch (NoSuchMethodException e) @@ -777,10 +689,8 @@ public class XmlConfiguration ise.initCause(e); throw ise; } - } - /* ------------------------------------------------------------ */ /* * Create a new value object. * @@ -793,7 +703,7 @@ public class XmlConfiguration { Class oClass = nodeClass(node); int size = 0; - int argi = node.size(); + int argIndex = node.size(); for (int i = 0; i < node.size(); i++) { Object o = node.get(i); @@ -801,34 +711,27 @@ public class XmlConfiguration continue; if (!((XmlParser.Node)o).getTag().equals("Arg")) { - argi = i; + argIndex = i; break; } size++; } - Map namedArgMap = new HashMap(); + Map namedArgMap = new HashMap<>(); List arguments = new LinkedList<>(); - - Object[] arg = new Object[size]; - for (int i = 0, j = 0; j < size; i++) + + for (int i = 0; i < size; i++) { Object o = node.get(i); - + XmlParser.Node argNode = (XmlParser.Node)o; if (o instanceof String) - { continue; - } - - arg[j++] = value(obj,(XmlParser.Node)o); - + String namedAttribute = argNode.getAttribute("name"); - if ( namedAttribute != null ) - { + if (namedAttribute != null) namedArgMap.put(namedAttribute,value(obj,(XmlParser.Node)o)); - } - + arguments.add(value(obj,(XmlParser.Node)o)); } @@ -838,7 +741,7 @@ public class XmlConfiguration try { Object n; - if ( namedArgMap.size() > 0 ) + if (namedArgMap.size() > 0) { LOG.debug("using named mapping"); n = TypeUtil.construct(oClass, arguments.toArray(), namedArgMap); @@ -848,8 +751,8 @@ public class XmlConfiguration LOG.debug("using normal mapping"); n = TypeUtil.construct(oClass, arguments.toArray()); } - - configure(n,node,argi); + + configure(n,node,argIndex); return n; } catch (NoSuchMethodException e) @@ -858,7 +761,6 @@ public class XmlConfiguration } } - /* ------------------------------------------------------------ */ /* * Reference an id value object. * @@ -874,13 +776,11 @@ public class XmlConfiguration return obj; } - /* ------------------------------------------------------------ */ /* * Create a new array object. */ private Object newArray(Object obj, XmlParser.Node node) throws Exception { - // Get the type Class aClass = java.lang.Object.class; String type = node.getAttribute("type"); @@ -926,7 +826,6 @@ public class XmlConfiguration return array; } - /* ------------------------------------------------------------ */ /* * Create a new map object. */ @@ -980,7 +879,6 @@ public class XmlConfiguration return map; } - /* ------------------------------------------------------------ */ /* * Get a Property. * @@ -1005,8 +903,6 @@ public class XmlConfiguration return prop; } - - /* ------------------------------------------------------------ */ /* * Get the value of an element. If no value type is specified, then white space is trimmed out of the value. If it contains multiple value elements they * are added as strings before being converted to any specified type. @param node @@ -1147,13 +1043,11 @@ public class XmlConfiguration throw new IllegalStateException("Unknown type " + type); } - /* ------------------------------------------------------------ */ private static boolean isTypeMatchingClass(String type, Class classToMatch) { return classToMatch.getSimpleName().equalsIgnoreCase(type) || classToMatch.getName().equals(type); } - /* ------------------------------------------------------------ */ /* * Get the value of a single element. @param obj @param item @return @exception Exception */ @@ -1179,14 +1073,12 @@ public class XmlConfiguration return newMap(obj,node); if ("Property".equals(tag)) return propertyObj(node); - if ("SystemProperty".equals(tag)) { String name = node.getAttribute("name"); String defaultValue = node.getAttribute("default"); return System.getProperty(name,defaultValue); } - if ("Env".equals(tag)) { String name = node.getAttribute("name"); @@ -1200,21 +1092,17 @@ public class XmlConfiguration } } - /* ------------------------------------------------------------ */ - /* ------------------------------------------------------------ */ - /* ------------------------------------------------------------ */ - /* ------------------------------------------------------------ */ /** * Run the XML configurations as a main application. The command line is used to obtain properties files (must be named '*.properties') and XmlConfiguration * files. *

* Any property file on the command line is added to a combined Property instance that is passed to each configuration file via - * {@link XmlConfiguration#setProperties(Map)}. + * {@link XmlConfiguration#getProperties()}. *

* Each configuration file on the command line is used to create a new XmlConfiguration instance and the {@link XmlConfiguration#configure()} method is used * to create the configured object. If the resulting object is an instance of {@link LifeCycle}, then it is started. *

- * Any IDs created in a configuration are passed to the next configuration file on the command line using {@link #getIdMap()} and {@link #setIdMap(Map)} . + * Any IDs created in a configuration are passed to the next configuration file on the command line using {@link #getIdMap()}. * This allows objects with IDs created in one config file to be referenced in subsequent config files on the command line. * * @param args @@ -1223,7 +1111,6 @@ public class XmlConfiguration */ public static void main(final String[] args) throws Exception { - final AtomicReference exception = new AtomicReference<>(); AccessController.doPrivileged(new PrivilegedAction()