Example #1
0
        private void CD_private(IGraphFSSession myIGraphFSSession, ref String myCurrentPath, String myParameter)
        {
            var _DirectoryObjectLocation = new ObjectLocation(ObjectLocation.ParseString(myCurrentPath), myParameter);

            try
            {

                if ((myIGraphFSSession).ObjectStreamExists(_DirectoryObjectLocation, FSConstants.DIRECTORYSTREAM).Value ||
                    (myIGraphFSSession).ObjectStreamExists(_DirectoryObjectLocation, FSConstants.VIRTUALDIRECTORY).Value)
                {

                    if (myCurrentPath.Equals(FSPathConstants.PathDelimiter) && _DirectoryObjectLocation.Equals("/.."))
                        myCurrentPath = FSPathConstants.PathDelimiter;

                    else
                        myCurrentPath = SimplifyObjectLocation(_DirectoryObjectLocation.ToString());

                }
                else
                    WriteLine("Sorry, this directory does not exist!");

            }

            catch (Exception e)
            {
                WriteLine(e.Message);
                WriteLine(e.StackTrace);
            }
        }
Example #2
0
 /// <summary>
 /// The constructor.
 /// </summary>
 /// <param name="myIGraphDBSession">The filesystem where the information is stored.</param>
 /// <param name="DatabaseRootPath">The database root path.</param>
 public DBTypeManager(IGraphFSSession myIGraphFS, ObjectLocation myDatabaseRootPath, EntityUUID myUserID, Dictionary<String, ADBSettingsBase> myDBSettings, DBContext dbContext)
 {
     _DBContext = dbContext;
     _UserID = myUserID;
     _DatabaseRootPath                               = myDatabaseRootPath;
     _IGraphFSSession                                = myIGraphFS;
     _ObjectLocationsOfAllUserDefinedDatabaseTypes   = LoadListOfTypeLocations(myDatabaseRootPath);
 }
Example #3
0
        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="myIGraphDBSession">The filesystem where the information is stored.</param>
        /// <param name="DatabaseRootPath">The database root path.</param>
        public DBTypeManager(IGraphFSSession myIGraphFS, ObjectLocation myDatabaseRootPath, EntityUUID myUserID, Dictionary<String, ADBSettingsBase> myDBSettings, DBContext dbContext)
        {
            _DBContext = dbContext;
            _UserID = myUserID;
            _DatabaseRootPath                               = myDatabaseRootPath;
            _IGraphFSSession                                = myIGraphFS;
            _ObjectLocationsOfAllUserDefinedDatabaseTypes   = LoadListOfTypeLocations(myDatabaseRootPath);

            dbContext.GraphAppSettings.Subscribe<ObjectsDirectoryShardsSetting>(GraphSettingChanged);
        }
Example #4
0
        /// <summary>
        /// Create a new BulkInsert.
        /// </summary>
        /// <param name="myGraphDBSession">The DB Reference</param>
        /// <param name="myGraphFSSession">The FS reference</param>
        /// <param name="myType">The type of the ne DBObjects</param>
        public BulkInsert(IGraphDBSession myGraphDBSession, IGraphFSSession myGraphFSSession, String myType)
        {
            _GraphDBSession = myGraphDBSession;
            _GraphFSSession = myGraphFSSession;

            (_GraphFSSession.SessionToken.SessionInfo as FSSessionInfo).FSSettings.ReflushAllocationMap = false;

            _DBTransaction = _GraphDBSession.BeginTransaction(myLongRunning: true, myIsolationLevel: IsolationLevel.Serializable);
            _Type = ((DBContext)_DBTransaction.GetDBContext()).DBTypeManager.GetTypeByName(myType);
        }
