Configure player

Close

WWDC Index does not host video files

If you have access to video files, you can configure a URL pattern to be used in a video player.

URL pattern

preview

Use any of these variables in your URL pattern, the pattern is stored in your browsers' local storage.

$id
ID of session: wwdc2001-603
$eventId
ID of event: wwdc2001
$eventContentId
ID of session without event part: 603
$eventShortId
Shortened ID of event: wwdc01
$year
Year of session: 2001
$extension
Extension of original filename: mov
$filenameAlmostEvery
Filename from "(Almost) Every..." gist: ...

WWDC01 • Session 603

Introduction to WebObjects Tools

WebObjects • 1:04:33

This session presents an overview of the tools available in WebObjects, highlighting which tools are best for given tasks and demonstrating how they can work together. Tools covered include Direct to Web, Direct to Java Client, WebObjects Builder, EOModeler, and Project Builder.

Speakers: Joe Moreno, Barry Janzen

Unlisted on Apple Developer site

Transcript

This transcript was generated using Whisper, it has known transcription errors. We are working on an improved version.

Good afternoon. How's the show going for you all? Good? Looks like we got another very pretty good crowd here today. My name is Barry Janzen, Barry Toolman Janzen, and welcome to Tool Time. We're going to go over the WebObjects Tools today. Before I do that, though, I've got some good news and some bad news. The bad news is that I don't talk as fast as Ernie Probecker, and I'm not as funny, nor do I demo as quick as Steve Heyman. That's the bad news.

The good news is that Ernie told me that we could give away a titanium laptop with WebObjects on it, and the way we're going to give it away is, this is all the standard disclaimers, please invoke all the standard disclaimers, this is a joke. Okay, but what we're going to do is we're going to count to three, and when I say three, the first one to stand up is going to get the laptop.

Okay? So here we go, everybody seated please. One, two, three. Okay, now that I've got your attention, let's talk about tools. The trickiest part of this presentation is going to be trying to get through it without using this number. Otherwise it's going to cost me. So we're going to talk about WebObjects Tools today.

If I can, there we go. So here's what you're gonna learn. We're gonna go over This session is an introduction to tools. There are many other sessions that go into tools in greater depth, but we're going to go over the tools that WebObjects developers will use in building a typical application. We'll build a very basic application. More specifically, we're going to build an application that uses Direct to Web as a starting point.

Along the way, we'll expose all the tools that are typically in the WebObjects developers' arsenal, and we'll also expose some of the things that are new in WebObjects 5. A little bit of Project Builder in that, so for some of you, I know that will be quite new.

So what are the tools? If you go online and you read WebObjects Tools and Techniques, you'll see that there are three... Oh! I made it five minutes, okay. You'll see that there's this trilogy, there's this trilogy of tools in Project Builder, EOModeler, and WebObjects Builder. Okay? If you go somewhere else on the web, if you look in Ernie's, in Ernie's presentation, if you look at tools and techniques, it actually adds direct-to-web in there, and doesn't talk as much about Project Builder.

Okay? So what are the tools? We always kind of refer to those three, but there's two others we'd like to talk to you about today as well, and that's direct-to-web assistant, and direct-to-Java client assistant. Okay? And those are tools that allow us to rapidly build these direct-to-web and direct-to-Java client applications.

In direct-to-web, it's a Java applet that connects up to your running application and modifies it. In direct-to-Java client, it's a swing UI interface with a connection to modify your application. It's a very simple way to modify your swing UI applications that are based on web objects. So we'll talk about five today.

First of all, the tasks, I'll go over the tasks that we're going to go through. So if you're a new developer, this is really targeted at you. But what we want to do is start from easiest to hardest. A lot of times we come out here, as systems engineers, when we go out and do demonstrations on WebObjects, it's a tremendously powerful and flexible set of frameworks and powerful tools that go with it.

And a lot of times we go very broad and very wide and very deep very quickly, and we lose a lot of people. So we're going to kind of go through a process here that isn't too hard to get started. I mean, if you're not a rich, experienced WebObjects developer that's been doing this for years and years, you should feel at home during this presentation.

If you are an experienced WebObjects developer, and perhaps you haven't... seen some of these other technologies, or used these other technologies extensively, my guess is you know a manager, or you know somebody you work with, who asks you about WebObjects, and you get the idea that maybe they're not going to drill to the depths of insert objects into both sides of relationships with key, and so they need something a little easier to get started with.

