aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes implemented methods on server-side Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "implemented methods on server-side" Watch "implemented methods on server-side" New topic
Author

implemented methods on server-side

Ed Ward
Ranch Hand

Joined: Jan 30, 2006
Posts: 147
Hi again, another question.
I plan to only implement search and update in my UI, but of course the other methods in the provided interface are implemented in the Data class per the spec.
That being the case, I was wondering if other's accomodated for just search and create on the server implementation as well or if at that point the methods in the provided interface were also available.
Seems like, since only search and create are required in the UI, the server should not make them available either and maybe throw an UnsupportedOperationException if a request comes across trying to invoke anything other than search or update

Seem reasonable?

Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

A common approach seems to be that you'd create a business class in a service layer. This business class will be exposed to the client, but the Data class will not. In this business class you only expose the search and update methods. A client will have access to the business class, but not your Data class, so they will only ever be able to call the search and update methods.


SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5596
    
  15

You have to implement these methods in the Data class (I would not risk just throwing an UnsupportedOperationException from the methods which are not used). For your server it makes no real difference if you expose just the methods you need or all methods. I just exposed a find and book methods (as I used a business service).


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Ed Ward
Ranch Hand

Joined: Jan 30, 2006
Posts: 147
Yea, I have them implemented in my Data class and when I did the stand alone client I only exposed the two methods needed for the UI. When I started the server/client implementation, for some reason I forgot that and made them all available; afterwhich I realized that because the UI only allows search and book, the other biz methods were never going to be called in this version.
Thanks for the sanity check!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: implemented methods on server-side