示例#1
0
        public override void SaveTable(IDatabase database, ITable table)
        {
            XmlDocument       databaseProperties = new XmlDocument();
            IUbicationManager ubicationManager   = this.GetUbicationManager();

            databaseProperties.Load(ubicationManager.GetDatabasePropertiesFilePath(database.databaseName) + extension);
            this.SaveTable(database, table, databaseProperties, databaseProperties.DocumentElement);
            databaseProperties.Save(ubicationManager.GetDatabasePropertiesFilePath(database.databaseName) + extension);
        }
        public void SetUbicationManager(string ubicationManager)
        {
            IUbicationManager manager = UbicationManagerFactory.GetUbicationManagerFactory().GetUbicationManager(ubicationManager);

            if (!Directory.Exists(manager.GetRootDirectoryPath()))
            {
                Directory.CreateDirectory(manager.GetRootDirectoryPath());
            }
            this.parser.SetUbicationManager(manager);
        }
        public IUbicationManager GetUbicationManager(string ubicationVersion)
        {
            IUbicationManager ubicationManager = null;

            switch (ubicationVersion)
            {
            case UbicationVersions.FirstUbicationVersion:
                ubicationManager = FirstUbicationManager.GetFirstUbicationManager();
                break;
            }
            return(ubicationManager);
        }
示例#4
0
        public override void DeleteTable(string databaseName, string tableName)
        {
            string      propertiesPath     = this.GetUbicationManager().GetDatabasePropertiesFilePath(databaseName) + extension;
            XmlDocument databaseProperties = new XmlDocument();

            databaseProperties.Load(propertiesPath);
            XmlNode tablePropertiesNode = databaseProperties.SelectSingleNode("//" + XMLTagsConstants.DatabasePropertiesTableElementTag_WR + "[" + XMLTagsConstants.DatabasePropertiesTableElementNameTag_WR + "='" + tableName + "']");

            if (tablePropertiesNode != null)
            {
                IUbicationManager ubicationManager = this.GetUbicationManager();
                databaseProperties.DocumentElement.RemoveChild(tablePropertiesNode);
                File.Delete(ubicationManager.GetTableDataFilePath(databaseName, tableName) + extension);
                File.Delete(ubicationManager.GetTableStructureFilePath(databaseName, tableName) + extension);
                databaseProperties.Save(propertiesPath);
            }
            else
            {
                throw new Exception("U retarded exception"); //probably, the own system will throw the exception, however, we dont know what type it will be, thats why we decide what exception will be thrown
            }
        }
示例#5
0
        public override void SaveDatabase(IDatabase database)
        {
            XmlDocument       databaseProperties = new XmlDocument();
            XmlElement        databaseElement    = databaseProperties.CreateElement(XMLTagsConstants.DatabasePropertiesRootElementTag_WR);
            IUbicationManager ubicationManager   = this.GetUbicationManager();
            string            databasePath       = ubicationManager.GetDatabaseFilePath(database.databaseName);

            if (!Directory.Exists(databasePath))
            {
                Directory.CreateDirectory(databasePath);
            }
            IEnumerator <ITable> enumerator = database.GetTableEnumerator();

            while (enumerator.MoveNext())
            {
                this.SaveTable(database, enumerator.Current, databaseProperties, databaseElement);
            }
            databaseProperties.AppendChild(databaseElement);
            databaseProperties.InsertBefore(databaseProperties.CreateXmlDeclaration(this.xmlDeclaration[0], this.xmlDeclaration[1], this.xmlDeclaration[2]), databaseElement);
            databaseProperties.Save(ubicationManager.GetDatabasePropertiesFilePath(database.databaseName) + extension);
        }
 public void SetUbicationManager(IUbicationManager ubicationManager)
 {
     this.ubicationManager = ubicationManager;
 }