Once they're started, you can help them out. Right? Right? Right? Right? Right? you can call Apple I services and we'll help you out. So there's lots of places to get help once you get started on web objects, but the trick is to get you started. So that's what our goal is with those technologies.

Okay? Okay, so the tasks are Project Builder, we're going to start a new project, we'll look at what is involved in the project, where do things go, how do we handle them, we'll compile a project, Project Builder does this for you, we'll set some runtime parameters, show you where that is, it's a little different than the new Project Builder, and then we'll launch the application.

Direct to Web will launch the Direct to Web Assistant, will customize both tasks and entities with the Direct to Web Assistant, and then we'll save and make changes on the fly. If some of you saw Scott Forstall in the keynote, you saw one of the hallmarks to our way of developing technology, and that is when you have live object systems, you can do some pretty cool things dynamically on the fly, and that's what we're going to try and do today.

WebObjects Builder, we're going to take some standard components that come in our application and we're going to modify those a little bit. Steve Hayman yesterday in session 601 went over this quite a bit yesterday, so we won't go into it quite as much as he did in their other sessions as well.

[Transcript missing]

And lastly, Direct to Java Client. There are other sessions on this as well, so what we're going to do is simply launch an application, show you where the Direct to Java Client Assistant is, and just do some browsing of some information that we'll use earlier on in the presentation.

We'll also put this slide at the end with some of the key other sessions, but we think you should know this now because other sessions will talk about some of these things and overlap a little bit. And if you want to find out, if you find something in this presentation that you really like, you may want to come to one of these following sessions. So Project Builder, there are a number of sessions going on with Project Builder.

I believe the first one's already completed, but there will be a couple of other ones on debugging. There will be a session on Direct to Web with Miguel here. WebObjects Builder will be covered again a little bit in getting the most out of WebObjects Tools. EOModelers will be touched upon at a couple of other sessions because it works with EOF.

So the sessions on EOF will be covering that as well. And Direct to Java Client, as I mentioned, there's a Direct to Java Client session and an Advanced Java Client session. So mark those down as we go through this and we'll try and give you the sample platter here of the WebObjects Tools. Okay.

So let's build a common web app. A common question I get when I meet with customers is, "Is WebObjects hard to use?" And I used to say, well, there is a steep learning curve, and yes, you know, and I'd say what Steve's saying, and so you learn a lot in a short amount of time, and you know, blah, blah, blah, blah, blah, blah, blah. Now I stop and ask them before I jump into that and say, well, it depends.

What problem are you trying to solve? And when customers start explaining what kind of problems they're trying to solve, it all depends on, you know. And a typical thing they're doing is they're looking at a database. and they're creating, reading, updating, deleting the standard kinds of things. Not a lot of business logic, a little bit of customization in the HTML, and that's about it.

So you look at them and say, well, we have some frameworks and we can probably do that with no code. And they go, oh really? Well, but it goes across this table and it has a too many relationship, and it goes across here on a many to many and it does this and that, and here's our whole schema and see how hard it is? And WebObjects has frameworks in there to help you do that.

to help you build an application that does all this without having to write code to do it. It's only when you solve the hard and the difficult problems that you really have to drill to the depths of WebObjects to do these kinds of things. So the following session, Intro to EOF, we'll begin to talk about that a little bit. We'll go into greater depths of how do you use EOF to solve these hard problems that are out there in the industry. But a lot of these problems aren't that hard.

So we'll show you the get started way on how to do that. The other thing I want to point out is if you don't know by now, wizards are bad. If you haven't heard that from Steve Heyman earlier or if you haven't heard that from somebody else, when we think of wizards, we think of code generators.

Wizards are okay to kind of get you started and help you out a little bit. And Project Builder has a little one just to sort of ask you. Ask you a few questions and just kind of help you get started. But if a wizard is going to generate a lot of code, that's typically a bad thing because who ends up supporting that code? Who's got to support all the lines of code to this gen? And the first thing you're going to do is you're going to look at that and you're going to go, oh my gosh, who wrote this stuff? And now I'm stuck here supporting it. So, wizards in general are bad. What is better is to use pre-built frameworks.

and to hook those and wire those up. So you'll see that metaphor in Interface Builder. You'll see that metaphor in WebObjects Builder. You'll see that metaphor in a lot of places and things we do of hooking them up. We traditionally use things like plist. Well, now the in thing to say is obviously XML. But that's how we hook these things up. That's how we get started with these. So rather than doing a wizard, we're going to start a direct to web application. I think you'll see it's much more flexible than a wizard.

