[Opensim-dev] nhibernate progress, baby steps

Sean Dague sean at dague.net
Thu Apr 3 15:10:57 UTC 2008


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.  No
changes 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.  Code
wise it is binary compatible (just attributes replaced by properties).
Someone that knows how serialization works could tell me whether or not
the serialization will be the same.  I added one convenience property so
that we can get/set UUID as a string.  SceneObjectGroup/Part already
looks 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 Valley
sean at dague dot net                            Linux Users Group
http://dague.net                                 http://mhvlug.org

There is no silver bullet.  Plus, werewolves make better neighbors
than zombies, and they tend to keep the vampire population down.
__________________________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20080403/3ce3f913/attachment-0001.pgp>


More information about the Opensim-dev mailing list