for (String servicePath: servicePaths) {
Resource serviceResource = registry.get(servicePath);
String lifecycleName = serviceResource.getProperty("registry.Aspects");
if (lifecycleName != null) {
lifecycleName = lifecycleName.replaceAll("\\s", "");
LifecycleInfoBean lifecycleInfoBean = lifecycleInfoBeanMap.get(lifecycleName);
List<LifecycleStageInfoBean> lifecycleStages = lifecycleStagesMap.get(lifecycleName);
if (lifecycleInfoBean == null) {
lifecycleInfoBean = new LifecycleInfoBean();
lifecycleInfoBean.setName(lifecycleName);
lifecycleInfoBeanMap.put(lifecycleName, lifecycleInfoBean);
// initializing lifecycle stages
lifecycleStages = new ArrayList<LifecycleStageInfoBean>();
lifecycleStagesMap.put(lifecycleName, lifecycleStages);
}
String lifecycleStageKey = "registry.lifecycle." + lifecycleName + ".state";
String lifecycleStageValue = serviceResource.getProperty(lifecycleStageKey);
LifecycleStageInfoBean lifecycleStageInfoBean = null;
// iterate and find the correct stage object
for (int i = 0; i < lifecycleStages.size(); i ++) {
LifecycleStageInfoBean stageInfoBeanIt = lifecycleStages.get(i);
if (stageInfoBeanIt.getName().equals(lifecycleStageValue)) {
lifecycleStageInfoBean = stageInfoBeanIt;
}
}
if (lifecycleStageInfoBean == null) {
// create a new life cycle stage
lifecycleStageInfoBean = new LifecycleStageInfoBean();
lifecycleStageInfoBean.setName(lifecycleStageValue);
lifecycleStageInfoBean.setServiceCount(1);
lifecycleStages.add(lifecycleStageInfoBean);
}
else {
// increment the current service count
lifecycleStageInfoBean.setServiceCount(lifecycleStageInfoBean.getServiceCount() + 1);
}
LifecycleStageInfoBean[] lifecycleStageInfoBeans = lifecycleStages.toArray(
new LifecycleStageInfoBean[lifecycleStages.size()]);
lifecycleInfoBean.setStages(lifecycleStageInfoBeans);
}
}
// now fill all the beans
LifecycleInfoBean[] lifecycleInfoBeans = lifecycleInfoBeanMap.values().toArray(