Пример #1
0
        void Database.DeleteAndReCreateFromFile(string filePath, bool keepDbInStandbyMode)
        {
            using (var sw = new StringWriter()) {
                sw.WriteLine("DROP DATABASE IF EXISTS {0};".FormatWith(info.Database));
                sw.WriteLine("CREATE DATABASE {0};".FormatWith(info.Database));
                sw.WriteLine("use {0}".FormatWith(info.Database));
                sw.Write(File.ReadAllText(filePath));
                sw.WriteLine("quit");

                executeMethodWithDbExceptionHandling(
                    delegate {
                    try {
                        StandardLibraryMethods.RunProgram(
                            StandardLibraryMethods.CombinePaths(binFolderPath, "mysql"),
                            getHostAndAuthenticationArguments() + " --disable-reconnect --batch --disable-auto-rehash",
                            sw.ToString(),
                            true);
                    }
                    catch (Exception e) {
                        if (e.Message.Contains("ERROR") && e.Message.Contains("at line"))
                        {
                            throw new UserCorrectableException("Failed to create database from file. Please try the operation again after obtaining a new database file.", e);
                        }
                        throw DataAccessMethods.CreateDbConnectionException(info, "re-creating (from file)", e);
                    }
                });
            }
        }
 private void startWebSite(string webSiteName)
 {
     if (siteExistsInIis(webSiteName))
     {
         StandardLibraryMethods.RunProgram(appCmdPath, "Start Site \"" + webSiteName + "\"", "", true);
     }
 }
Пример #3
0
        internal static byte[] CreateEwlNuGetPackage(DevelopmentInstallation installation, bool useDebugAssembly, string outputFolderPath, bool?prerelease)
        {
            var localExportDateAndTime = prerelease.HasValue ? null as DateTime? : DateTime.Now;

            IoMethods.ExecuteWithTempFolder(folderPath => {
                var ewlOutputFolderPath = StandardLibraryMethods.CombinePaths(installation.GeneralLogic.Path,
                                                                              "Standard Library",
                                                                              StandardLibraryMethods.GetProjectOutputFolderPath(useDebugAssembly));
                var libFolderPath = StandardLibraryMethods.CombinePaths(folderPath, @"lib\net451-full");
                foreach (var fileName in new[] { "dll", "pdb", "xml" }.Select(i => "EnterpriseWebLibrary." + i))
                {
                    IoMethods.CopyFile(StandardLibraryMethods.CombinePaths(ewlOutputFolderPath, fileName), StandardLibraryMethods.CombinePaths(libFolderPath, fileName));
                }

                IoMethods.CopyFile(StandardLibraryMethods.CombinePaths(installation.GeneralLogic.Path, @"Development Utility\Package Manager Console Commands.ps1"),
                                   StandardLibraryMethods.CombinePaths(folderPath, @"tools\init.ps1"));

                var webSitePath = StandardLibraryMethods.CombinePaths(installation.GeneralLogic.Path, "Web Site");
                var webProjectFilesFolderPath = StandardLibraryMethods.CombinePaths(folderPath, AppStatics.WebProjectFilesFolderName);
                IoMethods.CopyFolder(StandardLibraryMethods.CombinePaths(webSitePath, AppStatics.EwfFolderName),
                                     StandardLibraryMethods.CombinePaths(webProjectFilesFolderPath, AppStatics.EwfFolderName),
                                     false);
                IoMethods.CopyFile(StandardLibraryMethods.CombinePaths(webSitePath, AppStatics.StandardLibraryFilesFileName),
                                   StandardLibraryMethods.CombinePaths(webProjectFilesFolderPath, AppStatics.StandardLibraryFilesFileName));

                const string duProjectAndFolderName = "Development Utility";
                IoMethods.CopyFolder(
                    StandardLibraryMethods.CombinePaths(installation.GeneralLogic.Path,
                                                        duProjectAndFolderName,
                                                        StandardLibraryMethods.GetProjectOutputFolderPath(useDebugAssembly)),
                    StandardLibraryMethods.CombinePaths(folderPath, duProjectAndFolderName),
                    false);
                packageGeneralFiles(installation, folderPath, false);
                IoMethods.CopyFolder(
                    StandardLibraryMethods.CombinePaths(installation.ExistingInstallationLogic.RuntimeConfiguration.ConfigurationFolderPath,
                                                        InstallationConfiguration.InstallationConfigurationFolderName,
                                                        InstallationConfiguration.InstallationsFolderName,
                                                        (!prerelease.HasValue || prerelease.Value ? "Testing" : "Live")),
                    StandardLibraryMethods.CombinePaths(folderPath,
                                                        InstallationConfiguration.ConfigurationFolderName,
                                                        InstallationConfiguration.InstallationConfigurationFolderName),
                    false);

                var manifestPath = StandardLibraryMethods.CombinePaths(folderPath, "Package.nuspec");
                using (var writer = IoMethods.GetTextWriterForWrite(manifestPath))
                    writeNuGetPackageManifest(installation, prerelease, localExportDateAndTime, writer);

                StatusStatics.SetStatus(StandardLibraryMethods.RunProgram(StandardLibraryMethods.CombinePaths(installation.GeneralLogic.Path, @"Solution Files\nuget"),
                                                                          "pack \"" + manifestPath + "\" -OutputDirectory \"" + outputFolderPath + "\"",
                                                                          "",
                                                                          true));
            });

            return
                (File.ReadAllBytes(StandardLibraryMethods.CombinePaths(outputFolderPath,
                                                                       EwlNuGetPackageSpecificationStatics.GetNuGetPackageFileName(installation.ExistingInstallationLogic.RuntimeConfiguration.SystemShortName,
                                                                                                                                   installation.CurrentMajorVersion,
                                                                                                                                   !prerelease.HasValue || prerelease.Value ? installation.NextBuildNumber as int? : null,
                                                                                                                                   localExportDateAndTime: localExportDateAndTime))));
        }