Example #5
0
        /// <summary>
        /// Create a new BulkInsert.
        /// </summary>
        /// <param name="myGraphDBSession">The DB Reference</param>
        /// <param name="myGraphFSSession">The FS reference</param>
        /// <param name="myType">The type of the ne DBObjects</param>
        public BulkInsert(IGraphDBSession myGraphDBSession, IGraphFSSession myGraphFSSession, GraphDBType myType)
        {
            _GraphDBSession = myGraphDBSession;
            _GraphFSSession = myGraphFSSession;

            _Type = myType;

            (_GraphFSSession.SessionToken.SessionInfo as FSSessionInfo).FSSettings.ReflushAllocationMap = false;

            _DBTransaction = _GraphDBSession.BeginTransaction(myLongRunning: true, myIsolationLevel: IsolationLevel.Serializable);
        }
Example #6
0
        public DBSettingsManager(Dictionary<String, ADBSettingsBase> myReflectorSettings, Dictionary<String, ADBSettingsBase> myDBSettings, IGraphFSSession myIGraphFS, ObjectLocation mySettingsLocation)
        {
            _IGraphFSSession    = myIGraphFS;
            _DBSettingsLocation = mySettingsLocation;

            AllSettingsByName = new Dictionary<string, ADBSettingsBase>();
            AllSettingsByUUID = new Dictionary<UUID, ADBSettingsBase>();

            AddSettings(myReflectorSettings);
            AddSettings(myDBSettings);
        }
Example #7
0
        /// <summary>
        /// This will create a new dbContext, based on <paramref name="dbContext"/> reusing all shared data
        /// </summary>
        /// <param name="dbContext"></param>
        public DBContext(DBContext dbContext)
        {
            #region Immutable objects

            _DBPluginManager = dbContext.DBPluginManager;
            _DBSettingsManager = dbContext.DBSettingsManager;
            _IGraphFSSession = dbContext._IGraphFSSession;

            #endregion

            _SessionSettings = new DBSessionSettings(dbContext.SessionSettings);
            _DBObjectManager = new ObjectManagement.DBObjectManager(this, _IGraphFSSession);

            //
            _DBIndexManager = new Indices.DBIndexManager(_IGraphFSSession, this);

            _DBTypeManager = new DBTypeManager(dbContext.DBTypeManager);

            _DBObjectCache = _DBObjectManager.GetSimpleDBObjectCache(this);
        }
Example #8
0
 public DBObjectManager(DBContext dbContext, IGraphFSSession myIGraphFSSession)
 {
     _DBContext     = dbContext;
     _IGraphFSSession = myIGraphFSSession;
 }
Example #9
0
        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="myIGraphDBSession">The filesystem where the information is stored.</param>
        /// <param name="DatabaseRootPath">The database root path.</param>
        public DBContext(IGraphFSSession graphFSSession, ObjectLocation myDatabaseRootPath, EntityUUID myUserID, Dictionary<String, ADBSettingsBase> myDBSettings, Boolean myRebuildIndices, DBPluginManager myDBPluginManager, DBSessionSettings sessionSettings = null)
        {
            _DBPluginManager    = myDBPluginManager;

            _DBTypeManager      = new TypeManagement.DBTypeManager(graphFSSession, myDatabaseRootPath, myUserID, myDBSettings, this);
            _DBSettingsManager  = new DBSettingsManager(_DBPluginManager.Settings, myDBSettings, graphFSSession, new ObjectLocation(myDatabaseRootPath.Name, DBConstants.DBSettingsLocation));
            _DBObjectManager    = new DBObjectManager(this, graphFSSession);
            _DBIndexManager     = new DBIndexManager(graphFSSession, this);
            _SessionSettings    = sessionSettings;
            _DBObjectCache      = _DBObjectManager.GetSimpleDBObjectCache(this);
            _IGraphFSSession    = graphFSSession;

            //init types
            var initExcept = _DBTypeManager.Init(graphFSSession, myDatabaseRootPath, myRebuildIndices);

            if (initExcept.Failed())
            {
                throw new GraphDBException(initExcept.IErrors);
            }
        }
