You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Simon Nash (JIRA)" <tu...@ws.apache.org> on 2007/05/14 23:33:16 UTC
[jira] Updated: (TUSCANY-1280) Use singleton factory pattern for
default factories
[ https://issues.apache.org/jira/browse/TUSCANY-1280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simon Nash updated TUSCANY-1280:
--------------------------------
Summary: Use singleton factory pattern for default factories (was: Use singleton factory pattern for )
> Use singleton factory pattern for default factories
> ---------------------------------------------------
>
> Key: TUSCANY-1280
> URL: https://issues.apache.org/jira/browse/TUSCANY-1280
> Project: Tuscany
> Issue Type: Improvement
> Components: Java SCA Kernel
> Affects Versions: Java-SCA-0.90
> Environment: Windows XP
> Reporter: Simon Nash
> Assigned To: Simon Nash
> Fix For: Java-SCA-0.90
>
>
> DefaultAssemblyFactory, DefaultPolicyFactory, DefaultWSDLFactory, and DefaultWebServiceBindingFactory are SPIs that extend from non-SPI factory implementation code. A cleaner solution is to use a singleton factory pattern to avoid the need for SPI classes to extend from non-SPI implementation classes.. See discussion from http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg17590.html quoted below
> >>> 3. DefaultAssemblyFactory is in the interface package
> >>> org.apache.tuscany.assembly, but it extends from AssemblyFactoryImpl
> >>> which is in the implementation package
> >>> org.apache.tuscany.assembly.impl.
> >>> This means that "impl" code is showing up indirectly as part of an
> >>> SPI interface. The same arrangement is used for
> >>> DefaultPolicyFactory,
> >>> DefaultWSDLFactory, and DefaultWebServiceBindingFactory.
> >>
> >>
> >>
> >> I don't find this shocking and I don't have a better (and reasonably
> >> simple) idea to improve this. Do you have a proposal?
> >> - move the XyzDefaultFactory to the impl package?
> >> - get rid of XyzDefaultFactory and have the people new up a
> >> XyzFactoryImpl directly?
> >> - any other suggestion?
> >>
> > On further consideration, I think this pattern is OK because there's
> > no direct reference from extension code to any impl class. Other
> > arrangements are possible, such as:
> >
> > package org.apache.tuscany.assembly;
> >
> > import org.apache.tuscany.assembly.impl.AssemblyFactoryImpl;
> >
> > public class DefaultAssemblyFactory {
> >
> > private static AssemblyFactory defaultFactory;
> >
> > public static AssemblyFactory getDefaultFactory() {
> > if (defaultFactory == null)
> > defaultFactory = new AssemblyFactoryImpl();
> > return defaultFactory;
> > }
> > }
> >
> > I think this is slightly cleaner, but it's not a big deal one way
> > or the other.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org