On Feb 6, 2009, at 11:21 AM, Matteo Pelucco wrote:

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

It's own way, not really, but yes, there is some more to singleton components in Magnolia than plain old gof's singleton pattern.

If you're talking about module configuration beans, then see Will and Philippe's mails.

If you want swappable components, you can use FactoryUtil.getSingleton(class/interface), which will get you a singleton instance of the given class. If you pass it an interface or class name it knows about through properties, then it will return you that. You can have a property "com.foo.bar.MyInterface" with a value that is either a concrete implementation of that interface. It can also be a path to a configuration node ("/foo/bar" or "data:/chalala/ tralala"), in which case it will instanciate an ObservedObjectFactory, observing the given node and return you an instance of an object configured (using content2bean) from that node.

hth,

-g

----------------------------------------------------------------
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