Пример #4
0
        void Database.ExportToFile(string filePath)
        {
            Directory.CreateDirectory(dataPumpFolderPath);
            try {
                executeMethodWithDbExceptionHandling(
                    delegate {
                    try {
                        // We pass an enter keystroke as input in an attempt to kill the program if it gets stuck on a username prompt because of a bad logon string.
                        StandardLibraryMethods.RunProgram(
                            "expdp",
                            getLogonString() + " DIRECTORY=" + dataPumpOracleDirectoryName + " DUMPFILE=\"\"\"" + getDumpFileName() + "\"\"\" NOLOGFILE=y VERSION=12.1",
                            Environment.NewLine,
                            true);
                    }
                    catch (Exception e) {
                        throwUserCorrectableExceptionIfNecessary(e);
                        throw DataAccessMethods.CreateDbConnectionException(info, "exporting (to file)", e);
                    }
                });

                IoMethods.ExecuteWithTempFolder(
                    folderPath => {
                    IoMethods.CopyFile(getDumpFilePath(), StandardLibraryMethods.CombinePaths(folderPath, databaseFileDumpFileName));
                    File.WriteAllText(StandardLibraryMethods.CombinePaths(folderPath, databaseFileSchemaNameFileName), info.UserAndSchema);
                    ZipOps.ZipFolderAsFile(folderPath, filePath);
                });
            }
            finally {
                IoMethods.DeleteFile(getDumpFilePath());
            }
        }
 // NOTE: We do have the power to add and remove web sites here, and we can list just the stopped or just the started sites.
 // NOTE: When we add web sites with the ISU, we should NOT support host headers since WCF services have some restrictions with these. See http://stackoverflow.com/questions/561823/wcf-error-this-collection-already-contains-an-address-with-scheme-http
 private bool siteExistsInIis(string webSiteName)
 {
     if (!File.Exists(appCmdPath))
     {
         return(false);
     }
     return(StandardLibraryMethods.RunProgram(appCmdPath, "list sites", "", true).Contains("\"" + webSiteName + "\""));
 }
        /// <summary>
        /// Starts all web sites and services associated with this installation.
        /// </summary>
        public void Start()
        {
            var allServices = ServiceController.GetServices();

            foreach (var service in RuntimeConfiguration.WindowsServices.Select(
                         s => {
                var serviceController = allServices.SingleOrDefault(sc => sc.ServiceName == s.InstalledName);
                if (serviceController == null)
                {
                    throw new UserCorrectableException(
                        "The \"" + s.InstalledName + "\" service could not be found. Re-install the services for the installation to correct this error.");
                }
                return(serviceController);
            }))
            {
                try {
                    service.Start();
                }
                catch (InvalidOperationException e) {
                    const string message = "Failed to start service.";

                    // We have seen this happen when an exception was thrown while initializing global logic for the system.
                    if (e.InnerException is Win32Exception &&
                        e.InnerException.Message.Contains("The service did not respond to the start or control request in a timely fashion"))
                    {
                        throw new UserCorrectableException(message, e);
                    }

                    throw new ApplicationException(message, e);
                }
                service.WaitForStatusWithTimeOut(ServiceControllerStatus.Running);

                // Set failure actions.
                const int restartDelay = 60000;                 // milliseconds
                StandardLibraryMethods.RunProgram(
                    "sc",
                    "failure \"{0}\" reset= {1} actions= restart/{2}".FormatWith(service.ServiceName, serviceFailureResetPeriod, restartDelay),
                    "",
                    true);
                StandardLibraryMethods.RunProgram("sc", "failureflag \"{0}\" 1".FormatWith(service.ServiceName), "", true);
            }
            if (runtimeConfiguration.InstallationType != InstallationType.Development)
            {
                foreach (var site in runtimeConfiguration.WebSiteNames)
                {
                    startWebSite(site);
                }
            }
        }
