140 likes | 193 Views
Lecture 7. Interaction. Topics. Implementing data flows An internet solution Transactions in MySQL 4-tier systems – business rule/presentation separation Forms and URL in PHP User modelling Long running processes. Service Provider. Consolidator. extract. Schedule data.
E N D
Lecture 7 Interaction
Topics • Implementing data flows • An internet solution • Transactions in MySQL • 4-tier systems – business rule/presentation separation • Forms and URL in PHP • User modelling • Long running processes
Service Provider Consolidator extract Schedule data Validate and load Consolidated schedules
Typical implementation • The provider prepares the schedule file – e.g. extract process in scheduling software • The file is transmitted to the consolidator • mailing a floppy disk • emailing the file • ftp’ing the file … • The consolidator’s system has a scheduled task to pick up new schedule files, process them against the database and log any errors. • The report of the success or the list of errors must be returned to the provider
Internet solution • Consolidator provides form • Provider selects schedule file • Schedule file sent to server • Server executes script to: • validate data • Update database • Return log of actions and errors
Summary of actions • Script generates the form and returns it • User selects file • PUT action sends file to server • Script reads (parses) file (from temporary folder) • Script validates file • Script creates SQL statements to update the database • Script executes SQL in a TRANSACTION • Script returns the log of actions and errors
4-tier systems • Consider the task of displaying the number of minutes to the next bus on a given route. • This information can be requested • Via a web form • Via a Wap phone • Via SMS • From a partner system • Need to separate: • Logic to process the request and get the minutes to go – Business logic • Logic to respond to input and present data appropriate to interface - Presentation
SMS caller Browser routettg?rn=70 SMS message Sms request HTML Get view of data and format as Web Page (source) Get view and return SMS message Nextbus?routeno=70 minutes Compute next bus time(source) 4-tier system
user browser Server1 Server2 db Sequence diagram
PHP and forms • Fields on form are named • e.g. route • When form submitted with GET, name/value pairs are attached to URL • e.g. prog.php?route=70 • In script, values are accessed with variables of the same name • e.g. If ($route == ’70’)…
PHP and URLs • PHP can open URL just like a file • e.g. $fn= fopen(“http://www.google.com/search?q=SMS”); • Parameters can be included in URL • Web services provide more powerful interface
Long Running Processes • Users are concerned with units of work which are bigger than a single interaction • Issuing a new schedule (with all the attendant changes that have to take place) • On-line shopping order and delivery • Exam preparation and monitoring • Much interest in support for ‘Business Processes’ • Languages and notations to define business processes • ebXML, RAD, Activity Diagrams
Tutorial • To discuss the issues in the Exercises • Design, no implementation (unless you want to) • Questions appropriate to the exam