Okay, so getting started with Project Builder. Project Builder is, if you don't know by now, Project Builder is the way to develop WebObjects applications. On Mac OS X with WebObjects 5, it is a new Project Builder if you're a traditional WebObjects Builder and you've come along the way. So there are some things in there you'll need to be aware of that are a little bit different and we'll show those.

Project Builder is our integrated development environment. It also manages, other than just the standard edit, compile, debug code, it also manages resources for you. So we're creating these model files where we've modeled a database and we've got to store that somewhere, we've got to manage that somewhere. So that's included as a part of the product, as a part of the project. Same thing with WebObjects Builder.

It creates HTML and object descriptions that bind to that. It also manages those. It handles web server resources. It handles a number of other resources that you have to deal with in a typical web application. It also handles launching your applications and runtime parameters when you launch those so that you can test your applications.

Okay, so the first thing we'll do in Project Builder, we need to select the kind of project we're going to build. And as a new developer told me recently, the beauty of getting started with WebObjects is you launch Project Builder and now you have 47,000 project types to choose from. Which one? Okay, so it is a little difficult to pick the right one or to know the right one. So we'll kind of help you through that process, let you kind of know how to get started.

But direct to web, Think of Direct to Web as creating a model file much in the same way that we model a data dictionary or a schema coming in from the database. It's a little bit different. It's more of a rules file, really. But you can think of it as a little bit of abstraction from the objects in our application.

So EOModelers creates an abstraction from the database. It takes data rows and turns them into objects that we like to program in objects, right? and our model here will take those objects and basically describe how to present those. So we've now isolated ourselves both ways a little bit. From the user interface, which can change very quickly, and from the database that can change very quickly.

So Direct to Web will give us by default a standard login page. Nothing too exciting there. The Web Assistant then connects up to this application that we've launched, and it'll allow us to customize that on the fly. So that's what we're going to do. We'll launch the application, and then we'll customize it as we go along.

What do people use Direct to Web for? Traditionally, a few people have used it for doing things like validating my model. I have an object model from my database. Can I get from my customers to my suppliers? Can I traverse relationships? Can I traverse key value coding through all this stuff to get through all these relationships and make my application work the way it should? You can use it as a validation tool that, yeah, this actually has all the relationships that I need in my model. It's also very useful for creating administrative apps.

How many of you have developed an app and you get done and somebody says, well, we've got to have a way for our secretaries to get information into the system? You don't want to sit there and do a quick application or something. You can just throw it into Direct to Web and hand it over.

You can do it forever immediately. Okay? So that's another use. But what we'd like to do is customize it just a little bit more and begin to show you how you can actually use this as a real live running application, not just for admin apps and not just for pumping data into the application.

Again, WizardBed, remember that. We're going to build a new project, so this is what you'll do any time you're building a WebObjects application. Again, here's the 47,000 choices that you have. We will select a Direct to Web application, and we'll name this app "Our School." These are the pre-built frameworks that WebObjects includes.

If I've got other ones, such as when Steve Heyman built his demonstration yesterday, wanted to add in a few other frameworks, you can do this up front if you know you're going to want to include some pre-built code that either your company's developed or maybe Apple iServices has developed for you. Let's add a model. For right now, we're just going to kind of pass the model off until later in the presentation. Just consider it some magic somebody has handed you on how to connect up to a database.

So we choose our model. And now we have a couple of looks in Direct to Web. We'll choose the neutral look, but we can change this in the rules at any time if you want to change the look and feel.

[Transcript missing]

WebServer Resources, if we have WebServer Resources, things that need to go with the HTTP server and be copied over there to be vended, that's where they'll go.

And then the frameworks that I just included, again, if I want to include some others after I've started up, this is where I would put them. Okay? So that's our application. Hammer means build, so we're building the application. If you want to take a look at what is spewing out of here, you'll notice that it's not make anymore. It's now jam, using jam to build the files. And it's built.

The other thing that's kind of new, if you're just walking up to Project Builder and you're like most guys, I admit it, that don't want to read the manual or listen to your wife and pull into a gas station to get directions, you go to enough of these sessions, we'll all give you one or two tips, and you'll learn Project Builder here.

Executables, there we go, that's much better, thank you. Minus, whoa, port, port.

[Transcript missing]

You can also enter a number of other things in there. Like I said, we will need to build this application right now. When the build target is done, we can launch it now. And that should go a little better.

As I mentioned, there are a number of parameters you can set when you launch this, and those all show up here. So you can see where my port is set, and these are all in red here, the runtime parameters that you can set here. It used to be a separate panel, so get used to that a little bit of the moving panels as we go here. Okay, our application is ready.

