WWDC2001 Session 614
Transcript
Kind: captions Language: en so thank you and welcome to session 614 I know it's pretty late and you all want to get a hold of some beer so I tried to make it quick the session is about advanced Java client I want to start out by summarizing little bit what we heard in this session 609 and 606 and then we want to go into a lot more details about the distribution here so let me start by summarizing that what we learned so far so Java client is a technology for distributed desktop applications right it's a three-tier architecture the client interacts with the user it displays the user interface you use the Java foundation classes or swing for that so we are basically platform-independent the server accesses the database and the database does the Tia which stores the data the client never accesses the database directly all the communication from the client to the database goes through the server so the server has complete control over everything the client is allowed to do and what and not and also what's interesting to know is that the communication protocol between client and server at least by default is HTTP so you get the connectivity of a of an HTML based application running in the browser but it's a much richer user interface and Java client is mostly designed for the intranet it's their couple of complications that either the launch time or you know the amount of data you need to download or you decline installation so it's not a good technology for you to put on high traffic internet sites now jonathan is actually pretty powerful and it's very very prepared for a lot of advanced tasks but since we do not have too much documentation at this time a few of the features are relatively hidden but I think you should really know about them so I will try to talk about you know very concrete method names this time notification names and I hope that you know you can all take something away from here you know to really tune your applications so first of all I want to go enough detail about the distribution there and the objects in the distribution area I want to talk a little bit about issues that you have to know about when you're going to go into deployment with your applications and if you say at the time I'd like to use and talk a little more about the controller factories that comes from Exedy they direct a Java client side and I'm show you how can use it to implement some nice features so you've probably seen this diagram before I don't want to go through all these boxes again but I want to kind of point out about which of the pieces in this architecture I'm going to talk because well the distribution layer is the layer that connects the client and the server that's where I would spend most of the time and then at the end we talked about the factory if you be in the e generation they are right at the top so that stuff is some object some information about the distribution layer and the most important topic when it comes to the distribution layer to me is business logic petitioning in Java client you can have implementations of your business logic both on the client and the server side the business objects are fully functioning on both sides of the architecture and you have the choice to either use the same identical business logic or you can use what we call petition business logic and petition business look business logic simply means that you use different implementations on both sides of the architecture and so far I always you know and I started talking about it I said you know the first thing you can do is you can restrict the visibility of properties to the server side so that they are not visible on the client side I want to make it a bit more complicated for the purpose of this session because you can also add additional properties that they're only visible on the client side but not on the server side now how does that make sense well you know sometimes you're not interested in all the information a lot of detail information you just are interested in derived properties so let's say you have an object that stores dimensions like a bid hide in the debt and on the client you really only want to see the volume of the complete object so what you can do is you can add an additional property to your model actually and markets only as a client side that and then the UN you do not invade the height and depth so that detailed attributes you know would stay on the server side and the client side you only use a derived attribute you also have the choice to use different implementations so if you want to you know perform computations in different ways the implementation of the Business Objects in use can be different first of all that adds a lot of security to your application because you never sent data or even implementations to the client that you don't want the client to see right now the Java you should probably know that all the classes you sent to the client can easily be decompiled so if you have you know computations algorithms that you considered you know secret you don't want the you know to be ever become public on any client side then you can force the client to use an implementation on the server side so you can make force the client to make a round trip to the server execute the computation there then just send the end result back it's a no data and no implementation that you don't want the client to see will ever go there and business repetition also has a lot of performance optimization something that probably today but really fast client machines doesn't matter so much anymore but if you have very fast server machines and relatively slow client machines you can design your clients to make use of the computation power of the server boxes but as I said it probably doesn't matter too much anymore but what's what actually is important is that you can use business logic petitioning to minimize the amount of data that's transferred between server and client if you have computations that need to take a look at a lot of data but you didn't fetch a lot of objects from the database to just get an end result but you only want to display this end result you don't want to send or the detailed data that you need for the computation there's no need for you to send it to the client you just design your client to make a round-trip to the server right execute the computation there and on the way back you just send to reside and other data that is needed for the computation does not have to be sent over the wire to the client side if you think that that's one of the keys to be successful with Java client that you find the right petitioning of your business logic right the key really is to minimize the amount of data that is transferred if you define it server how do you tell UF to use business logic petitioning where you just go into your modeler and if you want to use different implementations usually where you choose a different class usually in your model if you look at an entity you have a column where you can enter a class name the Java client you can actually you know unhide another column called the client psychic last name and you actually find it in this add column popup menu that you see at the bottom of the table and in here you can specify a different class name I don't know whether you can read it but in the example that I use here you know the packages are example.com in the credit card but in the first row and it's actually the same on both client and server side but for example in the second row I use example dot server that customer and example our client our customers so there are two classes but in two different packages and on the client I used a different implementation and on the server side the other thing you can do any of your modelers you can if you actually look at the detail of of an entity if you look at all the properties and relationships you're probably familiar with the column to set class properties so these are the properties you you know that actually make it into your business logic and your business objects and for Java client you can again unhide another column you can set the client side class properties so here you know you can in this case actually restrict it declines the visibility of the member sins and the phone attributes so they only visible on the server but not on the client if you improve you know the methods you use to implement business logic petitioning or defined a new enterprise object the most important one you probably need to know about is invoke remote method that's the method you need you invoke on the client side to make it you know to and you use it to basically move the execution of method to the server side so if you want to go from the client to the server you use invoke remote method the arguments you pass are first about the editing context the object is in a method name the argument types the arguments themselves so this is the you know the method name of the augment types identify the method that is supposed to be invoked on the server side if you invoke invoke remote method what happens is that the state of the editing context on the client side is basically pushed to the server side to the editing context on the server side and then the method that you specified the last three arguments method named argument types its invoked on the server side objects on the equivalent server side object and there are two more methods that are helpful for you and they they use them on the server side and they evade from client update and prepare values for client those are basically notifications to the business object that something has happens on the client side that the object has been updated on the client side and you can use it you know to perform additional validation or if you you know you can do computations basically its notification that helps you know the client the values for this object were changed on the client side right and prepare values for client is involved right before the object is sent back right when you central reside back to the client before the object is encoded right to be transferred we invoke prepare values for clients so if you have derived attributes that the only visible on the client side vary from client up and prepare values for client are very useful it you can basically you know delay the computation of the derived values until the invoke prepare values for client again the order is on the client side we invoke you invoke invoke remote method on the server side evade from client update ism and the method remote method X is performed before the object is sent back me invoke prepare that is for client there's a very important naming conventionally used for remote method invocations the naming convention is that if the name of the method starts with client-side requests then we considered a method that is you know open for unrestricted access from any client if your method does not start with the client side request and then actually there's a security mechanism in place I talk a little more about it later you can use to restrict the access of methods to serve clients something that is now possible in though objects 5 but was not possible about it's 4.5 is that now you can use common super classes for your business logic implementations in web objects four five four five four four five one the server side was implemented in Objective C the client side was implemented in Java right in Objective C we had a wrapped API so the superclass was some you know in server side package so you generic record you custom object vendor in the server side package and the client you know had a different implementation of the superclass so for client side business object in the server side business object you couldn't use the common superclass but that's actually possibly now and that opens the door for you know a lot of good design actually so what I recommend to you is that you use common super classes for the two implementations and just define methods abstract right that you want to have different under both on both sides and then you you implement a client subclass that they were mode method invocations in the server subclass that the concrete computations let me show you an example so this slide shows you know roughly how you know a class secret would look like at this time I'm sub classing a generic record as you can see the package there shows this example that common import chrome web object you control it's just business logic I don't need anything more then you know I would implement shared functionality and other methods and the methods that I won't have different I declare abstract for the client-side unis I use a different package the page is not example the client and the class doesn't extend Eugene egg record anymore it extends my superclass the one that I just created example comment secret and the implementation of secret value performs the remote method invocation as you can see I'm using our naming convention clients at request here said something easier for me I don't have to worry about the security restrictions then and the method that I invoke takes no arguments that's why I and the end of the invoker mode method you know if there are no arguments you can just pass not on the server side again I use a different package example dot server again you know the class again extends the common superclass and now the method secret where you actually implement some of your business logic as you can see it's been complicated here but then there's a second method its clients that week first secret value so this is the method the client actually invokes and it then invokes the vir method right so this is the the design pattern that I recommend to you and the convenience or the the communion this is convenient because you can write business logic your code against the abstract superclass right it's available on both sides you don't have to worry about you know the complete package if you want to reference the class from other classes from other code you would write it against the shared superclass right this is abstract but for the since the API is defined already as abstract methods you know you can compile against it and then it happens to resolve to the concrete subclasses and the different packages at runtime let's take a look at the objects that made this happen there are four objects I want to point out to you two on the server side for Java client applet and your distribution context and two on the client side you distributed object store in your distribution channel actually you HD feature and as you'll see later the Vote Java client applet is a web objects component it lives under don't get confused with the name that there's an applet in there it's a web objects component living on the server side and it's responsible for generating the applet tag if you it has a lot of bindings you know some specific to happen to the applet like the width and the height the code base but it also has bindings really specific to you know Java client for example the name of the application class the name of the distribution channel as you will see later if you use direct Java client you have a binding that you can use to specify the class of the controller Factory and so therefore Java client applet is the object the basically prison well through which all the communication from the client goes if the client contacts the server it actually talks to this object the Vote Java client Apted about its component that the instantiated on the server side now you might wonder how that all works if you start the application the client application is a desktop application not as an applet if you serve it as in desktop at the next if you do create a void Java client applet but we don't really need it in that case but we decided to do it anyway because it gives you one single place that you can configure your client right we basically use the bindings of the boat Java client applet that you define that you can define to both initialize applets as well as desktop applications so the advantage for you is you don't have to worry about whether your client runs us an application or whether your client runs it's an asset it's the same code path that is executed all the time and there's one place on the server side in the code on the server side we can initialize or we can specify all the parameters for the client and usually you know if you want to change some of the bindings just open the you know is the main component go develop objects builder and the inspector and change or the binding step the other important object in the server-side is the EU distribution context the new distribution context is the object that performs all the work right when it comes to Java client it's the object that keeps track of a lot of state already it tracks which objects have been fetched by the client it's the object that basically you know takes care of synchronizing editing content business data on the client and the service side and you know we could have made the bow Java client applet and the you distribution context the same object well that probably would have been pretty poor object design and second of all as you will see later you actually have the choice to change the communication protocol if you don't want to use our way of communication if you don't want to go you know to avoid Java client app that you can plug in your own mechanism and so you would still use the ear distribution context right so the Vote driver kind a participates is the object that you know who sees messages but just forwarded to the distribution context and this and the distribution context is where all that work is performed on the client side the two important objects are a distributed object so in your distribution channel the you distributed object store is another type of root object store it basically replaces the you database context that you might be familiar with the distribution of it this will be the object so X as the parent object store for the editing context so the editing context fetch or save data they go through the distributed object store and the disability object store basically makes the client behave like in nested editing context to the server side the decision and every distributed object stored in this video officer uses a distribution channel to actually perform the communication so the distribution channel is responsible for sending the data from the client to the server and it's the you distribution trainer is actually an abstract class and you will usually use the concrete subclass you HTTP channel but if you don't like it you can plug in your own way of communication I know that you all like pictures so I have one for you so if an editing context you know on the client side fetches data it will actually go through a distributed object store which we use the distribution channel right to perform it to the communication with the server side in the server side the Vote Java client applet the instance of what Java connected that he created it's the object that receives the request it forwards it to the distribution context and that one and you know usually access to the editing context the default editing context of the session to actually you know take a look at the data so the four objects that introduce to you the distributed object store the distribution channel the Java client or Java client Apted in the distribution context those who opted to work together to connect the editing context on the client side to the editing context on the server side now that we knew the distributed object store there's some actually an API I want to mention to you the new distributed object store can easily be found because it's through the object store there's API on your object store default good object store this is that one default rule parent sorry about that you'll find it so it's actually very easy to to access the irresolute object store and it has an API that a generic API you can use to perform remote method invocation so if you have something you need from the server that it's not related to business logic you know something that you need in your application of logic maybe you know information about what kind of resources are available maybe you know you want to handle user defaults in a special way then you can use this method here and it's takes similar parameters than the one that we found on a way enterprise object it takes an editing context the reason I'll talk about in a minute it takes to keep path it actually identifies the objects on the object on the server side that receives the method but if you invoke it on an enterprise object it's clear which object is to receive on the and the server side because you know there's one version of the business object on the client one version on the server side you there's an equivalent on the server side so if you know exactly where to send a method but for the generic API game you have to specify where to send it the other arguments method name argument types and arguments you already know and there's another flag push changes so the method the the arguments entity constant push changes I think you would probably not need them very often but if you remote method invocation is related to some kind of business logic you can pass the inedited context and this method here will make sure that the state of that editing context is synchronized with the server side editing context okay so if you're if you need the latest state of the business logic on the server of the business data on the server side you can pass the editing context and for push changes you pass true and then the the distribution layer would take care of synchronizing the state of the editing context you pass to this method here and the edited countries on the server side let's take a look at the key path for a moment there are three ways you can describe the target of the remote method invocation first of all you can pass just knife for the key path if you do that the distribution area assumes that you want to invoke the method on the distribution context directly it's pretty rare and on our default mutation of your distribution context there's probably nothing you want to invoke if you subclasses of distribution context this might come in handy more common is probably that you pass an empty string an empty string indicates to the distribution area that you want to invoke a method on this what we call a distribution target the distribution context on the server side has a registry for arbitrary objects you can just add additional objects right to registry and when there's a remote method invocation the distribution context may search through these targets and find the first one that implements the method you described and invoke the method on it so these in invocation targets are very convenient way to basically extend the functionality of the distribution context right there's nothing the object will really be arbitrary you know any class that's just fine just has to implement the method you want to invoke and the method has to be public by the way now the question is how do you register additional targets because you know why the server is running there might be clients that are instantiated there's not just one distribution context for every client this and distribution context so to help you we send out a notification and it's called EU remote method receive a needed notification it's a very long name so use copy/paste but if you register for this notification receive it you can use the notification to add your invocation targets so basically you could make for example your application object you can you can register your application object for this notification and then in the notification the user introductory you actually find the distribution context that was just created so then the session yeah so then the client connects to the server will send up this notification and it will contain the distribution context and then you can use it to add your you know method receivers and if you don't person I and if you don't pass an empty string then the diffusion layer zooms that the the key path actually identifies an object relative to the distribution context for example it could be a session write a distribution context has a method session so if you person specify certain you know we will follow the key path the string you interpreted as a key path starting at the distribution context you know go to the target and use that bonus the method you want to send the definites the object you want to send the method to again even for this generic API we use the naming convention client-side requests so if your method name starts to cancer breakfast it's it's an open for unrestricted access we talked a little bit more about distribution centers as I said the distribution centers are responsible for transferring the data between client and server and as I said there's an abstract class a distribution channel and there's a concrete subclass new HTTP channel you were probably on most of the case you would stick with the EU HTTP channel if you don't like it at all you can implement your own subclass or your distribution channel and instead instead it's fairly complicated so you know if you can try to stick to the UDP channel if you want to change the class of the distribution channel there's a binding in the word Java client applet that you can change they can specify the new class name that you want to use on your HTTP channel there's one method that is particularly important because if you want to do things like connecting to SSA then you can override this one method here create socket you pass the protocol of the URL the host name and the port number to create a different kind of socket for example in SI saket not actually like to show you an example my name is Eric and running through SSA and back to us Nova chats to come up on stage and drive to demo for me so if you could switch to the demo machine for our demo purposes here we used a package called jss e that you can download from Sam's website it's basically some kind of reference implementation for for secure socket layer and we have the code that we had to write on the client side for the channel here on the screen so as you can see there's a class as a channel extending our new HTTP channel and if you focus for a moment on the create socket method first check of our check whether it's actually using HTTP if not we just use you know the superclass fermentations so this socket this division channel actually supports both protocols and if it's HTTP then the only thing we have to do is to use you know the stasis e djc classes to create an SSH socket said if you parametres and return this new socket it's that easy that's basically all you have to do and decline so now if you look at the static relation initialized at the top and there are two things we have to do make sure I had to write down on why that is so the first line enables the HTTP protocol in the URL handler and the other one registers as a security provider so these two things we had to do these two methods we had invoked to register you know the jss implementation with the system to be able to use the socket okay I think now we just like to run the applications so that you know that it works so the service starting and so far we obviously use this Java client launcher program I think it's minimizing the darker so it's at the right side this time you want to show you actually the strip that we're using so we wrote it in script and it's very simple it basically but it's based on the script that the budget generates for you anyway if you compile client applications if you we always create you know launch script for you for the server side that we also create the script for the client side if you just use that one and then the difference is if you pass in the UAE as you can see we use HTTP and the past additional arguments which is genic last name and there's our new channel class so let's execute the script and then hopefully in a second we would see an application that we just generated with the assistant it's a nothing fancy about the application but it connects to SSN so there's actually not a lot of code you have to write on the client side to do it to make that happen may actually turn out to us that it's much more complicated to configure apache to allow us to do SSA than you know to implement the client side and there's our client so there's nothing special about you've probably seen this before but the difference is now it's connecting to SSA so it's reading thank you know what let's sit back to the slides thank you a lot of features all of the hooks that you need to use I implemented or available to you in the form of delegates there are two objects where you can set a delegate for one is on the server side one's on the client side again and the server side is on the you distribution context the you know various delegate methods you can implement just to list what you can do I'm festival you can encrypt and decrypt the communication so everybody that is sent between client and server you can apply your own encryption mechanism to I think it's probably more convenient for you to just use SSA or something like that you if you want to implement your own encryption mechanism you have delegate methods so you can control every single by the dissent between client and server you can also control the access you know if the client then fetching Business Objects basically there's delegate method you can control exactly which objects the client is allowed to fetch so if you don't want to make an entity object of an entity visible to the client can use delegate and just say no you can see there sorry and the third hope you have in the delegate is that you can restrict the invocation of remote method invocations but if you don't follow the naming convention clients that request then by default we do not allow you allow the client still work any other method but you can use to delegate to open up the method invocation so for every remote method invocation that the client tries to perform the day delegate will be notified and can you know on a client basis determine whether this method can be executed on the server or not so those are pretty strong security features you on the client side in the you distribution channel you can also handle encryption decryption but this is the other way around both client and server offices need to work together otherwise you get a lot of mess but yeah so and the second piece is the second hook in the in delegate of the distribution channel is that you can deal with exceptions there are two types of exceptions you can get one is an i/o exception something went wrong with your communication right maybe something you can't open a socket you know maybe the network just went down something like that there's an exception like that the delegate can handle it it can try to reconnect maybe but it's up to you but there's another type of exceptions that happen quite often and that is that something on the server right there's nothing wrong with the communication but there's an exception raised on the server side maybe a validation error right maybe variation method on the server side of the business logic on the server side raise an exception and then you can handle those kinds of exceptions with the delegate another very common accepted by the way is session timeout right so the delegate has a way to deal with all these kinds of exceptions the timing is pretty important for setting the delegates because especially or especially if you do encryption decryption you have to make sure that the delegates are in place before the first byte is transferred right and the delegate needs to be in place on both sides of the architecture so the best way for you to set delegate is on the server side but then by receiving registering for another type of notification it's the you distribution distribution context instantiated notification you send it out whenever created is to a distribution context and there you can set a delegate right and on the client side the best way for you to set the delegate of the distribution channel is by using an subclass of your application and going to the constructor it's really the only place that you have you know to apply your own to plug in your own logic before we make the first round trip if you don't do in Krypton and decryption you can do it later but you know if you have to you would have if it's if you use encryption decryption then you would have to use an application your application subclass and like not to talk a little bit more about deployment issues first of all I'd like to go over the system requirements for the server side the Java client/server server application it's a standard object education wherever you can deploy a bit object server you can deploy it above your server for Java client on the client side the only thing view quite is jdk 1.3 that does contains thing now that was different in the earlier times the jdk one-on-one aid now jdk 1.3 contains things so there's no need to download it anymore on a cos 10 mecha-suits probably the best platform to deploy Java client applications because JDK 1 / 2 is integrated in the operating system very convenient on Windows and you have to download it from Suns website and unfortunately on Mac OS 9 there's no JDK 1.3 support so you will not be able to deploy them the two options you have the Java client for deployment are desktop applications or applets if you deploy desktop application you would create a little launch program on Mac OS 10 we probably use project builder or there's another tool called MOJ a beta on Windows you would probably just readily launch script and then create a shortcut to it from the desktop if you deploy an applet on mecca's 10 again it's relatively easy if you would probably use Internet Explorer which comes with the system and browsers on mecca's 10 use the java vm that comes with the operating system that's pretty nice on Windows for both Netscape we you probably require to use the Java plug-in but for IE microsoft has not committed to jdk 1.2 or 1.3 support I think Netscape has but you know depends on the version of Netscape that you use so the best way around this is to use the Java plug-in which Sun provides again it can be downloaded from Suns websites available to everybody and Java client is actually pretty smart about this and use JavaScript to detect the client configuration so we do the right thing for you but you can just say yes please use the Java plug-in you'll find out that if it's on necklace 10 you know if you don't have to use it its integrated in the operating system if it's on windows 4 ie and Netscape you do the right thing users will be pointed automatically to son's website they can download the plug-in and then everything is fine just to show you how easy it is to create a launch program I'd like to ask Noah to come up again and what we want to do is we want to create a launch program for the application we just generated the SS edge that they just demoed before the SSL demo and that's actually pretty nice because we can demo a few features of the new project builder that come in very handy so the first thing you do is we create a new project and this time we just choose a java application template it's not even a web object template if you give it a name call it is a launcher and this is a pretty simple project it has a Java class it has an icon fire so you can drag in your own I can if you want this is the default I could be we get and that's the properties fire maybe we go ahead and change some of these properties make should be already load them so just that they don't make any mistakes why we give this demo here first of all we will switch the main class we would specify typical class if you use the Java client common object to your application your application and then also we will use a property that is understood by the mrj and this is these are basically parameters that are passed the main function in your application so here we specify the application you are a write using HTTP again if you specify the chana class name as a demo client SSH and so these are basically the parameters that we pass on the command line when we use the script you just you know put them in this properties file here in addition to that we want to create if you know an application that contains all the Java classes that we need so we will drag a few jar fights and here we put them all in one convenient directory here the Java fights that we added first of all the word Java client a jar you find that in system library Java and it contains all the UF client-side classes there there are three Java files that come with Jas is e you just drop them in there and there's the SSA demo dot jar that is the that is the client side of our application so it contains our channel class and I think the interface controller that we needed for the client side and then something I would like to point out here is yeah please go to the targets you can activate that you can ask project builder to integrate all these jar files into your application so we activate the merge option here and what that we do it for us is that all the Java classes inside these jar files that we specified we end up inside your application right so it's going to be nicely packaged for you for deployment let me just take a moment because actually a lot of classes needs to merge together in one jar fire so this is really convenient in the new project video okay that's it and are we just started I mean it won't look very different from before but the nice thing is now we have you know a desktop application it's it's self-contained you can take this one app you contribute to the client that's all you have to do very nice what's happening that is so that's our client nothing special about it okay thank you know it puts it back to the slides okay I'd like to go again through the deployment options and compare the two deployment options and this is basically going to be a repetition of what we've heard so far but I think it's very important to understand so the biggest advantage of an applet is the simplicity of the client installation because when the applet starts up it downloads all the classes from the server side if it needs to execute the client program so if you want to upgrade your application if you want to ship a new version of the client you just have to you know install the new classes on the server side and when the clients start up the next time the applets they just pick up the new classes so that's very convenient for you to handle the applications you first we have to create this launch program and then you have to install it on the client and on the client it has to you know you have to have all the Java classes available on there on the client side so if you want to upgrade your a little bit of traveling because you have to make sure that all your client applicator or end users right upgrade to the new version so the alarms of the applet is really dead installation and upgrading is so easy on the other side the applications provide a much better user experience just much more convenient for the user to have a desktop application that can be accessed through you know student icon on the desktop that is completely embedded in the desktop environment you know you can hide the application you can minimize windows you have access to service menus you don't have to put the applet so the user experience is much nicer also applications perform a little better than applets that's mostly because applications run very isolated applets in one browser might have good efforts in one browser actually share the same Java VM so they can have all kinds of negative side effects both on the performance and the stability side that's not something you should be it would be happy about as as an application developer but applications are isolated if you know if another java application is running it doesn't affect us if it crashes if it doesn't that's something bad that the system it doesn't affect the the java application also from your perspective as the application developer you don't have to deal with security restrictions on the client-side in a place there's a security manager in place usually prevents untrusted code to execute to access the file system right the applications you don't have to worry about that because there's no security manager right you can do everything you need to do on the client side and users might see that it different and that's why it got a little dot here because you know that applets they know if it's untrusted code that the Java VM will prevent the update from messing around to the computer so they might actually like to execute at this this other side if you're in internet environments it probably doesn't matter so much because hopefully your end users trust the system administrator to pass out good software the last thing that this can come in very handy with applications that you have full control over all the Java VM parameters if you need a special heap size or you know you actually you want to choose the VM you want to execute in you can do some of the applications and applets you don't have any control over that it could compromise from my perspective is when it comes you know in the in regards to installation upgrading to use a special class loader for the client application the base system doesn't change that often the base system would be the JDK 1.3 and all our UF Java client classes so it's actually a very good idea to install those classes on the client side and then to download all the classes that are specific to your application there's actually exactly what we do with this Java client launcher that we used in the previous demos you know we didn't have to configure the client in any special way the reason was that it contacted the server first of all asked it what kind of classes are specific to this client right downloaded those classes even before it went into the UF code and so that's very convenient because you know the base doesn't change that often it's on the client but you still get you know a fair amount of upgrade ability with the special class loader because you can upgrade the client classes on the server side you can make it available on the server side and you only take a small hit because they're usually not that many specific classes to your application it's maybe 50 classes or so that's pretty quick to download right so you probably take a hit of you know one to three seconds at startup time but the benefit you know of of you for you to to be able to upgrade the client applications quickly and fix bugs in an elegant way without having to worry about you know shipping another installer and making sure that all the clients really install it that's quite compelling the next two points session time mods and server instances I received a lot of questions about that so Java client on the server side uses normally both sessions and the client connects the credible session objects object and sessions have you know sessions time out the problem that you know usually not a problem except that users of desktop applications usually don't expect that but I mean if you know if I'm running an app in the browser I can understand by a session times out but if I use a desktop application that I just double clicked I don't you know you didn't see this concept of session timeouts so to help you Java client explicitly notifies the server if the user hits the application right so what that means is that if the client you know it's terminated cleanly so you know the user chooses the quit command then we actually make an round-trip to the server hey I'm gone and the server within clean up that session so for most of your clients right you shouldn't have to worry about the session time of the session you know not terminating because it would explicitly notify the server the only sessions that might stay around is if you know maybe the network connection went down the user had decided to kill the application something like that so there might be a few sessions you know of not cleanly terminated applications to stay around but that shouldn't really bother you so the best way to leave the session timeouts is to use a very large timeout maybe 24 hours maybe in 48 hours that way users that started the desktop application you know southern in the morning then maybe they went for lunch come back three four hours later maybe had a few meetings in between but they don't face session timeouts and it shouldn't concern you that the sessions are around let's talk about server instance for a moment Java client with Java kind you could scared the server side in the normal way like that every other web object education if you serve a lot of clients at the same time just use much with server instances something they might have I'd like to give you a little more information so that you can you know better understand what's going on the clients some information that might help you to determine how many services you need the first thing you should know about Java client is that there's usually a very high load at startup right often there are classes that have to be downloaded especially if you're honest applets if you start a Java client there's some kind of UI information being exchanged also you know users usually start out in the beginning you know to search for objects they want to work with so that's usually high load at startup and then afterwards it uses just you know relatively small packages and actually for the same amount of data the communication the Java client the the package size for the data it's not smaller than the HTML so if you you know have five objects you want to say in HTML you know all the HTML around it if you compare that to the encoded stream of data that we use for Java client the Java can stream is much more compact it's really nicely compacted business data now the fact that the packages are smaller doesn't mean that you will never have a problem with the communication and what I would like to point out is that usually you know in intranet applications the amount of business data that the client wants to access it's much larger so what the message is really for the same amount of data there's no you don't have to worry about Java client you know creating a lot of data to be transferred but be careful because in internet applications most users will access more data than they do you know in the internet or they maybe have a new shopping basket or so that's not a lot of data there okay and I think we actually do have enough time so I'd like to talk a little more about the controller Factory the controller Factory is the object in the center of dr. Java clients than am using the face generation it's the object that's responsible to communicate with the server to request you know a description of the client-side user interface it's responsible for instantiated or the controller hierarchies that you use on the client side but the controller Factory is not only useful in dynamically generated applications you can make use of it you know it's actually very convenient sometimes to make stand empty created user interfaces and statically generated user interfaces so lip fight such a tenet in interface builder the factory provides a good amount of API that you can use to retrieve you know additional configuration information from the root system and also provide some API you know to create controllers and vendors on some kind of an action basis so if you need something like a modal dialog to quickly select a few objects and you don't want to go into interface builder set up this compute you know the window of the more dialog and lay out all the digits again you can just use a method on the controller Factory and we probably you know do the right thing so some of the methods I just listed here select the entity name would create a modal dialog that the user can choose an object open global IDs with entity name it would pass a set of global IDs and you would get a set of form windows if you want you know the user wants you want to use it to insert a new object you can ask the factory to create a window that insert the entity name and you know the creative in it but the user can enter the new data there's also more low-level API and to retrieve what we call primitive controllers you can consider a primitive controller to be a small unit in the UI basically related to one entity and one task so for example in the query window usually have very primitive controller and the list primitive controller right every query pane in the claim you know usually we usually consists of two primitive controllers and there's a pretty large API just a few methods here to a controller with entity less controller and form control over that but you can use and actually like to show you how you can use these methods to implement some nice features so no but it's coming up again cuz if you switch to the demo machine so here we have a prepared application and I think we first want to start it so the service started and now we used to Java plane launch again to launch the client there already is so you're connecting to the server now see the nice thing about this Java time conscious that you can even launch the client before the service there because the wait until all the classes are downloaded right if we wait until we connect and then download the classes and then start then jump into VF code so here's our application it looks pretty normal if I don't move that window a little more to the left and it looks like basically the winner we could have created with the assistant this especially menu item in this application that the ADA discards configure and we will you know if you get a little configuration tool which happens to look very similar to the assistant that you usually use now let's just have know about play around a little bit there and see what happens so he's removing some of the attributes there and he's switching to list okay doing the same thing there now what's the bender on the left side and we press the apply button so the UI automatically actually configures to this new to this layout so what we kind of simulate here is a UI where the end-user can actually choose what kind of data he or she wants to see right it's like a user configurable UI let's take a look at the source code we had to write for that so why don't you quit the client okay that's fine so the class interesting is JC dynamic which is a subclass of you interface controller and that's all the code we had to write so the important method here is update user interface we invoke it both in the constructor of the interface controller and it's also invoked when we press on the default on the apply button and this tool in the configuration tool and as you can see the only thing we do is if there is Orion editor to remove the old one then we create a new one that they have the controller factory and actually the primitive controller you know it's one controller as much with SAP contours it's a little hierarchy of controller status response before you know this this editor part and he sets this controller in there so we use a method a new controller it's called controller of the key value pairs which this is a method that it works through a hierarchy of controllers you know and looks for a matching controller for this this key value pair and then we just set a relationship paths so that's basically the connection of the list controller you know the detail controller to the master detail to the master interface and we add the sub controller so that's all the code we have to write for that so the controller factory is really useful for you if you want to have some kind of user configurable UI and why don't you press on the g JC application so this is you know code that would be much more complicated for you would obviously have to come over to view to it for the user to you know to enter the configuration data but we made it easy if you just use some kind of a you know simplified assistant here and the most important piece actually if you scroll up again there's a method defaults which we overrode and you just use especially defaults class as you can see in the constructor here and so this is basic just to register for whenever the user defaults change right then the Refresh the use interface that's all of you okay thank you know about so just to repeat what we did if you want to come up with a user configurable UI you would have to you know will actually use the word system right I mean if you use it an empty generated piece and the user interface so we you would have to write a rule to retrieve you know the list of properties the user really chose so you would have to create some kind of a you know a database a configuration store it could be you know and the file system can be in the database and in the interface file or actually sorry I forgot about that could be switch do you still have that open in IV just close okay it doesn't matter what we did in the interface file is the best created it with the assistant and then just remove the whole lower portion of the user of the Lib file and replace it with an empty box within its custom view and we told the interface controller that this is the so called sub controller area the sub controller areas is you know way for for us to point the controller to view where all the sub views of dynamic generated UI should be placed and so we have to read rule in the world system right to create to retrieve the list of properties on a user basis we would have to go into the interface file as you remove everything that we want to create an a McLean replace it with an empty box and then we have to after a little bit of code that dynamically swaps sub-controllers and as I said you use the API on the factory to retrieve primitive AP primitive controllers so for some in this controller with the entity and then obviously and probably the most complicated part he would have provided to like a preferences panel so where the user can configure the data it's not number okay so in summary Java client is very powerful it's prepared for a lot of advanced tasks the most important objects are the new distribution context on the server side and the you distributed object store on the client side let's mention mentioned about Java client applet and the new distribution channel I think most of the time you do not work with them directly but you use distribution context with the users with the object store and the delegates for those objects distribution channels are customizable it's actually pretty easy as you sort of plug-in SSA again you have multiple options to deploy you can deploy its desktop application or as an applet and the controller factory is a useful thing to look at even if you you know don't want to leave the traditional development if you still on the works of interface files and generate most of the pieces of the UI by hand and the controller Factory might make your life easier it's really worth to take a look at it okay I think typically slides at the end and the lab actually closes now it's open tomorrow again at 10:30 please vote for the objects as the best app server and those are the persons to contact Tony our director and Bob and product marketing and I services you