Example #10
0
        public DBTypeManager(DBTypeManager dBTypeManager)
        {
            _DBContext                                      = dBTypeManager._DBContext;
            _UserID                                         = dBTypeManager._UserID;
            _DatabaseRootPath                               = dBTypeManager._DatabaseRootPath;
            _IGraphFSSession                                = dBTypeManager._IGraphFSSession;
            _ObjectLocationsOfAllUserDefinedDatabaseTypes   = dBTypeManager._ObjectLocationsOfAllUserDefinedDatabaseTypes;

            _SystemTypes                                    = dBTypeManager._SystemTypes;
            _BasicTypes                                     = dBTypeManager._BasicTypes;
            _GUIDTypeAttribute                              = dBTypeManager._GUIDTypeAttribute;

            //TODO: As soon as we have serialized Indices we can recomment these sections
            #region As soon as we have serialized Indices we can recomment these sections

            //_UserDefinedTypes                               = dBTypeManager._UserDefinedTypes;
            //_TypesNameLookUpTable                           = dBTypeManager._TypesNameLookUpTable;

            foreach (GraphDBType ptype in _SystemTypes.Values)
                _TypesNameLookUpTable.Add(ptype.Name, ptype);

            foreach (GraphDBType ptype in _BasicTypes.Values)
                _TypesNameLookUpTable.Add(ptype.Name, ptype);

            LoadUserDefinedDatabaseTypes(false);

            #endregion
        }
