At 11:08 AM 8/5/2003 -0400, you wrote:

Here is something I want throw out and see if it makes sense. How about we write an object instance factory class that we can pass a key into and get a concrete class instance?


Example:

ObjectInstanceFactory.newInstance("org.apache.om.pluto.Preference:defintion")

Would return a org.apache.jetspeed.om.preference.PreferenceImpl instance.


Were as


ObjectInstanceFactory.newInstance("org.apache.om.pluto.Preference:user")

Would return a org.apache.jetspeed.om.preference.UserPreferenceImpl instance.

Or we could use a discovery mechanism to find and load concrete classes.

The end result I am aiming for is to get away from directly invoking constructors on specific objects, i.e. hide the implementation as much as possible.

The more suggestions on how to approach this the better.

Actually I really like that pattern and have been using for my projects with a lot of success. One thing that could be done is combine the getPortletUniqueID with the newInstance() call...


Something like this :

        UniqueObjectID uid = JetspeedPortletID.getPortletUniqueID();
        ObjectInstanceFactory.newInstance(uid);

You could also subclass UniqueObjectID for the various objects that can be used through the instance factory. And you can have the object instances return their uid which is always nice.

This can become quite generic and go all the way to a network unique identifier but I think that for the needs here an instance factory would be great.

Regards,
  Serge Huber.



- -- --- -----=[ shuber2 at jahia dot com ]=---- --- -- -
www.jahia.org : A collaborative source CMS and Portal Server



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to