| From | Sent On | Attachments |
|---|---|---|
| Simon Nash | Jun 22, 2009 11:59 am | |
| Mike Edwards | Jun 24, 2009 7:08 am | |
| Simon Nash | Jun 25, 2009 3:30 am | |
| Mike Edwards | Jun 25, 2009 5:42 am | |
| Simon Nash | Jun 25, 2009 6:28 am |
| Subject: | Re: [sca-j] JAVA-1: Moving the Domain URI from getService() to newInstance() | |
|---|---|---|
| From: | Simon Nash (oas...@cjnash.com) | |
| Date: | Jun 25, 2009 6:28:26 am | |
| List: | org.oasis-open.lists.sca-j | |
What I had in mind was the following:
package org.oasisopen.sca.client;
import java.net.URI; import java.util.Properties;
public abstract class SCAClientFactory {
protected static SCAClientFactoryFinder defaultFactoryFinder; private URI domainURI;
private SCAClientFactory() { }
protected SCAClientFactory(URI domainURI) { this.domainURI = domainURI; }
protected URI getDomainURI() { return domainURI; }
public static SCAClient newInstance() { return newInstance(null, null, domainURI); }
public static SCAClient newInstance(Properties properties) { return newInstance(properties, null, domainURI); }
public static SCAClient newInstance(ClassLoader classLoader) { return newInstance(null, classLoader, domainURI); }
public static SCAClient newInstance(Properties properties, ClassLoader classLoader URI domainURI) { final SCAClientFactoryFinder finder = defaultFactoryFinder != null ? defaultFactoryFinder : new SCAClientFactoryFinderImpl(); final SCAClientFactory factory = finder.find(properties, classLoader, domainURI); return factory.createSCAClient(); }
protected abstract SCAClient createSCAClient(); }
The protected method getDomainURI() allows the vendor-specific subclass code to access the URI that was passed on the one-arg constructor. IMO this should not be a public method because it is part of the SPI, not the API.
Simon
Mike Edwards wrote:
Simon,
I had not gone in for the enforcement of the one arg constructor in the vendor ClientFactory classes, although the default FactoryFinder assumed its presence:
Constructor<? *extends* SCAClientFactory> URIConstructor = factoryImplClass.getConstructor(domainURI.getClass());
I can buy the argument for enforcement in the way you suggest and add the required constructor methods to SCAClientFactory.
What is the argument for the protected getDomainURI() method on SCAClientFactory? I can more easily see the argument for a public version of such a method, although it did not seem essential, which is why I left it out (to keep it as simple as possible)
Yours, Mike.
Strategist - Emerging Technologies, SCA & SDO. Co Chair OASIS SCA Assembly TC. IBM Hursley Park, Mail Point 146, Winchester, SO21 2JN, Great Britain. Phone & FAX: +44-1962-818014 Mobile: +44-7802-467431 Email: mike...@uk.ibm.com
Simon Nash <oas...@cjnash.com> wrote on 25/06/2009 11:31:24:
Mike Edwards wrote:
Folks,
I've done a pass at implementing Simon's thoughts in spec form here:
http://www.oasis-open.org/apps/org/workgroup/sca-j/download.php/ 33076/sca-javacaa-1.1-spec-cd02-rev3%20Issue1%20rev%207.doc
http://www.oasis-open.org/apps/org/workgroup/sca-j/download.php/ 33077/sca-javacaa-1.1-spec-cd02-rev3%20Issue1%20rev%207.pdf
I took a quick look through this and I don't see anything to support the following requirement from my previous email about this:
To make this work in the VendorA/VendorB situation that we have been discussing, it would be necessary to also do one of the following: a) add additional methods setDomainURI() and getDomainURI() to the SCAClientFactory abstract class b) require every factory to have a one-argument constructor that takes the domain URI as an argument. This could be enforced by putting a private no-argument constructor and a protected one-argument contructor on the SCAClientFactory abstract class, together with a protected concrete getDomainURI() method that returns the domain URI. Of these two options, my preference is for b).
Please refer to my previous email for more detail on why this is needed.
------------------------------------------------------------------------
/ /
/Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU/
--------------------------------------------------------------------- To unsubscribe from this mail list, you must leave the OASIS TC that generates this mail. Follow this link to all your TCs in OASIS at: https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php





