Exemplo n.º 1
0
        public DataFileExporter(SourceQueryParameters source, DataFileBase destination)
        {
            InitializeMembers();

            this.source = source;
            this.destination = destination;
        }
Exemplo n.º 2
0
        public DataFileImporter(DataFileBase source, DestinationTableParameters destination)
            : base(destination)
        {
            InitializeMembers();

            this.source = source;
        }
Exemplo n.º 3
0
        internal FileDataReader(DataFileBase parent)
        {
            InizializeMembers();

            this.parent = parent;

            NextResult();
        }
Exemplo n.º 4
0
        internal FileDataReader(DataFileBase parent)
        {
            InizializeMembers();

            this.parent = parent;

            NextResult();
        }
Exemplo n.º 5
0
 private void InizializeMembers()
 {
     this.parent       = null;
     this.columnIndex  = null;
     this.blockCounter = -1;
     this.rowCounter   = -1;
     this.rowValues    = null;
     this.isIdentity   = null;
 }
Exemplo n.º 6
0
        private void CopyMembers(DataFileBlockBase old)
        {
            this.file = old.file;

            // Deep copy columns
            this.columns = new List <Column>();
            foreach (var c in old.columns)
            {
                this.columns.Add((Column)c.Clone());
            }
        }
Exemplo n.º 7
0
        public JobInstance ScheduleAsJob(Federation federation, TableOrView[] sources, string path, FileFormatDescription format, string queueName, string comments)
        {
            var job = GetInitializedJobInstance(queueName, comments);

            var settings = new ExportTablesJobSettings(job.JobDefinition.Settings);

            path = path ?? settings.OutputDirectory;
            path = Path.Combine(path, String.Format("{0}_{1}{2}", Context.UserName, job.JobID, Jhu.Graywulf.IO.Constants.FileExtensionZip));

            var destinations = new DataFileBase[sources.Length];
            for (int i = 0; i < sources.Length; i++)
            {
                var ff = FileFormatFactory.Create(federation.FileFormatFactory);

                var destination = ff.CreateFile(format);
                destination.Uri = Util.UriConverter.FromFilePath(String.Format("{0}{1}", sources[i].ObjectName, format.DefaultExtension));

                // special initialization in case of a text file
                // TODO: move this somewhere else, maybe web?
                if (destination is TextDataFileBase)
                {
                    var tf = (TextDataFileBase)destination;
                    tf.Encoding = Encoding.ASCII;
                    tf.Culture = System.Globalization.CultureInfo.InvariantCulture;
                    tf.GenerateIdentityColumn = false;
                    tf.ColumnNamesInFirstLine = true;
                }

                destinations[i] = destination;
            }

            var et = new ExportTables()
            {
                Sources = sources,
                Destinations = destinations,
                Archival = DataFileArchival.Zip,
                Uri = Util.UriConverter.FromFilePath(path),
                FileFormatFactoryType = federation.FileFormatFactory,
                StreamFactoryType = federation.StreamFactory,
            };

            job.Parameters["Parameters"].Value = et;

            return job;
        }
Exemplo n.º 8
0
        private void CopyMembers(DataFileBase old)
        {
            this.baseStream     = null;
            this.ownsBaseStream = false;

            this.fileMode = old.fileMode;
            this.uri      = old.uri;
            this.generateIdentityColumn = old.generateIdentityColumn;

            // Deep copy of blocks
            this.blocks = new List <DataFileBlockBase>();
            foreach (var b in old.blocks)
            {
                var nb = (DataFileBlockBase)b.Clone();
                this.blocks.Add((DataFileBlockBase)b.Clone());
            }

            this.blockCounter = -1;
        }
Exemplo n.º 9
0
 protected DataFileBase(DataFileBase old)
 {
     CopyMembers(old);
 }
Exemplo n.º 10
0
 public void Dispose()
 {
     this.parent = null;
     this.columnIndex = null;
 }
Exemplo n.º 11
0
 private void InizializeMembers()
 {
     this.parent = null;
     this.columnIndex = null;
     this.blockCounter = -1;
     this.rowCounter = -1;
     this.rowValues = null;
     this.isIdentity = null;
 }