Okay. Okay, so the default page in a Direct to Web application is a query all. And query all just says, take all the entities that you had in that database thing that somebody handed you and pick one thing and put it in there. Take a good guess. Okay? So it takes a pretty good guess on these things. Course, course name, where course name begins with B.

Okay, I can go out and search. Boom, there's my courses and my course database for my school. Okay? Anytime we hit home, we go back to the main page. Okay? We can also begin to customize this a little bit. So if you're building your first app, you're probably not going to do the full... Insert, Update, Delete, all this kind of stuff with multiple tables and a big thing.

If you got WebObjects out of the box, how many of you got the book out that said Getting Started? So the Getting Started book is probably how you got started, right? You did Guess Book, and then you did a simple Movies Demo. So when you do a Movies Demo or get started that way, usually you're only querying on one or at most two entities.

And then we're traversing down a path. So I don't want to make this quite so complex. But I'll show you as we go through this, there's two ways actually of doing this. I can launch it in the browser, which is a simpler way. And once the browser is getting meshed up with the underlying Java code that's in the MRJ, they'll be able to deal with this much better. But for now... We will walk this fine line as I walk off the edge of the stage here. So it's going to be a little tight here, but let's see what happens. Okay, that's good.

So the Query All page is the default page. It doesn't have a customization, but I'm going to customize the entities. As we said, we can customize the entities and the tasks that are involved in this app. So picture your manager or your coworker working on this and saying, OK, well, I can make all those read only. What's that-- that's going to change a little bit. Now I can also take course-- I probably only want to look at for now-- let's pick courses and students.

And let's save that off. OK. Reload. Boom. OK. So now I've only got two. I've cut that down to two entities. The others are hidden. So there were three categories here. If you can read the tiny font, it's hidden entities, read-only entities, and read-write. OK. So now I've got two. That's a good start. OK. So let's look at students.

Let's look at students whose last name begins with B. Okay, so we've got a number of them. I don't like first name in front of last name, so again, I can go into the Assistant. And now I'm going to go into Expert mode. Okay, so if I look at the properties of this page, I've got first name and I've got last name in here. And I can customize that to some extent by selecting last name.

Moving it up a notch, so that'll come first. But you'll notice, if you were at yesterday's session, Steve talked a little, Steve Heyman talked a little bit about key value coding and going across relationships that come from our model, that students have a 2-1 relationship to photo. So I can select photo.photo and move this into my application, or move this into my page.

And notice Direct to Web is smart enough to figure out the attributes that are there. I can save this. And let's check our browser again. Ah, it looks much nicer. Although a motley crew they be, don't they? Okay, some of you may recognize a few of those faces.

will have a quiz later. OK? So that'll be our student list page. So we can move through this application one by one, picking off all the different kinds of things. So this is what we can do. We can go in here and select and fix the user interface for courses and for students, and we'll map down until those things cross over until I look at students and all the courses that they're taking. So why don't we do that? Okay, in this list page, I've also got courses. Okay.

So I can move courses over here and I can inspect it. OK? I can do a too-many table, and maybe what I want to list is specifically the course name. So let's save that. take a look at what we have. So it's collapsing the courses. Let's clean that up. Save again.

So now I have the students and I've crossed a many to many relationship and I can list the courses. Still haven't done any coding yet. Still I'm just configuring basically the rules on how we're mapping from models to applications. So if I look at-- let's sort these by last name.

By clicking on the icon, I can sort them. Let's look at a course. Basic Circuits Inspection looks like it could use a little work, so let's go back home and clean up another one. So let's look at courses. We've cleaned up some of the student pages. Let's clean up some of the courses pages.

All right, so here's the courses. Let's take-- it looks like in here, Cost is free. Obviously, this is a free university. So let's take out some of these things. We'll leave in name. And let's leave in instructor name. and save that and reload. And that looks a little better. OK. Let's sort them like that. And I can do the same thing here. So I can list in this list page, I can actually list all the students that are in that page as well and traverse the relationship. So there's a relationship called Students.

Again, I'm crossing the barriers from one table to another. To do this in another tool, normally you'd be writing SQL joins and joining tables and having to deal with all this stuff. Let's put it in a table again and let's display their last name and let's save it.

OK, there we go. OK, so now I can begin to loop a little bit. I can look at individuals. Let's clean up one more thing. Let's clean up the inspection for students, and let's clean up the inspection for courses. So I don't like the fact that it lists seven courses. That looks kind of ugly. So I'll go back to my web assistant. Let's put take out enrolled. Let's take last name and bubble it up. First name, I'm bubbling this up.

