In the above lesson we kept mentioning "container". UHR system are organized into a hierarchy of container and leaf parts, which we call the System Tree. Let's modify the above to list the tree. Create a new directory called system02, copy everything from system01 to system02, change all occurances of "system01" to "system02", and change "Hello World" to "Hello World 2" to make sure we're not running the first system. The modified marker and starter class to list the System Tree is:
package uhr.tutorial.system02;
import uhr.core.cell.NodeCreator;
import uhr.core.structure.Container;
public class StartSystem {
public static void main(String args[]) {
String url = "classresource://uhr.tutorial.system02.StartSystem/_Container.dk";
Container rootContainer = new NodeCreator().createAndStartSystem(url);
// Arguments are (boolean startAtRoot, boolean includeHidden)
System.out.println("\n" + rootContainer.listTree(true, false));
}
} // End class
Which gives this output:
Hello World 2+Root HelloThere
The "+" means a part is a container. "Root" is the default root container name. In the Root you can see the single part named "HelloThere". That's your System Tree so far.
Behind the simplicity of that tree lies the UHR Core Framework. There are additional "hidden" parts that do the real work in a self-referential manner, since the core parts use themselves to run the system. We can peek at the full System Tree by tweaking our StartSystem class by changing the print line to:
System.out.println("\n" + rootContainer.listTree(true, true));
Which gives the amazing output of:
Hello World 2+Root core.NodeCreator(I) core.ParamStore(I) core.PartDKHandler(I) core.Linker(I) core.ConnectionRegistry(I) core.Matchmaker core.Lifecycle core.CellDK core.PartRegistry core.MessageRouter HelloThere
There are 10 core parts. The "(I)" means a part is "inheritable", so its services are available to parts in lower containers as well as that container. Most views of the System Tree do not show the core parts to avoid clutter. Note the first part. This is the same NodeCreator part you used to start your system. Wow! Isn't UHR exciting!!! :-)
Go to the next lesson.