try {
BeanInfo info = Introspector.getBeanInfo(RepositoryMetaData.class);
PropertyDescriptor[] properties = info.getPropertyDescriptors();
Repository repository = getRepository();
RepositoryMetaData data = repository.getMetaData();
URIFactory uf = repository.getURIFactory();
LiteralFactory lf = repository.getLiteralFactory();
URI subj = uf.createURI(getRequest().getResourceRef().toString(false, false));
Model model = new LinkedHashModel();
for (PropertyDescriptor p : properties) {
Object o = p.getReadMethod().invoke(data);
if (o instanceof Object[]) {
for (Object e : (Object[])o) {
add(model, subj, uf, p.getName(), lf, e);
}
}
else {
add(model, subj, uf, p.getName(), lf, o);
}
}
for (Isolation isolation : Isolation.values()) {
if (data.supportsIsolation(isolation)) {
add(model, subj, uf, "supportsIsolation", lf, isolation);
}
}
return new ModelRepresentation(model, factory, mediaType);