Let's take photo. And actually, I want to move that out and traverse the relationship for photo again. So as I'm inspecting a student, we'll display their photo both in the list page and in the inspection page. Okay. Let's add that. Make it an image. And in the courses, we're going to select the course name. Let's save that. Reload. There we go. One more thing. I'm not a big fan of collapsing. All right, so let's not allow collapsing. There we go.

I'll clean it up one more time, OK? All right, so now we basically have an application that I can take a student, look at their courses, go across to the courses. I need to clean up the inspect courses so that I can display who's all in the course. So let's synchronize that. This is always one that is fun to do because we can sometimes as this application goes along we can go a bit too quick and actually bind it up, but let's give it a shot here.

Okay, so we'll keep courses and we'll keep course instructor. There we go. Okay. Okay. That looks too simple. Let's go back and add students. And let's put a table in there that has a student's last name.

[Transcript missing]

So we'll go in here and fix or change all three. We'll change the login panel a little bit, we'll change the menu wrapper a little bit, and we'll change the header a little bit.

We'll show off some of the things of WebObjects Builder. WebObjects Builder is the way that you edit HTML in WebObjects. As Steve mentioned yesterday, if you want to deal with the files that WebObjects Builder normally deals with, you can use anything. But we think it's easiest to use in WebObjects Builder for a couple of reasons.

It edits your HTML, but it uses a standard metaphor that we have of objects, an object browser on the bottom. And what we're doing is we're binding those objects to the HTML. The only tag you'll see in the HTML from us is the WebObjects tag. So we really try and stay out of there, and instead we try and dynamically bind these objects with memory. So we're doing that with minimal impact on the HTML. WebObjects Builder also has built-in integration, as you saw yesterday in Steve Heyman's presentation.

WebObjects Builder is a web-based software that allows you to integrate entities from EOModeler into WebObjects Builder and it will automatically create a display group object for us in order to connect up to the backend. WebObjects Builder also has integration with Project Builder. So if I'm changing code in WebObjects Builder, it automatically and instantaneously updates in Project Builder. So let's take a look at that and customize that a little bit. Okay, if we can go back to the demo machine. So here are my web components. You can see I have three, as I said before. Nobody stood up, good.

Click on those to launch WebObjects Builder. And let's go ahead and bring up all three. And then we can just move Project Builder to the background. Okay? First, let's take a look at our login page that we had, our main page. So remember we said WebObjects Builder has the HTML part on the top and the object part on the bottom.

I can browse objects. You'll find the general design pattern of browsing and browsing objects to be a standard thing. It's one of my favorite developers. I'm from Boulder, Colorado. It's one of my favorite developers. It says it's all simply a matter of browsing. You can browse everything. So he wrote a tool that browses the Oracle schema and browses the Objective-C runtime. It's all just browsing, he says. So that's all we're doing here on the bottom. We can look at application objects, session objects. Below the line are methods or actions that I've got.

So my main.java has a default page action, which probably is bound to the login panel. Okay? So I'm going to... clean up the table a little bit. As we've shown you a little bit before, you can see the HTML along the bottom, the depths of the HTML path along the bottom.

So if I want to look at this table row right here, or if I want to look at what is included in a form, a WebObjects form, I can look at that level. So it's very handy. It's also very handy when you're tying methods to objects. You can bind here or I can bind as I drag from my... my object to bind to the HTML either place.

Okay? Very handy. Sometimes if you have some complex HTML, much easier to deal with in that fashion. Okay? All right. Let's take a look at a table row here. Let's get rid of the assistant part because I'm not really going to have... now that our app is looking pretty good, we're probably going to not need the assistant anymore. Let's take and center that. And let's look for an image that we have laying, just happen to have laying around.

All the education WebObjects. Now when I drag an image or any other kind of resource into my application, it's going to ask me, do you want to add this as a global resource? OK. So yes I do. It adds it as a global resource to my project. OK. So I can save that.

I can also look at what this page looks like in the raw HTML. Notice what I had highlighted here. Whatever I happen to highlight here as I move over, highlights here. So WebObject name equals Education WebObjects. So it named that right there in the HTML. And I can easily, again, if I'm having trouble finding something embedded in a table, I can click on it here and switch between views and actually see where that is where it's highlighted. I can also get somewhat of a view of what it's going to look like as a best guess in the rendering in the HTML.

