File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Is this the proxy pattern? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Is this the proxy pattern?" Watch "Is this the proxy pattern?" New topic
Author

Is this the proxy pattern?

Rama Ituarte
Ranch Hand

Joined: Apr 10, 2002
Posts: 62
Is this the proxy pattern?
I have a interface called DataIntf which has all of the public methods of the Data class. This interface is extended by my RemoteDataIntf interface, which also extends Remote. My remote implementation implements this interface. The subclass of Data implements this interface as well. On the client I use a factory that contains one method getConnection which returns an implementation of the DataInt interface. It will either return the remote implementation or the local, which is the subclass of the Data class. The client will make calls to this implementation. Is this considered the proxy pattern or do I have to have another class that is client specific and contains an instance of the subclass of Data and delegates all of the calls to the instance?
Replies are greatly appreciated!
Rama Ituarte
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Rama,
Sounds like a proxy to me. According to Design Patterns, the Proxy pattern consists of a Subject which defines an interface (in your case DataIntf), a Proxy which implements that interface (your implementation of the DataInt interface) and a RealSubject which also implements the interface (this would be Data). So I would say you could safely call it a Proxy pattern.
Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Rama Ituarte
Ranch Hand

Joined: Apr 10, 2002
Posts: 62
Thank you very much Michael! I really appreciate your time.
Have a good day.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is this the proxy pattern?