示例#1
0
        private IO.Tasks.ImportTable CreateImporterSimple()
        {
            string filename, extension;
            DataFileCompression compression;

            // Determine file format
            var format = FileFormatFactory.GetFileFormatDescription(
                GetUploadedFileUri(),
                out filename,
                out extension,
                out compression);

            var source = FileFormatFactory.CreateFile(format);

            source.BaseStream = ImportedFile.PostedFile.InputStream;
            //source.Open(ImportedFile.PostedFile.InputStream, DataFileMode.Read);

            var destination = CreateDestination("dbo", filename.Replace(".", "_")); // TODO: get 'dbo' from dataset description

            return(new IO.Tasks.ImportTable()
            {
                Source = source,
                Destination = destination
            });
        }
示例#2
0
        protected void RefreshForm()
        {
            var format = FileFormatFactory.GetFileFormatDescription(FileFormat.SelectedValue);

            DetectColumnNamesRow.Visible = format.CanDetectColumnNames;
            CompressedRow.Visible        = !format.IsCompressed;

            if (DetailsTable.Visible)
            {
                ToggleDetails.Text = "simple mode";
            }
            else
            {
                ToggleDetails.Text = "advanced mode";
            }
        }
示例#3
0
        private void ScheduleExportTableJob()
        {
            var table  = (Jhu.Graywulf.Schema.Table)SchemaManager.GetDatabaseObjectByKey(TableName.SelectedValue);
            var format = FileFormatFactory.GetFileFormatDescription(FileFormat.SelectedValue);

            // Make sure it's in MYDB
            if (StringComparer.InvariantCultureIgnoreCase.Compare(table.DatasetName, MyDBDatabaseDefinition.Name) != 0)
            {
                throw new InvalidOperationException();  // *** TODO
            }

            var queue = EntityFactory.CombineName(EntityType.QueueInstance, Federation.ControllerMachine.GetFullyQualifiedName(), Jhu.Graywulf.Registry.Constants.LongQueueName);
            var f     = new Jhu.Graywulf.Jobs.ExportTables.ExportTablesFactory(RegistryContext);

            // TODO: maybe add comments?
            var job = f.ScheduleAsJob(Federation, new[] { table }, null, format, queue, "");

            job.Save();
        }