Hi Daniel, I think, proposal 1 it is the right approach. I would implement a class "DataStore" or something like that, which hides the hibernate actions. Why you don't like the singleton approach? The approaches 2 to 4 are also singletons. You ever need a singleton here.
best regards Stephan -----Ursprüngliche Nachricht----- Von: webp...@tigris.org Gesendet: 19.03.2010 18:36:33 An: discuss@restlet.tigris.org Betreff: Context and Application >Hi, > >I am new to Restlet and any similar technology and I am wondering about the >right approach to share business and data objects (eg. Hibernate) among >Restlet Resources. > >After reading the books, docs and older posts in this forum, I know why the >Component Context shall not be used to pass information to the Resource >Restlets. I have also seen people talking different approaches: > >1) Create an singleton that provides access to the shared objects. I >personally dislike singleton approaches. > >2) Put the shared objects as attributes to the Application Context. This >requires (implicit) conventions about attribute names and casting. And >requires going through each Resource Restlet if some of the convention changes. > >3) Extend the Context with getter methods for shared objects. Objects are >stored as variables inside the Context. Resources then cast the Context and >call the getter methods. > >4) Extend the Application with getter methods for shared objects. Objects are >stored as variables inside the Application. Resources then cast the >Application and call the getter methods. > >5) Some better approach that I am missing? > >Sorry if the question is quite elementary, but I am not familiar to >webservice/restlet development. I will appreciate your advice. > >Thanks, >Daniel Felix Ferber ___________________________________________________________ GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT! Jetzt freischalten unter http://movieflat.web.de ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2463049