Operating System: Mac OS X 10.0
Considering configuring Struts to look up commands, the prospect of repeatedly
using both a catalog name and a command name is starting to look extremely
tedious. It would be nice to have a single String representation of the tuple,
and it probably makes sense to implement support for this in the base classes of
commons-chain, rather than requiring users to reinvent the wheel.
I have implemented a simple method in the CatalogFactory class which decomposes
a string ID into a catalog name and a command name and returns the command it
looks up. Using ":" as the separator, what precedes the ":" is treated as a
catalog name. If nothing precedes the colon, or if the segment before the colon
is not a valid catalog name, then the entire ID is used as the name of a command
in the "default" catalog.
(Should the "no such catalog" condition be an error instead? Should the
implementation be in CatalogFactoryBase instead of in CatalogFactory? My
thought was that that leaves the syntax a bit slippery.)