Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2014-11-20 16:53:02 +0000
committerJoakim Erdfelt2014-11-20 16:53:02 +0000
commit69daa8d76dd8a0094eabcb12204e1ccc16fe520c (patch)
treeb91f950d749021a3bbcfd395327461a61435d77f /jetty-start
parentdf9414eab2dbe0778ea64d7e7349a93aced5930e (diff)
downloadorg.eclipse.jetty.project-69daa8d76dd8a0094eabcb12204e1ccc16fe520c.tar.gz
org.eclipse.jetty.project-69daa8d76dd8a0094eabcb12204e1ccc16fe520c.tar.xz
org.eclipse.jetty.project-69daa8d76dd8a0094eabcb12204e1ccc16fe520c.zip
Cleanup of no longer needed code.
+ Removing Modules.normalizeDependencies() + Using Modules.resolveNode() instead + Chaning Modules.resolveNode() to not throw Exception
Diffstat (limited to 'jetty-start')
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java62
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/graph/Graph.java19
2 files changed, 13 insertions, 68 deletions
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java
index a4af019292..ba2a3efdc1 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java
@@ -22,9 +22,7 @@ import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.jetty.start.graph.Graph;
import org.eclipse.jetty.start.graph.GraphException;
@@ -113,7 +111,8 @@ public class Modules extends Graph<Module>
if (Props.hasPropertyKey(expandedName))
{
- throw new GraphException("Unable to expand property in name: " + name);
+ StartLog.debug("Not yet able to expand property in: %s",name);
+ return null;
}
Path file = baseHome.getPath("modules/" + expandedName + ".mod");
@@ -137,7 +136,7 @@ public class Modules extends Graph<Module>
@Override
public void onNodeSelected(Module module)
{
- StartLog.debug("on node selected: %s [%s]",module.getName(),baseHome.toShortForm(module.getFilesystemRef()));
+ StartLog.debug("on node selected: [%s] (%s.mod)",module.getName(),module.getFilesystemRef());
args.parseModule(module);
module.expandProperties(args.getProperties());
}
@@ -182,61 +181,6 @@ public class Modules extends Graph<Module>
}
}
- // load missing post-expanded dependent modules
- public void normalizeDependencies() throws IOException
- {
- Set<String> expandedModules = new HashSet<>();
- boolean done = false;
- while (!done)
- {
- done = true;
- Set<String> missingParents = new HashSet<>();
-
- for (Module m : getNodes())
- {
- for (String parent : m.getParentNames())
- {
- String expanded = args.getProperties().expand(parent);
- if (containsNode(expanded) || expandedModules.contains(parent))
- {
- continue; // found. skip it.
- }
- done = false;
- StartLog.debug("Missing parent module %s == %s for %s",parent,expanded,m);
- missingParents.add(parent);
- }
- }
-
- for (String missingParent : missingParents)
- {
- String expanded = args.getProperties().expand(missingParent);
- Path file = baseHome.getPath("modules/" + expanded + ".mod");
- if (FS.canReadFile(file))
- {
- Module module = registerModule(file);
- updateParentReferencesTo(module);
- if (!expanded.equals(missingParent))
- {
- expandedModules.add(missingParent);
- }
- }
- else
- {
- if (Props.hasPropertyKey(expanded))
- {
- StartLog.debug("Module property not expandable (yet) [%s]",expanded);
- expandedModules.add(missingParent);
- }
- else
- {
- StartLog.debug("Missing module definition: %s expanded to %s",missingParent,expanded);
- // missingModules.add(missingParent);
- }
- }
- }
- }
- }
-
private Module registerModule(Path file)
{
if (!FS.canReadFile(file))
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/graph/Graph.java b/jetty-start/src/main/java/org/eclipse/jetty/start/graph/Graph.java
index cfe2ba265f..849e5ddd2d 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/graph/Graph.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/graph/Graph.java
@@ -106,14 +106,19 @@ public abstract class Graph<T extends Node<T>> implements Iterable<T>
public void buildGraph() throws FileNotFoundException, IOException
{
- normalizeDependencies();
-
// Connect edges
- for (T node : nodes.values())
+ // Make a copy of nodes.values() as the list could be modified
+ List<T> nodeList = new ArrayList<>(nodes.values());
+ for (T node : nodeList)
{
for (String parentName : node.getParentNames())
{
T parent = get(parentName);
+
+ if (parent == null)
+ {
+ parent = resolveNode(parentName);
+ }
if (parent == null)
{
@@ -295,15 +300,11 @@ public abstract class Graph<T extends Node<T>> implements Iterable<T>
return nodes.values().iterator();
}
- public void normalizeDependencies() throws IOException
- {
- // override to implement
- }
-
public abstract void onNodeSelected(T node);
public T register(T node)
{
+ StartLog.debug("Registering Node: [%s] %s", node.getName(), node);
nodes.put(node.getName(),node);
return node;
}
@@ -428,7 +429,7 @@ public abstract class Graph<T extends Node<T>> implements Iterable<T>
throw new GraphException("Missing referenced dependency: " + name);
}
- count += selectNode(name,selection);
+ count += selectNode(node.getName(),selection);
}
return count;

Back to the top