Пример #7
0
        private void generateXmlSchemaLogic(string projectPath, string schemaPathInProject, string nameSpace, string codeFileName, bool useSvcUtil)
        {
            var projectGeneratedCodeFolderPath = StandardLibraryMethods.CombinePaths(projectPath, "Generated Code");

            if (useSvcUtil)
            {
                try {
                    StandardLibraryMethods.RunProgram(
                        StandardLibraryMethods.CombinePaths(AppStatics.DotNetToolsFolderPath, "SvcUtil"),
                        "/d:\"" + projectGeneratedCodeFolderPath + "\" /noLogo \"" + StandardLibraryMethods.CombinePaths(projectPath, schemaPathInProject) + "\" /o:\"" +
                        codeFileName + "\" /dconly /n:*," + nameSpace + " /ser:DataContractSerializer",
                        "",
                        true);
                }
                catch (Exception e) {
                    throw new UserCorrectableException("Failed to generate XML schema logic using SvcUtil.", e);
                }
            }
            else
            {
                Directory.CreateDirectory(projectGeneratedCodeFolderPath);
                try {
                    StandardLibraryMethods.RunProgram(
                        StandardLibraryMethods.CombinePaths(AppStatics.DotNetToolsFolderPath, "xsd"),
                        "/nologo \"" + StandardLibraryMethods.CombinePaths(projectPath, schemaPathInProject) + "\" /c /n:" + nameSpace + " /o:\"" +
                        projectGeneratedCodeFolderPath + "\"",
                        "",
                        true);
                }
                catch (Exception e) {
                    throw new UserCorrectableException("Failed to generate XML schema logic using xsd.", e);
                }
                var outputCodeFilePath = StandardLibraryMethods.CombinePaths(
                    projectGeneratedCodeFolderPath,
                    Path.GetFileNameWithoutExtension(schemaPathInProject) + ".cs");
                var desiredCodeFilePath = StandardLibraryMethods.CombinePaths(projectGeneratedCodeFolderPath, codeFileName);
                if (outputCodeFilePath != desiredCodeFilePath)
                {
                    try {
                        IoMethods.MoveFile(outputCodeFilePath, desiredCodeFilePath);
                    }
                    catch (IOException e) {
                        throw new UserCorrectableException("Failed to move the generated code file for an XML schema. Please try the operation again.", e);
                    }
                }
            }
        }
