DumontEXE 0.0.1
cmcQueue.h
00001 /* ***************************************************************************
00002 **
00003 ** Copyright (C) 2007 Lorimark Solutions, LLC. All rights reserved.
00004 **
00005 ** This file is part of the DumontEXE Scripting Extension Kit
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://dumont.showoff-db.org/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://dumont.showoff-db.org/licensing.html 
00017 ** or contact the sales department at sales@lorimarksolutions.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ** author: Mark Petryk ~ Lorimark Solutions, LLC
00023 ** **************************************************************************/
00024 
00025 #ifndef CDA_QUEUE_H_422FD07F_0597_4cbb_A034_9AE85166472E
00026 #define CDA_QUEUE_H_422FD07F_0597_4cbb_A034_9AE85166472E
00027 
00028 #include <QProcess>
00029 
00030 #include "cmcObject.h"
00031 
00032 namespace cmcDatabaseApi {
00033 
00034 class cmcApplication;
00035 class cmcCursor;
00036 
00037 /*!
00038 ** \brief Process Queue
00039 **
00040 ** This object represents a 'Process' queue.  A process queue is a
00041 **  container that manages a list of items that must be sent 
00042 **  sequentially to a process of some sort.  An example of such a
00043 **  list of items would be a list of programs to run in sequence
00044 **  to accomplish a particular task.
00045 **
00046 ** For instance.  Consider that Commence does a good job of firing
00047 **  agents to accomplish various tasks.  If a calendar item is edited,
00048 **  and saved, for instance, Commence can respond by firing an agent
00049 **  to post-process that calendar item to, say, sync it with another
00050 **  application like Outlook.
00051 **
00052 ** However, a problem arises when one client computer syncs with
00053 **  the workgroup, and the workgroup pushes dozens of calendar item
00054 **  changes to your client.  This often results in dozens of agents
00055 **  firing very quickly causing dozens of scripts to run simultaneously
00056 **  causing a virtual halt of your system.
00057 **
00058 ** Instead of the agent launching multiple .vbs applications to perform
00059 **  these post-process functions, the agent can add 'Queue Items' to
00060 **  the queue category for handling by this object.  This object, then,
00061 **  continuously scans the \ref DumontQueue "Dumont Queue" Category 
00062 **  for new items and processes them one by one.
00063 **
00064 **
00065 */
00066 class cmcQueue:
00067   public cmcObject
00068 {
00069   Q_OBJECT
00070   public:
00071 
00072     /*!
00073     ** \brief Standard Constructor \n
00074     **
00075     */
00076     cmcQueue( const QString & queueName, cmcApplication * app, QObject * parent );
00077 
00078     ~cmcQueue();
00079 
00080   public slots:
00081 
00082     /*!
00083     ** \brief Return the cursor \n
00084     **
00085     ** This cursor is filtered and sorted
00086     **
00087     */
00088     cmcCursor * cursor();
00089 
00090     /*!
00091     ** \brief Return the Category Name \n
00092     **
00093     ** Defaults to "DumontQueue"
00094     **
00095     */
00096     QString queueCategoryName();
00097 
00098     /*!
00099     ** \brief Return True if Application has Queue Category \n
00100     **
00101     */
00102     bool hasQueueCategory();
00103 
00104     /*!
00105     ** \brief Add a named item to the Queue \n
00106     **
00107     **
00108     */
00109     bool add
00110     (
00111       const QString & itemName,
00112       long priority,
00113       const QString & program,
00114       const QString & value
00115     );
00116 
00117     /*!
00118     ** \brief Add a unnamed item to the Queue \n
00119     **
00120     ** An unnamed item is an item that ends up having a guid value
00121     **  as it's name field value.  The guid value is random and is
00122     **  generated automatically by the system when the item is added.
00123     **
00124     */
00125     bool add
00126     (
00127       long priority,
00128       const QString & program,
00129       const QString & arguments
00130     );
00131 
00132     /*!
00133     ** \brief Count of items in the queue \n
00134     **
00135     */
00136     long count();
00137 
00138     /*!
00139     ** \brief Clear the queue of all its items \n
00140     **
00141     */
00142     bool clear();
00143 
00144     /*!
00145     ** \brief Check the Busy status \n
00146     **
00147     */
00148     bool isBusy();
00149 
00150     /*!
00151     ** \brief Check the Halt status \n
00152     **
00153     */
00154     bool isHalted();
00155 
00156     /*!
00157     ** \brief Set the Halt status \n
00158     **
00159     */
00160     bool setHalt( bool state );
00161 
00162     /*!
00163     ** \brief Internal Call-back function \n
00164     **
00165     */
00166     void processFinished( int exitCode, QProcess::ExitStatus exitStatus );
00167 
00168     /*!
00169     ** \brief Application Timer Event \n
00170     **
00171     ** 
00172     **
00173     */
00174     void timerEvent( QTimerEvent * event );
00175 
00176   protected:
00177 
00178     QProcess * process;
00179 
00180     bool m_busy;
00181     bool m_halt;
00182 
00183 
00184 
00185 }; // endclass cmcQueue:
00186 
00187 } // endnamespace cmcDatabaseApi
00188 
00189 #endif
00190 
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties




~ ~ ~ ~ ~ ~
Source Code without Comments is like a Cranberry Garland
without the berries. Comment your Code!
 
Commence Database User Support Group Forum
http://newsgroup.showoff-db.org/
~ ~ ~ ~ ~ ~
Author: Mark Petryk
Lorimark Solutions, LLC
mark@lorimarksolutions.com