should the "uri" be in the database?

  3 posts   Feedicon  
Replies: 2 - Last Post: August 28, 2009 02:50
by: windyguo_cloud
showing 1 - 3 of 3
 
Posted: August 02, 2009 16:28 by jxstanford
I'm trying to create a data model for private clouds based on the API for the Sun cloud. One of the issues that I'm facing is that the uri field conflicts with the generation of RESTful services with NetBeans.

This got me thinking that the URI is fairly dependent on the host of the API, and maybe only the instance id for a resource should be stored in the DB. Then the uri can be constructed by the API server rather than being static data in the DB.

So what I'm thinking is that where there is a "uri" field for a resource, I'll just use an auto_increment id field.

One side effect that I could see is that all things that need uris would now need instance values, and some of the getters would need to be modified to deal with it, but I don't see any other significant problems.

Does anyone have any pro/con thoughts about this?

Thanks,
John
 
Posted: August 02, 2009 22:13 by Craig McClanahan
If you are trying to model the server side, the URI doesn't belong in the database description of your persistent objects. In MVC terms, the uri is part of the view tier, not the model. In a service implementation, it should be calculated by the resource method that is creating the response.

Inside the database, I would use primary keys on all the tables, and build the typical foreign key constraints between them to represent the valid relationships. Then, I would tend to use those PK values in the URIs composed by the resource method.
 
Posted: August 28, 2009 02:50 by windyguo_cloud
I think it's better to use an persistent identifier of the resource instead of its URI here. And the identifier can be resolved to any uptodate information of the resource, such as its URLs, or other relevant URIs.

I don't know what kind of identifier or unique ID technology is used in the Sun Cloud project. We are researching on CNRI's Handle System(http://www.handle.net/), a distributed system provding persistant identifying and dynamic locating of digital resources over internet. I think it's a proper technology and infrastructure for resource sharing and many internet applications, include cloud computing.
Replies: 2 - Last Post: August 28, 2009 02:50
by: windyguo_cloud
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close