Exemplo n.º 1
0
        /// <summary>
        /// Initializes private members to their default values.
        /// </summary>
        private void InitializeMembers()
        {
            this.userGuid    = Guid.Empty;
            this.userName    = null;
            this.jobGuid     = Guid.Empty;
            this.jobID       = null;
            this.contextGuid = Guid.NewGuid();

            this.isValid = true;

            this.showHidden  = false;
            this.showDeleted = false;

            this.connectionString = null;
            this.connectionMode   = Registry.ConnectionMode.None;
            this.transactionMode  = Registry.TransactionMode.None;

            this.databaseConnection  = null;
            this.databaseTransaction = null;

            this.activity   = null;
            this.eventOrder = 0;

            this.clusterProperty    = new EntityProperty <Cluster>(this);
            this.domainProperty     = new EntityProperty <Domain>(this);
            this.federationProperty = new EntityProperty <Federation>(this);
        }
Exemplo n.º 2
0
        internal Context(IGraywulfActivity activity, CodeActivityContext activityContext)
        {
            InitializeMembers();

            // Get job info from the scheduler
            var scheduler = activityContext.GetExtension<IScheduler>();

            if (scheduler != null)
            {
                Guid jobguid, userguid;
                string jobid, username;

                scheduler.GetContextInfo(
                    activityContext.WorkflowInstanceId,
                    out userguid, out username,
                    out jobguid, out jobid);

                this.userGuid = userguid;
                this.userName = username;
                this.jobGuid = jobguid;
                this.jobID = jobid;

                this.contextGuid = activityContext.WorkflowInstanceId;

                this.activityContext = activityContext;
                this.activity = activity;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Disposes the context and commits the SQL transaction, closes the connection.
        /// </summary>
        public void Dispose()
        {
            if (activity != null)
            {
                activity = null;
            }

            if (databaseTransaction != null)
            {
                switch (transactionMode)
                {
                case Registry.TransactionMode.None:
                    break;

                case Registry.TransactionMode.AutoCommit:
                    CommitTransaction();
                    break;

                case Registry.TransactionMode.DirtyRead:
                case Registry.TransactionMode.ManualCommit:
                    RollbackTransaction();
                    break;

                default:
                    throw new NotImplementedException();
                }
            }

            if (databaseConnection != null)
            {
                CloseConnection();
            }

            isValid = false;
        }
Exemplo n.º 4
0
        internal Context(IGraywulfActivity activity, CodeActivityContext activityContext)
        {
            InitializeMembers();

            // Get job info from the scheduler
            var scheduler = activityContext.GetExtension <IScheduler>();

            if (scheduler != null)
            {
                Guid   jobguid, userguid;
                string jobid, username;

                scheduler.GetContextInfo(
                    activityContext.WorkflowInstanceId,
                    out userguid, out username,
                    out jobguid, out jobid);

                this.userGuid = userguid;
                this.userName = username;
                this.jobGuid  = jobguid;
                this.jobID    = jobid;

                this.contextGuid = activityContext.WorkflowInstanceId;

                this.activityContext = activityContext;
                this.activity        = activity;
            }
        }
Exemplo n.º 5
0
        public Context CreateContext(IGraywulfActivity activity, CodeActivityContext activityContext, ConnectionMode connectionMode, TransactionMode transactionMode)
        {
            var context = new Context(activity, activityContext)
            {
                ConnectionString = connectionString,
                ConnectionMode   = connectionMode,
                TransactionMode  = transactionMode,
            };

            return(context);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Returnes a new registry context when in Graywulf execution mode.
        /// </summary>
        /// <param name="activity"></param>
        /// <param name="activityContext"></param>
        /// <param name="connectionMode"></param>
        /// <param name="transactionMode"></param>
        /// <returns></returns>
        public Jhu.Graywulf.Registry.Context CreateContext(IGraywulfActivity activity, System.Activities.CodeActivityContext activityContext, Jhu.Graywulf.Registry.ConnectionMode connectionMode, Jhu.Graywulf.Registry.TransactionMode transactionMode)
        {
            switch (executionMode)
            {
            case Query.ExecutionMode.SingleServer:
                return(null);

            case Query.ExecutionMode.Graywulf:
                return(Jhu.Graywulf.Registry.ContextManager.Instance.CreateContext(activity, activityContext, connectionMode, transactionMode));

            default:
                throw new NotImplementedException();
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes private members to their default values.
        /// </summary>
        private void InitializeMembers()
        {
            this.userGuid = Guid.Empty;
            this.userName = null;
            this.jobGuid = Guid.Empty;
            this.jobID = null;
            this.contextGuid = Guid.NewGuid();

            this.isValid = true;

            this.showHidden = false;
            this.showDeleted = false;

            this.connectionString = null;
            this.connectionMode = Registry.ConnectionMode.None;
            this.transactionMode = Registry.TransactionMode.None;

            this.databaseConnection = null;
            this.databaseTransaction = null;

            this.activity = null;
            this.eventOrder = 0;

            this.clusterProperty = new EntityProperty<Cluster>(this);
            this.domainProperty = new EntityProperty<Domain>(this);
            this.federationProperty = new EntityProperty<Federation>(this);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Disposes the context and commits the SQL transaction, closes the connection.
        /// </summary>
        public void Dispose()
        {
            if (activity != null)
            {
                activity = null;
            }

            if (databaseTransaction != null)
            {
                switch (transactionMode)
                {
                    case Registry.TransactionMode.None:
                        break;
                    case Registry.TransactionMode.AutoCommit:
                        CommitTransaction();
                        break;
                    case Registry.TransactionMode.DirtyRead:
                    case Registry.TransactionMode.ManualCommit:
                        RollbackTransaction();
                        break;
                    default:
                        throw new NotImplementedException();
                }
            }

            if (databaseConnection != null)
            {
                CloseConnection();
            }

            isValid = false;
        }
Exemplo n.º 9
0
        public Context CreateContext(IGraywulfActivity activity, CodeActivityContext activityContext, ConnectionMode connectionMode, TransactionMode transactionMode)
        {
            var context = new Context(activity, activityContext)
            {
                ConnectionString = connectionString,
                ConnectionMode = connectionMode,
                TransactionMode = transactionMode,
            };

            return context;
        }
Exemplo n.º 10
0
        /// <summary>
        /// Initializes private members to their default values.
        /// </summary>
        private void InitializeMembers()
        {
            this.userGuid = Guid.Empty;
            this.userName = null;
            this.jobGuid = Guid.Empty;
            this.jobID = null;
            this.contextGuid = Guid.NewGuid();

            this.isValid = true;

            this.showHidden = false;
            this.showDeleted = false;

            this.connectionString = null;
            this.connectionMode = Registry.ConnectionMode.None;
            this.transactionMode = Registry.TransactionMode.None;

            this.databaseConnection = null;
            this.databaseTransaction = null;

            this.activity = null;
            this.eventOrder = 0;
        }
Exemplo n.º 11
0
 public Jhu.Graywulf.Registry.Context CreateContext(IGraywulfActivity activity, System.Activities.CodeActivityContext activityContext, Jhu.Graywulf.Registry.ConnectionMode connectionMode, Jhu.Graywulf.Registry.TransactionMode transactionMode)
 {
     switch (executionMode)
     {
         case Query.ExecutionMode.SingleServer:
             return null;
         case Query.ExecutionMode.Graywulf:
             return Jhu.Graywulf.Registry.ContextManager.Instance.CreateContext(activity, activityContext, connectionMode, transactionMode);
         default:
             throw new NotImplementedException();
     }
 }