WWDC2001 Session 605

Transcript

Kind: captions Language: en hi thank you for joining us I'm glad to see a good number of you found your way back over to the conference center to catch up with the rest of our sessions our next session is going to be moving to web objects 5 so I'd like to introduce Melissa Turner from the engineering team to come up and start the possession app well as Tony told you my name is Melissa I'm one of the web objects development deployment engineers and I'm gonna be your presenter for the next hour or so I'm first we might as well get it out of the way yes I'm an engineer yes I'm female sometimes it happens this is the session 605 moving to web objects and I hit the wrong direction the session assumes that you have some knowledge of web objects we're primarily going to concern concentrate on some of the conversion issues for those of you who have a web objects-- 4 or 5 or web objects 4 or 5 one application that you want to move to of objects 5 we're going to cover some of the benefits of moving to web objects 5 we're going to cover how you would go about migrating an application to web objects 5 and we're going to talk about some of the new improvements and some of the features in the web objects 5 frameworks I am NOT going to cover anything in depth I'm not going to cover a Oh F for Java client we have entire sessions devoted to those some of them I believe there's one following this I recommend it highly and but remember anything that I don't cover is going to be covered elsewhere what is web objects 5 this is a question we've gotten from several people web objects 5 is essentially web objects 4 5 1 ported to Java it has the same feature set it's got essentially the same API as web objects 4 5 there's a few exceptions that we'll talk about later on Windows it uses the 4 5 developer tools that you're all familiar with we have a new project builder as you all know on ten and we have integrated with that yo modeler whoa builder and the rule editor have been Akwa fide but other than that they're pretty much the same for those of you who want to do split deployments the web objects live monitoring tools are capable of dealing with and managing web objects for 5/1 applications and we have some new features what are some of the benefits of moving to web objects 5 well there's a number of them the big one for a lot of you and I know this has been a concern is that web objects 4 or 5 used an older version of the JDK that's over web object 5 uses the JDK 1.3.1 actually I believe for those of you who are on Windows you'll notice that we do still install a 1 dot 1.8 JRE this is purely for the use of our tools you should not use it you should just pretend it didn't pretend it isn't their benefit the big thing about moving to the JDK 1-3 is that it allows you to integrate with a lot of the new and third-party tools that are out there development environments debuggers optimizers a lot of tools that you didn't have access to when you were writing in the bridge java environment and it makes it a lot easier for you to integrate with third-party products because as we all know there's a lot of mindshare in the java world there's a lot of people producing packages to do everything from control robots to do reporting you now have access to all of those packages and because we've moved to JDBC you'll also have extended database connectivity this means that you no longer have to wait for a database company to come out with a set of native client libraries on whichever platform it is you'd like to deploy on most database companies ship type for database JDBC drivers which plug into our JDBC adapter and things should work much more easily you can do development on Mac os10 or on Windows as you could in 4-5-1 and we also support deployment on those platforms plus Solaris one of the other big features of web objects 5 is that it's much easier to develop on one platform and then move your application to another platform there's no issues with remembering your LD library path there's no dynamic shared libraries issues things go much more smoothly and we've had some performance improvements Ernie talks a little bit about this a couple of days ago we did some benchmarking comparing web objects 4-5-1 with web objects 5 on Windows Mac OS 10 and Solaris and lo and behold we discovered that we did a good job of converting to pure Java we're faster on all platforms on Mac OS 10 we're about 22 percent faster than a comparable app written in objective-c pure objective-c this is not comparing against bridge Java this is pure objective-c we're about 22 percent faster on Mac OS 10 or even better on Windows we're about 51 percent faster and on Solaris platform that I know a lot of you to play on we're over a hundred and eighty percent faster so we were very happy with that you can clearly say so now that we told you that yes there are some serious benefits to moving to web objects 5 a lot of you are going to have the question should I convert or not and people who should convert are people who have objective-c or web script apps that are very early in their development phase or people who have existing bridge Java product projects that they may be in deployment or they may be in development it's very easy to port bridge Java to pure Java and anyone who requires to access to more Java standards or to third-party products should also consider moving to web objects 5 people who should not consider or at least should seriously can con should be seriously contemplated about moving to web objects 5 are people who have objective-c projects that use a lot of low-level objective-c if you're using categories if you're using posers if you have obviously message send anywhere in your code you may want to think twice about migrating because it means you're doing things with the objective-c dynamic runtime that cannot be done easily in Java if you've got a lot of basic C code if you're losing using lots of third-party C libraries you're doing a lot of nasty pointer manipulation you may also want to think twice about it because that's a more complicated conversion and if you've got an app that's already in production and it's not being updated there is an old engineering rule if that I learned when I first started to programming its if it ain't broke don't fix it it's you're happy with your application it's making you money you don't need to change it by all means don't next question once you've decided to convert is how do you go about converting we provide a tool called Java converter that basically allows you to simply and programmatically convert your web objects application from four or five to a pure Java environment on Windows this is located at next root library web objects Java applications Java converter gua on Mac OS 10 this is at system library web objects Java applications Java converter gua it claims to be adult whoa but it really isn't we're just leveraging the packaging you run it from a shell inside the directory and it's a fairly simple thing to do you enter your command script plus the full path of the project directory or files that you want to convert and you hit return and we take over from there if you want to migrate using the Java convertor there's a few ways you can do it if you have if you want to convert on a file by file basis you can take an individual C objective-c or web script file and convert that to pure Java or you can convert an entire project directory at once or if you're feeling a little bit more constrained you have code that's possibly in the nastier areas you may want to consider doing a hybrid project and migrating you know first to bridge Java on a file by file basis and then once you have all of those done moving up to pure Java or you may want to move your entire project first to bridge Java and then to pure Java this could give those of you who have lots of categories and posers and that kind of thing a little bit more time to do your conversion without having to disrupt your application some of the advantages of using Java converter that we don't touch your original source code we lay down a parallel set of files from as the ones we converted if there's a conversion problem in the converter we clearly describe the error in code in your code in the new code as a JC error JC warning or JC info we also print the transcript a little warning that something happens so you can just go off and search and find out what the problem was we've tested the Java converter against most the Objective C frameworks we've got we've tested it against woof we tends to test it against AOF you'll control EO access we converted many of our examples using it we've done a bunch of internal code that you will never see it's extensible with customized top scripts if there's something that you need it to do that it doesn't already do and it's a lot faster than manual conversion what I can say is that when we did before we had the Java converter we were converting by hand and we were managing to do about 300 350 lines a day once we got the Java converter and played that jumped up to 3 to 4,000 lines of code a day you can spend an awful lot of time moving brackets around some of the limitations though are that we cannot convert your eel model file you're gonna have to go in and manually change the adapter and possibly add or remove a little bit of data we don't change any of the api's that you've put in your WOD files or in any of your other archive files and if you have Objective C code that relies on poseurs categories that kind of thing we cannot fully convert it we can create helper classes that will take the place of your category but you're gonna have to go through your code and in any place where you're calling a method that was in the category you're gonna have to redirect it to use the helper class C code as I've mentioned we can change the C function invocation to a method call but we can't translate whatever's on the other end of the method and we can't determine which new API you should be hooking up to so you're gonna have to do that by yourselves and the conversion process does take you about 80% of the way there though and I'm sure a lot of you are going yeah right it can't be that easy so I'm gonna call Francois Gio up and he's going to convert one of the examples that we've set before of objects four or five one right here on stage and front my please hello welcome everybody so some people know me already I already did last your presentation and Java converter and I will attempt to out impossible today I will convert here with no net to protect me an application we are shipping well we used to ship info file so we are the window okay so as Melissa said Java converter converter is a terminal based tool and I am going to go execute it we I have here a sink movie application I cannot open it because it's a 4/5 application but trust me it here I'm going to go in the product directory here the sink movies application now in my java applications folder i have the java controller application and inside that who are as Melissa said series so the Java converter tool so to use a Java controller tool I just make it point to my think movies application and I have my covers covers go first okay it started no I can go have a coffee I don't have to type anything he will generate the classes in the java classes it will create a new project copy everything in a new directory so that it doesn't stomp on existing files and that's it well I think that's it but it's only 80% of the work is done I'm going to do manually the last 20% so here I have five word do most of you know what five Margie's it's a very powerful UI based tool and I'm going to compare what I had originally and the output of the converter okay I have both of them here so you notice that it changed quite a bit of five but if I look at these files there is mainly one difference and we look at the files but there are more differences but for example of a five we've just one difference here all the Derrick Andrade needed to do is to change import statements no big deal let's look at a more complicated file what does this one do just some packaged renaming here on the second change and this one is even more complicated so here we have the case of an API change the Java control did for you actually this instead of returning a component we know return an interface and here are some warnings that Java controller put in for you and in this case the warnings are not very useful because the syntax was correct in the first place and here there were some changes that Melissa will talk more about later on and as Gregorian date has been replaced by NS timestamp and all the api's and class names have been changed accordingly more or less time stem changes okay and you can trust me most of these are just the same right you trust okay so now the next step is to open the new converted project in the new product builder so I'm going to click on import PV that project is one of the wizard that project builder comes with and I'm going to point it to the converted project are people coughing on purpose okay so that's it I have my classes here my components everything is very even the frameworks are here or here the reserve so one good thing about conversion is that it enables you to do a lot of cleanup because objective-c ends up which were really lenient you could go along and have a lot of inconsistencies and you'll notice that most of the changes I'm going to go and do now are to fix inconsistencies here there is a framework that we didn't use that was there listed so I'm not going to remove it and one framework I do need to add is JDBC adapter framework because everything goes through JDBC now and I'm not as good as Steve Heymann so I'll just select all the targets here I put it at the right place looks better what else I have a new model and I'm going to open it because I know I need to do some changes in there Java controller does not fix the models for you I will go and switch adapter to the JDBC adapter you have the known adapter I don't recommend using the known adapter is the DVC one won't take you far okay now here another thing that I found that was inconsistent in this model is that we had a lot of packages business logic server and we never referenced these packages anywhere in our project so why keep and actually Java will refuse to run your app if we keep these packages I'm going to get rid of them okay now if I inspect one of these at this point I should be able to go and fetch it yeah so my dad my open bill database is running and I can look at entries I think yes here one tricky point in the EO model is that most of the number of classes cannot be resolved automatically by the JDBC adapter so here that you see that the value type or number is set to an intern that's correct but here for bigdecimal we have no value type so the this has to be fixed to the capital V value type so this is a type in the model is a type in Java at the end when I run the application so class and this is the type the intermediate type setup by the DBC by the division at all if you have questions about that I recommend going to the advanced us session is there any more of these member there is one more I have to find it geez the movies number a big this you know here this one needs to be fixed okay now I won't forget to save it and if it opened just in case I forgot something okay now I think I can build let's see what kind of arrows I get okay I have some more of these packages laying around in some places that's a side effect of this okay another one so I'm just walking through it like you would if your developer so I will know the app compiled so I'm not starting the application from Project danger and it will stop Internet Explorer okay so here I add an arrow and I'm going to go try and figure out what's wrong it's saying that it was not able to to create the page me I can close this one let me go to the terminal so when you cannot create the main page it means it's pretty bad and I know where it is if you remember in during the final conversion the when I did the a used file merge there was a change done here on this line and Java converter is clever enough to recognize an application and to insert a main function so that the application can be started except here it was not able to recognize it because it there was a complete package specified it was not clever enough to recognize that this is actually what occasion so I need to add this main function is all by hand so all these main faction does is for web so call the main code to your own main function I will say I can stop that and recombine so the app will come back somewhere okay no I have the first page it seems to work okay I mean oh I hate this movie no I won't enter review but I still hate it let's let's add a test see if the features okay so there is another problem it is to be expected and the problem is in this new nsdictionary here and the page is what page was this a display video page so let's look at this play video page okay so this play video page doesn't have an image dictionary but takes a mutable dictionary so I'm just going to go fix that and that will be it once again I don't know how the bridge could live with this frankly but I'm sure Java doesn't take it I go back to the head and see the Russian works yeah you tended it they're actually an old one there too okay so that that's about all it takes so as you see 80% of the work was done the last 20% interesting part was left to you on most of what we did was cleaning up an imperfect model on an imperfect application in the first place so as you all right perfect code you should have much less problems than we do even in your examples if I find me I will just do one last thing and open up again the window where I did the conversion and if I just type Java controller I see the set of parameters that can be passed to it you have a flag to stop the conversion at bridge java application so if you're converting from objective-c to bridge diver you can do that with this flag you have a flag when you are using Objective C conversion to specify extra headers to resolve macros and so on you can also give special instruction to the free compiler and you can specify your product directory and Objective C file a bridge Java file or a web script sign and then there is a description of all the other flags so one point I want to make that Melissa didn't is that bridge traffic conversion will only work on Windows and T because as you know web objects 5 does not run bridge to have applications and web objects 4 5 on Mac OS 10 doesn't burn any bridges other application either so while you're on windows NT you can use Microsoft converter from Java to see shop and you get a 64 percent conversion to see shop same that will be it and you back the mic to Melissa thanks Francois so as you can see most of the problems you're going to run across in doing conversion of applications or well many of them are you going to be your own fault now you're going to talk about what you're gonna see in your code after conversions happens you take the Java converter you run it and as Francois showed you we do some stuff to your original code there's two general classes of things you'll see afterwards there's stuff we've put in specifically to help with conversion and there's stuff that is new in our frameworks and is intended to be ongoing we've added some convenience classes to help you port your code to pure Java NS comparator and s bundle low timer these are things that often have equivalents that you could write Java code to do what they do but we figured we'd save you the trouble we've left some classes like NS coder and NS coding in although they're now completely abstract we removed a few things NS run loops NS user defaults and we changed the validation mechanism to be more in line with the way Java works NS comparators a pretty simple class that encapsulates NS comparison results from objective-c we only use it in a couple of places we use it in nsarray sort using comparator method and it basically sorts the elements of the receiving array into a new array we use it in the NS mutable arrays.sort using comparator method which sorts in place the elements of the array if you're writing new java code you may want to consider making any classes that you're going to be sorting comparable this will have sort of two things comparable isn't an exact match to NS comparator but it does allow you excuse me to create a one really simple comparator to use in these things that simply defers to the comparable methods on your underlying objects NS bundle is going to be pretty familiar to those of you who worked with the objective-c it's corresponds to the directory where related resources are stored it still has some deprecated api's to help can with people who are converting from four or five and we've extended the functionality to handle properties files and do we have some new api's for finding and loading resources for those of you who are using it in four or five you should note that the java class loader does not support the concept of dynamic class loading so there is no concept of loadable bundles in level objects five we've renamed and deleted some stuff most of it shouldn't worry you very much but just so you know that it happened we renamed NS timer to what timer and we don't use it for session timeouts anymore NS run loop has been removed we have for those of you who get into D compiling code we have a private will run loop that we use in what for wool application specific stuff but you should not be trying to use it and we've removed NS archiver which was the NS concrete the concrete subclass of NS coding coder will talk a little bit more about that when we talk about serialization later user defaults is one thing that took a fairly serious hit we've actually deprecated the user defaults class itself although the sort of concept of defaults exists in class NS properties that we'll also talk about later some of the default names now property names have been deprecated whoa debugging enabled yo adapter debugging enabled NS project search paths they're still there but they do different things and they may not be there for long and some defaults have been renamed whoa CGI adapter URL is now what would after URL and whoa should send like beat is now lowlife beat enables we'll talk more about properties and what they've become later and we had to change the validation mechanism to review for those of you who have had four or five but you know you wrote those methods a long time ago validation methods in four or five took a pointer to the target object as their parameter they returned an exception object if for some reason the target object was invalid and if coercion was necessary that would happen is a side effect on the target object well having side effects on target objects that are passed in as parameters isn't something that Java is really good at a lot of Java's value classes are final and immutable so we had to change that so validation methods in four five once again they take the object as their parameter but instead of acting by side effect they return the valid value for that parameter as the return value and if for some reason that parameter value was invalid they throw an NS validation validation exception if they do return null that should be interpreted as coercion to the null value in Java note that the Java converter doesn't take care of this for you you're going to have to go through and look at your validation methods and figure out what they really should be returning here's some examples of method signatures in Objective C for five Java and five Java the first one is pretty simple it's a validate street address it takes a pointer to a string and you can see that it returns an NS exception for five Java looks very similar because we're going through Java wrapper is to get actually use Objective C classes underlying the Java again we pass in a string which is down there in the bridge interpreted as an NS string which can be mutable if it needs to be and we return a void or we don't return anything I suppose would be a better way to put it that would be that one and the final one is the correct way to do this in web objects five again you see that we're taking a string parameter value but also see that instead of returning a void we now return a string and throw a validation exception that's pretty much all there is to it and now on to the new and interesting stuff we're engineers we don't need to link we don't know when to leave well enough alone we have to constantly add new stuff to our products or we get you know unhappy so we've added some new stuff we've added a bunch of time classes and s times down Bennis timestamp formatter and it's time zone we've added in a socket utilities to help you creating saw to help you with creating sockets we created a new class called NS log and as I mentioned earlier NS properties we've done some stuff with NS locking which some of you may be familiar with we've changed key value coding around a little bit and we've moved to Java serialization we've also done some stuff in other you know less central web objects packages like we'll mail delivery whoa smile and Java plot why honest times down this is a question that we've had several times already at this conference we've had it from people who saw the beta we've had it from people who you know immediately download installed the web objects developed her stuff from the CD you got we wanted to basically give you all of the functionality that was in an esper glory and date in our web objects 5 product and we ran into some issues in the JDK first off there for those of you who've looked at it you know that their time zone class does not contain historical information and as we were trying to implement that we ran into some other assumption conflicts with the way we were implementing time zone and the way their date classes worked so we needed to create a time class to work with our time zones why didn't we call it NS calendar date or anise coriander no great deep reason we wanted to show that it was descending from Java SQL timestamp and to a certain extent the word calendar is already in use in Java and given it our time stamps don't work at all in the same way we didn't want to introduce any possible confusion one thing to remember is that you really shouldn't use our stuff with their stuff it doesn't work too well you will see weird behavior in s timestamp as I said is the so class of just in Java SQL timestamp it replaces all uses of NS calendar date or for those of you in the bridge Java world and it's Gregorian date it provides most of the same functionality that you saw in four or five or four five one and yo f Maps database date types in two NS timestamps something that has changed noticeably that if may effect a few of you is that we have a new reference date we've moved from January 1 2000 UTC which was the objective-c sort of time 0 to January 1 1970 UTC which is the Java and UNIX standard time 0 we've also added a timestamp for matter too well format timestamps so class of Java text format it doesn't really do much although one thing that you might be pleased to hear is that it's capable of dealing with Objective C pattern specifiers as well as java pattern specifiers and it's a little bit heavy weight so if you've got an application that does that formats timezone or time stamps into strings in a number of places you may want to consider creating one timestamp formatter and sharing it amongst all the stuff we've created NS timezone as I mentioned earlier this kit allows you to have a correct historical and geographical context for your time it's a subclass of java.util timezone it's built using the standard zone info files that you get from by FTP from LC NCI nih.gov this basically lets you and there will be a till about this later you can if those files change you can download the new versions compile them and drop them into web objects to get the new zone info and it should only be used as I mentioned can't reiterate enough with our time classes don't try and mix in that trip Java and a socket utilities is a fairly simple class that we added to let you specify connection timeouts and if socket creation fails it will throw a timeout except it will throw an ioexception without the utilities there can be a problem on some platforms where failing to create a socket will hang your system indefinitely and we kind of thought that was a bad idea it's fairly simple to use an S socket utilities here's an example of how you'd create a socket using the standard Java way so you've got your constructor taking an address support a local address in the local part this is the equivalent in using in a socket utilities there's a factory method that takes an address support a local address a local port and a connection timeout it measured in milliseconds and notice that we catch the exception which means there's no socket and we have to deal with that somehow in its properties as I mentioned earlier replaces nsuserdefaults it's basically a wrapper to the standard Java properties mechanism which you can see defined in Java util properties it's a convenience class for merging application properties of standard system properties with framework properties and all that kind of lovely stuff for convention conversion people who are converting a lot of the methods that were on nsuserdefaults are still around on NS properties what are properties where properties properties can be read from a number of sources there's a set of standard system properties that come with your VM there's user specific properties store it in hot Java properties your application your frameworks can have their own properties files your application has can have properties file and you can specify them on the command line we use the standard Java conflict resolution mechanism which states that the last property red is the one that gets used there red in this order it's worth knowing more details properties files must be named properties and they must be located in the resources directory of your framework or your application they're in the standard Java properties format which is that they're in a file each property is a on its own line each line has the format property key equals property value with no spaces around the equal sign if you want to specify the properties on the command line you use the standard Java dash D flag although we do also in a deprecated fashion support the old objective-c format for command line arguments NSLog I mentioned this is a class that we're actually pretty excited about we think it's neat we think it should be very useful to most of you there's actually three classes involved there's NSLog which is a static class that allows you to interface with the web objects logging system there's logger which is an abstract class that defines sort of the core functionality in which you should subclass if you want to do your own logging mechanism and we provide one concrete subclass the print stream logger which will basically while your output to a print stream why do you want to use it well there's a few reasons it's set up to allow you to control the scope and granularity of debugging you can set up debug groups and debug levels which will allow you to say if you have an application that does HTML generation has business logic and has database access you can separate by debug groups logging in each of those areas and you can turn only one of them on it's time if you want or you can use debug levels to say well I'm in development but I don't want to have to worry about touching my code when I go out of development so I want all of this logging to happen at one debug level but once I move into deployment I want to set a different debug level and only see really critical stuff you can redirect the output however you want by sub-classing logger we provide the print stream you can set it up to do email or anything else you really want if you decide that you want to turn on for both logging it will also print out the time stamp at which the logging happened and the thread that did the logging this can be useful if you're trying to track down synchronization problems and there's an issue known issue with Java Runtime exact which is that if you launch a child process using exec and then don't pull data out of the child processes out and error streams then your child process will eventually hang when its buffers get full again we don't think freezing is good here's a sample how to create a debug group it's pretty simple and you'll notice that it's a long and that we're left shifting by 40 the first 32 bits are in use by internal web objects logging stuff the other 32 or open for you to use however you'd like to base this the second bit is an example of how you would pass in a command line parameter to enable debugging there's your command line basically you read in the property standard Java this is how you read properties mechanism if it says you should be debugging then we're both enable the verbose debugging on the debug out and error streams enable debugging for the group that we defined earlier and set the local level to informational this will print out everything in that debug group it's pretty simple to redirect the output to a different directory again you pass something in in the standard Java properties format again you read a standard Java system property if their property is there create a print stream pointing at that file and set as appropriate here we show setting in a slug debug you can also set NS log out in NS log error if you want you can set that to no and no logging will happen at all hi my name is Rd Wilhoit I just want to get this out of the way to begin with I'm not female and I'm not French but I am a web objects engineer so it does sometimes happen today I'm going to be telling you about a different manner of interacting with the web objects application server as Melissa alluded I will be talking about NS log I'm also going to be talking about the world mail delivery class which is not new to web objects 5 but has been revised slightly now it uses the SMTP client class in Suns standard class libraries I'm going to show you two different forms of email integration the first thing that I'm going to show you is sending of web objects components to a hypothetical customer the second thing that I'm going to show you is a sending of critical error messages to a hypothetical system administrator for demonstration convenience I'm going to be using the same email address for both the customer and the system administrator obviously this wouldn't be the case in real life but I only have one web browser here and I'm sorry one mail browser here also in order to clarify the demonstration my application copies some of the images from the think movies example but it isn't actually the think movies example it's just a partial mock-up I'm not sure if we're going to be able to make the source code for the demonstration available but I didn't want to confuse you if you do have a chance to look at the source code as many of you may know the low mail delivery class is capable of emailing web objects components as well as plain text messages you can use this as an alternative mechanism for interacting with the web application server let's take a look at our at our project we are going to be looking at the application class and more specifically at the constructor for the application class one of the most interesting things that's happening in the constructor which is going to be invoked at startup time so we're going to magically see an email appear in our mail browser is that we're invoking a direct action called send email form action if we go and look at this direct action we see that it's very simple it really only does one thing compose component email so we're going to be sending an email using page component called email form to a pre-specified recipient I'm not going to show you the source for the page component you'll see the source the results of the source when I launch this thing so let's fire it up and see what happens as this thing starts up I wanted to mention that I'm doing some of the configuration on the sly of the SMTP host used by will mail delivery as well as the recipient and the sender and all that stuff using command-line arguments in project builders launch panel so that's that's how it's finding out all of this information so it started let's go and look at our mail browser and we see that our friendly web objects application has sent us an email and this is a list of movies that we can rent each movie is represented by a hyperlink I'll choose my favorite one I know if any of you can guess which one that is for some reason ie wants to insert itself I don't know I think Microsoft is wanting to get on stage with me but anyway I'm gonna go back to the project to show you what's happening behind the scenes before we see what happens what the result of clicking on hyperlink is so if we go and we look at the direct action class again clicking on the hyperlink actually invokes a second direct action called rent selected movie action and this action does two things the first thing that it does is that it sends a confirmation email to our hypothetical customer this is essentially the same thing that we've just done so that's not specially interesting the second and more interesting thing that we do is that we do a bit of Investigation as to what what movie we've got and we see that the application has come back to us and it's it's given us the confirmation email but oh we've received a system error so this is intended obviously for the system administrator not the customer it's no atrocious cinema alert apparently the apparently the web objects application doesn't like my choice at movies so going back to the project let's see if we can answer the question how's this email being sent so we saw here that we're looking we're actually checking what what movie were selecting this thing isn't emailing it every time I don't have anything behind the behind the magic curtains here all that is doing is is invoking the append Len method of the error member of the NS log class and you can see that it's just passing a string and the string I happen to use HTML because it looks nicer in the mail browser because we have nice HTML rendering and mail done app but you could you could do any string obviously it doesn't have to be HTML but the real question is how is the email being generated this not really clear here because as Melissa mentioned our default loggers which are the print stream loggers a few things to the console as well as to specified files so what's happening here what happens is that the logger class is actually an abstract class as she mentioned and you can subclass it as a matter of fact you can insert this thing into the NS log class which is the is the broker for all of the logging interactions you see here in the declaration that we're extending NS logs logger inner class and if you look at the class initialization you see that we are initializing all this stuff using those command line arguments that I mentioned before we create a new instance of the male logger class and we set the error member of NS log using this new instance which you saw before the local variable is called air that's the male logger instance so unfortunately this doesn't really tell us how the email is being sent to understand that we need to go and look at the append method there's a lot of code here this this example is is complete it's a simple example but it is a complete example we're not going to be talking about all of the accessor methods and all the rest that's as but as you can see here and it's hard to see with a big font but I'm actually the appending method now there's an abstract method I've implemented it here but instead of using print streams I'm using the SMTP client class in order to email the messages so I've already mentioned why how this is different from the default logger why you care about this is that in Java still it it's still useful to log things a lot of times and unfortunately is still necessary the debuggers are can be pretty decent but sometimes is unavoidable when debugging things to to log things to understand what's happening one of the nice things about this is that you can use the default print stream loggers which is really just equivalent to system.out.print 'ln and is just as easy to use you get all the same capabilities but you don't have the problems that Melissa alluded to and you also don't have to comment the things out and recompile you can just leave it in there and you can turn off the loggers you can even configure that at runtime so using the some command line arguments I'll refer you to the documentation for more information on those command-line arguments so this is just a demonstration of one of the new features and it's log in web objects 5 but I hope that this demonstration encourages you to take a look at the whole product thank you for your time ok thanks well onto more stuff that was interesting and fun and I've still got less interesting stuff to deal with so please bear with me ans lock this should be familiar to a lot of you who were working with objective-c there's three classes in s lock and it's multi reader locked in s recursive lot they all conform to the NS locking interface this basically says that thou shalt implement the methods lock and unlock mostly they're here to facilitate conversion from web objects for 5 but they also are a little bit more complicated and a little bit broader than the Java synchronization mechanism so they can coordinate locking of objects over a longer period or over a more convoluted code path and they can allow developers to do things that are kind of hard to do using just synchronized good example of that would be the multi reader lock Java synchronization method doesn't distinguish between reading or writing so it always watched the object that you're looking at but if you're writing your application you may know that you know 90 nine point nine percent of the time it's gonna be a read so it doesn't really matter if multiple things are looking at the data at the same time so you may want to use a multi reader lock which will end up only locking the object when you're trying to write to it key value coding a lot of you are probably gonna recognize that name from previous versions a unified way to access properties of different types it can access things that are in methods private methods public methods instance variables NS key value coding is yoki value coding split up into a number of pieces there's four abstract interfaces that define the various methods and key value coding there's an error handling interface and there are some default implementations that we provide the first interface is generic NS key value coding this is the very basic if you want key value coding behavior you must implement this interface defines key value for key and take value for key it has a subclass NS key-value coding additions which implement some value for key path and take value for key path the methods stored value for key path and take stored value for key were defined and split out into a Oh key value coding again that's the subclass of NS key value coding and finally there's yo key value coding additions which implement defines the methods values for keys and take values from dictionary this basically allows you to implement whichever pieces of the key value coding stuff you think you're going to need in your application without having to implement any of the rest of it in each interface we define two static inner classes there's the default implementation which is a convenient way to get it the default behavior if you want to add key value coding to a class and there's a utility class which is a convenient way to get the default key value coding behavior for any class whether or not it implements the key value coding interface as I mentioned earlier we've gone to Java serialization NS code and NS coding have our abstract now and we've replaced the whole the we've replaced our use of them with a native Java serialization scheme we've left them in place in case you had subclasses of and as our coding that you wanted continue using any classes that implemented NS coding now are now implementing serial are now serializable in java and if you want to see an example of how Java serialization works have a look at the persistent session stories apple that we shipped with web objects 5 what are the advantages of doing this Java developers don't have to lose learn a new archiving scheme which is a good thing and the Java Runtime framework does all of the work it takes care of graph traversal it takes care of cycle analysis all of that stuff we don't have to worry about it anymore we can concentrate on making web objects better well mail delivery as RD was talking about earlier is based on Suns Sun net SMTP SMTP client this is a protocol that doesn't support cc or BCC so people who are cc'd will also end up in the to field but it does allow mail pages to submit forms or to CM pitchers because well absolute URLs have generated java plot some of you may recognize this from previous versions it's now a WT based which means that all a WT fonts are available and that images are anti aliased there's been a number of bug fixes and some improvements unfortunately it's now subject to the limitations the AWT which is essentially that if you want to use it you have to have a window server running this is a limitation that should vanish when 1.4 is released later this year and the wolf smile framework some of you may remember that we demonstrated this at web at [Music] www.flairsgymnastics.com but when various pieces of it start playing if you have streamed content and I think we're done in summary web objects five is pretty much the same as web objects for five and four five one we haven't changed an awful lot we've added a few things we provide Java converter to help you migrate and we've added some new stuff to encourage you to move from four five to web objects five I think that's all I have to say unfortunately I can't play guitars and I don't sing very well so you know I can't live up to James James Dempsey's yesterday and I think I'd like to call my QA team actually I think first I had supposed to mention the lab and it's open until 6:00 most days this week and supposed to encourage you to vote for what objects is the best app server here's some of the other things that you might be interested in some things that have changed between web objects five four five and web objects five there's a direct direct to Java client XML later this afternoon and deployment has changed a bit and if you have feedback and I'm sure you will there's the feedback forum on Friday and list of people to contact there's Tony our who's our director Bob Fraser Fraser our marketer because I services lots the URLs up there you