source: sandbox/workflow/branches/609/lib/factory/WorkflowFactory.php @ 2268

Revision 2268, 5.5 KB checked in by pedroerp, 14 years ago (diff)

Ticket #609 - Registrando mais classes na factory do módulo.

  • Property svn:executable set to *
Line 
1<?php
2/**************************************************************************\
3* eGroupWare                                                               *
4* http://www.egroupware.org                                                *
5* --------------------------------------------                             *
6*  This program is free software; you can redistribute it and/or modify it *
7*  under the terms of the GNU General Public License as published by the   *
8*  Free Software Foundation; either version 2 of the License, or (at your  *
9*  option) any later version.                                              *
10\**************************************************************************/
11
12/**
13 * Specialization of the BaseFactory class.
14 * This class is used to instantiate classes by
15 * the workflow module (not by processes). You
16 * cannot access this class directly, but requests
17 * to the Factory frontend class in 'unsecured mode'
18 * will be forwarded to this class.
19 *
20 * @package Factory
21 * @license http://www.gnu.org/copyleft/gpl.html GPL
22 * @author Pedro Eugênio Rocha - pedro.eugenio.rocha@gmail.com
23 */
24final class WorkflowFactory extends BaseFactory {
25
26
27        /**
28         * @var boolean $_instantiated Attribute that stores whether this
29         *              class was instantiated or not. This is used to limit the
30         *              instantiation of this class.
31         * @access private
32         * @static
33         */
34        private static $_instantiated = false;
35
36
37        /**
38         * Construct the class. This function will inform which classes
39         * you will be able to instantiate and where to find it.
40         * This function implements a kind of singleton design pattern too.
41         * @access public
42         */
43        public function __construct() {
44
45                /* don't let the user to instantiate this class more than once. */
46                if (self::$_instantiated)
47                        throw new Exception("You can't instantiate this class again.");
48
49                /* registering allowed classes */
50                $this->registerFileInfo('WorkflowObjects', 'class.WorkflowObjects.inc.php', 'inc');
51                $this->registerFileInfo('WorkflowWatcher', 'class.WorkflowWatcher.inc.php', 'inc');
52                $this->registerFileInfo('WorkflowLDAP', 'class.WorkflowLDAP.inc.php', 'inc');
53                $this->registerFileInfo('WorkflowSecurity', 'class.WorkflowSecurity.inc.php', 'inc');
54                $this->registerFileInfo('ResourcesRedirector', 'class.ResourcesRedirector.inc.php', 'inc');
55                $this->registerFileInfo('TemplateServer', 'class.TemplateServer.inc.php', 'inc');
56                $this->registerFileInfo('CachedLDAP', 'class.CachedLDAP.inc.php', 'inc');
57                $this->registerFileInfo('BrowserInfo', 'class.BrowserInfo.inc.php', 'inc');
58                $this->registerFileInfo('JobScheduler', 'class.JobScheduler.inc.php', 'inc');
59                $this->registerFileInfo('UserPictureProvider', 'class.UserPictureProvider.inc.php', 'inc');
60
61                $this->registerFileInfo('run_activity', 'class.run_activity.inc.php', 'inc');
62                $this->registerFileInfo('process_smarty', 'class.process_smarty.inc.php', 'inc');
63                $this->registerFileInfo('workflow_smarty', 'class.workflow_smarty.inc.php', 'inc');
64                $this->registerFileInfo('workflow_acl', 'class.workflow_acl.inc.php', 'inc');
65                $this->registerFileInfo('workflow_processmanager', 'class.workflow_processmanager.inc.php', 'inc');
66                $this->registerFileInfo('workflow_wfruntime', 'class.workflow_wfruntime.inc.php', 'inc');
67                $this->registerFileInfo('workflow_gui', 'class.workflow_gui.inc.php', 'inc');
68                $this->registerFileInfo('workflow_rolemanager', 'class.workflow_rolemanager.inc.php', 'inc');
69                $this->registerFileInfo('workflow_activitymanager', 'class.workflow_activitymanager.inc.php', 'inc');
70                $this->registerFileInfo('workflow_instance', 'class.workflow_instance.inc.php', 'inc');
71
72                $this->registerFileInfo('bo_participants', 'class.bo_participants.inc.php', 'inc');
73                $this->registerFileInfo('bo_agent_mail_smtp', 'class.bo_agent_mail_smtp.inc.php', 'inc');
74                $this->registerFileInfo('bo_editor', 'class.bo_editor.inc.php', 'inc');
75
76                $this->registerFileInfo('so_agent_mail_smtp', 'class.so_agent_mail_smtp.inc.php', 'inc');
77
78                /* registering egw external classes */
79                $this->registerFileInfo('phpgw', 'class.phpgw.inc.php', '', EGW_INC_ROOT);
80                $this->registerFileInfo('db', 'class.db.inc.php', '', EGW_INC_ROOT);
81                $this->registerFileInfo('accounts', 'class.accounts.inc.php', '', EGW_INC_ROOT);
82                $this->registerFileInfo('config', 'class.config.inc.php', '', EGW_INC_ROOT);
83                $this->registerFileInfo('common', 'class.common.inc.php', '', EGW_INC_ROOT);
84                $this->registerFileInfo('session', 'class.session.inc.php', '', EGW_INC_ROOT);
85                $this->registerFileInfo('nextmachs', 'class.nextmatchs.inc.php', '', EGW_INC_ROOT);
86                $this->registerFileInfo('categories', 'class.categories.inc.php', '', EGW_INC_ROOT);
87                $this->registerFileInfo('listbox', 'class.listbox.inc.php', '', EGW_INC_ROOT);
88                $this->registerFileInfo('phpmailer', 'class.phpmailer.inc.php', '', EGW_INC_ROOT);
89
90                /**
91                 * It can cause some troubles. A class named 'bo' must be instantiated by a
92                 * Factory::getInstance('bo') call, that isn't really intuitive.. Something to
93                 * think about...
94                 */
95                $this->registerFileInfo('bo', 'class.bo.inc.php', 'emailadmin/inc', EGW_SERVER_ROOT);
96
97
98                /**
99                 * TODO - This is a veeery big workaround to maintain compatibility with
100                 * processes that uses the old non-static factory. So, we made this wrapper
101                 * (adapter) that just calls the new and cute static factory class in the
102                 * right way. It should be removed as soon as possible.
103                */
104                $this->registerFileInfo('ProcessWrapperFactory', 'ProcessWrapperFactory.php', 'lib/factory/');
105
106
107                /* ok. no more instances of this class.. */
108                self::$_instantiated = true;
109        }
110}
111
112?>
Note: See TracBrowser for help on using the repository browser.