The next big step was to change the PredefinedCommandFactory to look up commands in more than just the TypeMapCommandFactory. In the original code the CommandCenter, which is where the main execution happens, created a new PredefinedCommandFactory which would delegate to a TypeMapCommandFactory to create the static Command objects. I added logic to PredefinedCommandFactory to have a List
Because of this, the order that the CommandFactories are added to the list of delegates is important as it is also the order that they will be given a chance to create a Command object. Right now the static TypeMapCommandFactory is added first and checked first. This way there is no way to have a script called that is the same name as an existing static Command. I’m not sure how I feel about this. Its easy to change so I’ll see how I like it as I continue testing.
All of this works in new unit tests and I tried it on the command line. It was pretty cool to see my test scripts getting run from the interactive shell. Its starting to come together. I don’t think the script engine integration part I’m doing now is going to be all that hard. I think that designing and implementing the script API is going to be tougher, mostly because I’ll probably be changing it a lot as I start to use it myself to write scripts. No one is a tougher critic on your code than your first user.