LOG.info("Processing controllers...");
for (String uri : uriControllerMappings.keySet()) {
LOG.info(new StringBuilder().append("Processing controllers for ")
.append(uri).toString());
Controller controller = uriControllerMappings.get(uri);
LOG.info(new StringBuilder().append("Found controller ")
.append(uriControllerMappings.get(uri).getType()).toString());
ArrayList<Method> matches = uriMethodMappings.get(uri);
LOG.info(new StringBuilder().append("Found methods ")
.append(matches.toString()).append(" ").append(matches.size())
.toString());
Service service =
new Service(identifier, multiUriMappings.get(uri), new Controller(
controller.getType(), controller.getJavadoc(), matches));
services.add(service);
service.assertValid();
JiBXUtils.marshallService(service,
ServiceUtils.serviceFile(dirs, identifier));
identifier++;
}
LOG.info("Processing services...");
Services list = new Services();
for (Service service : services) {
org.apache.commons.collections.Predicate predicate =
new ControllerTypePredicate(service.getController().getType());
if (CollectionUtils.exists(list.getControllers(), predicate)) {
ControllerSummary controller =
(ControllerSummary) CollectionUtils.find(list.getControllers(),
predicate);
controller.addService(service);
} else {
ControllerSummary controller =
new ControllerSummary(service.getController().getType(),
service.getController().getJavadoc());
controller.addService(service);
list.addController(controller);
}
}
LOG.info("Marshalling services...");