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
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.
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).
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!
Trust God, but always tether your camel... to this tiny ad.
how do I do my own kindle-like thing - without amazon