Exemple #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void doImport() throws java.io.IOException
        public override void DoImport()
        {
            FileSystemAbstraction fs = _outsideWorld.fileSystem();
            File storeDir            = _databaseConfig.get(GraphDatabaseSettings.database_path);
            File reportFile          = new File(_reportFileName);

            Stream    badOutput    = new BufferedOutputStream(fs.OpenAsOutputStream(reportFile, false));
            Collector badCollector = badCollector(badOutput, IgnoringSomething ? BadCollector.UNLIMITED_TOLERANCE : 0, collect(_ignoreBadRelationships, _ignoreDuplicateNodes, _ignoreExtraColumns));

            Configuration configuration = new WrappedBatchImporterConfigurationForNeo4jAdmin(importConfiguration(null, false, _databaseConfig, storeDir, _highIO));

            // Extract the default time zone from the database configuration
            ZoneId dbTimeZone = _databaseConfig.get(GraphDatabaseSettings.db_temporal_timezone);

            System.Func <ZoneId> defaultTimeZone = () => dbTimeZone;

            CsvInput input = new CsvInput(nodeData(_inputEncoding, _nodesFiles), defaultFormatNodeFileHeader(defaultTimeZone), relationshipData(_inputEncoding, _relationshipsFiles), defaultFormatRelationshipFileHeader(defaultTimeZone), _idType, new WrappedCsvInputConfigurationForNeo4jAdmin(csvConfiguration(_args, false)), badCollector, new CsvInput.PrintingMonitor(_outsideWorld.outStream()));

            ImportTool.doImport(_outsideWorld.errorStream(), _outsideWorld.errorStream(), _outsideWorld.inStream(), DatabaseLayout.of(storeDir), reportFile, fs, _nodesFiles, _relationshipsFiles, false, input, this._databaseConfig, badOutput, configuration, false);
        }
Exemple #2
0
        /// <summary>
        /// Construct a wrapper of supported backup strategies
        /// </summary>
        /// <param name="onlineBackupContext"> the input of the backup tool, such as CLI arguments, config etc. </param>
        /// <param name="backupProtocolService"> the underlying backup implementation for HA and single node instances </param>
        /// <param name="backupDelegator"> the backup implementation used for CC backups </param>
        /// <param name="pageCache"> the page cache used moving files </param>
        /// <returns> strategy coordinator that handles the which backup strategies are tried and establishes if a backup was successful or not </returns>
        internal virtual BackupStrategyCoordinator BackupStrategyCoordinator(OnlineBackupContext onlineBackupContext, BackupProtocolService backupProtocolService, BackupDelegator backupDelegator, PageCache pageCache)
        {
            FileSystemAbstraction  fs                     = _outsideWorld.fileSystem();
            BackupCopyService      copyService            = new BackupCopyService(fs, new FileMoveProvider(fs));
            ProgressMonitorFactory progressMonitorFactory = ProgressMonitorFactory.textual(_outsideWorld.errorStream());
            BackupRecoveryService  recoveryService        = new BackupRecoveryService();
            long   timeout = onlineBackupContext.RequiredArguments.Timeout;
            Config config  = onlineBackupContext.Config;

            StoreFiles     storeFiles = new StoreFiles(fs, pageCache);
            BackupStrategy ccStrategy = new CausalClusteringBackupStrategy(backupDelegator, _addressResolver, _logProvider, storeFiles);
            BackupStrategy haStrategy = new HaBackupStrategy(backupProtocolService, _addressResolver, _logProvider, timeout);

            BackupStrategyWrapper         ccStrategyWrapper       = Wrap(ccStrategy, copyService, pageCache, config, recoveryService);
            BackupStrategyWrapper         haStrategyWrapper       = Wrap(haStrategy, copyService, pageCache, config, recoveryService);
            StrategyResolverService       strategyResolverService = new StrategyResolverService(haStrategyWrapper, ccStrategyWrapper);
            IList <BackupStrategyWrapper> strategies = strategyResolverService.GetStrategies(onlineBackupContext.RequiredArguments.SelectedBackupProtocol);

            return(new BackupStrategyCoordinator(_consistencyCheckService, _outsideWorld, _logProvider, progressMonitorFactory, strategies));
        }