Example #11
0
        /// <summary>
        /// Initializes the type manager. This method may only be called once, else it throws an TypeInitializationException.
        /// </summary>
        /// <param name="myIGraphFSSession">The myIGraphFS, on which the database is stored.</param>
        /// <param name="myDatabaseLocation">The databases root path in the myIGraphFS.</param>
        public Exceptional Init(IGraphFSSession myIGraphFSSession, ObjectLocation myDatabaseLocation, Boolean myRebuildIndices)
        {
            #region Input validation

            if (myIGraphFSSession == null)
                return new Exceptional<bool>(new Error_ArgumentNullOrEmpty("The parameter myIGraphFS must not be null!"));

            if (myDatabaseLocation == null)
                return new Exceptional<bool>(new Error_ArgumentNullOrEmpty("The parameter myDatabaseLocation must not be null!"));

            //ToDo: Find a better way to check this!
            if (_BasicTypes.ContainsKey(DBBaseObject.UUID))
                return new Exceptional<bool>(new Error_UnknownDBError("The TypeManager had already been initialized!"));

            #endregion

            var objectDirectoryShards = UInt16.Parse(_DBContext.GraphAppSettings.Get<ObjectsDirectoryShardsSetting>());

            #region DBObject - The base of all database types
            // DBObject is a child of DBBaseObject

            var typeDBBaseObject = new GraphDBType(DBBaseObject.UUID, myDatabaseLocation, DBBaseObject.Name, null, new Dictionary<AttributeUUID, TypeAttribute>(), false, false, "The base of all database types", DBConstants.ObjectDirectoryShards);
            _SystemTypes.Add(typeDBBaseObject.UUID, typeDBBaseObject);

            #endregion

            #region DBReference - The base of all user defined database types
            // DBObject is a child of DBBaseObject

            // == DBObject!
            var typeDBReference = new GraphDBType(DBReference.UUID, myDatabaseLocation, DBReference.Name, DBBaseObject.UUID, new Dictionary<AttributeUUID, TypeAttribute>(), false, false, "The base of all user defined database types", DBConstants.ObjectDirectoryShards);

            #region DBVertex

            var typeDBVertex = new GraphDBType(DBVertex.UUID, myDatabaseLocation, DBVertex.Name, DBReference.UUID, new Dictionary<AttributeUUID, TypeAttribute>(), false, false, "The base of all user defined database vertices", DBConstants.ObjectDirectoryShards);
            _SystemTypes.Add(typeDBVertex.UUID, typeDBVertex);

            #endregion

            #region UUID special Attribute

            var specialTypeAttribute_UUID = new SpecialTypeAttribute_UUID() { DBTypeUUID = DBReference.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_UUID, this, false);
            _GUIDTypeAttribute = specialTypeAttribute_UUID;

            #endregion

            #region CreationTime special attribute

            var specialTypeAttribute_CrTime = new SpecialTypeAttribute_CREATIONTIME() { DBTypeUUID = DBUInt64.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_CrTime, this, false);

            #endregion

            #region DeletionTime special attribute

            var specialTypeAttribute_DelTime = new SpecialTypeAttribute_DELETIONTIME() { DBTypeUUID = DBUInt64.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_DelTime, this, false);

            #endregion

            #region Edition special attribute

            var specialTypeAttribute_Edition = new SpecialTypeAttribute_EDITION() { DBTypeUUID = DBString.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_Edition, this, false);

            #endregion

            #region Editions special attribute

            var specialTypeAttribute_Editions = new SpecialTypeAttribute_EDITIONS() { DBTypeUUID = DBString.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_Editions, this, false);

            #endregion

            #region LastAccessTime special attribute

            var specialTypeAttribute_AcTime = new SpecialTypeAttribute_LASTACCESSTIME() { DBTypeUUID = DBUInt64.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_AcTime, this, false);

            #endregion

            #region LastModificationTime special attribute

            var specialTypeAttribute_LastModTime = new SpecialTypeAttribute_LASTMODIFICATIONTIME() { DBTypeUUID = DBUInt64.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_LastModTime, this, false);

            #endregion

            #region TypeName special Attribute

            var specialTypeAttribute_TYPE = new SpecialTypeAttribute_TYPE() { DBTypeUUID = DBString.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_TYPE, this, false);

            #endregion

            #region REVISION special Attribute

            var specialTypeAttribute_REVISION = new SpecialTypeAttribute_REVISION() { DBTypeUUID = DBString.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_REVISION, this, false);

            #endregion

            #region REVISIONS special Attribute

            var specialTypeAttribute_REVISIONS = new SpecialTypeAttribute_REVISIONS() { DBTypeUUID = DBString.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_REVISIONS, this, false);

            #endregion

            #region STREAMS special Attribute

            var specialTypeAttribute_STREAMS = new SpecialTypeAttribute_STREAMS() { DBTypeUUID = DBString.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_STREAMS, this, false);

            #endregion

            #region NUMBER OF REVISIONS Attribute

            var specialTypeAttribute_NUMBEROFREVISIONS = new SpecialTypeAttribute_NUMBEROFREVISIONS() { DBTypeUUID = DBUInt64.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_NUMBEROFREVISIONS, this, false);

            #endregion

            #region NUMBER OF COPIES

            var specialTypeAttribute_NUMBEROFCOPIES = new SpecialTypeAttribute_NUMBEROFCOPIES() { DBTypeUUID = DBUInt64.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_NUMBEROFCOPIES, this, false);

            #endregion

            #region PARENT REVISION IDs

            var specialTypeAttribute_PARENTREVISIONIDs = new SpecialTypeAttribute_PARENTREVISIONS() { DBTypeUUID = DBString.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_PARENTREVISIONIDs, this, false);

            #endregion

            #region MAX REVISION AGE

            var specialTypeAttribute_MAXREVISIONAGE = new SpecialTypeAttribute_MAXREVISIONAGE() { DBTypeUUID = DBUInt64.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_MAXREVISIONAGE, this, false);

            #endregion

            #region MIN NUMBER OF REVISIONS

            var specialTypeAttribute_MINNUMBEROFREVISIONS = new SpecialTypeAttribute_MINNUMBEROFREVISIONS() { DBTypeUUID = DBUInt64.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_MINNUMBEROFREVISIONS, this, false);

            #endregion

            #region MAX NUMBER OF REVISIONS

            var specialTypeAttribute_MAXNUMBEROFREVISIONS = new SpecialTypeAttribute_MAXNUMBEROFREVISIONS() { DBTypeUUID = DBUInt64.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_MAXNUMBEROFREVISIONS, this, false);

            #endregion

            #region MAX NUMBER OF COPIES

            var specialTypeAttribute_MAXNUMBEROFCOPIES = new SpecialTypeAttribute_MAXNUMBEROFCOPIES() { DBTypeUUID = DBUInt64.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_MAXNUMBEROFCOPIES, this, false);

            #endregion

            #region MIN NUMBER OF COPIES

            var specialTypeAttribute_MINNUMBEROFCOPIES = new SpecialTypeAttribute_MINNUMBEROFCOPIES() { DBTypeUUID = DBUInt64.UUID, RelatedGraphDBTypeUUID = typeDBReference.UUID, KindOfType = KindsOfType.SpecialAttribute };
            typeDBReference.AddAttribute(specialTypeAttribute_MINNUMBEROFCOPIES, this, false);

            #endregion

            foreach (var attr in typeDBReference.Attributes)
            {
                typeDBVertex.AddAttribute(attr.Value, this, false);
            }

            _SystemTypes.Add(typeDBReference.UUID, typeDBReference);

            #endregion

            #region DBEdge

            var typeDBEdge = new GraphDBType(new TypeUUID(DBConstants.DBEdgeID), myDatabaseLocation, DBConstants.DBEdgeName, DBReference.UUID, new Dictionary<AttributeUUID, TypeAttribute>(), false, false, "The base of all user defined database edges", DBConstants.ObjectDirectoryShards);

            _SystemTypes.Add(typeDBEdge.UUID, typeDBEdge);

            #endregion

            #region Build-in basic database types
            // These are children of DBBaseObject

            _BasicTypes.Add(DBBoolean.UUID, new GraphDBType(DBBoolean.UUID, new ObjectLocation(myDatabaseLocation), DBBoolean.Name, DBBaseObject.UUID, new Dictionary<AttributeUUID, TypeAttribute>(), false, false, "", DBConstants.ObjectDirectoryShards));
            _BasicTypes.Add(DBDateTime.UUID, new GraphDBType(DBDateTime.UUID, new ObjectLocation(myDatabaseLocation), DBDateTime.Name, DBBaseObject.UUID, new Dictionary<AttributeUUID, TypeAttribute>(), false, false, "", DBConstants.ObjectDirectoryShards));
            _BasicTypes.Add(DBDouble.UUID, new GraphDBType(DBDouble.UUID, new ObjectLocation(myDatabaseLocation), DBDouble.Name, DBBaseObject.UUID, new Dictionary<AttributeUUID, TypeAttribute>(), false, false, "", DBConstants.ObjectDirectoryShards));
            _BasicTypes.Add(DBInt64.UUID, new GraphDBType(DBInt64.UUID, new ObjectLocation(myDatabaseLocation), DBInt64.Name, DBBaseObject.UUID, new Dictionary<AttributeUUID, TypeAttribute>(), false, false, "", DBConstants.ObjectDirectoryShards));
            _BasicTypes.Add(DBInt32.UUID, new GraphDBType(DBInt32.UUID, new ObjectLocation(myDatabaseLocation), DBInt32.Name, DBBaseObject.UUID, new Dictionary<AttributeUUID, TypeAttribute>(), false, false, "", DBConstants.ObjectDirectoryShards));
            _BasicTypes.Add(DBUInt64.UUID, new GraphDBType(DBUInt64.UUID, new ObjectLocation(myDatabaseLocation), DBUInt64.Name, DBBaseObject.UUID, new Dictionary<AttributeUUID, TypeAttribute>(), false, false, "", DBConstants.ObjectDirectoryShards));
            _BasicTypes.Add(DBString.UUID, new GraphDBType(DBString.UUID, new ObjectLocation(myDatabaseLocation), DBString.Name, DBBaseObject.UUID, new Dictionary<AttributeUUID, TypeAttribute>(), false, false, "", DBConstants.ObjectDirectoryShards));

            _BasicTypes.Add(DBBackwardEdgeType.UUID, new GraphDBType(DBBackwardEdgeType.UUID, new ObjectLocation(myDatabaseLocation), DBBackwardEdgeType.Name, DBBaseObject.UUID, new Dictionary<AttributeUUID, TypeAttribute>(), false, false, "", DBConstants.ObjectDirectoryShards));

            #endregion

            foreach (var _GraphDBType in _SystemTypes.Values)
                _TypesNameLookUpTable.Add(_GraphDBType.Name, _GraphDBType);

            foreach (var _GraphDBType in _BasicTypes.Values)
                _TypesNameLookUpTable.Add(_GraphDBType.Name, _GraphDBType);

            return LoadUserDefinedDatabaseTypes(myRebuildIndices);
        }
