Overall architecture - adarrivi/pascal-triangle GitHub Wiki

The project is divided in 3 different layers:

  • View: contains the http server and process requests
  • Service: has the business logic.
  • Model : contains the domain model.

Another layer, Config, is added across them holding the application context.

layer configuration

Following the application workflow:

workflow

    1. and 2): A http request is received by the server. The pipeline factory creates a new instance of the defined handler (NettyHttpServerHandler) to process it.
    1. and 5): The handler, using HttpControllerFactory, works out to which controller must redirect the request (depending on the url), if any. If there are no controllers associated with the given url, then a bad response is sent back.
  • 6): The controller verifies the request parameters.
    1. and 8): all the calls the the service are cached.
  • 9), 10), 11) and 12): The service creates the pyramid, works out the requested weight and returns the result back to the controller.
  • 13): The controller creates the proper http response back.
  • 14): The response is sent back to the client.