So I am working on a simple server for my application. The basic purpose of this server is to listen to request, understand it, forward the request to the domain (an object within the server) which then interacts with the file system to create some objects and return data to where the request came from.
So far, I have come up with design like this:
So what I have done, is to start a service which has a Connector and an Engine.
-
The Connector has multiple protocol handlers that handle a specified protocol. Each protocol handler initializes an Endpoint Listener which opens a socket and listens to incoming requests.
-
The Engine has multiple domains, where each domain has its designated directory on the file system to read/write data.
I am able to initialize the Service layer including all its object, but I am not able to figure out what can I do to make the Connector and Engine to be able to exchange data.
Here comes the complexiy.
It is not fixed that the Service would have only one connector, or the Engine would have only one Domain, or the Connector would have only one Protocol Handler. Eveything is configured through an XML file. The server could run multiple services as well.
Additional information that could be useful.
- Everything in the diagram has a Lifecycle (EXCEPT PROTOCOL HANDLERS AND ENDPOINT) that is
init() -> start() -> stop() -> destroy()
. A listener could be added to listen to change in lifecycle states.
I dont know whether it is a good question or not, or the implementation is not as confusing as I think, but I would like to know what other people think could be a good way to do this...
Aucun commentaire:
Enregistrer un commentaire