// get all namespaces we know about
namespaces =
new ArrayList<Namespace>(resourceIndex
.getNamespaceResources().size());
for (ResourceLocation rl : resourceIndex.getNamespaceResources()) {
Namespace ns = new Namespace();
ns.setPrefix(""); // empty prefix, doesn't matter, just can't be null
ns.setResourceLocation(rl.getResourceLocation());
namespaces.add(ns);
}
} else {
namespaces = request.getNamespaces();
}
List<Pattern> patterns =
new ArrayList<Pattern>(request.getPatterns().size());
for (String s : request.getPatterns()) {
patterns.add(verifyPattern(s));
}
FindNamespaceValuesResponse response =
OBJECT_FACTORY.createFindNamespaceValuesResponse();
for (Namespace ns : namespaces) {
ns = verifyNamespace(ns);
try {
// get namespace values
List<String> vals = new ArrayList<String>();
for (Pattern p : patterns) {
vals.addAll(
namespaceService.search(ns.getResourceLocation(), p));
}
// get equivalences
List<NamespaceValue> values = new ArrayList<NamespaceValue>();
for (String v : vals) {