Пример #8
0
        private void packageWebApps(DevelopmentInstallation installation, string serverSideLogicFolderPath)
        {
            // NOTE: When packaging web apps, try to find a way to exclude data files. Apparently web deployment projects include these in their output even though
            // they aren't part of the source web projects. NOTE ON NOTE: We don't use WDPs anymore, so maybe we can eliminate this note.
            foreach (var webProject in installation.DevelopmentInstallationLogic.DevelopmentConfiguration.webProjects ?? new WebProject[0])
            {
                var webAppPath = StandardLibraryMethods.CombinePaths(serverSideLogicFolderPath, webProject.name);

                // Pre-compile the web project.
                try {
                    StandardLibraryMethods.RunProgram(
                        StandardLibraryMethods.CombinePaths(RuntimeEnvironment.GetRuntimeDirectory(), "aspnet_compiler"),
                        "-v \"/" + webProject.name + ".csproj\" -p \"" + StandardLibraryMethods.CombinePaths(installation.GeneralLogic.Path, webProject.name) + "\" " +
                        (webProject.IsUpdateableWhenInstalledSpecified && webProject.IsUpdateableWhenInstalled ? "-u " : "") + "-f \"" + webAppPath + "\"",
                        "",
                        true);
                }
                catch (Exception e) {
                    throw new UserCorrectableException("ASP.NET pre-compilation failed for web project " + webProject.name + ".", e);
                }
                try {
                    StandardLibraryMethods.RunProgram(
                        StandardLibraryMethods.CombinePaths(AppStatics.DotNetToolsFolderPath, "aspnet_merge"),
                        "\"" + webAppPath + "\" -o " + webProject.NamespaceAndAssemblyName + ".Package -a -copyattrs",
                        "",
                        true);
                }
                catch (Exception e) {
                    throw new UserCorrectableException("ASP.NET Merge Tool failed for web project " + webProject.name + ".", e);
                }

                // Delete files and folders that aren't necessary for installed installations.
                IoMethods.DeleteFolder(StandardLibraryMethods.CombinePaths(webAppPath, "Generated Code"));
                IoMethods.DeleteFolder(StandardLibraryMethods.CombinePaths(webAppPath, "obj"));
                IoMethods.DeleteFile(StandardLibraryMethods.CombinePaths(webAppPath, webProject.name + ".csproj"));
                IoMethods.DeleteFile(StandardLibraryMethods.CombinePaths(webAppPath, webProject.name + ".csproj.user"));
                IoMethods.DeleteFile(StandardLibraryMethods.CombinePaths(webAppPath, webProject.name + ".csproj.vspscc"));
                IoMethods.DeleteFile(StandardLibraryMethods.CombinePaths(webAppPath, AppStatics.StandardLibraryFilesFileName));

                var webConfigPath = StandardLibraryMethods.CombinePaths(webAppPath, "Web.config");
                File.WriteAllText(
                    webConfigPath,
                    File.ReadAllText(webConfigPath)
                    .Replace("debug=\"true\"", "debug=\"false\"")
                    .Replace("<!--<add name=\"HttpCacheModule\" />-->", "<add name=\"HttpCacheModule\" />"));
            }
        }