Exemplo n.º 12
0
        private void CopyMembers(DataFileBlockBase old)
        {
            this.file = old.file;

            // Deep copy columns
            this.columns = new List<Column>();
            foreach (var c in old.columns)
            {
                this.columns.Add((Column)c.Clone());
            }
        }
Exemplo n.º 13
0
 private void InitializeMembers(StreamingContext context)
 {
     //this.databaseInstanceName = String.Empty;
     //this.schemaName = null;
     //this.datasetName = null;
     //this.databaseName = null;
     //this.tableName = null;
     this.source = null;
     this.destination = null;
 }
Exemplo n.º 14
0
 private void InitializeMembers()
 {
     this.file    = null;
     this.columns = new List <Column>();
 }
Exemplo n.º 15
0
 private void InitializeMembers()
 {
     this.file       = null;
     this.dataReader = null;
 }
Exemplo n.º 16
0
 private void InitializeMembers()
 {
     this.file = null;
     this.dataReader = null;
 }
Exemplo n.º 17
0
 private void CopyMembers(DataFileBlockBase old)
 {
     this.file = old.file;
     this.columns = new List<DataFileColumn>(old.columns);
 }
Exemplo n.º 18
0
 private void InitializeMembers()
 {
     this.source = null;
 }
Exemplo n.º 19
0
        public FileCommand(DataFileBase file)
        {
            InitializeMembers();

            this.file = file;
        }
Exemplo n.º 20
0
        private void WriteTable(IDbCommand cmd, DataFileBase destination)
        {
            // Wrap command into a cancellable task
            var guid = Guid.NewGuid();
            var ccmd = new CancelableDbCommand(cmd);
            RegisterCancelable(guid, ccmd);

            // Pass data reader to the file formatter
            ccmd.ExecuteReader(dr =>
            {
                destination.WriteFromDataReader(dr);
            });

            UnregisterCancelable(guid);
        }
Exemplo n.º 21
0
        protected void WriteTable(SourceTableQuery source, DataFileBase destination)
        {
            // Create command that reads the table
            using (var cmd = source.CreateCommand())
            {
                using (var cn = source.OpenConnection())
                {
                    using (var tn = cn.BeginTransaction(IsolationLevel.ReadUncommitted))
                    {
                        cmd.Connection = cn;
                        cmd.Transaction = tn;
                        cmd.CommandTimeout = Timeout;

                        WriteTable(cmd, destination);
                    }
                }
            }
        }
Exemplo n.º 22
0
 protected void ReadTable(DataFileBase source, DestinationTable destination)
 {
     // Import the file by wrapping it into a dummy command
     using (var cmd = new FileCommand(source))
     {
         ImportTable(cmd, destination);
     }
 }
Exemplo n.º 23
0
        public DataFileBlockBase(DataFileBase file)
        {
            InitializeMembers();

            this.file = file;
        }
Exemplo n.º 24
0
        public FileCommand(DataFileBase file)
        {
            InitializeMembers();

            this.file = file;
        }
Exemplo n.º 25
0
 protected DataFileBase(DataFileBase old)
 {
     CopyMembers(old);
 }
Exemplo n.º 26
0
        public DataFileBlockBase(DataFileBase file)
        {
            InitializeMembers();

            this.file = file;
        }
Exemplo n.º 27
0
 private void InitializeMembers()
 {
     this.source = null;
     this.destination = null;
 }
Exemplo n.º 28
0
 public void Dispose()
 {
     this.parent      = null;
     this.columnIndex = null;
 }
Exemplo n.º 29
0
        private void CopyMembers(DataFileBase old)
        {
            this.baseStream = null;
            this.ownsBaseStream = false;

            this.fileMode = old.fileMode;
            this.uri = old.uri;
            this.generateIdentityColumn = old.generateIdentityColumn;

            // Deep copy of blocks
            this.blocks = new List<DataFileBlockBase>();
            foreach (var b in old.blocks)
            {
                var nb = (DataFileBlockBase)b.Clone();
                this.blocks.Add((DataFileBlockBase)b.Clone());
            }

            this.blockCounter = -1;
        }
Exemplo n.º 30
0
 private void InitializeMembers()
 {
     this.file = null;
     this.columns = new List<DataFileColumn>();
 }
Exemplo n.º 31
0
 private void CopyMembers(ExportTable old)
 {
     this.source = old.source;
     this.destination = old.destination;
 }