I am working on the architecture of a telecom monitoring application that must allow the user to kick off actions through a web page, after login security checks, and directly from a command line on the same host as the monitored system. The business-level requirements and validation should be the same, regardless of the user interface, as well as data retrieval thru the APIs of the monitored system. SMPP 3.4 will be used for the API dialog between the application and the monitored system.
The fundamental question I have is where to draw the line between the user interface tier and the business tier?
1. Use (custom) controller(s) for the actions, and have the command line interface translate the action arguments into an HttpServletRequest before firing the request on an action controller. The controller would use the user interface parameter in the request to determine the action view. The command line "view" would just send action results text to STDOUT, STDERR, and possibly to a log file.
2. Have the web page controller(s) translate the action request into an action domain object; fire the appropriate action on it, and then translate the domain object attributes into the appropriate Model and view. The command line "controller" (what would you call it?) would do similar things: translate the command arguments into an action domain object; fire the appropriate action on it, and then translate the domain object attributes into the appropriate Model and View.
I envision having a DAO for each action domain object type which will implement the API calls to the monitored system.
Some of the action commands may be long transactions, taking over an hour to execute. How can we use Spring to oversee the "health" of such long transactions?
Thanks for your advice.