Пример #9
0
 void Database.ExecuteSqlScriptInTransaction(string script)
 {
     executeMethodWithDbExceptionHandling(
         delegate {
         try {
             StandardLibraryMethods.RunProgram(
                 "sqlcmd",
                 (info.Server != null ? "-S " + info.Server + " " : "") + "-d " + info.Database + " -e -b",
                 "BEGIN TRAN" + Environment.NewLine + "GO" + Environment.NewLine + script + "COMMIT TRAN" + Environment.NewLine + "GO" + Environment.NewLine + "EXIT" +
                 Environment.NewLine,
                 true);
         }
         catch (Exception e) {
             throw DataAccessMethods.CreateDbConnectionException(info, "updating logic in", e);
         }
     });
 }
Пример #10
0
 void Database.ExportToFile(string filePath)
 {
     executeMethodWithDbExceptionHandling(
         delegate {
         try {
             // The --hex-blob option prevents certain BLOBs from causing errors during database re-creation.
             StandardLibraryMethods.RunProgram(
                 StandardLibraryMethods.CombinePaths(binFolderPath, "mysqldump"),
                 getHostAndAuthenticationArguments() + " --single-transaction --hex-blob --result-file=\"{0}\" ".FormatWith(filePath) + info.Database,
                 "",
                 true);
         }
         catch (Exception e) {
             throw DataAccessMethods.CreateDbConnectionException(info, "exporting (to file)", e);
         }
     });
 }
        private void stopServices()
        {
            var allServices  = ServiceController.GetServices();
            var serviceNames = RuntimeConfiguration.WindowsServices.Select(s => s.InstalledName);

            foreach (var service in allServices.Where(sc => serviceNames.Contains(sc.ServiceName)))
            {
                // Clear failure actions.
                StandardLibraryMethods.RunProgram("sc", "failure \"{0}\" reset= {1} actions= \"\"".FormatWith(service.ServiceName, serviceFailureResetPeriod), "", true);

                if (service.Status == ServiceControllerStatus.Stopped)
                {
                    continue;
                }
                service.Stop();
                service.WaitForStatusWithTimeOut(ServiceControllerStatus.Stopped);
            }
        }
Пример #12
0
        void Database.ExecuteSqlScriptInTransaction(string script)
        {
            using (var sw = new StringWriter()) {
                // Carriage returns seem to be significant here.
                sw.WriteLine("WHENEVER SQLERROR EXIT SQL.SQLCODE;");
                sw.Write(script);
                sw.WriteLine("EXIT SUCCESS COMMIT;");

                executeMethodWithDbExceptionHandling(
                    delegate {
                    try {
                        // -L option stops it from prompting on failed logon.
                        StandardLibraryMethods.RunProgram("sqlplus", "-L " + getLogonString(), sw.ToString(), true);
                    }
                    catch (Exception e) {
                        throw DataAccessMethods.CreateDbConnectionException(info, "updating logic in", e);
                    }
                });
            }
        }
 private void runInstallutil(WindowsService service, bool uninstall)
 {
     try {
         StandardLibraryMethods.RunProgram(
             StandardLibraryMethods.CombinePaths(RuntimeEnvironment.GetRuntimeDirectory(), "installutil"),
             (uninstall ? "/u " : "") + "\"" +
             StandardLibraryMethods.CombinePaths(
                 GetWindowsServiceFolderPath(service, true),
                 service.NamespaceAndAssemblyName + ".exe"
                 /* file extension is required */) + "\"",
             "",
             true);
     }
     catch (Exception e) {
         const string message = "Installer tool failed.";
         if (e.Message.Contains(typeof(EmailSendingException).Name))
         {
             throw new UserCorrectableException(message, e);
         }
         throw new ApplicationException(message, e);
     }
 }
