TreeInfo currentTree = (TreeInfo)currentTrees.get(profile);
if (currentTree == null)
{
HashSet resourcesToManage = new HashSet ();
TreeInfo result = new DefaultTreeInfo ();
ArrayList pluginsSubset = getPluginsSubsetForProfile (profile);
HashSet resourcesAlreadyScanned = new HashSet ();
result.setRootResources (new ManageableResource[] {bootstrapResource});
// Bootstrap tree creation
//
resourcesToManage.add (bootstrapResource);
while (resourcesToManage.size () > 0)
{
ManageableResource currentResource = (ManageableResource)resourcesToManage.iterator ().next ();
// pre-clean resources environment
//
resourcesToManage.remove (currentResource);
resourcesAlreadyScanned.add (currentResource);
Iterator iter = getTreesForResource(currentResource, profile, pluginsSubset);
while (iter.hasNext ())
{
TreeNode subTree = (TreeNode)iter.next ();
result.addTreeToResource (currentResource, subTree);
HashSet subResources = findSubResources (subTree);
if (subResources != null && subResources.size () > 0)
{
Iterator subsRes = subResources.iterator ();
while (subsRes.hasNext ())
{
ManageableResource subRes = (ManageableResource)subsRes.next ();
if (!resourcesAlreadyScanned.contains (subRes))
resourcesToManage.add (subRes);
}
}
}
}
this.treeVersion++;
result.setTreeVersion (this.treeVersion);
try
{
TreeNodeMenuEntry[] base = new TreeNodeMenuEntry[]
{
new SimpleTreeNodeMenuEntryImpl ("Update tree", new RefreshTreeAction (false)),
new SimpleTreeNodeMenuEntryImpl ("Force update tree", new RefreshTreeAction (true)),
};
if (enableShutdown)
{
result.setRootMenus (new TreeNodeMenuEntry[]
{
base[0],
base[1],
new SeparatorTreeNodeMenuEntry (),
new SimpleTreeNodeMenuEntryImpl ("Shutdown JBoss instance",
new MBeanAction (new ObjectName("jboss.system:type=Server"),
"shutdown", new Object[0], new String[0])
),
new SimpleTreeNodeMenuEntryImpl ("Shutdown and Restart JBoss instance",
new MBeanAction (new ObjectName("jboss.system:type=Server"),
"exit", new Object[] {new Integer (10)},
new String[] {"int"})
),
new SimpleTreeNodeMenuEntryImpl ("HALT and Restart JBoss instance",
new MBeanAction (new ObjectName("jboss.system:type=Server"),
"halt", new Object[] {new Integer (10)},
new String[] {"int"})
)
}
);
}
else
{
result.setRootMenus (base);
}
result.setHomeAction(new HttpLinkTreeAction (this.mainLinkUrl));
result.setIconUrl (this.mainLogoUrl);
}
catch (Exception bla) {}
currentTree = result;