Ejemplo n.º 1
0
        /// <summary>
        /// Add a chain mapping - when the Job identified by the first key completes
        /// the job identified by the second key will be triggered.
        /// </summary>
        /// <param name="firstJob">a Key with the name and group of the first job</param>
        /// <param name="secondJob">a Key with the name and group of the follow-up job</param>
        public void AddJobChainLink(Key firstJob, Key secondJob)
        {
            if (firstJob == null || secondJob == null)
            {
                throw new ArgumentException("Key cannot be null!");
            }
            if (firstJob.Name == null || secondJob.Name == null)
            {
                throw new ArgumentException("Key cannot have a null name!");
            }

            chainLinks.Add(firstJob, secondJob);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Get the names of all of the triggers associated with the given job.
 /// </summary>
 /// <param name="conn">The DB Connection.</param>
 /// <param name="jobName">The name of the job.</param>
 /// <param name="groupName">The group containing the job.</param>
 /// <returns>An array of <see cref="Key" /> objects</returns>
 public virtual Key[] SelectTriggerNamesForJob(ConnectionAndTransactionHolder conn, string jobName,
                                               string groupName)
 {
     using (IDbCommand cmd = PrepareCommand(conn, ReplaceTablePrefix(SqlSelectTriggersForJob)))
     {
         AddCommandParameter(cmd, 1, "jobName", jobName);
         AddCommandParameter(cmd, 2, "jobGroup", groupName);
         using (IDataReader rs = cmd.ExecuteReader())
         {
             ArrayList list = new ArrayList(10);
             while (rs.Read())
             {
                 string trigName = GetString(rs[ColumnTriggerName]);
                 string trigGroup = GetString(rs[ColumnTriggerGroup]);
                 list.Add(new Key(trigName, trigGroup));
             }
             object[] oArr = list.ToArray();
             Key[] kArr = new Key[oArr.Length];
             Array.Copy(oArr, 0, kArr, 0, oArr.Length);
             return kArr;
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Get the names of all of the triggers in the given group and state that
        /// have misfired.
        /// </summary>
        /// <param name="conn">The DB Connection</param>
        /// <param name="groupName">Name of the group.</param>
        /// <param name="state">The state.</param>
        /// <param name="ts">The timestamp.</param>
        /// <returns>an array of <see cref="Key" /> objects</returns>
        public virtual Key[] SelectMisfiredTriggersInGroupInState(ConnectionAndTransactionHolder conn, string groupName,
                                                                  string state,
                                                                  long ts)
        {
            using (IDbCommand cmd = PrepareCommand(conn, ReplaceTablePrefix(SqlSelectMisfiredTriggersInGroupInState))
                )
            {
                AddCommandParameter(cmd, 1, "timestamp", Convert.ToDecimal(ts));
                AddCommandParameter(cmd, 2, "triggerGroup", groupName);
                AddCommandParameter(cmd, 3, "state", state);

                using (IDataReader rs = cmd.ExecuteReader())
                {
                    ArrayList list = new ArrayList();
                    while (rs.Read())
                    {
                        string triggerName = GetString(rs[ColumnTriggerName]);
                        list.Add(new Key(triggerName, groupName));
                    }
                    object[] oArr = list.ToArray();
                    Key[] kArr = new Key[oArr.Length];
                    Array.Copy(oArr, 0, kArr, 0, oArr.Length);
                    return kArr;
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Get the names of all of the jobs that are volatile.
 /// </summary>
 /// <param name="conn">The DB Connection</param>
 /// <returns>An array of <see cref="Key" /> objects.</returns>
 public virtual Key[] SelectVolatileJobs(ConnectionAndTransactionHolder conn)
 {
     using (IDbCommand cmd = PrepareCommand(conn, ReplaceTablePrefix(SqlSelectVolatileJobs)))
     {
         AddCommandParameter(cmd, 1, "isVolatile", GetDbBooleanValue(true));
         using (IDataReader dr = cmd.ExecuteReader())
         {
             ArrayList list = new ArrayList();
             while (dr.Read())
             {
                 string triggerName = (string)dr[ColumnJobName];
                 string groupName = (string)dr[ColumnJobGroup];
                 list.Add(new Key(triggerName, groupName));
             }
             Object[] oArr = list.ToArray();
             Key[] kArr = new Key[oArr.Length];
             Array.Copy(oArr, 0, kArr, 0, oArr.Length);
             return kArr;
         }
     }
 }