Я пытаюсь найти элегантный фреймворк для размещения всех компонентов моего сервера.
Сервер:
1. Receives a request, as a XML string, from the client.
2. Validates the messages ( !null && !empty mainly).
3. Unmarshalls the message into a Request object.
4. Validates the internals of the Request object (ensures all the required fields are there, ie. id, requestName etc).
5. If valid, create a specific request (I receive a lot of extra information in the original request and I need a very small subset of it to process the request).
6. Process the request and retrieve the output.
7. Send the output to the client.
В настоящее время мой дизайн выглядит примерно так:
Controller{
processMessage(String requestMsg){
boolean isValid = validator.validate(requestMsg);
Request request = creator.createRequest(requestMsg);
isValid = validator.validate(request);
processor.processRequest();
}
Класс контроллера состоит из валидаторов, создателей и процессоров.
После получения запроса используется шаблон validate - create - process.
Теперь все это работает, но я не могу не задаться вопросом, могу ли я расположить эти компоненты лучше. Лучше быть более слабо связанным.
Есть ли рамки, которые я мог бы использовать? Любые идеи, советы, ссылки будут очень полезны.
Приветствия