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 + •
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
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 EO Adaptor 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 EO Adaptor 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 EO Adaptor 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 EO Adaptor Server The Internet Web (not to scale) Server Databases
25 Apple Confidential 6/28/00 User Submits Request to Web Server WO Adaptor App EO Adaptor 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 EO Adaptor Server The Internet Web (not to scale) Server Databases
Login.wo What’s your user name?
INPUT: WOString { value = userName; } SUBMIT: WOSubmitButton { action = handleLogin; } 27 Apple Confidential 6/28/00 WO Adaptor App EO Adaptor Server The Internet Web (not to scale) Server Databases
Login.wo • The requesting What’s your user name? component studies
// Login.javaLogin.wo • Requesting public class Login extends WOComponent { public String userName; component publicWhat’s WOComponent your user handleLogin() name? {
Welcome.wo • Action is invoked, Welcome back, and session loads the
Welcome.wo • WEBOBJECT tags Welcome back, and corresponding
Welcome.wo • Any needed objects Select WelcomeFIRST,LAST,ID back, from are fetched from
Welcome.wo • Rows are returned “Steve”,”Hayman”, Welcome back, “shayman” from the database and
Enterprise Objects EOModel UserName:Database WOStringORACLE { value = Customer CUST session.customer.firstName; Customer } Product PROD 33 Apple Confidential 6/28/00 WO Adaptor App EO Adaptor Server The Internet Web (not to scale) Server Databases
Welcome.wo • Messages are “Steve”,”Hayman”, Welcome back, ”shayman” sent to EOs
EOModel “Steve” UserName:Database WOStringORACLE { value = Customer CUST session.customer.firstName; Customer } Product PROD 34 Apple Confidential 6/28/00 WO Adaptor App EO Adaptor Server The Internet Web (not to scale) Server Databases
Welcome.wo • Response is Welcome back, substituted into Steve HTML template
“Steve” UserName: WOString { value = session.customer.firstName; Customer } 35 Apple Confidential 6/28/00 WO Adaptor App EO Adaptor Server The Internet Web (not to scale) Server Databases
MyComponent.wo • Session sends plain 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 EO Adaptor 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/ – Main.html This product Image4: WOImage { – Main.wod
numberFormat =
• Main.java public class Order extends WOComponent { private ShoppingItem product; public WOComponent placeOrder( ) { session().addToShoppingCart(product); return pageWithName(“Checkout”); } } 41 Apple Confidential 6/28/00 You’ll Create Lots of WO Components • One for each “page” • Subcomponents for headers, footers, navigation bars • Reusable components for common UI elements • JavaScript client-side tricks • Components that contain other components
42 Apple Confidential 6/28/00 So How Do You Make Those Components ? • They’re just text files • Use whatever you like – emacs – vi – stickies – cat
43 Apple Confidential 6/28/00 Oh, Come On
• OK. You can use any WYSIWIG HTML editor • DreamWeaver • GoLive • Or even WebObjects Builder
44 Apple Confidential 6/28/00 Inspector
HTML
Objects and Actions
45 Apple Confidential 6/28/00 Use WOB in Raw Mode, if You Like
46 Apple Confidential 6/28/00 Use Palettes to Organize Your Stuff
416—Designing Reusable Components
47 Apple Confidential 6/28/00 403—Persistent Object Modeling with EOModeler
48 Apple Confidential 6/28/00 EOModeler and EOF
• Define a recipe for constructing objects from databases
Vehicle objects == the MDL table Vehicle.basePrice() == the PRMIN column
49 Apple Confidential 6/28/00 EOModeler
Model complex relationships between objects too. vehicle.maker. makerName vehicle.packages
50 Apple Confidential 6/28/00 Session 401 A Really Brief EOModeler Demo
51 Apple Confidential 6/28/00 52 Apple Confidential 6/28/00 Project Builder WO
• Coordinates resources • Code editing and debugging • Localization
53 Apple Confidential 6/28/00 Session 401 Delivering Other User Interfaces
Nobody Said You Had to Use HTML
54 Apple Confidential 6/28/00 Other UIs
• Deliver your business objects through other front-end technologies • Java Client • PDF • XML 411—Integrating • WAP Client-Side Technologies
55 Apple Confidential 6/28/00 Java Client 406—Rapid Development with Direct to Java Client • A more “traditional” client-server application • Pure Java application on the client • WO app on the server • Enterprise Objects migrate between the two
56 Apple Confidential 6/28/00 PDF—High-Quality Printable Documents
• www.reportmill.com • Object-based PDF generation and reporting • Subtotaling, grouping, sorting, slicing, dicing
57 Apple Confidential 6/28/00 XML 414—WebObjects and XML • Turn one or more objects into an XML string with only a line or two of code
WOXMLCoder aCoder = WOXMLCoder.coder(); aString = aCoder.encodeRootObjectForKey( currentCar, “Vehicle” );
58 Apple Confidential 6/28/00 WAP—Wireless Applications
• Special objects that emit WML instead of HTML • www.wapobjects.com
59 Apple Confidential 6/28/00 Session 401 Superduper Assistants
Got a Model? You’re 95% Done
60 Apple Confidential 6/28/00 405—Rapid Development Direct to Web with Direct to Web
Your EOModel + Direct to Web A complete, full featured, and good-looking web app
61 Apple Confidential 6/28/00 406—Rapid Development Direct to Java Client with Direct to Java Client
Your EOModel + Direct to Java Client A complete, full-featured, and good-looking Java-based application
62 Apple Confidential 6/28/00 Demo Direct to Web Direct to Java Client
63 Apple Confidential 6/28/00 Session 401 Deploying Your Application
How Do You Launch Your App and Keep It Running?
64 Apple Confidential 6/28/00 Monitor
• A WebObjects application that manages other WebObjects applications • Tell it what WO Application Server machines you have, and what applications you’d like to run, and how many instances of each • A service called wotaskd launches them and keeps them running
65 Apple Confidential 6/28/00 Monitor in Action
66 Apple Confidential 6/28/00 More on Big Application Deployment
405—Deploying 414—Performance Applications Metrics
418—Building 410—Optimization Large-Scale Applications
67 Apple Confidential 6/28/00 Session 401 Learning More
68 Apple Confidential 6/28/00 WOInfoCenter
• Documentation • Books • Examples • Tutorials • All browseable and searchable via a WebObjects application
69 Apple Confidential 6/28/00 70 Apple Confidential 6/28/00 71 Apple Confidential 6/28/00 WO Training Classes
• Programming WebObjects I • Programming WebObjects II • WebObjects Deployment
• www.apple.com/webobjects/schedule.html
72 Apple Confidential 6/28/00 Roadmap
402 WebObjects Builder: Room J2 Designing dynamic HTML components Tues., 1:30 p.m.
403 Persistent Object Modeling Room J2 with Enterprise Objects Framework Tues., 3:00 p.m.
404 WO: Deploying Applications Room J2 Tues., 4:30 p.m.
WO: Rapid Development Room J2 405 Direct To Web Wed., 9:00 a.m. 406 Direct to Java Client Wed., 10:30 a.m.
73 Apple Confidential 6/28/00 Session 401 Q&A
74 Apple Confidential 6/28/00