There are palettes, as Steve mentioned yesterday. He has many more palettes than I do. But you can drag and drop other things off the palettes into here. If I had this image on a palette already, it would be something that I could just drag into my project and bind up. The dynamic things that WebObjects includes are on the bottom row here. So as you hold your mouse above those, you can see all the kinds of things that we can bind up to WebObjects. Thank you.

And I can also add other variables or keys, and it does this in a very smart way. So if I want to add a key such as, let's call it a course, and it's a class, this will list all the different kind of classes I have access to. But it's not just the standard object types. It also figures out and substitutes in things like courses that come from my EOModel.

So it understands how to connect up to the database and include these things in my application. When I add that, my course object now understands what are the attributes that it's pulling from our model.

[Transcript missing]

So we'll delete that. So there's many powerful things you can do with WebObjects Builder. We'll keep that as our main page. And let's go on to some of the other reusable components that are in our application.

So you'll notice on the page there's a menu header and a... This is the page wrapper. It's an object that we use in WebObjects. In order to get reuse on a lot of our pages very quickly, so I can wrap any page in this page wrapper and it gets all the settings in there for free, when I drag the image in again, it says, do you want to replace, since I've already put this in the resources, I know that, I've got something in there by that name, do you want to replace it or do you want to just use it? Let's just use it.

Okay, so we'll include that in our page wrapper, we'll call that one good, save that. Okay, now our last page is the menu on the side. It's a read-only application, so we're not going to insert anything new. So again, I can select anything that I have in WebObjects Builder and simply delete it.

Okay? We probably don't want to customize anymore. Notice I can see on the tagline that that's what I'm trying to delete. We can delete that as well. Okay. Let's save that. And let's keep this one open so we can show you how this can modify on the fly or how we can do other kinds of things. Okay? So that's WebObjects Builder in a very short time frame. Let's launch our project again. Rebuild and launch.

Let's take a look at what we have. Okay. So here's our new login panel. We can clean this up however you want, but this certainly looks better than what I started with. Foo, Bar, again in my super secret Apple Connect login panel. Okay, so now I can search. There's one thing I'm not wild about in here.

It says entities. If you can see it in the upper left. So entities doesn't probably mean anything to most of the teachers in my school. So let's take a look in WebObjects Builder. I don't see it. It's hard to see again in the HTML. So this is one of those instances where it's kind of nice to go into.

WebObjects Builder Raw Mode. And I can search on entities. And there it is. And let's change this to looking for-- OK. So it's handy sometimes to have the raw HTML there as well so I can search for difficult things that are hidden. And again, do I have to recompile this app now? No, because it's all dynamic on the fly. And notice it's looking for-- I can look for courses.

I can look for students. Let's look for, again, courses. There's my courses, basic circuits, and I can traverse my relationships. Okay? Not a bad app for how many minutes? About a half an hour at most. If I wasn't talking so much, I could probably do it in about five. Okay? Thanks.

Okay, so you can begin to see the power of what we can do with these tools. And yet we're building these straightforward apps without developing any code, and we can do this very rapidly, but yet not lose the power of WebObjects underneath. So we haven't taken away any of the incredible power that a lot of serious developers that have been using this for a long time understand is lying underneath the covers.

So what a great way to get started with a tool that isn't going to hit the ceiling as soon as we walk away from this application. Okay, so to talk a little bit more, I've kind of abstracted away from where this information all came from. So in order to talk about that, I'm going to bring out Dan Montana. No, Joe Moreno to talk about EOModeler. Thank you.

Afternoon, I'm Joe Moreno with Apple Eye Services. About two minutes to two this afternoon, I was in the WebObjects lab. Someone came up to me and said, hey Joe, aren't you doing introduction to WebObjects Tools? And I said, why yes. And they said, well, that begins in two minutes.

So, obviously it was wrong, but I about had a heart attack, thinking I wasn't going to make it over here on time. For about the next 15 minutes, or maybe even shorter if I can squeeze it in, I'm going to talk about EOModeler. But I can't tell you what EOModeler does unless you know what an EOModel is.

So, it's going to be more on EOModel, what an EOModel is. An EOModel provides persistent data store connectivity. It maps data into objects and it defines relationships. And these circles that you see, these disks, the red disks with the yellow circles, those represent EOs. if you've never seen that before. All an EO is is a Java object in memory. Absolutely no difference, with the exception that an EO connotates the data came from, say, a row in a database table.

Each EOModel WebObjects app connects to a specific data source. So in your WebObjects application you can have multiple data connections. Now it does not have to be a relational database. It could be a flat file, it could be XML, or it could be screen scraping. But for the rest of my little talk here, I'm just going to go on ace option, we're talking to a relational database system.

