OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

sca-j message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [sca-j] [JAVA-1] Updated code proposal


Mark Combellack wrote:
> Hi,
> 
>  
> 
> I have updated the code for JAVA-1 based on our recent discussions to 
> include the following requested changes from the previous version.
> 
>  
> 
>     * Moved the SCAClient and SCAClientFactory client code into
>       org.oasisopen.sca.client package
>     * Renamed the package containing the SCAClientFactoryFinder from
>       org.oasisopen.sca.impl to org.oasisopen.sca.client.spi
 >
This class is a reference implementation and therefore should be in
the org.oasisopen.sca.client.impl package.  It is not an SPI interface
to be implemented by vendors.  (The comment at the start of this class is
highly misleading.)  The vendor extension point is to inject a concrete
subclass of SCAClientFactory into the SCAClientFactory.defaultFactory
field, not to replace this class.  I thought this was where we ended up
in our last discussion.

   Simon

>     * Split the test cases into separate Eclipse projects to show the
>       different ways that a Vendor can integrate their implementation:
> 
> ·         Project java-1-samplevendor-systemproperties            Sample 
> vendor implementation that uses System Properties
> 
> ·         Project java-1-samplevendor-METAINFservices           Sample 
> vendor implementation that uses META-INF/services file
> 
> ·         Project java-1-samplevendor-injection                         
> Sample vendor implementation that uses direct injection into 
> SCAClientFactory
> 
>  
> 
>  
> 
> 
>     */Code Overview/*
> 
> * *
> 
> *SCA Client Perspective*
> 
>  
> 
> The scenario is fairly simple – some code that is running outside of the 
> SCA Domain wants to lookup and use a Service that is inside the domain.
> 
>  
> 
> The following code shows how the HelloService could be looked up and 
> invoked from unmanaged SCA Code.
> 
>  
> 
>         *final* String serviceURI = "SomeHelloServiceURI";
> 
>         *final* URI domainURI = *new* URI("SomeDomainURI");
> 
>        
> 
>         *final* SCAClient scaClient = SCAClientFactory.newInstance();
> 
>         *final* HelloService helloService = 
> scaClient.getService(HelloService.*class*, serviceURI, domainURI);
> 
>         *final* String reply = helloService.sayHello("Mark");
> 
>  
> 
> The client first calls SCAClientFactory./newInstance()/ that returns an 
> instance of SCAClient. This SCAClient instance can then be used to look 
> up the HelloService
> 
>  
> 
>  
> 
> *SCAClient Interface*
> 
>  
> 
> The definition of SCAClient interface would be:
> 
>  
> 
> *public* *interface* SCAClient {
> 
>  
> 
>     <_T_> T getService(Class<T> _interfaze_, String serviceURI, URI 
> domainURI)
> 
>         *throws* _NoSuchServiceException_, _NoSuchDomainException_;   
> 
> }
> 
>  
> 
>  
> 
> *SCAClientFactory** class*
> 
>  
> 
> The SCAClientFactory abstract class is responsible for providing the 
> indirection from the user’s generic SCA code and the vendor’s 
> implementation of the SCA Runtime. The user’s code will ask it for a 
> SCAClient via the /newInstance/() method.
> 
>  
> 
> The SCAClientFactory class provides this indirection to the vendor’s 
> implementation by:
> 
>  
> 
>     * if a defaultFactory has been injected then use it.
>     * If no defaultFactory has been injected then delegate to the
>       SCAClientFactoryFinder
> 
>  
> 
> The code for the SCAClientFactory is now quite short and consists of 
> (I’ve trimmed the JavaDoc to make it easer to read in this email)
> 
>  
> 
> *public* *abstract* *class* SCAClientFactory {
> 
>  
> 
>     *private* *static* SCAClientFactory /defaultFactory/;
> 
>  
> 
>     *public* *static* SCAClient newInstance() {
> 
>         *return* /newInstance/(*null*, *null*);
> 
>     }
> 
>  
> 
>     *public* *static* SCAClient newInstance(Properties properties) {
> 
>         *return* /newInstance/(properties, *null*);
> 
>     }
> 
>  
> 
>     *public* *static* SCAClient newInstance(ClassLoader classLoader) {
> 
>         *return* /newInstance/(*null*, classLoader);
> 
>     }
> 
>  
> 
>     *public* *static* SCAClient newInstance(Properties properties, 
> ClassLoader classLoader) {
> 
>         *final* SCAClientFactory factory;
> 
>         *if*(/defaultFactory/ == *null*) {
> 
>             factory = SCAClientFactoryFinder./find/(properties, 
> classLoader);
> 
>         } *else* {
> 
>             factory = /defaultFactory/;
> 
>         }
> 
>         *return* factory.createSCAClient();
> 
>     }
> 
>  
> 
>     *protected* *abstract* SCAClient createSCAClient();
> 
> }
> 
>  
> 
>  
> 
> *SCAClientFactoryFinder** class*
> 
>  
> 
> SCA will provide a /reference implementation/ of the SCAClientFactory 
> class. It will discover the Vendors SCAClientFactory implementation by 
> referring to the following information:
> 
>  
> 
>     * The org.oasisopen.sca.client.SCAClientFactory property from the
>       Properties specified on the newInstance() method call if specified
>     * The org.oasisopen.sca.client.SCAClientFactory property from the
>       System Properties
>     * The META-INF/services/org.oasisopen.sca.client.SCAClientFactory file
> 
>  
> 
> Since this is a /reference implementation/ Vendors are free to replace 
> the SCAClientFactoryFinder class with an alternative implementation that 
> meets the lookup mechanisms require for their SCA Runtime.
> 
>  
> 
>  
> 
> 
>     */What does the Vendor need to do?/*
> 
>  
> 
> *Implement their **SCAClientFactory** and **SCAClient** implementation 
> classes*
> 
>  
> 
> Vendors need to provide an implementation of SCAClient that is capable 
> of looking up Services in their SCA Runtime.
> 
>  
> 
> Vendors need to subclass SCAClientFactory and implement the 
> createSCAClient() method so that it creates an instance of their 
> SCAClient implementation.
> 
>  
> 
>  
> 
> *Configure the Vendor Implementation classes so they are used*
> 
>  
> 
> Vendors have several options:
> 
>  
> 
> _Option 1: Set System Property to point to the Vendor’s implementation_
> 
>  
> 
> Vendors set the org.oasisopen.sca.client.SCAClientFactory System 
> Property to point to their implementation class and use the reference 
> implementation of SCAClientFactoryFinder
> 
>  
> 
> _Option 2: Provide a META-INF/services file_
> 
>  
> 
> Vendors provide a 
> META-INF/services/org.oasisopen.sca.client.SCAClientFactory file that 
> points to their implementation class and use the reference 
> implementation of SCAClientFactoryFinder
> 
>  
> 
> _Option 3: Inject a vendor implementation instance into 
> __SCAClientFactory___
> 
>  
> 
> Vendors inject an instance into the defaultFactory field of 
> SCAClientFactory. The SCAClientFactoryFinder is not used in this scenario.
> 
>  
> 
> _Option 4: Provide a Vendor specific implementation of 
> __SCAClientFactoryFinder___
> 
>  
> 
> Vendors write a new implementation of SCAClientFactoryFinder and replace 
> the /reference implementation/ that is provided by SCA.
> 
>  
> 
>  
> 
>  
> 
> 
>     */Source Code/*
> 
>  
> 
> I have attached a ZIP file that contains the source code, unit tests and 
> an Eclipse project files for JAVA-1. The projects are:
> 
>  
> 
> JAVA-1-Code-Proposal                                       Code proposal 
> for JAVA-1
> 
> JAVA-1-SampleVendor-Injection                          Sample Vendor 
> implementation that injects directly into SCAClientFactory
> 
> JAVA-1-SampleVendor-METAINFservices            Sample Vendor 
> implementation that uses a META-INF/services file
> 
> JAVA-1-SampleVendor-SystemProperties            Sample Vendor 
> implementation that uses System Properties.
> 
> JAVA-1-SampleCommonCode                             Sample Service that 
> is used as part of the demonstration of the vendor code
> 
>  
> 
>  
> 
> When loading the Eclipse project files, you may need to set the target 
> JDK to match the JDK you have installed. To do this simply:
> 
>  
> 
>     * Select the Properties menu item on the Project menu.
>     * Select the Java Build Path in the list on the left hand side
>     * Select the JRE System Library on the right hand side
>     * Press the Edit button
>     * Make sure the workspace default JRE is selected and press Finish
>     * Press OK
> 
>  
> 
>  
> 
>  
> 
> I would appreciate your thoughts/comments on this updated proposal.
> 
>  
> 
> Thanks,
> 
>  
> 
> Mark
> 
> Mark Combellack| Software Developer| Avaya | Eastern Business Park | St. 
> Mellons | Cardiff | CF3 5EA | Voice: +44 (0) 29 2081 7624 | 
> mcombellack@avaya.com <mailto:|mcombellack@avaya.com>
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> 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 




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]