This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

implemented methods on server-side

 
Ed Ward
Ranch Hand
Posts: 147
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 582
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Roel De Nijs
Sheriff
Posts: 9137
75
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Ed Ward
Ranch Hand
Posts: 147
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic