Developing in the z2-Environment - Part 2

Please make sure you have read the first part of this section.

Now that everything is set, please turn your attention to the class LibraryDataView. Change line 30 so that the method populateItem now reads:

While doing so, you can of course use code completion. You can actually drill-down into the method getRandomized if you wish. All binaries contain the source code.

So now let it run: The simplest way is to right-click on the project sample.wicket.imagelib and choose "Arm Z-Project". You will see that the "Z" decorating the folder has a green halo now. That simply indicates there there is a file called LOCAL in the project folder.

Please press "Sync" on the graphical console, or press the left "Z" button in the top toolbar in Eclipse, or press Alt+Y on your keyboard. All of these actions will trigger a synchronization of the runtime. You should be able to tell from the console view that something happened - that an application got reloaded.

If you open your browser for http://localhost:8080/wickil you should now see something like this (different picture and text of course):

Please play around with it. Change the title string (second column in the table above - in case it was too hidden) by repeating what we did.

Why is this important?

What happened? We modified some code and notified the runtime about a change in its "source of truth" - the repositories. But in contrast to deployment of an application after a build (by Eclipse, ANT, or Maven - to name a few), the runtime pulled all modifications from your workspace.

Next, assuming you still use the getRandomized() method to randomize the title column in the picture list, we want to modify the utility class StringModifier. We don not have a project containing that class in our workspace yet. So please check out samples.shared.service from the l1 folder in the central Subversion repository.

This is a shared project. It has an API (containing StringModifier) that is used from more than one project.
Once the check out has completed. Please press the right "Z" button ("Resolve z-Project classpath") again to force a workspace refresh. Also, please "Arm the Z-Project" samples.shared.service.

Within that project please find the class StringModifier. We want to make sure everybody understands that the result of the getRandomized method is a randomized version of the input string. So let's change the method at line 34 so that it reads:

Press "Sync" (or the left "Z" Button). Regardless of how many projects you have "armed" in your workspace, the sync step makes sure that the local runtime will adhere to it. After refreshing your browser, it should show something like this:

It would do so, regardless of whether the web application was checked out or not.

Why is this important?

Note that you modified several projects but didn't worry about order of dependencies and deployment. As the runtime pulls modifications, it will always consider the complete closure of projects in your workspace and the remote repositories to determine its most up-to-date configuration.

Develop your own Web App

The fastest way to develop your own web application is to let the Eclipsoid tool create the basic skeleton for you. Please choose "New" / "Other..." / "Z" / "New Z Web Project" in Eclipse. This will set up a new project in your workspace, that is already "armed" and contains the basic structure of an empty Java EE Web application. In order to have it started by the runtime, you have to modify the file z.properties in the web folder. Please modify the line determining the system state your web application is supposed to be part of and chose a context path, i.e. the first path element of URLs leading to your app. Assuming your context path is "/myapp" (note: it must start with a "/"), the file should look like this:

Now start putting organizing your web application artifacts under the WebContent folder. It's simply a regular Java Web Application adhering to the servlet specification version 2.5. Publish updates using the "Sync" button or by pressing Alt+y in Eclipse.

Summary

In this section, you saw that you can pick a project from the z2-Environment repository and start modifying it with full IDE comfort and minimal worrying about dependency projects. You saw that the Eclipsoid tool will make use of the runtimes capability to provide compilation results to conveniently "complete" your Eclipse workspace's class paths.

Also, you saw that you can quickly test modifications by enabling synchronization with your development workspace in preference over the central repository. This will work for single projects, projects with a lot of dependencies and across several projects.

In conjunction with previous sections, we saw that, apart from a Java SE distribution, all you need to install, start, understand, and develop for the z2-Environment is the URL of its central repository.

Next: References.