Example #12
0
 /// <summary>
 /// This will close the BulkInsert and flushes all DBObjects.
 /// </summary>
 public void Dispose()
 {
     Flush();
     _LastDBO = null;
     _LastBackwardEdge = null;
     _GraphDBSession = null;
     _GraphFSSession = null;
     _Type = null;
 }
Example #13
0
 public DBIndexManager(IGraphFSSession myIGraphFSSession, DBContext dbContext)
 {
     _IGraphFSSession = myIGraphFSSession;
     _DBContext = dbContext;
 }
        /// <summary>
        /// Start the interface
        /// </summary>
        /// <param name="myIGraphFSSession">An instance of IGraphFSSession</param>
        public void Start(IGraphFSSession myIGraphFSSession/*, String myEndpointPath*/)
        {
            if (myIGraphFSSession== null)
                throw new ArgumentNullException("IGraphFS has to be an instance.");

            _ServiceHost = new ServiceHost(myIGraphFSSession, _BaseAddress);

            try
            {
                ServiceBehaviorAttribute serviceBehaviorAttribute = new ServiceBehaviorAttribute();
                if (_ServiceHost.Description.Behaviors[typeof(ServiceBehaviorAttribute)] != null)
                    serviceBehaviorAttribute = (ServiceBehaviorAttribute)_ServiceHost.Description.Behaviors[typeof(ServiceBehaviorAttribute)];
                else
                    _ServiceHost.Description.Behaviors.Add(serviceBehaviorAttribute);

                serviceBehaviorAttribute.InstanceContextMode = InstanceContextMode.Single;
                serviceBehaviorAttribute.IncludeExceptionDetailInFaults = true;

                //_ServiceHost.Description.Behaviors[typeof(ServiceBehaviorAttribute)];
                NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
                binding.ReceiveTimeout = TimeSpan.MaxValue;
                binding.PortSharingEnabled = false;
                #if(!__MonoCS__)
                binding.ReliableSession.InactivityTimeout = TimeSpan.MaxValue;
                #endif

                #region Security
                /*
                binding.Security.Mode = SecurityMode.TransportWithMessageCredential;
                _ServiceHost.Credentials.ServiceCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindByIssuerName, "SONES GmbH - Mail CA");
                _ServiceHost.Credentials.ClientCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
                */
                #endregion

                _ServiceHost.AddServiceEndpoint(typeof(IGraphFSSession), binding, _BaseAddress);
                _ServiceHost.Open(new TimeSpan(0,1,0));

                _AdministrationServiceAnnouncer = new Announcer(myIGraphFSSession.GetFileSystemUUID().ToString(), _BaseAddress, DiscoverableServiceType.Filesystem);
            }
            catch (CommunicationException ce)
            {
                /*
                 * If you're getting an exception while starting up this the first time you probably want to do
                 * these things:
                 *
                 * 1. Start this as local Administrator OR Add your User to the SMSvcHost.exe.config file in the
                 *    \Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ directory
                 * 2. You want to run "sc.exe config NetTcpPortSharing start= demand" as local Administrator to
                 *    enable the net.tcp Port Sharing.
                 *
                 * */
                // TODO: Insert the above todo into the installer/wizard for final customer deployment.

                System.Diagnostics.Debug.WriteLine(ce);
                _ServiceHost.Abort();
                ((IDisposable)_ServiceHost).Dispose();

                throw ce;
            }
        }
