What about adding a status code to the result, like is done in another hc tool from Jörg?
https://github.com/joerghoh/cq5-healthcheck/blob/master/api/src/main/java/de/joerghoh/cq5/healthcheck/StatusCode.java Regards Carsten 2013/7/30 Carsten Ziegeler <[email protected]> > Hi, > Ok, so how about > >> >> public interface HealthCheck { >> HealthCheckResult execute(); >> >> // Unique ID (path of the Resource used to define >> / this item, OSGi config PID, etc.) >> public String getId(); >> >> // Tags are used to select HCItems when checking a subset of them >> public Set<String> getTags(); >> >> // Additional info: name, description, how to fix etc >> public Map<String, String> getInfo(); >> } >> >> public interface HealthCheckResult { >> public HealthCheck getHealthCheck(); >> // If this is false, all checks were successful >> public boolean anythingToReport(); >> public List<LogMessage> getLogMessages(); >> } >> >> And HealthCheck are just OSGi services. >> >> > Sounds good, except :) > - I'm not sure whether the info part should be part of the result - if > it's static it can be part of the interface, but I could imagine that it > might change and be potentially different between executions. > - the ID does not need to be part of the interface, this can be part of > the service registration properties. > - tags: i think these could be part of the service registration properties > as well > > The benefit of having the info as service reg props is that the > filtering/checking can be done without really instantiating/getting the > services. > > Regards > Carsten > -- > Carsten Ziegeler > [email protected] > -- Carsten Ziegeler [email protected]