Also, an EOModel will map data at runtime into particular data types. Example here is a var char would become a Java line string and int would become a Java line num. It doesn't have to happen like this, but that's generally what makes sense. This is the Connection Dictionary Inspector, which I will show you on my demo. If you can see it in the back, all it has is the Connection Dictionary information. We're using JDBC, OpenBase, and then the URL where you find the database.

There's usually, doesn't have to be, but there is usually a one-to-one mapping between a database table and an EL or a Java class in your project. And this is where you can see the mapping provided. A student entity or student database in your database table maps to a student EL. Very intuitive, makes sense.

Also again, it provides the mapping between columns and EO attributes. also creates templates for you. You will click a button and it will generate a Java file for you which will go into your project. This is what the file looks like. This isn't the whole file, but the top part there shows the setter and the getter for last name and first name. And then below that white line is where you start implementing your custom logic. For example, a very simple custom method here is full name. It's the one we always use for some reason. And all it does is return first name plus a space plus last name.

Also in an EOModel, you define relationships. You define two-one relationships. You can define too many relationships, just like you do in a database. One other thing that I think is a big one with an EOModel is you can define a many-to-many. Now, even though your database doesn't support the many-to-many, you can, in memory, following too many relationships and It just works like magic where the middle table, which is in the database, is sort of hidden so you don't even have to pretend. You can ignore it like your appendix or something. You can also define relationship rules, like delete rules, cascade, deny, nullify, no action. Cascade, that's a big one.

Cascade, you have a student object and it has, let's say, a one-to-one to a photo. Every student has one and only one photo. When I delete the student, it doesn't make sense to keep the photo object in the database anymore. That's how you get orphaned rows in your child database tables. So you can tell EOModeler that when I delete a student, generate the SQL also to delete the photo. You can do deny, nullify, no action. Propagate primary key in a one-to-one relationship again between student and photo.

When I insert a new student, it makes sense to already go ahead and insert a row into the photo table and then join them across the same primary key. So basically the primary key is propagated. And also owns destination, this is a little more advanced, but again, an example of student to photo.

In memory, you can create, read, update, delete your standard CRUD with EOs. One thing you can do is you hook them up into relationships and you unhook them. When you unhook them, if one owns the destination and you don't re-hook it up, it gets deleted from the database, which may be what you want.

Here are some things that EOModelers, the tools specifically, can do. They can reverse engineer database schemas into an EOModel, which we've done quite a few times, probably once a session so far. Generate SQL to create or sync database schema. This is good if you don't know SQL. Like, I don't know SQL too well, so I just use EOModeler to cheat. It can graphically create fetch specs.

In the next session, they're going to talk about fetch specs. All a fetch spec is is a query on a database. And you can do it programmatically in your Java code. Again, this doesn't mean you have to put SQL in there, but you can generate a fetch spec programmatically in your code.

Or you can store it graphically in your EOModel. It allows importing and exporting of data. EOModeler can import from a flat file into a database. Or it can export. Or it can export into a flat file. These flat files we call P lists or property lists. And you can also browse live data.

EOModel is just the tip of the iceberg though. There's a whole layer of middleware between your WebObjects application and the database. And this whole area of middleware we call EOF, Enterprise Objects Frameworks. And basically your EOModel works with EOF to keep EOs, Java objects in memory, synchronized with the database and vice versa. You make a change to a Java object in memory that represents an EO, when you say save changes, that SQL is going to the database. And here's an example of just how simple it is to get data from a database in your Java code.

The first line there is basically saying, "Give me all the students with the last name Smith." So you get an array of objects back. The next one is we're going to take the first object, object at the next zero, and we're going to change it from Smith to Jones. And then the last line, we're going to save changes. Now that editing context is basically just a bucket that your data goes into. And it watches for changes and then updates the database. That you'll get some more exposure to in the next session after this.

So this is the key. An EOModel provides a layer of abstraction that minimizes the cost of change. As we switch over to the demo, I'm just going to comment that we've all experienced

[Transcript missing]

So what we do here is open an EOModel and reverse engineer it. I'm going to open a database and reverse engineer it into an EOModel like you've seen so many times before.

Found the database and we're not going to do anything with primary keys, there are not going to be any relationships. This is going to be an EOModel of tables. So these are the tables. First thing is the connection dictionary. This is what you saw in the slide earlier.

