Recently, I was working on a reorganization of a system that processes client data packets. The system performs a series of steps, each of which uses the files of the previous steps (and sometimes the data in memory) and produces its own output in the form of files or data. Sometimes the output for a particular step is already available. I have to be careful to make sure that when one step fails, we continue to perform all possible steps (those that are independent of the failed step), so that the final conclusion is as complete as possible. In addition, not all steps must be performed in all situations.
Previously, relationships were implicit in the code structure. For instance:
void processClientData() { try { processA(); } catch(Exception e) { log.log(Level.SEVERE, "exception occured in step A", e); processC();
I modified this to make explicit dependencies dependent, consistent error handling, etc., by introducing Tasks:
public interface Task { List<Task> getDependencies(); void execute();
It starts to look very much like a very irrigated version of a dependency management build system (ANT, being most familiar to me). I don't want to drag ANT for this kind of thing, and I certainly don't want to write out XML.
I have my system and it works (mostly), but it is still a bit hacked, and since then I have been thinking about how much I hate reinventing the wheel. I would expect this to be a fairly common problem that has been solved many times by people smarter than me. Alas, several hours of work on Google did not appear.
Is there a library that implements such things without being a really heavy prefab system? I also appreciate any pointers, including libraries in other languages (or even new systems), from which I should draw inspiration.
EDIT: I appreciate the suggestions (and I will pay due attention to them), but I'm really NOT looking for an “assembly system” as such. What I'm looking for is more like the kernel of the build system, which I could just call directly from Java and use as a small library with low loads to perform the specified dependency analysis, task execution, and resource management. As I said, I have existing (working) code in pure Java, and I don’t want to enter the XML and all the baggage that comes with it, without a compelling reason . . p>