Пример #14
0
        void Database.ExecuteSqlScriptInTransaction(string script)
        {
            using (var sw = new StringWriter()) {
                sw.WriteLine("START TRANSACTION;");
                sw.Write(script);
                sw.WriteLine("COMMIT;");
                sw.WriteLine("quit");

                executeMethodWithDbExceptionHandling(
                    delegate {
                    try {
                        StandardLibraryMethods.RunProgram(
                            StandardLibraryMethods.CombinePaths(binFolderPath, "mysql"),
                            getHostAndAuthenticationArguments() + " " + info.Database + " --disable-reconnect --batch --disable-auto-rehash",
                            sw.ToString(),
                            true);
                    }
                    catch (Exception e) {
                        throw DataAccessMethods.CreateDbConnectionException(info, "updating logic in", e);
                    }
                });
            }
        }
        /// <summary>
        /// This is the code to install and start the SeleniumRC service.
        /// </summary>
        public static void InstallSeleniumServiceIfNecessary()
        {
            var          supportFilesDestinationPath = StandardLibraryMethods.CombinePaths(ConfigurationStatics.RedStaplerFolderPath, "Selenium Support");
            const string serviceName     = "SeleniumRC";
            const string seleniumJarFile = "selenium-server.jar";
            const string srvany          = "srvany.exe";

            var seleniumServerService = ServiceController.GetServices().Where(s => s.DisplayName == serviceName).SingleOrDefault();

            if (!Directory.Exists(supportFilesDestinationPath) || seleniumServerService == null)
            {
                // Wipe out any possible pre-existing configuration.
                IoMethods.DeleteFolder(supportFilesDestinationPath);
                if (seleniumServerService != null)
                {
                    // Delete the service and remove the registry values.
                    StandardLibraryMethods.RunProgram("sc", "delete " + serviceName, "", true);
                    seleniumServerService = null;
                }


                // NOTE: This will work because the only machines running tests are dev machines and integration machines, and both of those not only should have this in their Vault
                // tree, but they are guaranteed to have gotten latest on the Standard Library system before attempting to run a test (since you can't run a test until you've built).
                // Still, there may be a more robust way to do this in the future.
                // If we do keep this solution, you have to ask yourself why it makes sense to store the files here just to copy them to Red Stapler/Selenium Support. The only good reason
                // may be that the Vault tree could be prone to full deletion/re-getting, and that would fail if a service was referencing a file inside the tree.

                // NOTE: This path is probably wrong, and should not be hard-coded.
                const string supportFilesSourcePath = @"C:\Red Stapler Vault\Supporting Files\Standard Library\Solution Files\Selenium Support";

                var srvanyDestinationPath = StandardLibraryMethods.CombinePaths(supportFilesDestinationPath, srvany);
                // Create c:\Red Stapler\Selenium Support
                Directory.CreateDirectory(supportFilesDestinationPath);
                IoMethods.CopyFile(StandardLibraryMethods.CombinePaths(supportFilesSourcePath, srvany), srvanyDestinationPath);
                IoMethods.CopyFile(StandardLibraryMethods.CombinePaths(supportFilesSourcePath, seleniumJarFile),
                                   StandardLibraryMethods.CombinePaths(supportFilesDestinationPath, seleniumJarFile));


                const string serviceRegCmd = @"ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\" + serviceName + "\\Parameters  /v ";
                const string regDataType   = " /t REG_SZ /d ";
                const string javaFolder    = @"C:\Program Files\Java\jre6\bin";
                var          parametersToSeleniumServer = "";
                if (AppTools.IsDevelopmentInstallation)
                {
                    var firefoxProfileFolderPath = StandardLibraryMethods.CombinePaths(supportFilesDestinationPath, "Firefox");
                    Directory.CreateDirectory(firefoxProfileFolderPath);
                    parametersToSeleniumServer = " -firefoxProfileTemplate \\\"" + firefoxProfileFolderPath + "\\\"";
                }

                // This is the code to add the registry parameters to the Selenium Server.  This only needs to be run once.
                StandardLibraryMethods.RunProgram("sc", "create " + serviceName + " binPath= \"" + srvanyDestinationPath + "\" start= auto", "", true);
                StandardLibraryMethods.RunProgram("REG",
                                                  serviceRegCmd + "Application" + regDataType + "\"" + StandardLibraryMethods.CombinePaths(javaFolder, "java.exe") + "\"",
                                                  "",
                                                  true);
                StandardLibraryMethods.RunProgram("REG", serviceRegCmd + "AppDirectory" + regDataType + "\"" + supportFilesDestinationPath + "\" ", "", true);
                StandardLibraryMethods.RunProgram("REG",
                                                  serviceRegCmd + "AppParameters" + regDataType + "\"-Xrs -jar " + seleniumJarFile + parametersToSeleniumServer + "\"",
                                                  "",
                                                  true);

                // Wait for the service to be created
                while (seleniumServerService == null)
                {
                    seleniumServerService = ServiceController.GetServices().Where(s => s.DisplayName == serviceName).SingleOrDefault();
                }
            }

            if (seleniumServerService.Status != ServiceControllerStatus.Running)
            {
                seleniumServerService.Start();
                seleniumServerService.WaitForStatus(ServiceControllerStatus.Running);
            }
        }
