source: sandbox/workflow/trunk/lib/factory/WorkflowFactory.php @ 2466

Revision 2466, 10.0 KB checked in by pedroerp, 14 years ago (diff)

Ticket #609 - Merged 2356:2442 /sandbox/workflow/branches/609 em /sandbox/workflow/trunk.

  • 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('WorkflowMacro', 'class.WorkflowMacro.inc.php', 'inc');
55                $this->registerFileInfo('WorkflowJobManager', 'class.WorkflowJobManager.inc.php', 'inc');
56                $this->registerFileInfo('SecurityUtils', 'class.utils.security.php', 'inc');
57                $this->registerFileInfo('ResourcesRedirector', 'class.ResourcesRedirector.inc.php', 'inc');
58                $this->registerFileInfo('TemplateServer', 'class.TemplateServer.inc.php', 'inc');
59                $this->registerFileInfo('CachedLDAP', 'class.CachedLDAP.inc.php', 'inc');
60                $this->registerFileInfo('BrowserInfo', 'class.BrowserInfo.inc.php', 'inc');
61                $this->registerFileInfo('JobScheduler', 'class.JobScheduler.inc.php', 'inc');
62                $this->registerFileInfo('JobRunner', 'class.JobRunner.inc.php', 'inc');
63                $this->registerFileInfo('Thread', 'class.Thread.inc.php', 'inc');
64                $this->registerFileInfo('Paging', 'class.Paging.inc.php', 'inc');
65                $this->registerFileInfo('FsUtils', 'class.fsutils.inc.php', 'inc');
66                $this->registerFileInfo('UserPictureProvider', 'class.UserPictureProvider.inc.php', 'inc');
67                $this->registerFileInfo('powergraphic', 'class.powergraphic.inc.php', 'inc');
68
69                $this->registerFileInfo('run_activity', 'class.run_activity.inc.php', 'inc');
70                $this->registerFileInfo('process_smarty', 'class.process_smarty.inc.php', 'inc');
71                $this->registerFileInfo('workflow_smarty', 'class.workflow_smarty.inc.php', 'inc');
72                $this->registerFileInfo('workflow_acl', 'class.workflow_acl.inc.php', 'inc');
73                $this->registerFileInfo('workflow_process', 'class.workflow_process.inc.php', 'inc');
74                $this->registerFileInfo('workflow_processmanager', 'class.workflow_processmanager.inc.php', 'inc');
75                $this->registerFileInfo('workflow_wfruntime', 'class.workflow_wfruntime.inc.php', 'inc');
76                $this->registerFileInfo('workflow_gui', 'class.workflow_gui.inc.php', 'inc');
77                $this->registerFileInfo('workflow_rolemanager', 'class.workflow_rolemanager.inc.php', 'inc');
78                $this->registerFileInfo('workflow_baseactivity', 'class.workflow_baseactivity.inc.php', 'inc');
79                $this->registerFileInfo('workflow_activitymanager', 'class.workflow_activitymanager.inc.php', 'inc');
80                $this->registerFileInfo('workflow_instance', 'class.workflow_instance.inc.php', 'inc');
81
82                $this->registerFileInfo('bo_monitors', 'class.bo_monitors.inc.php', 'inc');
83                $this->registerFileInfo('bo_adminaccess', 'class.bo_adminaccess.inc.php', 'inc');
84                $this->registerFileInfo('bo_userinterface', 'class.bo_userinterface.inc.php', 'inc');
85                $this->registerFileInfo('bo_participants', 'class.bo_participants.inc.php', 'inc');
86                $this->registerFileInfo('bo_agent_mail_smtp', 'class.bo_agent_mail_smtp.inc.php', 'inc');
87                $this->registerFileInfo('bo_editor', 'class.bo_editor.inc.php', 'inc');
88                $this->registerFileInfo('bo_utils', 'class.bo_utils.inc.php', 'inc');
89
90                $this->registerFileInfo('so_agent_mail_smtp', 'class.so_agent_mail_smtp.inc.php', 'inc');
91                $this->registerFileInfo('so_external_applications', 'class.so_external_applications.inc.php', 'inc');
92                $this->registerFileInfo('so_adminaccess', 'class.so_adminaccess.inc.php', 'inc');
93                $this->registerFileInfo('so_orgchart', 'class.so_orgchart.inc.php', 'inc');
94                $this->registerFileInfo('so_userinterface', 'class.so_userinterface.inc.php', 'inc');
95                $this->registerFileInfo('so_adminjobs', 'class.so_adminjobs.inc.php', 'inc');
96                $this->registerFileInfo('so_move_instances', 'class.so_move_instances.inc.php', 'inc');
97
98                /* job classes */
99                $this->registerFileInfo('AbsoluteDate', 'class.AbsoluteDate.inc.php', 'inc/jobs');
100                $this->registerFileInfo('RelativeDate', 'class.RelativeDate.inc.php', 'inc/jobs');
101                $this->registerFileInfo('WeekDate', 'class.WeekDate.inc.php', 'inc/jobs');
102
103                /* galaxia engine classes */
104                $this->registerFileInfo('GUI', 'GUI.php', 'inc/engine/src/GUI');
105                $this->registerFileInfo('ProcessManager', 'ProcessManager.php', 'inc/engine/src/ProcessManager');
106                $this->registerFileInfo('ActivityManager', 'ActivityManager.php', 'inc/engine/src/ProcessManager');
107                $this->registerFileInfo('InstanceManager', 'InstanceManager.php', 'inc/engine/src/ProcessManager');
108                $this->registerFileInfo('RoleManager', 'RoleManager.php', 'inc/engine/src/ProcessManager');
109                $this->registerFileInfo('JobManager', 'JobManager.php', 'inc/engine/src/ProcessManager');
110                $this->registerFileInfo('Process_GraphViz', 'GraphViz.php', 'inc/engine/src/ProcessManager');
111                $this->registerFileInfo('ProcessMonitor', 'ProcessMonitor.php', 'inc/engine/src/ProcessMonitor');
112                $this->registerFileInfo('Process', 'Process.php', 'inc/engine/src/API');
113                $this->registerFileInfo('Instance', 'Instance.php', 'inc/engine/src/API');
114                $this->registerFileInfo('Start', 'Start.php', 'inc/engine/src/API/activities');
115                $this->registerFileInfo('End', 'End.php', 'inc/engine/src/API/activities');
116                $this->registerFileInfo('Join', 'Join.php', 'inc/engine/src/API/activities');
117                $this->registerFileInfo('Split', 'Split.php', 'inc/engine/src/API/activities');
118                $this->registerFileInfo('Standalone', 'Standalone.php', 'inc/engine/src/API/activities');
119                $this->registerFileInfo('View', 'View.php', 'inc/engine/src/API/activities');
120                $this->registerFileInfo('SwitchActivity', 'SwitchActivity.php', 'inc/engine/src/API/activities');
121                $this->registerFileInfo('Activity', 'Activity.php', 'inc/engine/src/API/activities');
122                $this->registerFileInfo('BaseActivity', 'BaseActivity.php', 'inc/engine/src/API');
123
124                $this->registerFileInfo('ajax_ldap', 'class.ajax_ldap.inc.php', 'inc/engine');
125                $this->registerFileInfo('ajax_config', 'class.ajax_config.inc.php', 'inc/engine');
126                $this->registerFileInfo('WfRuntime', 'WfRuntime.php', 'inc/engine/src/common');
127                $this->registerFileInfo('WfSecurity', 'WfSecurity.php', 'inc/engine/src/common');
128
129                /* nano classes */
130                $this->registerFileInfo('Services_JSON', 'JSON.php', 'inc/nano');
131                $this->registerFileInfo('NanoRequest', 'NanoRequest.class.php', 'inc/nano');
132                $this->registerFileInfo('NanoController', 'NanoController.class.php', 'inc/nano');
133                $this->registerFileInfo('NanoJsonConverter', 'NanoJsonConverter.class.php', 'inc/nano');
134                $this->registerFileInfo('NanoSanitizer', 'NanoSanitizer.class.php', 'inc/nano');
135
136                /* natural classes */
137                $this->registerFileInfo('PosString', 'pos_string.php', 'inc/natural');
138                $this->registerFileInfo('NatType', 'nat_types.php', 'inc/natural');
139                $this->registerFileInfo('NaturalResultSet', 'class.natural_resultset.php', 'inc/natural');
140
141                /* registering egw external classes */
142                $this->registerFileInfo('db', 'class.db.inc.php', '', EGW_INC_ROOT);
143                $this->registerFileInfo('acl', 'class.acl.inc.php', '', EGW_INC_ROOT);
144                $this->registerFileInfo('accounts', 'class.accounts.inc.php', '', EGW_INC_ROOT);
145                $this->registerFileInfo('config', 'class.config.inc.php', '', EGW_INC_ROOT);
146                $this->registerFileInfo('common', 'class.common.inc.php', '', EGW_INC_ROOT);
147                $this->registerFileInfo('session', 'class.session.inc.php', '', EGW_INC_ROOT);
148                $this->registerFileInfo('nextmatchs', 'class.nextmatchs.inc.php', '', EGW_INC_ROOT);
149                $this->registerFileInfo('categories', 'class.categories.inc.php', '', EGW_INC_ROOT);
150                $this->registerFileInfo('listbox', 'class.listbox.inc.php', '', EGW_INC_ROOT);
151                $this->registerFileInfo('phpmailer', 'class.phpmailer.inc.php', '', EGW_INC_ROOT);
152
153                /**
154                 * It can cause some troubles. A class named 'bo' must be instantiated by a
155                 * Factory::getInstance('bo') call, that isn't really intuitive.. Something to
156                 * think about...
157                 */
158                $this->registerFileInfo('bo', 'class.bo.inc.php', 'emailadmin/inc', EGW_SERVER_ROOT);
159
160
161                /**
162                 * TODO - This is a veeery big workaround to maintain compatibility with
163                 * processes that uses the old non-static factory. So, we made this wrapper
164                 * (adapter) that just calls the new and cute static factory class in the
165                 * right way. It should be removed as soon as possible.
166                */
167                $this->registerFileInfo('ProcessWrapperFactory', 'ProcessWrapperFactory.php', 'lib/factory/');
168
169
170                /* ok. no more instances of this class.. */
171                self::$_instantiated = true;
172        }
173}
174
175?>
Note: See TracBrowser for help on using the repository browser.