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 | */ |
---|
24 | final 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('Logger', 'class.Logger.inc.php', 'inc'); |
---|
66 | $this->registerFileInfo('FsUtils', 'class.fsutils.inc.php', 'inc'); |
---|
67 | $this->registerFileInfo('UserPictureProvider', 'class.UserPictureProvider.inc.php', 'inc'); |
---|
68 | $this->registerFileInfo('powergraphic', 'class.powergraphic.inc.php', 'inc'); |
---|
69 | |
---|
70 | $this->registerFileInfo('run_activity', 'class.run_activity.inc.php', 'inc'); |
---|
71 | $this->registerFileInfo('process_smarty', 'class.process_smarty.inc.php', 'inc'); |
---|
72 | $this->registerFileInfo('workflow_smarty', 'class.workflow_smarty.inc.php', 'inc'); |
---|
73 | $this->registerFileInfo('workflow_acl', 'class.workflow_acl.inc.php', 'inc'); |
---|
74 | $this->registerFileInfo('workflow_process', 'class.workflow_process.inc.php', 'inc'); |
---|
75 | $this->registerFileInfo('workflow_processmanager', 'class.workflow_processmanager.inc.php', 'inc'); |
---|
76 | $this->registerFileInfo('workflow_wfruntime', 'class.workflow_wfruntime.inc.php', 'inc'); |
---|
77 | $this->registerFileInfo('workflow_gui', 'class.workflow_gui.inc.php', 'inc'); |
---|
78 | $this->registerFileInfo('workflow_rolemanager', 'class.workflow_rolemanager.inc.php', 'inc'); |
---|
79 | $this->registerFileInfo('workflow_baseactivity', 'class.workflow_baseactivity.inc.php', 'inc'); |
---|
80 | $this->registerFileInfo('workflow_activitymanager', 'class.workflow_activitymanager.inc.php', 'inc'); |
---|
81 | $this->registerFileInfo('workflow_instance', 'class.workflow_instance.inc.php', 'inc'); |
---|
82 | |
---|
83 | $this->registerFileInfo('bo_monitors', 'class.bo_monitors.inc.php', 'inc'); |
---|
84 | $this->registerFileInfo('bo_adminaccess', 'class.bo_adminaccess.inc.php', 'inc'); |
---|
85 | $this->registerFileInfo('bo_userinterface', 'class.bo_userinterface.inc.php', 'inc'); |
---|
86 | $this->registerFileInfo('bo_participants', 'class.bo_participants.inc.php', 'inc'); |
---|
87 | $this->registerFileInfo('bo_agent_mail_smtp', 'class.bo_agent_mail_smtp.inc.php', 'inc'); |
---|
88 | $this->registerFileInfo('bo_editor', 'class.bo_editor.inc.php', 'inc'); |
---|
89 | $this->registerFileInfo('bo_utils', 'class.bo_utils.inc.php', 'inc'); |
---|
90 | |
---|
91 | $this->registerFileInfo('so_agent_mail_smtp', 'class.so_agent_mail_smtp.inc.php', 'inc'); |
---|
92 | $this->registerFileInfo('so_external_applications', 'class.so_external_applications.inc.php', 'inc'); |
---|
93 | $this->registerFileInfo('so_adminaccess', 'class.so_adminaccess.inc.php', 'inc'); |
---|
94 | $this->registerFileInfo('so_orgchart', 'class.so_orgchart.inc.php', 'inc'); |
---|
95 | $this->registerFileInfo('so_userinterface', 'class.so_userinterface.inc.php', 'inc'); |
---|
96 | $this->registerFileInfo('so_adminjobs', 'class.so_adminjobs.inc.php', 'inc'); |
---|
97 | $this->registerFileInfo('so_move_instances', 'class.so_move_instances.inc.php', 'inc'); |
---|
98 | |
---|
99 | /* job classes */ |
---|
100 | $this->registerFileInfo('AbsoluteDate', 'class.AbsoluteDate.inc.php', 'inc/jobs'); |
---|
101 | $this->registerFileInfo('RelativeDate', 'class.RelativeDate.inc.php', 'inc/jobs'); |
---|
102 | $this->registerFileInfo('WeekDate', 'class.WeekDate.inc.php', 'inc/jobs'); |
---|
103 | |
---|
104 | /* galaxia engine classes */ |
---|
105 | $this->registerFileInfo('GUI', 'GUI.php', 'inc/engine/src/GUI'); |
---|
106 | $this->registerFileInfo('ProcessManager', 'ProcessManager.php', 'inc/engine/src/ProcessManager'); |
---|
107 | $this->registerFileInfo('ActivityManager', 'ActivityManager.php', 'inc/engine/src/ProcessManager'); |
---|
108 | $this->registerFileInfo('InstanceManager', 'InstanceManager.php', 'inc/engine/src/ProcessManager'); |
---|
109 | $this->registerFileInfo('RoleManager', 'RoleManager.php', 'inc/engine/src/ProcessManager'); |
---|
110 | $this->registerFileInfo('JobManager', 'JobManager.php', 'inc/engine/src/ProcessManager'); |
---|
111 | $this->registerFileInfo('Process_GraphViz', 'GraphViz.php', 'inc/engine/src/ProcessManager'); |
---|
112 | $this->registerFileInfo('ProcessMonitor', 'ProcessMonitor.php', 'inc/engine/src/ProcessMonitor'); |
---|
113 | $this->registerFileInfo('Process', 'Process.php', 'inc/engine/src/API'); |
---|
114 | $this->registerFileInfo('Instance', 'Instance.php', 'inc/engine/src/API'); |
---|
115 | $this->registerFileInfo('Start', 'Start.php', 'inc/engine/src/API/activities'); |
---|
116 | $this->registerFileInfo('End', 'End.php', 'inc/engine/src/API/activities'); |
---|
117 | $this->registerFileInfo('Join', 'Join.php', 'inc/engine/src/API/activities'); |
---|
118 | $this->registerFileInfo('Split', 'Split.php', 'inc/engine/src/API/activities'); |
---|
119 | $this->registerFileInfo('Standalone', 'Standalone.php', 'inc/engine/src/API/activities'); |
---|
120 | $this->registerFileInfo('View', 'View.php', 'inc/engine/src/API/activities'); |
---|
121 | $this->registerFileInfo('SwitchActivity', 'SwitchActivity.php', 'inc/engine/src/API/activities'); |
---|
122 | $this->registerFileInfo('Activity', 'Activity.php', 'inc/engine/src/API/activities'); |
---|
123 | $this->registerFileInfo('BaseActivity', 'BaseActivity.php', 'inc/engine/src/API'); |
---|
124 | |
---|
125 | $this->registerFileInfo('ajax_ldap', 'class.ajax_ldap.inc.php', 'inc/engine'); |
---|
126 | $this->registerFileInfo('ajax_config', 'class.ajax_config.inc.php', 'inc/engine'); |
---|
127 | $this->registerFileInfo('WfRuntime', 'WfRuntime.php', 'inc/engine/src/common'); |
---|
128 | $this->registerFileInfo('WfSecurity', 'WfSecurity.php', 'inc/engine/src/common'); |
---|
129 | |
---|
130 | /* nano classes */ |
---|
131 | $this->registerFileInfo('Services_JSON', 'JSON.php', 'inc/nano'); |
---|
132 | $this->registerFileInfo('NanoRequest', 'NanoRequest.class.php', 'inc/nano'); |
---|
133 | $this->registerFileInfo('NanoController', 'NanoController.class.php', 'inc/nano'); |
---|
134 | $this->registerFileInfo('NanoJsonConverter', 'NanoJsonConverter.class.php', 'inc/nano'); |
---|
135 | $this->registerFileInfo('NanoSanitizer', 'NanoSanitizer.class.php', 'inc/nano'); |
---|
136 | |
---|
137 | /* natural classes */ |
---|
138 | $this->registerFileInfo('PosString', 'pos_string.php', 'inc/natural'); |
---|
139 | $this->registerFileInfo('NatType', 'nat_types.php', 'inc/natural'); |
---|
140 | $this->registerFileInfo('NaturalResultSet', 'class.natural_resultset.php', 'inc/natural'); |
---|
141 | |
---|
142 | /* registering egw external classes */ |
---|
143 | $this->registerFileInfo('db', 'class.db.inc.php', '', EGW_INC_ROOT); |
---|
144 | $this->registerFileInfo('acl', 'class.acl.inc.php', '', EGW_INC_ROOT); |
---|
145 | $this->registerFileInfo('accounts', 'class.accounts.inc.php', '', EGW_INC_ROOT); |
---|
146 | $this->registerFileInfo('config', 'class.config.inc.php', '', EGW_INC_ROOT); |
---|
147 | $this->registerFileInfo('common', 'class.common.inc.php', '', EGW_INC_ROOT); |
---|
148 | $this->registerFileInfo('sessions', 'class.sessions.inc.php', '', EGW_INC_ROOT); |
---|
149 | $this->registerFileInfo('nextmatchs', 'class.nextmatchs.inc.php', '', EGW_INC_ROOT); |
---|
150 | $this->registerFileInfo('categories', 'class.categories.inc.php', '', EGW_INC_ROOT); |
---|
151 | $this->registerFileInfo('listbox', 'class.listbox.inc.php', '', EGW_INC_ROOT); |
---|
152 | $this->registerFileInfo('phpmailer', 'class.phpmailer.inc.php', '', EGW_INC_ROOT); |
---|
153 | |
---|
154 | /** |
---|
155 | * It can cause some troubles. A class named 'bo' must be instantiated by a |
---|
156 | * Factory::getInstance('bo') call, that isn't really intuitive.. Something to |
---|
157 | * think about... |
---|
158 | */ |
---|
159 | $this->registerFileInfo('bo', 'class.bo.inc.php', 'emailadmin/inc', EGW_SERVER_ROOT); |
---|
160 | |
---|
161 | |
---|
162 | /** |
---|
163 | * TODO - This is a veeery big workaround to maintain compatibility with |
---|
164 | * processes that uses the old non-static factory. So, we made this wrapper |
---|
165 | * (adapter) that just calls the new and cute static factory class in the |
---|
166 | * right way. It should be removed as soon as possible. |
---|
167 | */ |
---|
168 | $this->registerFileInfo('ProcessWrapperFactory', 'ProcessWrapperFactory.php', 'lib/factory/'); |
---|
169 | |
---|
170 | |
---|
171 | /** |
---|
172 | * TODO - This is another ATR - Alternative Technical Resource (common known |
---|
173 | * as workaround) to allow instantiation of "wf" classes. Although these classes |
---|
174 | * should have not been instanciated by the workflow module, some of them are |
---|
175 | * instantiated by run_activity during every execution. =( |
---|
176 | * In a new version of MVC these objects must be created by the Processes. |
---|
177 | */ |
---|
178 | $this->registerFileInfo('wf_natural', 'class.wf_natural.php', 'inc/local/classes'); |
---|
179 | $this->registerFileInfo('wf_db', 'class.wf_db.php', 'inc/local/classes'); |
---|
180 | |
---|
181 | |
---|
182 | /* ok. no more instances of this class.. */ |
---|
183 | self::$_instantiated = true; |
---|
184 | } |
---|
185 | } |
---|
186 | |
---|
187 | ?> |
---|