use of org.springframework.osgi.web.deployer.support.DefaultContextPathStrategy in project hale by halestudio.
the class WelcomePage method addControls.
@Override
protected void addControls(boolean loggedIn) {
super.addControls(loggedIn);
// create a model which loads the list of war bundles dynamically
IModel<List<BundleInfo>> listViewModel = new LoadableDetachableModel<List<BundleInfo>>() {
private static final long serialVersionUID = 8919477639656535497L;
@Override
protected List<BundleInfo> load() {
// get context paths of other war bundles
List<BundleInfo> wars = new ArrayList<BundleInfo>();
Activator aa = Activator.getInstance();
DefaultContextPathStrategy s = new DefaultContextPathStrategy();
for (Bundle b : aa.getWarBundles()) {
if (isHidden(b)) {
continue;
}
BundleInfo bi = new BundleInfo();
bi.name = getHumanReadableName(b);
bi.path = s.getContextPath(b);
wars.add(bi);
}
// sort list
Collections.sort(wars, new Comparator<BundleInfo>() {
@Override
public int compare(BundleInfo o1, BundleInfo o2) {
return o1.name.compareTo(o2.name);
}
});
return wars;
}
};
// fill list view
ListView<BundleInfo> lv = new ListView<BundleInfo>("applications", listViewModel) {
private static final long serialVersionUID = -3861139762631118268L;
@Override
protected void populateItem(ListItem<BundleInfo> item) {
BundleInfo bi = item.getModelObject();
item.add(new ExternalLink("path", bi.path, bi.name));
}
};
add(lv);
}
Aggregations