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();
        }
        protected Guid ScheduleExportTableJob(string schemaName, string tableName, string path, QueueType queueType)
        {
            var queue = String.Format("QueueInstance:Graywulf.Controller.Controller.{0}", queueType.ToString());

            using (var context = ContextManager.Instance.CreateContext(ConnectionMode.AutoOpen, TransactionMode.AutoCommit))
            {
                var user = SignInTestUser(context);

                var ef         = new EntityFactory(context);
                var federation = ef.LoadEntity <Federation>(Registry.AppSettings.FederationName);
                var format     = FileFormatFactory.Create(federation.FileFormatFactory).GetFileFormatDescription(typeof(Jhu.Graywulf.Format.DelimitedTextDataFile).FullName);

                var mydbds = federation.MyDBDatabaseVersion.GetUserDatabaseInstance(user).GetDataset();

                var source = new Jhu.Graywulf.Schema.Table()
                {
                    Dataset      = mydbds, // TODO: fix this
                    DatabaseName = mydbds.DatabaseName,
                    SchemaName   = schemaName,
                    TableName    = tableName
                };

                var etf = new ExportTablesFactory(context);
                var ji  = etf.ScheduleAsJob(
                    federation,
                    new TableOrView[] { source },
                    path,
                    format,
                    queue,
                    "");

                ji.Save();

                return(ji.Guid);
            }
        }
Example #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();
        }
Example #4
0
        protected Guid ScheduleExportTableJob(string schemaName, string tableName, string path, QueueType queueType)
        {
            var queue = String.Format("QueueInstance:Graywulf.Controller.Controller.{0}", queueType.ToString());

            using (var context = ContextManager.Instance.CreateContext(ConnectionMode.AutoOpen, TransactionMode.AutoCommit))
            {
                var user = SignInTestUser(context);

                var ef = new EntityFactory(context);
                var federation = ef.LoadEntity<Federation>(Registry.AppSettings.FederationName);
                var format = FileFormatFactory.Create(federation.FileFormatFactory).GetFileFormatDescription(typeof(Jhu.Graywulf.Format.DelimitedTextDataFile).FullName);

                var mydbds = federation.MyDBDatabaseVersion.GetUserDatabaseInstance(user).GetDataset();

                var source = new Jhu.Graywulf.Schema.Table()
                {
                    Dataset = mydbds,  // TODO: fix this
                    DatabaseName = mydbds.DatabaseName,
                    SchemaName = schemaName,
                    TableName = tableName
                };

                var etf = new ExportTablesFactory(context);
                var ji = etf.ScheduleAsJob(
                    federation,
                    new TableOrView[] {source },
                    path,
                    format,
                    queue,
                    "");

                ji.Save();

                return ji.Guid;
            }
        }