Example #15
0
        private void LoadGraphType(IGraphFSSession myIGraphFSSession, ObjectLocation myObjectLocation)
        {
            if (myIGraphFSSession.ObjectExists(myObjectLocation).Value != Trinary.TRUE)
                throw new GraphDBException(new Error_DatabaseNotFound(myObjectLocation));

            if (myIGraphFSSession.UserMetadataExists(new ObjectLocation(myObjectLocation, DBConstants.DBTypeDefinition), "Name").Value != Trinary.TRUE)
                throw new GraphDBException(new Error_DatabaseNotFound(myObjectLocation));

            if (myIGraphFSSession.UserMetadataExists(new ObjectLocation(myObjectLocation, DBConstants.DBTypeDefinition), "Superclass").Value != Trinary.TRUE)
                throw new GraphDBException(new Error_DatabaseNotFound(myObjectLocation));

            ParentTypeUUID = (TypeUUID)myIGraphFSSession.GetUserMetadatum(new ObjectLocation(myObjectLocation, DBConstants.DBTypeDefinition), "Superclass").Value.First<Object>();
            _UUID = (TypeUUID)myIGraphFSSession.GetUserMetadatum(new ObjectLocation(myObjectLocation, DBConstants.DBTypeDefinition), "UUID").Value.First<Object>();

            #region Load attributes and settings

            // Attributes
            var _AttributeList = myIGraphFSSession.GetUserMetadata(new ObjectLocation(myObjectLocation, DBConstants.DBAttributesLocation));

            if (_AttributeList.Success() && _AttributeList.Value != null)
            {
                foreach (var _KeyValuePair in _AttributeList.Value)
                {

                    var _TypeAttribute = (TypeAttribute)_KeyValuePair.Value;

                    _Attributes.Add(_TypeAttribute.UUID, _TypeAttribute);
                    _TypeAttributeLookupTable.Add(_TypeAttribute.UUID, _TypeAttribute);

                }
            }

            // Settings
            var _SettingList = myIGraphFSSession.GetUserMetadata(new ObjectLocation(myObjectLocation, DBConstants.DBSettingsLocation));

            if (_SettingList.Success() && _SettingList.Value != null)
            {
                foreach (var _KeyValuePair in _SettingList.Value)
                {
                    var _ADBSettingsBase = (ADBSettingsBase)_KeyValuePair.Value;
                    _TypeSettings.Add(_ADBSettingsBase.Name, _ADBSettingsBase);
                }
            }

            #endregion

            #region Load the list of Indices

            // ahzf: This looks strange!
            if (myIGraphFSSession.ObjectStreamExists(new ObjectLocation(myObjectLocation, DBConstants.DBIndicesLocation), FSConstants.DIRECTORYSTREAM).Value == Trinary.TRUE)
                _AttributeIndices = new Dictionary<IndexKeyDefinition, Dictionary<String, AAttributeIndex>>();

            else
                Console.WriteLine("No Indices for database type '" + Name + "' found!");

            #endregion

            // Set the property in order to automagically set the
            // ObjectPath and ObjectName
            ObjectLocation = myObjectLocation;
        }
