5.2 MosWsClient Class

The MosWsClient class is the primary entry point for the client. When invoked from the command line, it provides the main() method implementation to start up the client. When embedded in another application, MosWsClient operates as a Runnable and should be run in its own thread.

Figure 5-2 MosWsClient Class

The run() method implements the primary run logic for the client as shown in the following code snippet:

          while (_running)
            {
                ServiceFactory svcFactory = _context.getServiceFactory();
                _context.setCurrentServiceType(null);

                ServiceCall service = svcFactory.getService();
                _context.setCurrentServiceType(service.getServiceType());

                try
                {
                    service.gatherParms();
                    service.runService();
                    service.processResponse();
                }
                catch (Abort e)
                {
                    _log.info("Aborted execution of " + service.getServiceType().name());
                }
            }