Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-dev] Please stop to hardcode concrete class instantiation

Hi Sebastien,

   EclipseLink is highly extensible and over the years I have extended it and plugged in custom policies to get it to do all kinds of things.  A recent example of doing this is my work on Teneo integrating EMF (Eclipse Modeling Framework) with EclipseLink.

   That being said, it could be more extensible and pluggable in many areas.  We could delegate *all* class instantiation to pluggable factories or identify concrete classes to instantiate through config file properties but this is obviously overkill.   There are probably only a handful of classes that need this treatment and the only way we'll figure out which handful is through feedback like yours.  You've run into a case where you'd like to replace SessionBroker with a custom class and so I recommend you file a specific bug for this and possibly in a separate bug suggestions on a mechanism to address general plugability.  This has come up recently in the context of OSGi in which a bundle fragment was used to contribute a platform specific version of an EclipseLink class.  I'd definitely want to ensure that any approach we take to plugability works in all environments.


Sebastien Tardif wrote:
Please stop to hardcode concrete class instantiation.

In the code below, I don't see why you assume that SessionBroker should
not be replaced by customer, using derived class, knowing that it is not
really tested and coded well.

Even if you believe some concrete class already have some hooks. You do
not know all your customer needs. You should have as much hooks as
possible. The basic start is to externalize resolution of the classes to

Thanks for your understanding.

    protected SessionBroker buildSessionBrokerConfig(SessionBrokerConfig
sessionBrokerConfig) {
        SessionBroker sessionBroker = new SessionBroker();
eclipselink-dev mailing list


Shaun Smith | Principal Product Manager | Phone: +19055023094
Oracle Server Technologies, Oracle TopLink
ORACLE Canada | 110 Matheson Boulevard West, Suite 100, Mississauga, Ontario | L5R 3P4
Green Oracle Oracle is committed to developing practices and products that help protect the environment

Back to the top