Example #16
0
        /// <summary>
        /// This will create an em
        /// </summary>
        /// <param name="myIGraphFS"></param>
        /// <param name="myObjectLocation">the location (object myPath and Name) of the requested GraphType within the file system</param>
        public GraphDBType(IGraphFSSession myIGraphFSSession, ObjectLocation myObjectLocation, Boolean myIsUserDefined, Boolean myIsAbstract, UInt16 myObjectDirectoryShards)
            : this()
        {
            if (myObjectLocation == null || myObjectLocation.Length < FSPathConstants.PathDelimiter.Length)
                throw new ArgumentNullException("Invalid ObjectLocation!");

            ParentTypeUUID              = new TypeUUID(0);
            _Attributes                 = new Dictionary<AttributeUUID,TypeAttribute>();
            _AttributeIndices           = new Dictionary<IndexKeyDefinition, Dictionary<string,AAttributeIndex>>();
            _AttributeIndicesNameLookup = new Dictionary<String, IndexKeyDefinition>();
            _TypeSettings               = new Dictionary<string, ADBSettingsBase>();
            _TypeAttributeLookupTable   = new Dictionary<AttributeUUID,TypeAttribute>();
            _MandatoryAttributes        = new HashSet<AttributeUUID>();
            _UniqueAttributes           = new List<AttributeUUID>();
            ObjectDirectoryShards       = myObjectDirectoryShards;

            LoadGraphType(myIGraphFSSession, myObjectLocation);

            _IsUserDefined = myIsUserDefined;
            _IsAbstract = myIsAbstract;
        }