[Opensim-dev] nhibernate progress, baby steps

Stefan Andersson stefan at tribalmedia.se
Thu Apr 3 17:44:42 UTC 2008


This should play well with the notion of having a 'model' assembly that has been discussed at a couple of occasions, and that I believe both me and MW are vehement proponents of;
 
This 'model' assembly (say, 'OpenSim.Model' ) would consist of base classes looking very much like Seans nhibernate-friendly classes, with no real methods associated to them, just data.
 
These classes would then be specialized into different context (like nhibernate, apps, other db, xml, http requests, remoting) but the contexts would still be signature-compatible with each other. 
 
(For example, if we had a OpenSim.Region.Environment.SceneObjectGroup it could be xmlserializabled and then deserialized into a OpenSim.Web.RemotePrimStorage.SceneObjectGroup)
 
An 'ScenePresence' would probably have three or four subclasses, each tailored for a different context. (One on the regionserver and one on the grid server)
 
A very important factor is that this assembly would be considered a root assembly, referenced probably by all other assemblies, but referencing nothing itself.
 
(I actually think that this means we would not allow libsl types in the model, but in subsequent specializations)
 
Now, the BIG win would actually not be intra-OpenSim but extra-OpenSim: It would let us create applications, tools and services outside of the core OpenSim set that could re-use the model as a foundation for an 'Service API' of sorts.
 
I think the best strategy is just to agree that this is something we want, then establish the assembly, and then start moving type by type into it.
 
Best,
/Stefan


Date: Thu, 3 Apr 2008 16:17:03 +0100From: michaelwri22 at yahoo.co.ukTo: opensim-dev at lists.berlios.deSubject: Re: [Opensim-dev] nhibernate progress, baby stepsahh okay that sounds fine. I just wasn't sure if you were talking about having the nhibernate code (for storing via nhibernate) directly in the core classes. As I believe was talked about some time ago. But yeah making classes use Properties rather than Public variables is something we should be doing anyway.Sean Dague <sean at dague.net> wrote: 
On Thu, Apr 03, 2008 at 03:05:31PM +0100, Michael Wright wrote:> I'm not quite clear on how you plan to integrate this into> opensim. Will it be via interfaces like current db systems are. So a> call is made on the interface asking the db system to store that> object. Or are you planning on having these nhibernate objects> directly in the core.> > I'm really unsure of that, if that is the plan, as it ties the core to> nhibernate without any chance of implementing a non nhibernate based> storage system. I think we should have interfaces like currently ,but> of course improved and more standardised. That would have a call like> StorageAsset(AssetBase asset). But we can't rely on AssetBase asset> being of type NHibernateAssetData. As that again would be restricting> us to nhibernate.It goes into the standard OpenSim.Data.* model that happens today. Nochanges to the data layer there at this point.> Maybe AssetBase isn't the best example of what I'm thinking. But if> we had NhibernateSceneObjectGroup. We couldn't expect all> SceneObjectGroup objects in the core to be of that sub type. As what> if a Module add some sceneobjects and just used the base type.As an example, this is what a NHibernate friendly AssetBase looks like.Notice, there is really nothing NHibernate specific about this. Codewise it is binary compatible (just attributes replaced by properties).Someone that knows how serialization works could tell me whether or notthe serialization will be the same. I added one convenience property sothat we can get/set UUID as a string. SceneObjectGroup/Part alreadylooks much more like this, and I think probably won't need any changes.using System;using libsecondlife;namespace OpenSim.Framework{[Serializable]public class AssetBase{private byte[] _data;private LLUUID _fullid;private sbyte _type;private sbyte _invtype;private string _name = String.Empty;private string _description = String.Empty;private bool _local = false;private bool _temporary = false;public AssetBase(){}public AssetBase(LLUUID assetId, string name){FullID = assetId;Name = name;}public virtual LLUUID FullID {get { return _fullid; }set { _fullid = value; }}public virtual string ID {get { return _fullid.ToString(); }set { _fullid = new LLUUID(value); }}public virtual byte[] Data {get { return _data; }set { _data = value; }}public virtual sbyte Type {get { return _type; }set { _type = value; }}public virtual sbyte InvType {get { return _invtype; }set { _invtype = value; }}public virtual string Name {get { return _name; }set { _name = value; }}public virtual string Description {get { return _description; }set { _description = value; }}public virtual bool Local {get { return _local; }set { _local = value; }}public virtual bool Temporary {get { return _temporary; }set { _temporary = value; }}}}-Sean-- __________________________________________________________________Sean Dague Mid-Hudson Valleysean at dague dot net Linux Users Grouphttp://dague.net http://mhvlug.orgThere is no silver bullet. Plus, werewolves make better neighborsthan zombies, and they tend to keep the vampire population down._________________________________________________________________________________________________________________Opensim-dev mailing listOpensim-dev at lists.berlios.dehttps://lists.berlios.de/mailman/listinfo/opensim-dev


Sent from Yahoo! Mail. A Smarter Inbox.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20080403/1a0d09a5/attachment-0001.html>


More information about the Opensim-dev mailing list