예제 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void createStore(java.io.File super, org.neo4j.io.fs.FileSystemAbstraction fileSystem, String dbName, int nodesToCreate, String recordFormat, boolean recoveryNeeded, String logicalLogsLocation) throws java.io.IOException
            internal static void CreateStore(File @base, FileSystemAbstraction fileSystem, string dbName, int nodesToCreate, string recordFormat, bool recoveryNeeded, string logicalLogsLocation)
            {
                File storeDir           = new File(@base, dbName);
                GraphDatabaseService db = (new TestGraphDatabaseFactory()).setFileSystem(fileSystem).newEmbeddedDatabaseBuilder(storeDir).setConfig(GraphDatabaseSettings.record_format, recordFormat).setConfig(OnlineBackupSettings.online_backup_enabled, false.ToString()).setConfig(GraphDatabaseSettings.logical_logs_location, logicalLogsLocation).newGraphDatabase();

                for (int i = 0; i < (nodesToCreate / 2); i++)
                {
                    using (Transaction tx = Db.beginTx())
                    {
                        Node node1 = Db.createNode(Label.label("Label-" + i));
                        Node node2 = Db.createNode(Label.label("Label-" + i));
                        node1.CreateRelationshipTo(node2, RelationshipType.withName("REL-" + i));
                        tx.Success();
                    }
                }

                if (recoveryNeeded)
                {
                    File tmpLogs = new File(@base, "unrecovered");
                    fileSystem.Mkdir(tmpLogs);
                    File txLogsDir = new File(storeDir, logicalLogsLocation);
                    foreach (File file in fileSystem.ListFiles(txLogsDir, TransactionLogFiles.DEFAULT_FILENAME_FILTER))
                    {
                        fileSystem.CopyFile(file, new File(tmpLogs, file.Name));
                    }

                    Db.shutdown();

                    foreach (File file in fileSystem.ListFiles(txLogsDir, TransactionLogFiles.DEFAULT_FILENAME_FILTER))
                    {
                        fileSystem.DeleteFile(file);
                    }

                    foreach (File file in fileSystem.ListFiles(tmpLogs, TransactionLogFiles.DEFAULT_FILENAME_FILTER))
                    {
                        fileSystem.CopyFile(file, new File(txLogsDir, file.Name));
                    }
                }
                else
                {
                    Db.shutdown();
                }
            }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void copyFile(java.io.File from, java.io.File to) throws java.io.IOException
        public override void CopyFile(File from, File to)
        {
            @delegate.CopyFile(from, to);
        }