コード例 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="backendProviderType">Type of backend provider to create.</param>
 /// <param name="ui">The UI service.</param>
 /// <param name="dirs">The directories service.</param>
 /// <param name="settings">The LCM settings.</param>
 internal LcmServiceLocatorFactory(BackendProviderType backendProviderType, ILcmUI ui, ILcmDirectories dirs, LcmSettings settings)
 {
     m_backendProviderType = backendProviderType;
     m_ui       = ui;
     m_dirs     = dirs;
     m_settings = settings;
 }
コード例 #2
0
ファイル: LcmCacheTests.cs プロジェクト: regnrand/liblcm
        /// <summary>Setup for db4o client server tests.</summary>
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            m_projectsDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
            Directory.CreateDirectory(m_projectsDirectory);

            m_ui             = new DummyLcmUI();
            m_lcmDirectories = new TestLcmDirectories(m_projectsDirectory);
        }
コード例 #3
0
 public void TestSetup()
 {
     m_projectsFolder = new TemporaryFolder("BEPPortTests");
     m_lcmDirectories = new TestLcmDirectories(m_projectsFolder.Path);
 }
コード例 #4
0
ファイル: ProjectIdentifier.cs プロジェクト: sillsdev/LfMerge
 public ProjectIdentifier(ILcmDirectories LcmDirs, string database)
 {
     LcmDirectories = LcmDirs;
     Path           = GetPathToDatabase(LcmDirs, database);
 }
コード例 #5
0
ファイル: ProjectIdentifier.cs プロジェクト: sillsdev/LfMerge
 private static string GetPathToDatabase(ILcmDirectories LcmDirs, string database)
 {
     return(System.IO.Path.Combine(LcmDirs.ProjectsDirectory, database,
                                   database + LcmFileHelper.ksFwDataXmlFileExtension));
 }
コード例 #6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 internal MemoryOnlyBackendProvider(LcmCache cache, IdentityMap identityMap, ICmObjectSurrogateFactory surrogateFactory,
                                    IFwMetaDataCacheManagedInternal mdc, IDataMigrationManager dataMigrationManager, ILcmUI ui, ILcmDirectories dirs, LcmSettings settings)
     : base(cache, identityMap, surrogateFactory, mdc, dataMigrationManager, ui, dirs, settings)
 {
     m_projectSettingsStore = new MemorySettingsStore();
     m_userSettingsStore    = new MemorySettingsStore();
 }
コード例 #7
0
        private readonly IFwMetaDataCacheManaged m_mdc;         // needed for some data migrations changing over to custom fields.

        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="startingModelVersionNumber">The starting model version number for the
        /// migration.</param>
        /// <param name="dtos">DTOs from BEP-land.</param>
        /// <param name="mdc">The MDC.</param>
        /// <param name="projectFolder">The project folder (don't even think about trying to
        /// pass a path on a server other than the local machine, and -- yes -- I CAN control
        /// your thoughts!).</param>
        /// <param name="dirs"></param>
        /// ------------------------------------------------------------------------------------
        internal DomainObjectDtoRepository(int startingModelVersionNumber, HashSet <DomainObjectDTO> dtos,
                                           IFwMetaDataCacheManaged mdc, string projectFolder, ILcmDirectories dirs)
        {
            if (dtos == null)
            {
                throw new ArgumentNullException("dtos");
            }
            if (mdc == null)
            {
                throw new ArgumentNullException("mdc");
            }

            m_currentModelVersionNumber = startingModelVersionNumber;
            m_dtos          = dtos;
            m_mdc           = mdc;
            m_projectFolder = projectFolder;
            m_dirs          = dirs;

            // Add classes from MDC
            foreach (var clsid in mdc.GetClassIds())
            {
                // Leaf classes will have nothing in 'subclasses'.
                var className = mdc.GetClassName(clsid);
                m_dtosByClass.Add(className, new HashSet <DomainObjectDTO>());
                if (className == "CmObject")
                {
                    m_classAndSuperClass.Add(className, null);
                }
                var subclasses = new HashSet <string>();
                m_classesAndTheirDirectSubclasses.Add(className, subclasses);
                var subclassIds = mdc.GetDirectSubclasses(clsid);
                if (subclassIds.Count() == 0)
                {
                    if (!m_classAndSuperClass.ContainsKey(className))
                    {
                        m_classAndSuperClass.Add(className, mdc.GetBaseClsName(clsid));
                    }
                    continue;
                }
                foreach (var directSubClsid in subclassIds)
                {
                    var directSubclassName = mdc.GetClassName(directSubClsid);
                    subclasses.Add(directSubclassName);

                    // added ContainsKey check because of mono bug https://bugzilla.novell.com/show_bug.cgi?id=539288
                    // see also change in LcmMetaDataCache.cs (AddClass methods replaced with AddClass1, AddClass2)
                    // for simular reasons (order of types obtains via reflection)https://bugzilla.novell.com/show_bug.cgi?id=539288.
                    if (!m_classAndSuperClass.ContainsKey(directSubclassName))
                    {
                        m_classAndSuperClass.Add(directSubclassName, className);
                    }
                }
            }

#if ORIGINAL
            foreach (var classname in m_classesAndTheirDirectSubclasses.Keys)
            {
                // Some may have no instances.
                m_dtosByClass.Add(classname, (from dto in m_dtos
                                              where dto.Classname == classname
                                              select dto).ToList());
            }

            foreach (var dto in m_dtos)
            {
                m_dtoByGuid.Add(dto.Guid.ToLower(), dto);
            }
#else
            m_dtoByGuid = new Dictionary <string, DomainObjectDTO>(m_dtos.Count);
            foreach (var dto in m_dtos)
            {
                m_dtoByGuid.Add(dto.Guid.ToLower(), dto);
                AddToClassList(dto);
            }
#endif
        }
コード例 #8
0
 internal SharedXMLBackendProvider(LcmCache cache, IdentityMap identityMap, ICmObjectSurrogateFactory surrogateFactory, IFwMetaDataCacheManagedInternal mdc,
                                   IDataMigrationManager dataMigrationManager, ILcmUI ui, ILcmDirectories dirs, LcmSettings settings)
     : base(cache, identityMap, surrogateFactory, mdc, dataMigrationManager, ui, dirs, settings)
 {
     m_peerProcesses = new Dictionary <int, Process>();
     m_peerID        = Guid.NewGuid();
     if (MiscUtils.IsMono)
     {
         // /dev/shm is not guaranteed to be available on all systems, so fall back to temp
         m_commitLogDir = Directory.Exists("/dev/shm") ? "/dev/shm" : Path.GetTempPath();
     }
 }