Webobjects Technical Overview
Total Page:16
File Type:pdf, Size:1020Kb
Session 401 WebObjects Technical Overview Steve Hayman Systems Engineer, Apple iServices 1 Apple Confidential 6/28/00 Introduction • Understand the WO architecture • See the tools, frameworks, and development process in action 2 Apple Confidential 6/28/00 What You’ll Learn • WO Tools • WO Frameworks • WO Deployment • Understand the titles of the other WO sessions 406—Rapid Development with Direct to Java Client 3 Apple Confidential 6/28/00 What WebObjects Does • It’s an Application Server • Who invented that term anyway? • It’s more than just that – Developer Tools – Pre-written objects (Frameworks) The best part! – Runtime environment – Monitoring and control tools 4 Apple Confidential 6/28/00 For Instance Java Clients Web Browsers Data Services Web Servers Distributed Objects Data Sources 5 Apple Confidential 6/28/00 Who WebObjects Is For • Developers • Very powerful • Steep learning curve • But that’s OK 6 Apple Confidential 6/28/00 WebObjects Works With… • Java. Objective-C. WebScript • Databases—Oracle, Informix, Sybase, SQL Server, LDAP, OpenBase, FrontBase, … • Mainframes—CORBA, 3270 screen-scraping • Different UIs—HTML, WAP, PDF, XML • Most web servers—Apache, Netscape, IIS • Lots of 3rd-party objects and APIs • Open open open open open open open open 7 Apple Confidential 6/28/00 Where You Can Use WebObjects • Develop on Mac OS X, Mac OS X Server, or Windows NT • Deploy on OS X, OS X Server, NT, Solaris, HP/UX, Linux – (Note: database support varies by platform) • Mix and match as needed • Start small and grow bigger 8 Apple Confidential 6/28/00 Start With This… 9 Apple Confidential 6/28/00 417—Building …And Scale Easily to This Large-Scale Apps Browsers Multiple Databases Multiple Multiple WO HTTP Servers App Servers 10 Apple Confidential 6/28/00 Key Ideas • Web Components (front-end) • Enterprise Objects (back-end) • Kept completely separate • Bound together at runtime 11 Apple Confidential 6/28/00 Web Components • HTML templates + • <WEBOBJECT> tags that indicate where something interesting and dynamic happens + • Bindings that fill in the blanks + • Lots of pre-written objects to reuse 12 Apple Confidential 6/28/00 What Comes Out of a Component? • A string—of your choice – Plain text – HTML – Image data – JavaScript commands – AppleScript commands – … 13 Apple Confidential 6/28/00 Non-HTML Components Too • PDF • WAP • XML Mix and match 14 Apple Confidential 6/28/00 Enterprise Objects • Java objects that implement your business rules… – Customer, Order, Product, Vehicle, Package, Option • Adaptors that speak to databases – Oracle, Sybase, Informix, LDAP… • Models that connect objects to databases – Customer Oracle CUST table – Vehicle Informix VHCL table • Relationships between objects – Customer has a list of Vehicles 15 Apple Confidential 6/28/00 EOF Is the Real Gem Here! • Pure business objects • Totally UI independent • Totally database independent • Persistence is completely managed for you 403—Persistent Object Modeling with EOModeler 16 Apple Confidential 6/28/00 (And Coming Soon—EJB) 407—WebObjects: EJB 17 Apple Confidential 6/28/00 … All Bound Together… • WO app – Loads components – Finds <WEBOBJECT> tags – Fetches and sends messages to Enterprise Objects – Mixes results into the component • User sees plain HTML (PDF, WAP, XML) • Customize the entire process at runtime if needed 18 Apple Confidential 6/28/00 …With Advanced Session Management… • WO manages an extensible Session object for each individual user • Also an Application object shared by all • Complete control over session creation and archiving • Extend Session to add security, shopping carts, user preferences, personalization and so on 19 Apple Confidential 6/28/00 … and Runtime Monitoring Tools • Monitor – WO application that manages your big honkin’ deployment environment 404—Deploying Applications 20 Apple Confidential 6/28/00 Session 401 WebObjects in Action 21 Apple Confidential 6/28/00 WebObjects in Action WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases Oracle, Sybase Any OS Apache Mac OS X Server Informix, ODBC Any Web Netscape Windows NT/2000 SQL Server, LDAP Server IIS Solaris Flat File, 3270 CGI HP/UX OpenBase, FrontBase, 4D… 22 Apple Confidential 6/28/00 A Really Simple App WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases 1. Process a Request 2. Generate a Response 23 Apple Confidential 6/28/00 Three Steps WO Does for You Automatically WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases 1. Take Values from a Request 3. Generate a Response 2. Invoke an Action 24 Apple Confidential 6/28/00 User Submits Request to Web Server Request WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases 25 Apple Confidential 6/28/00 User Submits Request to Web Server WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases • Web server adaptor finds appropriate application server and instance, and forwards the request to it – First request? A random instance is chosen, and a new Session created – Subsequently? Return to the original one 26 Apple Confidential 6/28/00 Session Finds the Requesting WOComponent WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases Login.wo <HTML> What’s your user name? <WO NAME=FORM> <WO NAME=INPUT> <WO NAME=SUBMIT> INPUT: WOString { value = userName; } SUBMIT: WOSubmitButton { action = handleLogin; } 27 Apple Confidential 6/28/00 WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases Login.wo • The requesting <HTML> What’s your user name? component studies <WO NAME=FORM> any form values that <WO NAME=INPUT> have been submitted <WO NAME=SUBMIT> INPUT: WOString { value = userName; } SUBMIT: WOSubmitButton { action = handleLogin; } 28 Apple Confidential 6/28/00 WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases // Login.javaLogin.wo • Requesting public class Login extends WOComponent { public<HTML> String userName; component publicWhat’s WOComponent your user handleLogin() name? { <WOsession().fetchCustomer(userName); NAME=FORM> then figures out <WOreturn NAME=INPUT> pageWithName(“Welcome”); } <WO NAME=SUBMIT> what action to invoke } INPUT: WOString – Action returns { value = userName; } another component SUBMIT: WOSubmitButton { action = handleLogin; } 29 Apple Confidential 6/28/00 WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases Welcome.wo • Action is invoked, <HTML> Welcome back, and session loads the <WEBOBJECT resulting response NAME=UserName> Component UserName: WOString { value = session.customer.firstName; } 30 Apple Confidential 6/28/00 WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases Welcome.wo • WEBOBJECT tags <HTML> Welcome back, and corresponding <WEBOBJECT messages are NAME=UserName> identified UserName: WOString { value = session.customer.firstName; } 31 Apple Confidential 6/28/00 WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases Welcome.wo • Any needed objects <HTML> Select WelcomeFIRST,LAST,ID back, from are fetched from <WEBOBJECTCUST where the database NAME=UserName>ID=‘shayman’ • SQL is generated EOModel UserName:Database WOStringORACLE { value = automatically Customer CUST session.customer.firstName; } Product PROD 32 Apple Confidential 6/28/00 WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases Welcome.wo • Rows are returned <HTML> “Steve”,”Hayman”, Welcome back, “shayman” from the database and <WEBOBJECT converted into NAME=UserName> Enterprise Objects EOModel UserName:Database WOStringORACLE { value = Customer CUST session.customer.firstName; Customer } Product PROD 33 Apple Confidential 6/28/00 WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases Welcome.wo • Messages are <HTML> “Steve”,”Hayman”, Welcome back, ”shayman” sent to EOs <WEBOBJECT NAME=UserName> EOModel “Steve” UserName:Database WOStringORACLE { value = Customer CUST session.customer.firstName; Customer } Product PROD 34 Apple Confidential 6/28/00 WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases Welcome.wo • Response is <HTML> Welcome back, substituted into Steve HTML template “Steve” UserName: WOString { value = session.customer.firstName; Customer } 35 Apple Confidential 6/28/00 WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases MyComponent.wo • Session sends plain <HTML> Welcome back, HTML back to user Steve UserName: WOString { value = session.customer.firstName; } 36 Apple Confidential 6/28/00 That’s the Request/Response Loop WO Adaptor App Adaptor EO Server The Internet Web (not to scale) Server Databases public void takeValuesFromRequest ( WORequest aRequest, WOContext aContext ) public WOElement invokeAction ( WORequest aRequest, WOContext aContext ) public void appendToResponse ( WOResponse aResponse, WOContext aContext ) • Application, Session, and all Components participate (If they want to) 37 Apple Confidential 6/28/00 Please Note! • No mixing of SQL and HTML • Database, interface, business logic are all completely separate and independent • No need to write SQL or HTML at all (unless you want to) 38 Apple Confidential 6/28/00 The Tools 39 Apple Confidential 6/28/00 403—Designing Dynamic HTML Components 40 Apple Confidential 6/28/00 You’ll Create WO Components • Main.wo/ <HTML> – Main.html This product Image4: WOImage { – Main.wod <WEBOBJECT NAME=Image4> src = “pic.gif”; }