fixed merge
This commit is contained in:
parent
ec22a1ba0b
commit
5fed7c713f
|
@ -34,7 +34,7 @@ public interface Configuration
|
||||||
{
|
{
|
||||||
public final static String ATTR="org.eclipse.jetty.webapp.configuration";
|
public final static String ATTR="org.eclipse.jetty.webapp.configuration";
|
||||||
|
|
||||||
public default String getClassName() { return getClass().getName(); }
|
public default String getName() { return getClass().getName(); }
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------------- */
|
||||||
/** Get a class that this class replaces/extends
|
/** Get a class that this class replaces/extends
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
|
// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
// All rights reserved. This program and the accompanying materials
|
// All rights reserved. This program and the accompanying materials
|
||||||
// are made available under the terms of the Eclipse Public License v1.0
|
// are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
@ -47,7 +47,7 @@ public class Configurations extends AbstractList<Configuration>
|
||||||
{
|
{
|
||||||
ServiceLoader<Configuration> configs = ServiceLoader.load(Configuration.class);
|
ServiceLoader<Configuration> configs = ServiceLoader.load(Configuration.class);
|
||||||
for (Configuration configuration : configs)
|
for (Configuration configuration : configs)
|
||||||
__known.put(configuration.getClassName(),configuration);
|
__known.put(configuration.getName(),configuration);
|
||||||
LOG.debug("Known Configurations {}",__known.keySet());
|
LOG.debug("Known Configurations {}",__known.keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ public class Configurations extends AbstractList<Configuration>
|
||||||
public void add(Configuration... configurations)
|
public void add(Configuration... configurations)
|
||||||
{
|
{
|
||||||
for (Configuration configuration : configurations)
|
for (Configuration configuration : configurations)
|
||||||
add(configuration.getClassName(),configuration);
|
add(configuration.getName(),configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(@Name("configClass")String... configClass)
|
public void add(@Name("configClass")String... configClass)
|
||||||
|
@ -182,7 +182,7 @@ public class Configurations extends AbstractList<Configuration>
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
for (Configuration configuration : configurations)
|
for (Configuration configuration : configurations)
|
||||||
add(configuration.getClassName(),configuration);
|
add(configuration.getName(),configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(@Name("configClass")String... configClass)
|
public void set(@Name("configClass")String... configClass)
|
||||||
|
@ -194,11 +194,11 @@ public class Configurations extends AbstractList<Configuration>
|
||||||
|
|
||||||
public void remove(Configuration... configurations)
|
public void remove(Configuration... configurations)
|
||||||
{
|
{
|
||||||
List<String> names = Arrays.asList(configurations).stream().map(Configuration::getClassName).collect(Collectors.toList());
|
List<String> names = Arrays.asList(configurations).stream().map(Configuration::getName).collect(Collectors.toList());
|
||||||
for (ListIterator<Configuration> i=_configurations.listIterator();i.hasNext();)
|
for (ListIterator<Configuration> i=_configurations.listIterator();i.hasNext();)
|
||||||
{
|
{
|
||||||
Configuration configuration=i.next();
|
Configuration configuration=i.next();
|
||||||
if (names.contains(configuration.getClassName()))
|
if (names.contains(configuration.getName()))
|
||||||
i.remove();
|
i.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ public class Configurations extends AbstractList<Configuration>
|
||||||
for (ListIterator<Configuration> i=_configurations.listIterator();i.hasNext();)
|
for (ListIterator<Configuration> i=_configurations.listIterator();i.hasNext();)
|
||||||
{
|
{
|
||||||
Configuration configuration=i.next();
|
Configuration configuration=i.next();
|
||||||
if (names.contains(configuration.getClassName()))
|
if (names.contains(configuration.getName()))
|
||||||
i.remove();
|
i.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ public class Configurations extends AbstractList<Configuration>
|
||||||
|
|
||||||
public String[] toArray()
|
public String[] toArray()
|
||||||
{
|
{
|
||||||
return _configurations.stream().map(Configuration::getClassName).toArray(String[]::new);
|
return _configurations.stream().map(Configuration::getName).toArray(String[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sort()
|
public void sort()
|
||||||
|
@ -231,7 +231,7 @@ public class Configurations extends AbstractList<Configuration>
|
||||||
TopologicalSort<Configuration> sort = new TopologicalSort<>();
|
TopologicalSort<Configuration> sort = new TopologicalSort<>();
|
||||||
|
|
||||||
for (Configuration c:_configurations)
|
for (Configuration c:_configurations)
|
||||||
map.put(c.getClassName(),c);
|
map.put(c.getName(),c);
|
||||||
for (Configuration c:_configurations)
|
for (Configuration c:_configurations)
|
||||||
{
|
{
|
||||||
for (String b:c.getBeforeThis())
|
for (String b:c.getBeforeThis())
|
||||||
|
@ -282,7 +282,7 @@ public class Configurations extends AbstractList<Configuration>
|
||||||
{
|
{
|
||||||
for (ListIterator<Configuration> i=_configurations.listIterator();i.hasNext();)
|
for (ListIterator<Configuration> i=_configurations.listIterator();i.hasNext();)
|
||||||
{
|
{
|
||||||
if (i.next().getClassName().equals(replaces.getName()))
|
if (i.next().getName().equals(replaces.getName()))
|
||||||
{
|
{
|
||||||
i.set(configuration);
|
i.set(configuration);
|
||||||
return;
|
return;
|
||||||
|
@ -293,7 +293,7 @@ public class Configurations extends AbstractList<Configuration>
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_configurations.stream().map(Configuration::getClassName).anyMatch(n->{return name.equals(n);}))
|
if (!_configurations.stream().map(Configuration::getName).anyMatch(n->{return name.equals(n);}))
|
||||||
_configurations.add(configuration);
|
_configurations.add(configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class WebAppContextTest
|
||||||
{
|
{
|
||||||
WebAppContext wac = new WebAppContext();
|
WebAppContext wac = new WebAppContext();
|
||||||
wac.setServer(new Server());
|
wac.setServer(new Server());
|
||||||
Assert.assertThat(Arrays.asList(wac.getConfigurations()).stream().map(Configuration::getClassName).collect(Collectors.toList()),
|
Assert.assertThat(Arrays.asList(wac.getConfigurations()).stream().map(Configuration::getName).collect(Collectors.toList()),
|
||||||
Matchers.contains(
|
Matchers.contains(
|
||||||
"org.eclipse.jetty.webapp.WebInfConfiguration",
|
"org.eclipse.jetty.webapp.WebInfConfiguration",
|
||||||
"org.eclipse.jetty.webapp.WebXmlConfiguration",
|
"org.eclipse.jetty.webapp.WebXmlConfiguration",
|
||||||
|
|
Loading…
Reference in New Issue