Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 204838 - Refactor components to separate classes from factories
Summary: Refactor components to separate classes from factories
Status: CLOSED FIXED
Alias: None
Product: Community
Classification: Eclipse Foundation
Component: Project Management & Portal (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Gabe O'Brien CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-27 13:33 EDT by Bjorn Freeman-Benson CLA
Modified: 2013-09-13 16:19 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bjorn Freeman-Benson CLA 2007-09-27 13:33:09 EDT
For performance reasons, we should not be loading the class files each time we load the factory files. Thus we need to use dynamic loading and interfaces.
Comment 1 Karl Matthias CLA 2007-10-08 12:37:35 EDT
You can do this just by moving the require_once() calls into the function that instantiates an object.  Sometimes you have to then hide the class name from the parser so it doesn't complain about not knowing about this class.  I do this by saying something like:

$classname = 'project_committer';
$class = new $classname($context);

This will prevent the parser from complaining and still let us load the class dynamically.
Comment 2 Gabe O'Brien CLA 2008-04-10 15:35:44 EDT
I moved all of the require_once(...) calls inside around to reduce the runtime including (which is what this bug was all about) and created files for any objects that were in the same file as the factory.

I addition I refactored all the factories to now use one base class (abstractfactory).  Abstractfactory provides a generic getObjectForId,getObjectForContext and getActiveObjects implementation.

Each object that a factory can create is wrapped inside of a create objects function ( like create_bugzilla_objects).  That way we don't have to duplicate the security for creating objects (one for by context and another for by id). 

The functions getObjectsForContext and getObjectForId provided by abstractfactory both call a function in the factory called getObjects which then calls each private create function (like create_bugzilla_objects).


Comment 3 Karl Matthias CLA 2008-04-15 18:31:50 EDT
Released in STAGING_184