I think the pluggability of the factory is still there, same as SCADomainFactory.newInstance().

SCADomainFactory.newInstance() can follow the typical factory pattern to search for the sub class of SCADomainFactory.

1) The META-INF/services/org.apache.tuscany.sca.SCADomainFactory
2) The system property named as "org.apache.tuscany.sca.SCADomainFactory"
3) The default implementation class (hard-coded)

If I understand correctly, Ant was proposing to have a shortcut 1) to replace 2).
1)
SCADomain domain = SCADomainFactory.createSCADomain("http://mydomain:7890/asmalldomain";);

2)
SCADomainFactory domainFactory = SCADomainFactory.newInstance();
SCADomain domain = domainFactory.createSCADomain("http://mydomain:7890/asmalldomain";);

Personally, I prefer the style 2). It's cleaner and it will be more flexible if we have than one methods on the SCADomainFactory.

Thanks,
Raymond

----- Original Message ----- From: "Jean-Sebastien Delfino" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, October 08, 2007 3:55 PM
Subject: Re: [DISCUSS] SCA Domain


ant elder wrote:
On 10/1/07, Jean-Sebastien Delfino <[EMAIL PROTECTED]> wrote:

ant elder wrote:

On 9/27/07, Jean-Sebastien Delfino <[EMAIL PROTECTED]> wrote:

<snip>



Why all the static and abstract methods? Is there a reason SCADomain


couldn't just be an interface with a separate for
creating
instances?



 I don't know. A factory works for me.


+1 for making SCADomain an interface

+1 for having a factory

So instead of:
SCADomain domain = SCADomain.newInstance(...)

We'll have:
SCADomainFactory domainFactory;
SCADomain domain = domainFactory.createSCADomain(domainURI)

Now how do people would like to the get factory? a pretty common

pattern

is:
SCADomainFactory domainFactory = SCADomainFactory.newInstance(...)

Is there a better pattern?

Does that answer the question about "why the static and abstract
methods"? :)


The question wasn't so much about why use static and abstract methods

but

why they were all munged into the one SCADomain class, now that its

accepted

that is better to have a separate SCADomain interface i think  its fine

to

keep the static and abstract methods on the SCADomainFactory as that

keeps

the API simple to use. So this code:

SCADomainFactory domainFactory = SCADomainFactory.newInstance();
SCADomain domain = domainFactory.createSCADomain("
http://mydomain:7890/asmalldomain";);

could be simplified to:

SCADomain domain = SCADomainFactory.createSCADomain("
http://mydomain:7890/asmalldomain";);

   ...ant



Can you help me understand:
- how people will be able to plug-in different factories?
- how to pass the factory to use? I'm not sure I understand how it'll be
possible with createSCADomain() being a static method.

Thanks

--
Jean-Sebastien



Um, it would just work similarly to the current SCADomain class, the impl of
any other static methods can still call newInstance so can still plug in
different factories.

   ...ant



Sorry I still don't understand how

SCADomain domain = SCADomainFactory.createSCADomain("http://mydomain:7890/asmalldomain";);

will allow to plug-in different factories. I'm guessing how it'll allow to plug-in different Domain implementations (like SCADomain did) but I'm confused by the factory proposal.

What will the factory look like to allow for pluggability? and once a factory has been selected how will it be passed around?

--
Jean-Sebastien


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



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

Reply via email to