Index: sandbox/workflow/branches/609/inc/local/classes/class.wf_instance.php
===================================================================
--- sandbox/workflow/branches/609/inc/local/classes/class.wf_instance.php	(revision 2253)
+++ sandbox/workflow/branches/609/inc/local/classes/class.wf_instance.php	(revision 2292)
@@ -456,9 +456,6 @@
 		if ($userID !== '*')
 		{
-			require_once dirname(__FILE__) . '/class.wf_role.php';
-			require_once dirname(__FILE__) . '/class.wf_engine.php';
-
-			$wfRole = new wf_role();
-			$engine = new wf_engine();
+			$wfRole = Factory::getInstance('wf_role');
+			$engine = Factory::getInstance('wf_engine');
 			/* get information about the activity */
 			if (($activityInfo = $engine->getActivityInformationByID($activityID)) === false)
@@ -529,6 +526,5 @@
 
 		/* try to get the role id */
-		require_once dirname(__FILE__) . '/class.wf_role.php';
-		$wfRole = new wf_role();
+		$wfRole = Factory::getInstance('wf_role');
 		if (($roleID = $wfRole->getRoleIdByName($roleName)) === false)
 			return false;
Index: sandbox/workflow/branches/609/inc/local/classes/class.wf_engine.php
===================================================================
--- sandbox/workflow/branches/609/inc/local/classes/class.wf_engine.php	(revision 2253)
+++ sandbox/workflow/branches/609/inc/local/classes/class.wf_engine.php	(revision 2292)
@@ -90,6 +90,5 @@
 	function continueInstance($activityID, $instanceID)
 	{
-		require_once 'class.wf_instance.php';
-		$WFInstance = new wf_instance();
+		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->continueInstance($activityID, $instanceID);
 	}
@@ -104,6 +103,5 @@
 	function abortInstance($instanceID)
 	{
-		require_once 'class.wf_instance.php';
-		$WFInstance = new wf_instance();
+		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->abort($instanceID);
 	}
@@ -119,6 +117,5 @@
 	function setInstanceName($instanceID, $name)
 	{
-		require_once 'class.wf_instance.php';
-		$WFInstance = new wf_instance();
+		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->setName($instanceID, $name);
 	}
@@ -134,6 +131,5 @@
 	function setInstancePriority($instanceID, $priority)
 	{
-		require_once 'class.wf_instance.php';
-		$WFInstance = new wf_instance();
+		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->setPriority($instanceID, $priority);
 	}
@@ -149,6 +145,5 @@
 	function getIdleInstances($numberOfDays, $activities = null)
 	{
-		require_once 'class.wf_instance.php';
-		$WFInstance = new wf_instance();
+		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->getIdle($numberOfDays, $activities);
 	}
@@ -175,6 +170,5 @@
 	function getInstancesByName($name)
 	{
-		require_once 'class.wf_instance.php';
-		$WFInstance = new wf_instance();
+		$WFInstance = &Factory::getInstance('wf_instance');
 		$preOutput = $WFInstance->getByName($name);
 		$output = array();
@@ -197,6 +191,5 @@
 	function getChildInstances($instanceID = null, $activityID = null)
 	{
-		require_once 'class.wf_instance.php';
-		$WFInstance = new wf_instance();
+		$WFInstance = Factory::getInstance('wf_instance');
 		$preOutput = $WFInstance->getChildren($instanceID, $activityID);
 		$output = array();
@@ -217,6 +210,5 @@
 	function getInstanceProperties($instanceID)
 	{
-		require_once 'class.wf_instance.php';
-		$WFInstance = new wf_instance();
+		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->getProperties($instanceID);
 	}
@@ -231,6 +223,5 @@
 	function getChildInstanceProperties($instanceID)
 	{
-		require_once 'class.wf_instance.php';
-		$WFInstance = new wf_instance();
+		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->getProperties($instanceID);
 	}
@@ -346,6 +337,5 @@
 	function getUserInstances($users, $activities = null, $status = null)
 	{
-		require_once 'class.wf_instance.php';
-		$WFInstance = new wf_instance();
+		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->getByUser($users, $activities, $status);
 	}
@@ -360,6 +350,5 @@
 	function setInstanceProperty($instanceID, $nameProperty, $value)
 	{
-		require_once 'class.wf_instance.php';
-		$WFInstance = new wf_instance();
+		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->setProperty($instanceID, $nameProperty, $value);
 	}
@@ -377,6 +366,5 @@
 	function checkUserAccessToInstance($userID, $instanceID, $activityID, $writeAccess = true)
 	{
-		require_once 'class.wf_instance.php';
-		$WFInstance = new wf_instance();
+		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->checkUserAccess($userID, $instanceID, $activityID, $writeAccess);
 	}
Index: sandbox/workflow/branches/609/inc/class.JobScheduler.inc.php
===================================================================
--- sandbox/workflow/branches/609/inc/class.JobScheduler.inc.php	(revision 2233)
+++ sandbox/workflow/branches/609/inc/class.JobScheduler.inc.php	(revision 2292)
@@ -194,5 +194,5 @@
 	Factory::getInstance('WorkflowMacro')->prepareEnvironment();
 
-	$job = new JobScheduler();
+	$job = Factory::newInstance('JobScheduler');
 	$job->run();
 }
Index: sandbox/workflow/branches/609/inc/class.ui_ajaxinterface.inc.php
===================================================================
--- sandbox/workflow/branches/609/inc/class.ui_ajaxinterface.inc.php	(revision 2233)
+++ sandbox/workflow/branches/609/inc/class.ui_ajaxinterface.inc.php	(revision 2292)
@@ -11,5 +11,4 @@
 \**************************************************************************/
 
-require_once 'class.workflow_acl.inc.php';
 require_once 'common.inc.php';
 require_once 'engine/class.ajax_config.inc.php';
@@ -50,5 +49,5 @@
 	function set_wf_session()
 	{
-		$acl = new workflow_acl();
+		$acl = Factory::getInstance('workflow_acl');
 		$_SESSION['phpgw_info']['workflow']['server_root'] = PHPGW_SERVER_ROOT;
 		$_SESSION['phpgw_info']['workflow']['phpgw_api_inc'] = PHPGW_API_INC;
Index: sandbox/workflow/branches/609/inc/class.ui_adminsource.inc.php
===================================================================
--- sandbox/workflow/branches/609/inc/class.ui_adminsource.inc.php	(revision 2233)
+++ sandbox/workflow/branches/609/inc/class.ui_adminsource.inc.php	(revision 2292)
@@ -17,5 +17,4 @@
  */
 require_once dirname(__FILE__) . SEP . 'class.ui_ajaxinterface.inc.php';
-require_once dirname(__FILE__) . SEP . 'class.workflow_acl.inc.php';
 require_once 'engine' . SEP . 'config.ajax.inc.php';
 
@@ -43,5 +42,5 @@
 	function ui_adminsource()
 	{
-		$this->workflow_acl = new workflow_acl();
+		$this->workflow_acl = Factory::getInstance('workflow_acl');
 		$denyAccess = true;
 		if ($this->workflow_acl->checkWorkflowAdmin($_SESSION['phpgw_info']['workflow']['account_id']))
Index: sandbox/workflow/branches/609/inc/class.bo_userinterface.inc.php
===================================================================
--- sandbox/workflow/branches/609/inc/class.bo_userinterface.inc.php	(revision 2291)
+++ sandbox/workflow/branches/609/inc/class.bo_userinterface.inc.php	(revision 2292)
@@ -12,5 +12,4 @@
 require_once('class.so_userinterface.inc.php');
 require_once('class.bo_ajaxinterface.inc.php');
-require_once('class.Paging.inc.php');
 
 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'GUI' . SEP . 'GUI.php');
@@ -148,5 +147,5 @@
 		$itemsPerPage = isset($preferences['ui_items_per_page']) ? $preferences['ui_items_per_page'] : 15;
 		$lightVersion = ((isset($preferences['use_light_interface']) ? $preferences['use_light_interface'] : 0) == 1);
-		$paging = new Paging($itemsPerPage, $_POST);
+		$paging = Factory::newInstance('Paging', $itemsPerPage, $_POST);
 
 		/* define the sorting */
@@ -726,5 +725,5 @@
 			/* paginate the result */
 			$itemsPerPage = isset($_SESSION['phpgw_info']['workflow']['user']['preferences']['ui_items_per_page']) ? $_SESSION['phpgw_info']['workflow']['user']['preferences']['ui_items_per_page'] : 15;
-			$paging = new Paging($itemsPerPage, $_POST);
+			$paging = Factory::newInstance('Paging', $itemsPerPage, $_POST);
 			$output['instances'] = $paging->restrictItems($output['instances']);
 			$output['paging_links'] = $paging->commonLinks();
Index: sandbox/workflow/branches/609/inc/class.ui_monitors.inc.php
===================================================================
--- sandbox/workflow/branches/609/inc/class.ui_monitors.inc.php	(revision 2253)
+++ sandbox/workflow/branches/609/inc/class.ui_monitors.inc.php	(revision 2292)
@@ -12,5 +12,4 @@
 
 require_once(dirname(__FILE__) . SEP . 'class.ui_ajaxinterface.inc.php');
-require_once(dirname(__FILE__) . SEP . 'class.workflow_acl.inc.php');
 /**
  * @package Workflow
@@ -37,5 +36,5 @@
 	{
 		$this->set_wf_session();
-		$this->workflow_acl = new workflow_acl();
+		$this->workflow_acl = Factory::getInstance('workflow_acl');
 
 		if (!($this->workflow_acl->checkUserGroupAccessToType('MON', $_SESSION['phpgw_info']['workflow']['account_id']) || ($this->workflow_acl->checkWorkflowAdmin($_SESSION['phpgw_info']['workflow']['account_id']))))
