Changes for page Java Client and Direct To Java Client Example Project using WebStart
Last modified by David Avendasora on 2008/07/01 16:52
From version 32.1
edited by David Avendasora
on 2008/06/26 10:34
on 2008/06/26 10:34
Change comment:
There is no comment for this version
To version 22.1
edited by David Avendasora
on 2008/06/25 09:38
on 2008/06/25 09:38
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,7 +5,3 @@ 1 -This tutorial will help you create a single Eclipse/WOLips project that contains both the client- and server-side classes of a WebObjects Java Client project, build both applications and then launch them both. 2 - 3 -You can also create a Java Client application using two separate Eclipse WebObjects projects. One for the server, and one for the client. This will make the separation between client and server much more obvious, but then you will have two Eclipse projects to maintain. 4 - 5 5 1. Create a new WebObjects Application 6 6 [[image:Picture 9.png]] 7 7 1. Name it "WebStartJNLPTest" in Eclipse with a package of "your.app" {{note title="Note!"}}If you change the Project name or packages, then you'll need to make additional changes in the subsequent steps.{{/note}} ... ... @@ -29,9 +29,7 @@ 29 29 30 30 {{/code}} 31 31 32 -1. Create a WOComponent named "JavaClient". 33 -[[image:Picture 11.png]][[image:Picture 10.png]] 34 -This WOComponent will be what passes the specifics about your client-side application to WebObjects. 28 +1. Create a WOComponent named "JavaClient". This WOComponent will be what passes the specifics about your client-side application to WebObjects. {{note title="Note!"}}If you are not creating a Direct To Java Client (D2JC) application, then you will need to replace the applicationClassName (com.webobjects.eogeneration.EODynamicApplication) with the name of your client-side application class. Your non-D2JC client-side Application class *must* subclass EOApplication.{{/note}} 35 35 1. Modify the JavaClient.html replacing the contents with: 36 36 37 37 {{code title="JavaClient.html Contents"}} ... ... @@ -38,14 +38,14 @@ 38 38 <WEBOBJECT NAME=JavaClientComponent></WEBOBJECT> 39 39 {{/code}} 40 40 41 -1. Paste the following as the contents of the JavaClient.wod file.Feelfree to change the applicationName, applicationDescription andvendor parameters to anythingyou wish.35 +1. Modify the JavaClient.wod file by adding: 42 42 43 43 {{code title="JavaClient.wod Contents"}} 44 44 45 45 JavaClientComponent: WOJavaClientComponent { 46 46 applicationClassName = "com.webobjects.eogeneration.EODynamicApplication"; 47 - applicationName = " D2JCWebStartTest";48 - applicationDescription = " D2JCWebStartTest";41 + applicationName = "WebStartJBNDTest"; 42 + applicationDescription = "WebStartJBNDTest"; 49 49 downloadClientClasses = "noDownloadClientClasses"; 50 50 vendor = "My Company"; 51 51 } ... ... @@ -52,11 +52,9 @@ 52 52 53 53 {{/code}} 54 54 55 -{{note title="Note!"}}If you are not creating a Direct To Java Client (D2JC) application, then you will need to replace the applicationClassName parameter (com.webobjects.eogeneration.EODynamicApplication) with the name of your client-side application class. Your non-D2JC client-side Application class *must* subclass EOApplication.{{/note}} 56 - 57 -1. If you didn't add an EOModel file to the project when you created it, do it now. Drop any existing EOModel in the Resources directory, or create one from scratch. 58 -If you don't specify a client class name for each entity, then WebObjects will automatically use EOGenericRecord as it's class. Once you want to start specifying client-side logic including default values and such, you will need to add the Client Class Name to the Entity in the EOModel, and then setup a new .eogen file in eclipse to generate the client-side classes. 59 59 1. Add the following frameworks to the project build path: 50 + 51 +{{code}} 60 60 JavaDirectToWeb 61 61 JavaDTWGeneration 62 62 JavaEOApplication ... ... @@ -71,13 +71,10 @@ 71 71 JavaJDBCAdaptor 72 72 JavaWebObjects 73 73 JavaWOExtensions 66 +{{/code}} 74 74 75 -{{note title="Note!"}} 76 - If you are not creating a D2JC application, then you won't need all of these, but they won't hurt anything either. 77 -{{/note}} 68 +1. Create a ClasspathClient.txt file in the root of the project and paste the following as contents: 78 78 79 -1. Create a ClasspathClient.txt file in the root of the project and paste the following as contents:{{note title="Note!"}}If you changed the applicaton name in Step 2 above, make sure you change the name of the Client-Side .jar file in the first classpath line below (WebStartJNLPTest.jar). Also be sure to match the case of the project. Client-Side .jar filenames are CamelCase instead of all lowercase as server-side .jar filenames are.{{/note}} 80 - 81 81 {{code title="ClasspathClient.txt File"}} 82 82 83 83 # ApplicationClass == com.webobjects.eoapplication.client.EOClientApplicationSupport ... ... @@ -106,16 +106,70 @@ 106 106 107 107 {{/code}} 108 108 109 - Thisfile is onlyrequiredbytheapplicationwhenit isbeinglaunchedfromwithinEclipse.98 +1. Create a javaclientbuild.xml file in root of the project and paste the follwing as contents: 110 110 111 -1. Create a Java Client Incremental Builder by following the [[instructions>>Java Client-WebStart Incremental Build]]. This file is needed to make up for the lack of Java Client application building by the WOLips Incremental Builder. It also copies the client launch scripts into the project so that the application will auto-launch when you run it from within Eclipse. 112 -1. If you did not setup the Java Client Incremental Builder, then right-click on the javaclientbuild.xml file and select "Run As -> Ant Build" 113 -[[image:Picture 12.png]] 100 +{{code title="javaclientbuild.xml"}} 101 + 102 +<project name="javaclient" default="javaclient" basedir="."> 103 + <target name="setProps"> 104 + <property file="${user.home}${file.separator}build.properties"/> 105 + <property file="build.properties"/> 106 + <property file="${user.home}${file.separator}Library${file.separator}wobuild.properties"/> 107 + <condition property="wo.properties.check.failed"> 108 + <not> 109 + <and> 110 + <isset property="wo.wosystemroot"/> 111 + <isset property="wo.wolocalroot"/> 112 + </and> 113 + </not> 114 + </condition> 115 + <fail message="Could not find ${user.home}${file.separator}Library${file.separator}wobuild.properties." if="wo.properties.check.failed"/> 116 + </target> 117 + <target name="javaclient" depends="setProps"> 118 + <mkdir dir="build/${project.name}.woa/Contents/WebServerResources/Java"/> 119 + 120 + <!-- project client-side classes --> 121 + <copy todir="build/${project.name}.woa/Contents/WebServerResources/Java/"> 122 + <fileset dir="${classes.dir}"> 123 + <include name="**/client/**/*.class,**/common/**/*.class,**/BMGenericRecord.class"/> 124 + <exclude name="**/server/**/*.class"/> 125 + </fileset> 126 + </copy> 127 + 128 + <jar basedir="${classes.dir}" 129 + includes="**/client/**/*.class,**/common/**/*.class,**/BMGenericRecord.class" 130 + excludes="**/server/**/*.class" 131 + jarfile="build/${project.name}.woa/Contents/WebServerResources/Java/${project.name}.jar"> 132 + </jar> 133 + 134 + <!-- Launch Scripts and WOBootstrap.jar--> 135 + <mkdir dir="build/${project.name}.woa/Contents/MacOS"/> 136 + <mkdir dir="build/${project.name}.woa/Contents/UNIX"/> 137 + <mkdir dir="build/${project.name}.woa/Contents/Windows"/> 138 + 139 + <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/UnixLaunch.sh" 140 + tofile="build/${project.name}.woa/Contents/${project.name}"/> 141 + <chmod file="build/${project.name}.woa/Contents/${project.name}" perm="ugo+rx"/> 142 + <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/WinLaunch.CMD" 143 + tofile="build/${project.name}.woa/Contents/${project.name}.CMD"/> 144 + <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/WOBootstrap.jar" 145 + tofile="build/${project.name}.woa/Contents/WOBootstrap.jar"/> 146 + 147 + <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/UnixLaunchClient.sh" 148 + tofile="build/${project.name}.woa/Contents/MacOS/${project.name}_Client"/> 149 + <chmod file="build/${project.name}.woa/Contents/MacOS/${project.name}_Client" perm="ugo+rx"/> 150 + <copy file="ClasspathClient.txt" tofile="build/${project.name}.woa/Contents/MacOS/ClasspathClient.txt"/> 151 + 152 + <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/WinLaunch.CMD" 153 + tofile="build/${project.name}.woa/Contents/Windows/${project.name}.CMD"/> 154 + 155 + </target> 156 +</project> 157 + 158 +{{/code}} 159 + 160 +1. Right-click on the javaclientbuild.xml file and select "Run As -> Ant Build" 114 114 1. Right-click on the project and select "Run As -> WebObjects Application" 115 -[[image:Picture 13.png]] 116 116 1. Select your.app.Application as the Application class 117 -[[image:Picture 14.png]] 118 -1. If you want to actually deploy this application, then you will also need to [[modify the build.xml file>>Java Client-Building]]. 119 -This is it. WebStart should automatically download your client application and launch it. If you are creating a D2JC application and did not put an EOModel file in the Resources directory of your project, then you'll see something like this: 120 -[[image:Picture 15.png]] 121 -If you don't want a D2JC application, then you are on your own for creating the user interface for it. Your client-side application can be a command-line or GUI application. If you want a Swing GUI, then I **highly** recommend Florijan Stamenkovic's [[JBND Framework>>http://web.mac.com/flor385/JBND/]] 163 +1. Copy the Direct Connect URL from the Eclipse console and paste it into your browser. You should get a "click here" link. 164 +1. Click it.