}
public static ArrayList getTrees(RenderRequest request) {
ArrayList arryList = new ArrayList();
StringTree treeEAR = new StringTree("Enterprise Applications");
arryList.add(treeEAR);
StringTree treeEJB = new StringTree("EJBModule");
arryList.add(treeEJB);
StringTree treeWeb = new StringTree("WebModule");
arryList.add(treeWeb);
StringTree treeRAR = new StringTree("ResourceAdapterModule");
arryList.add(treeRAR);
StringTree treeCLI = new StringTree("AppClientModule");
arryList.add(treeCLI);
StringTree treeSys = new StringTree("System Module");
arryList.add(treeSys);
org.apache.geronimo.kernel.Kernel kernel = org.apache.geronimo.kernel.KernelRegistry
.getSingleKernel();
ConfigurationManager configManager = ConfigurationUtil
.getConfigurationManager(kernel);
List infos = configManager.listConfigurations();
for (Iterator infoIterator = infos.iterator(); infoIterator.hasNext();) {
ConfigurationInfo info = (ConfigurationInfo) infoIterator.next();
Configuration conf = configManager.getConfiguration(info
.getConfigID());
if (conf != null) {
StringTree curr = new StringTree(info.getConfigID().toString());
;
switch (info.getType().getValue()) {
case 0:// EAR
{
treeEAR.addChild(curr);
break;
}
case 1:// EJB
{
treeEJB.addChild(curr);
break;
}
case 2:// CAR
{
treeCLI.addChild(curr);
break;
}
case 3:// RAR
{
treeRAR.addChild(curr);
break;
}
case 4:// WAR
{
treeWeb.addChild(curr);
break;
}
case 5:// SERVICE
{
treeSys.addChild(curr);
break;
}
}
addDependencies(curr, conf);
if (info.getType().getValue() == ConfigurationModuleType.EAR.getValue()) {
StringTree nodeEJB = new StringTree("EJBModule");
curr.addChild(nodeEJB);
StringTree nodeWeb = new StringTree("WebModule");
curr.addChild(nodeWeb);
StringTree nodeRAR = new StringTree("ResourceAdapterModule");
curr.addChild(nodeRAR);
StringTree nodeCLI = new StringTree("AppClientModule");
curr.addChild(nodeCLI);
Map<String, String> query = new HashMap<String, String>();
query.put("j2eeType", "EJBModule");
query.put("J2EEApplication", info.getConfigID().toString());
Set<AbstractName> setEnt = kernel.listGBeans(new AbstractNameQuery(null, query));
for (AbstractName gb : setEnt) {
StringTree subCurr = new StringTree(info.getConfigID().getGroupId()
+ "/"
+ info.getConfigID().getArtifactId()
+ "_"
+ gb.getNameProperty("name")
+ "/"
+ info.getConfigID().getVersion()
+ "/"
+ info.getConfigID().getType());
nodeEJB.addChild(subCurr);
addDependencies(subCurr, configManager
.getConfiguration(gb.getArtifact()));
}
Map<String, String> query1 = new HashMap<String, String>();
query1.put("j2eeType", "ResourceAdapterModule");
query1.put("J2EEApplication", info.getConfigID().toString());
Set<AbstractName> setEnt1 = kernel.listGBeans(new AbstractNameQuery(null, query1));
for (AbstractName gb : setEnt1) {
StringTree subCurr = new StringTree(info.getConfigID().getGroupId()
+ "/"
+ info.getConfigID().getArtifactId()
+ "_"
+ gb.getNameProperty("name")
+ "/"
+ info.getConfigID().getVersion()
+ "/"
+ info.getConfigID().getType());
nodeRAR.addChild(subCurr);
addDependencies(subCurr, configManager.getConfiguration(gb.getArtifact()));
}
for (Configuration config: conf.getChildren()) {
StringTree subCurr = new StringTree(config.getAbstractName().toString());
nodeWeb.addChild(subCurr);
addDependencies(subCurr, config);
}
for (Artifact name : conf.getOwnedConfigurations()) {
StringTree subCurr = new StringTree(name.toString());
nodeCLI.addChild(subCurr);
addDependencies(subCurr, configManager.getConfiguration(name));
}
}
}
}
StringTree treeRepo = new StringTree("Repository");
arryList.add(treeRepo);
ListableRepository[] repos = PortletManager.getCurrentServer(request)
.getRepositories();
for (int i = 0; i < repos.length; i++) {
ListableRepository repo = repos[i];
final SortedSet artifacts = repo.list();
for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
String fileName = iterator.next().toString();
treeRepo.addChild(fileName);
}
}
return arryList;