SIF 3 Provider Exercise Java SIF 3 Provider

  • Slides: 8
Download presentation
SIF 3: Provider Exercise - Java SIF 3 Provider Exercise: School. Info Provider Presented

SIF 3: Provider Exercise - Java SIF 3 Provider Exercise: School. Info Provider Presented by: Joerg Huber

2 Setting the Scene ¡ ¡ Decide on Data Model Decide on SIF Object(s)

2 Setting the Scene ¡ ¡ Decide on Data Model Decide on SIF Object(s) – i. e. School. Info CRUD only DIRECT Environment l ¡ ¡ Environment Management Considerations No Events Immediate Request/Response Training Course SIF 3: Provider Exercise March 21 © Systemic Pty Ltd

3 Data Model Classes (as with Consumer) ¡ The SIF 3 Framework has a

3 Data Model Classes (as with Consumer) ¡ The SIF 3 Framework has a library with the SIF AU 1. 3 data model (sif. Data. Model_au 1. 3. jar). l l ¡ Generated based on SIF AU 1. 3 XSD. Has methods to marshal/unmarshal to/from XML Classes are named as the SIF Object: l l Single Student: School. Info. Type Student List: School. Collection. Type Refer to “First Consumer” presentation for more details on Data Model Classes. Training Course SIF 3: Provider Exercise March 21 © Systemic Pty Ltd

4 Core Object Provider Classes The following is a list of core classes required

4 Core Object Provider Classes The following is a list of core classes required for developing an Object Provider. Details will follow as part of the exercise. ¡ Base. Provider (CRUD) or Base. Event. Provider (CRUD & Events) l l ¡ Each SIF Object used in the final provider must extend one of these two classes. Forces a number of methods to be implemented Provider. Servlet. Context l l Initialises & frees up resources of a provider when webapp (provider) is started or shutdown. Already implemented. Developer does not need to do anything here (configured in web. xml) Training Course SIF 3: Provider Exercise March 21 © Systemic Pty Ltd

5 Steps developing an Object Provider ¡ ¡ For each SIF Object used in

5 Steps developing an Object Provider ¡ ¡ For each SIF Object used in the provider write a separate class extending Base. Provider or Base. Event. Provider Implement abstract and/or interface methods => May want to look into Student. Personal. Provider ¡ Link marshal/unmarshal with provider l l ¡ Ensures that SIF 3 Framework produces correct XML Use Data. Model. Unmarshal. Factory & Data. Model. Marshal. Factory from sif. Data. Model_au 1. 3. jar! Link SIF Object Class with each provider l l Implement get. Single. Object. Class. Info and get. Multi. Object. Class. Info methods to return appropriate Model. Object. Info (see demo code) Use predefined constants Training Course SIF 3: Provider Exercise March 21 © Systemic Pty Ltd

Steps developing an Object Provider 6 (cont. ) Note: You can read some School.

Steps developing an Object Provider 6 (cont. ) Note: You can read some School. Info objects from a file (refer to SIF 3 Training Exercises - Java. docx – Exercise 3 for details) ¡ CRUD Operations l Attempt to implement create. Single() ¡ l Attempt to implement retrieve() ¡ l Deal with “use. Advisory” parameter. Deal with “paging” Null out other methods. Training Course SIF 3: Provider Exercise March 21 © Systemic Pty Ltd

Steps developing an Object Provider 7 (cont. ) Configure the following in the provider.

Steps developing an Object Provider 7 (cont. ) Configure the following in the provider. properties file: ¡ List each provider class as a comma separated list in the “provider. classes” property ¡ Set the package name of the consumer classes in the “provider. base. Package. Name” property. As part of this training most of the above should be pre-set. Refer to Developer’s Guide for much more details on how to develop a provider. Training Course SIF 3: Provider Exercise March 21 © Systemic Pty Ltd

8 Run Object Provider ¡ Deploy your Object Provider to your web- or application

8 Run Object Provider ¡ Deploy your Object Provider to your web- or application container. l l l ¡ Within your IDE you should be able to run the Demo. Consumer class. It is an executable. l ¡ Deploy = Stop/Start your web- or application server. If you load schools from the supplied XML file you should see a log entry indicating 2 schools are loaded. If not check weather the property provider. school. file. location in the provider. properties file points to a valid location. Comment out School. Consumer methods. Observe the output on the command line… Training Course SIF 3: Provider Exercise March 21 © Systemic Pty Ltd