Exemplo n.º 1
0
        public override void SetMetaModel(NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel
                                          metaModel2)
        {
            NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci        = null;
            NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = new NeoDatis.Odb.Core.Layers.Layer2.Meta.SessionMetaModel
                                                                           ();
            GetSession(true).SetMetaModel(metaModel);
            // Just add the classes
            System.Collections.IEnumerator iterator = metaModel2.GetAllClasses().GetEnumerator
                                                          ();
            while (iterator.MoveNext())
            {
                this.GetMetaModel().AddClass((NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo)iterator
                                             .Current);
            }
            // Now persists classes
            iterator = metaModel.GetAllClasses().GetEnumerator();
            int i = 0;

            while (iterator.MoveNext())
            {
                ci = (NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo)iterator.Current;
                if (ci.GetPosition() == -1)
                {
                    objectWriter.PersistClass(ci, (i == 0 ? -2 : i - 1), false, false);
                }
                i++;
            }
        }
Exemplo n.º 2
0
 public override void AddSession(ISession session, bool
                                 readMetamodel)
 {
     // Associate current session to the fsi -> all transaction writes
     // will be applied to this FileSystemInterface
     session.SetFileSystemInterfaceToApplyTransaction(objectWriter.GetFsi());
     if (readMetamodel)
     {
         NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = null;
         try
         {
             objectReader.ReadDatabaseHeader(baseIdentification.GetUserName(), baseIdentification
                                             .GetPassword());
         }
         catch (NeoDatis.Odb.ODBAuthenticationRuntimeException e)
         {
             Close();
             throw;
         }
         metaModel = new NeoDatis.Odb.Core.Layers.Layer2.Meta.SessionMetaModel();
         session.SetMetaModel(metaModel);
         metaModel = objectReader.ReadMetaModel(metaModel, true);
         // Updates the Transaction Id in the file
         objectWriter.WriteLastTransactionId(GetCurrentTransactionId());
     }
 }
Exemplo n.º 3
0
 public virtual void UpdateMetaModel()
 {
     NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = GetMetaModel();
     NeoDatis.Tool.DLogger.Info("Automatic refactoring : updating meta model");
     // User classes
     System.Collections.IEnumerator iterator = metaModel.GetUserClasses().GetEnumerator
                                                   ();
     while (iterator.MoveNext())
     {
         objectWriter.UpdateClassInfo((NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo)iterator
                                      .Current, true);
     }
     // System classes
     iterator = metaModel.GetSystemClasses().GetEnumerator();
     while (iterator.MoveNext())
     {
         objectWriter.UpdateClassInfo((NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo)iterator
                                      .Current, true);
     }
 }