Пример #16
0
        void Database.DeleteAndReCreateFromFile(string filePath, bool keepDbInStandbyMode)
        {
            executeDbMethodWithSpecifiedDatabaseInfo(
                new OracleInfo(
                    (info as DatabaseInfo).SecondaryDatabaseName,
                    info.DataSource,
                    "sys",
                    ConfigurationLogic.OracleSysPassword,
                    info.SupportsConnectionPooling,
                    info.SupportsLinguisticIndexes),
                cn => {
                executeLongRunningCommand(cn, "CREATE OR REPLACE DIRECTORY " + dataPumpOracleDirectoryName + " AS '" + dataPumpFolderPath + "'");
                deleteAndReCreateUser(cn);
            });

            try {
                IoMethods.ExecuteWithTempFolder(
                    tempFolderPath => {
                    var folderPath = StandardLibraryMethods.CombinePaths(tempFolderPath, "Database File");
                    ZipOps.UnZipFileAsFolder(filePath, folderPath);
                    try {
                        IoMethods.CopyFile(StandardLibraryMethods.CombinePaths(folderPath, databaseFileDumpFileName), getDumpFilePath());

                        executeMethodWithDbExceptionHandling(
                            delegate {
                            try {
                                StandardLibraryMethods.RunProgram(
                                    "impdp",
                                    getLogonString() + " DIRECTORY=" + dataPumpOracleDirectoryName + " DUMPFILE=\"\"\"" + getDumpFileName() + "\"\"\" NOLOGFILE=y REMAP_SCHEMA=" +
                                    File.ReadAllText(StandardLibraryMethods.CombinePaths(folderPath, databaseFileSchemaNameFileName)) + ":" + info.UserAndSchema,
                                    "",
                                    true);
                            }
                            catch (Exception e) {
                                throwUserCorrectableExceptionIfNecessary(e);
                                if (e is FileNotFoundException)
                                {
                                    throw new UserCorrectableException("The schema name file was not found, probably because of a corrupt database file in the data package.", e);
                                }

                                // Secondary databases such as RLE cause procedure compilation errors when imported, and since we have no way of
                                // distinguishing these from legitimate import problems, we have no choice but to ignore all exceptions.
                                if ((info as DatabaseInfo).SecondaryDatabaseName.Length == 0)
                                {
                                    throw DataAccessMethods.CreateDbConnectionException(info, "re-creating (from file)", e);
                                }
                            }
                        });
                    }
                    finally {
                        IoMethods.DeleteFile(getDumpFilePath());
                    }
                });
            }
            catch {
                // We don't want to leave a partial user/schema on the machine since it may confuse future ISU operations.
                executeDbMethodWithSpecifiedDatabaseInfo(
                    new OracleInfo(
                        (info as DatabaseInfo).SecondaryDatabaseName,
                        info.DataSource,
                        "sys",
                        ConfigurationLogic.OracleSysPassword,
                        info.SupportsConnectionPooling,
                        info.SupportsLinguisticIndexes),
                    deleteUser);

                throw;
            }
        }