aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Pattern to provide One point of access to multiple services. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Pattern to provide One point of access to multiple services." Watch "Pattern to provide One point of access to multiple services." New topic
Author

Pattern to provide One point of access to multiple services.

pawan chopra
Ranch Hand

Joined: Jan 23, 2008
Posts: 408

Hi All,

I have multiple services each service calls database and fetch some data based on some criteria. For example;

StateService fetch state based on id from database
BusinessLineService fetch business object

There are couple more like this.

Now for single page I need data from these services. I am not sure where should I call these methods? I was thinking to do that in my controller. But then I have a scenario where I have to actually fetch data from two services and merge them. Not sure what should be the way. Can any one guide me on this? Thanks.


Pawan Chopra
SCJP - DuMmIeS mInD
Haripraghash Subramaniam
Greenhorn

Joined: Oct 24, 2010
Posts: 2
When you say services, are they deployed and hosted separately? If they are deployed and hosted separately from the web application, i believe more importantly, it will lead to chatty interfaces. But to address your concern, you need to have a facade/Service agent in your web application that does the calls and wraps the resulting data into a single class and returns it.
Dieter Quickfend
Ranch Hand

Joined: Aug 06, 2010
Posts: 359
Indeed, Session Facade and Transfer Object are two good patterns to be looking at. If your services are remote, you could add Service Locator and Business Delegate to that.


Oracle Certified Professional: Java SE 6 Programmer
Oracle Certified Expert: Java EE 6 Web Component Developer
Oracle Certified Expert: Java EE 6 Enterprise JavaBeans Developer
pawan chopra
Ranch Hand

Joined: Jan 23, 2008
Posts: 408

Hi Friends,

Thanks for suggestions. Services are local. But I think it doesn't matter I can use Facade design pattern. But I thought there may be something better than that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pattern to provide One point of access to multiple services.
 
Similar Threads
Returning complex datatypes in a Web Service response
Avoid Concurrent Update
EJB variable intialization
service() method
JDBC - Result Set to Array List