|Subject:||[sca-j] JAVA-1: Moving the Domain URI from getService() to newInstance()|
|From:||Simon Nash (oas...@cjnash.com)|
|Date:||Jun 22, 2009 11:59:07 am|
Mike suggested on today's TC call that the domain URI could be moved from the SCAClient.getService() method to the SCAClientFactory.newInstance() method.
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).
To see why this in needed, consider the case of client code running within a VendorB runtime that has injected a VendorB factory finder. If the client code wants to access a domain DomainA that uses a VendorA implementation of the factory, the sequence of events is as follows:
1. Client calls SCAClientFactory.newInstance(properties, classLoader, "DomainA")
2. The VendorB factory finder looks up the VendorA factory class using the supplied properties and classLoader.
3. The VendorB factory finder does one of the following: a) calls a no-argument constructor on the VendorA factory class, then calls setDomainURI("DomainA") on the returned factory b) calls a one-argument constructor on the VendorA factory class, passing "DomainA" as the constructor argument In either case the result is an instance of Vendor A's factory implementation class that is bound to DomainA. If the domain URI were not passed in this step, the VendorA factory object would not know which domain URI to use for getService() calls.
4. Client calls the getService(interfaze, serviceURI) method on the VendorA/DomainA factory object returned by step 3. The VendorA concrete factory implementation class calls this.getDomainURI() to find the correct domain URI to use.
The above scheme is slightly more complex than the current proposal, but the "future-proofing" benefit may justify this.
--------------------------------------------------------------------- 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