This shows You have the database and the EOModel talks to the database. This is the URL right here and that's the database that it found. And you can have your login and password here and you can go right in here and change it. So now we're going to flip over to the diagram view, and we're all going to focus on two entities, the student and the photo that we were talking about earlier.

There's a student, there's a photo. We didn't tell it to assign primary keys. I'm going to go in here, assign Talent ID as a primary key, and Talent ID. This is what I really like. I always forget where the foreign key goes, you know, well now I know it goes on the too many side. I used to forget and I joined the relationships wrong when I'd inspect them. So now I just click here.

and then drag over to the other one now. It won't let me connect to photo because photo is a different data type than talent ID. But it will let me connect to talent ID. It brings up this inspector, which I'm going to minimize, close for now. And you see it's actually joined the two tables. And there's actual real data behind these. You can browse them.

And if there was real data... There we go. Yeah, there's real data behind them. So the next thing you do is save your EOModel. It's going to give me a warning, I know, because I haven't gone through and made it all copacetic. But I'll just save it in my home directory with a unique intuitive name.

Now I'm going to generate a Java class. Alright, so I'm highlighting the student entity. I'm just going to turn this off, which we'll explain in a later session what I just did. And we won't click on the Java here. I didn't give it a name, so it's going to assume to use student.java. Makes sense. And it generated a student.

[Transcript missing]

Put setters and getters for the first name and the last name. Now one thing you'll notice is that's the only line of code that actually goes to the database and pulls out the data. There is no SQL in there. And then again down here you would just start putting in your custom business logic such as full name.

And the last thing, I mentioned I don't know SQL. So if I was generating this schema in EOModeler and there was no database under it, I could very simply come here and Just click on the SQL panel here. Let me turn everything off to show you explicitly what it's doing.

It will create the tables that you want. There's a SQL, and this depends on what type of database you're connected to. It'll give you primary key constraints, primary key support, etc. And this depends on, again, which database you're talking to. And it will generate the whole schema for you. That concludes my portion of the talk. I'm going to turn it back over to Barry to talk about Direct to Web. Thank you. Thanks, Joe. Good job.

Okay, we have just enough time to talk about Direct to Java Client a little bit. Direct to Java Client is similar to Direct to Web, but it has a swing UI interface. Okay, so it's not using the browser. It's a pure Java application. It gives you a little bit of a richer experience than the limitations of the web. Again, it's very rapid development for these kinds of apps. And the thing to remember about this is that it's probably easiest

[Transcript missing]

Let's build a new project. Okay.

And it's going to be a Direct to Java Client. Application, we'll call it My School 2. I'm going to add one additional framework here that just simply sets up Some parameters for me. It's called the Java Client Class Loader. So it'll allow me to run this app much quicker. Let's pick the model. Again, the model is... So we use the same model that we were using before, except now we're going to display it in Swing.

So we can build and launch this application. One of the things that was set up there for me, normally this would go ahead and launch it in the browser. I'm actually going to launch a Java client launcher. So it's going to launch this in a pure Java form. It can also vend this through the browser so that if you do have to suck down swing classes, it can actually do that for you.

But in this case... We're not going to launch a browser. So let's go ahead and connect up to our running application right now. And we'll show you in a bit what that looks like. So it's the same logic, the same model that was in my application before. And let's get rid of some other things.

And here it is. So it's the same kind of thing we were doing, but now it's available to me in swing. So any platform that would have Java on it can run this. Let's look for last names again, just to show you that we are live and connected up.

Here's my last names. And let's look for a similar kind of name. One of the things this allows me to do is bring up other kinds of windows. So I don't need to stay within frames or the windows. I can have multiple windows. I can click on other people in my application. And I can have multiple windows open at the same time. Same thing that we had before, I've got the tools.

But now instead of a Java applet, this is what the assistant looks like. So I can customize this. If I want to get rid of facility and I want to get rid of instructor, I can apply that and restart. Okay, so now you can see I've restarted and I've got rid of two of the tabs and now I have the exact same application running in a pure swing UI environment. Okay, that's it. If we can go back to the slides.

Okay, so if you're interested in checking out these tools, we would encourage you to come to the WebObjects labs. Here's the times, here's the hours. It's a great lab. It's much cleaner and doesn't make your hands stink as much as a cadaver lab, so it's a lot of fun. The roadmap, as I mentioned before, I mentioned a lot more of the courses. These are some of the highlights.

Stick around for Introduction to EOF. It should be very interesting. And these are some of the other ones that are the rest of the week. Okay, people to contact at Apple, again, Tony Triovion and Bob, our new product manager, who I believe has misspelled his last name on the slides here.