Isn't that what the ModuleRegistry class pretty much does? I might be wrong / misunderstanding your questions, but my modules also have a single module class instance created and managed by the ModuleRegistry:

ModuleRegistry.Factory.getInstance().getModuleInstance("my-module");

-will

On 06.02.2009, at 11:21, Matteo Pelucco wrote:


Hi all...

I have several modules, each of them with configurations, set of preloaded data... I've created a "moduleManager", with "domain methods" callable also from other modules. Some of them, are basically only configurations, loaded from JCR, database, running classes...
How can I register my class to be used as Singleton?
I need this class to be created when Magnolia start and maybe updated / destroyed / recreated some time (scheduler, maybe, or on my request).

SCENARIO:

I have a NewsManager which load from JCR news categories and stores them within an Array, with a getCategories() public method. I need this array everytime I want to load categories on the front- end (editing, update, viewing, menus...). So, I would like to call NewsManager.getInstance().getCategories() whenever I want but I don't want to go down on JCR everytime.

I've manage this with standard Singletons, but I've heard that Magnolia has its own way to manage singletons, isn't it?


Matteo


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------



----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to