The Data Access Object pattern, most often shortened to DAO is a pattern in which objects are dedicated to the communication with the Data Layer.
- ClassPojo
- IClassPojoDao -> ClassPojoDaoImpl(has Pojos)
- Create PojoDaoImpl
- -> create several Pojo and adds them into the list
- PojoDaoImpl::getAllPojos() - iterate trough all elements
- Other methods of the DAO interfaces can be invoked. Like the Transfer object
- These objects often instantiate "SessionFactories" for this purpose and handle all of the logic behind communicating with the database.
- The standard practice is to create a DAO interface, followed by a concrete class implementing the interface and all methods defined in it.
- Looks very similar to the transfer object pattern.
You want to provide access to one or more services using XML and web protocols.
- ClassBusinessService
- WebServiceBroker(has/operates BusinessService) -> POJOBroker
- WebServiceBroker(has/operates BusinessService) -> SessionBeanJAXBroker
- WebServiceBroker(has/operates BusinessService) -> POJOJAXBroker
- EnpointProcessor(has WebServiceBroker)
- Create BusinessService
- Create POJOBroker
- Create SessionBeanJAXBroker
- Create POJOJAXBroker
- Create EndpointProcessor
- EndpointProcessor::request - decide which broker to invoke next - depends on the incoming protocol
- -> SessionBeanJAXBroker::doSomething
- -> BusinessService::doSomething
- -> SessionBeanJAXBroker::doSomething
- The EnpointProcessor takes the request, extracts it and forwards it to the web broker.
- More complicated implementation will be with list of brokers that are accessed through lookup.
- Layer between the end-point and the business service which knows many protocols but uses only the apropriate one for communication between both sides.