示例#1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private StoreLogService(org.neo4j.logging.LogProvider userLogProvider, org.neo4j.io.fs.FileSystemAbstraction fileSystem, java.io.File internalLog, java.util.Map<String, org.neo4j.logging.Level> logLevels, org.neo4j.logging.Level defaultLevel, java.time.ZoneId logTimeZone, long internalLogRotationThreshold, long internalLogRotationDelay, int maxInternalLogArchives, java.util.concurrent.Executor rotationExecutor, final System.Action<org.neo4j.logging.LogProvider> rotationListener) throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        private StoreLogService(LogProvider userLogProvider, FileSystemAbstraction fileSystem, File internalLog, IDictionary <string, Level> logLevels, Level defaultLevel, ZoneId logTimeZone, long internalLogRotationThreshold, long internalLogRotationDelay, int maxInternalLogArchives, Executor rotationExecutor, System.Action <LogProvider> rotationListener)
        {
            if (!internalLog.ParentFile.exists())
            {
                fileSystem.Mkdirs(internalLog.ParentFile);
            }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.logging.FormattedLogProvider.Builder internalLogBuilder = org.neo4j.logging.FormattedLogProvider.withZoneId(logTimeZone).withDefaultLogLevel(defaultLevel).withLogLevels(logLevels);
            FormattedLogProvider.Builder internalLogBuilder = FormattedLogProvider.withZoneId(logTimeZone).withDefaultLogLevel(defaultLevel).withLogLevels(logLevels);

            FormattedLogProvider internalLogProvider;

            if (internalLogRotationThreshold == 0)
            {
                Stream outputStream = createOrOpenAsOutputStream(fileSystem, internalLog, true);
                internalLogProvider = internalLogBuilder.ToOutputStream(outputStream);
                rotationListener(internalLogProvider);
                this._closeable = outputStream;
            }
            else
            {
                RotatingFileOutputStreamSupplier rotatingSupplier = new RotatingFileOutputStreamSupplier(fileSystem, internalLog, internalLogRotationThreshold, internalLogRotationDelay, maxInternalLogArchives, rotationExecutor, new RotationListenerAnonymousInnerClass(this, rotationListener, internalLogBuilder));
                internalLogProvider = internalLogBuilder.ToOutputStream(rotatingSupplier);
                this._closeable     = rotatingSupplier;
            }
            this._logService = new SimpleLogService(userLogProvider, internalLogProvider);
        }
示例#2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static java.io.File clean(org.neo4j.io.fs.FileSystemAbstraction fs, java.io.File dir) throws java.io.IOException
        private static File Clean(FileSystemAbstraction fs, File dir)
        {
            if (fs.FileExists(dir))
            {
                fs.DeleteRecursively(dir);
            }
            fs.Mkdirs(dir);
            return(dir);
        }
示例#3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected void prepareSampleDatabase(String version, org.neo4j.io.fs.FileSystemAbstraction fileSystem, org.neo4j.io.layout.DatabaseLayout databaseLayout, java.io.File databaseDirectory) throws java.io.IOException
        protected internal override void PrepareSampleDatabase(string version, FileSystemAbstraction fileSystem, DatabaseLayout databaseLayout, File databaseDirectory)
        {
            File resourceDirectory = FindFormatStoreDirectoryForVersion(version, databaseDirectory);
            File directory         = databaseLayout.DatabaseDirectory();

            fileSystem.DeleteRecursively(directory);
            fileSystem.Mkdirs(directory);
            fileSystem.CopyRecursively(resourceDirectory, directory);
        }
示例#4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected java.io.File getTempFile(org.neo4j.io.fs.FileSystemAbstraction fileSystem, java.io.File recordsFile) throws java.io.IOException
        protected internal virtual File GetTempFile(FileSystemAbstraction fileSystem, File recordsFile)
        {
            File directory = recordsFile.ParentFile;

            if (!fileSystem.FileExists(directory))
            {
                fileSystem.Mkdirs(directory);
            }

            long n = _random.nextLong();

            n = (n == long.MinValue) ? 0 : Math.Abs(n);
            return(new File(directory, Convert.ToString(n) + "_" + recordsFile.Name + ".tmp"));
        }
示例#5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: java.io.OutputStream write(org.neo4j.io.fs.FileSystemAbstraction fs) throws java.io.IOException
        internal Stream Write(FileSystemAbstraction fs)
        {
            fs.Mkdirs(_profileFile.ParentFile);                 // Create PROFILE_FOLDER if it does not exist.
            Stream sink = fs.OpenAsOutputStream(_profileFile, false);

            try
            {
                return(new GZIPOutputStream(sink));
            }
            catch (IOException e)
            {
                IOUtils.closeAllSilently(sink);
                throw new IOException("Exception when building compressor.", e);
            }
        }
示例#6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void createFile(org.neo4j.io.fs.FileSystemAbstraction fs, java.io.File file) throws java.io.IOException
        private void CreateFile(FileSystemAbstraction fs, File file)
        {
            fs.Mkdirs(file.ParentFile);
            fs.Open(file, OpenMode.READ_WRITE).close();
        }