TERRYSMITH.NET    Java One Journal - Volume I - Issue II  
             Home              Painting              Photography              Software              Writing
Hunting for Books
How Filters Replace Servlets in the Java Platform Web Application Programming Model
Monitoring of a Virtual Machine for the Java Platform
High-Performance GUIs with the Java Foundation Classes ('JFC/Swing') API
Building Next-Generation Web Application Interfaces for the Java 2 Platform, Enterprise Edition (J2EE)
Implementing Web Services with the Java API for XML-Based RPC ('JAX-RPC') and the Java Web Services Developer Pack ('Java WSDP')
Java Specification Request 73 (JSR-73): An Overview of the Data Mining API
BOF - New Debugging and Visualization Technologies for Java
BOF - Meet the Java Foundation Classes ("JFC/Swing") API Team

Hunting for Books

I skipped out on this morning's keynote to browse the Java bookstore on the upper level and the book vendor's booths on the show floor. Too many keynotes are bad for your health. Besides, Scott McNealy, CEO of Sun, was speaking. I would stand in line to hear Ellison speak, maybe even Gates (especially if he was going to do a live demo that might potentially blow up in his face), but who cares about Scott McNealy.

I can remember when there were only about five books on Java. If you had the first edition of Java in a Nutshell then that was all you needed. Now there are hundreds and hundreds of Java books. Much more than last year. Big books, small books, multiple books on the same API. All selling for $49.95.

Top eighteen most promising new books at JavaOne:

(This spot open. Send me money to have your book listed here.)

Ditto.

cover Designing Enterprise Applications with the J2EE Platform, Second Edition JavaOne Special Edition (Inderjeet Singh et. al. / Addison-Wesley)
I got this one free so it gets a free listing.

cover Taming Java Threads (Allen Holub / Apress)
This book is not new, but it was also free and therefore gets a free listing.

cover Java Web Services (David Chappell and Tyler Jewell / O'Reilly)
Also free at the conference

cover Java Rules (Douglas Dunn / Addison-Wesley)
Looks like a good basic Java book.

cover JavaScript Design (William B Sanders / New Riders)
Looks like a very good book on JavaScript. Nice thick pages.

cover Mastering Data Mining (Michael Berry & Gordon Linoff / Wiley)

cover Essential XML: Beyond Markup (Don Box et. el. / Addison-Wesley)
This one's not new but I'm listing it anyway.

cover Java, XML, and the JAXP (Arthur Griffith / Wiley)
A small little book that looks like it covers a lot of stuff. It has a good chapter on Ant in the back.

cover XML Schemas (Chelsea Valentine et. al. / Sybex)

cover J2EE Connector Architecture and Enterprise Application Integration (Rahul Sharma et. al. / Addison-Wesley for Sun Press)

cover Developing EJB 2.0 Components (Tulachan / Sun Press)
Looks like an easy-to-read EJB book.

cover Herding Cats: A Primer for Programmers Who Lead Programmers (Rainwater / Apress )
Great name. I read parts of it and it looks like it has potential.

cover JBoss Administration and Development (Scott Stark et. al. / Sams )
Written by the head dudes at JBoss LLC.

cover Sun Certified Enterprise Architect for J2EE Technology (Mark Cade and Simon Robers / Prentice Hall)
Small book but to the point. Only book out on the subject (at the time I'm writting this) so the choice is easy. Written by the developers and assessors of the exam.

cover Java Data Access: JDBC, JNDI, and JAXP (Todd Thomas, technical editor me, Terry Smith / M&T Books (codename for Hungry Minds Press))
Don't blame me for the crapping coding style and bad examples. I had limited power. It was hard enough to get the guy to match up his subjects and verbs properly.

cover Moving to .Net (Dan Appleman / Apress)

Marty Hall's Core Servlets and JavaServer Pages (JSP) was one of the best-selling books last year, and it was indeed a great book. His new book, More Servlets and JavaServer Pages, doesn't look as promising. The first half of it is repetition from his first book, almost like he thinks no one will have used this stuff between reading his first book and reading this one. The second half looks decent, but I don't know that it's worth it.

How Filters Replace Servlets in the Java Platform Web Application Programming Model

JavaOne really messed up this year. Last year the most popular sessions were in the large halls, Halls A, B, and C, with more than enough setting and multiple projector screens. When I got to room 135 for this talk there were about 150 people waiting outside the door. It was already full. Instead, they set up a video simulcast in Hall A, which is being used as the cafeteria this year, where it took them another five minutes to get the audio working. Altogether I missed the first twelve minutes. About 350 more people filtered in to see the filter talk.

Filters implement javax.servlet.Filter. This interface has init(FilterConfig), destroy(), doFilter(request, response, chain) methods. The doFilter method is where the work is done. You can call chain.dofilter(HttpServletRequest, HttpServletResponse) to pass the joint down the chain.

Filters are configured in the deployment descriptor. They may be associated with a URL or a named resource. The container will parse through the web.xml file and build a chain for you. They will be called in the order they are defined in the file. The deployer has control over the control of how filters are called, not necessarily the developer.

Filters and Servlets can wrap requests and responses. For example, a wrapped request could remove or add HTTP headers. A wrapped response can capture and change the response. [Http]ServletRequestWrapper and [Http]ServletResponseWrapper take references to the real request or the real response.

The speaker created a wrapper for the wrapper. I'm not exactly sure what the code's purpose was, but I'm including it here in order to make this Journal look more impressive:

public class ResponseWrapper extends HttpServletResponseWrapper
{
   ByteArrayPrintWriter bapw = new ByteArrayPrintWriter();

   public java.io.PrintWriter getWriter()
   {
      return bapw.getWriter();
   }

   public ServletOutputStream getOuputStream() throws IOException
   {
      return bapw.getStream();
   }

   public byte[] getData()
   {
      return bapw.getByteArray();
   }
}

Monitoring of a Virtual Machine for the Java Platform

The speaker of this talk is a Performance Engineer at Sun. I wonder what the pressure is like with his job title. Does his wife go around saying, "I'm married to a Performance Engineer?"

Seven minutes into the talk and topics such as "Production systems have different needs than development systems" as still being covered. Seven minutes into the presentation and none of the slides so far have had any concrete useful information on them. Fifteen minutes into the talk and he's still doing periodic overviews of the topics that will be covered in the talk. I leave and go to the Swing talk instead.

High-Performance GUIs with the Java Foundation Classes ('JFC/Swing') API

I made my way to the Swing talk which is pretty much full but people are still being admitted. I found a spot on the floor near the wall with a half-decent view of one of the projector screens.

RepaintManager internals. Fun stuff. It uses a HashTable to map from a JComponent to a Rectangle that needs to be painted. It unions dirty regions per JComponent. This is good for common cases, but you may want to subclass it.

The next thing I know I'm told that if I don't find a seat I'll have to leave. I looked around for a few seconds and couldn't find one without disturbing half the people on a row and taking a few of them the out with my JavaOne bag in the process. I left and waited outside for the next talk that was in the same room. I'm zero for three in worthwhile conference sessions for the day.

Building Next-Generation Web Application Interfaces for the Java 2 Platform, Enterprise Edition (J2EE)

"Users deserve a richer experience." Don't we all. The speaker is going to cover how to incorporate Flash technologies into Java web applications. If speakers are going to cover vendor-specific technology like Macromedia Flash, I really wish they would mention that in the session title.

The flash player supports rich vector-graphics, Actionscript (like Javascript), event-driven, etc. The speaker demos a fake website for a pharmaceutical company. The first version uses brain-dead HTML tables. The second uses Flash to produce some very usable and attractive window panes that are movable within the browser. It looks great.

Another demo displays a listbox with a textbox and a combobox above it. You can use the combobox to limit the entries in the listbox to items of a specific category type. If you start typing in the listbox, say "ts" for example, then all items in the listbox are removed except for those that start with "ts". An interesting widget.

After demonstrating a call to an EJB from a Flash client, the speaker showed how to use the Macromedia Flash debugger. The only interesting thing here is that their debugger is implemented as an interactive Macromedia Flash movie.

Another content-free talk. Zero for four on the day.

Implementing Web Services with the Java API for XML-Based RPC ('JAX-RPC') and the Java Web Services Developer Pack ('Java WSDP')

I opted for this talk to ensure that my buzzword compliance meter doesn't fall too low for the day. JAX-RPC is in proposed final draft now. The speaker is Roberto. Roberto is the lead engineer for JAX-RPC.

WSDL describes a Web Service as a collection of ports and operations. JAX-RPC allows WSDL and SOAP-interoperability.

It's surprising to me that "Web Services" is the hottest topic this year. Non-Java web services have been around for years, mostly as well-defined HTML services. Throw in XML though, create a new buzzword called WSDL (actually this one is about two years old), and everyone goes crazy about it. But I digress. Back to the deep content of this talk...

Handlers let you access the underlying SOAP request and response messages. Use the javax.xml.soap APIs. It's also surprising to me how popular SOAP is even though most developers don't use it. Walk around the crowded halls at JavaOne and it's aromatically apparent.

Pluggable serializers make it possible to use arbitrary Java objects in your method signatures. Like for serializing hash tables for example. They're not portable across implementations though. You especially don't want to try porting hash table serializers across state lines.

A packaged JAX web service consists of service interfaces for value objects, the service implementation, handlers and serializers, WSDL (option), deployment descriptor, and a Certificate of Authenticity signed by Roberto. You stuff all this in a WAR file. Then run a tool for the JAX-RPC API that generates some support classes. The JAX-RPC servlet then uses these generated classes to do its thing.

A web application may have many servlets. A servlet has one WSDL document, possibly many ports. A port has many brothels but only one implementation class. The JAXRPCServlet is the gateway for all requests. Next slide. The pastel-blue box flows into the red box. The blue boxes on the right and the bottom flow into the red box. The red box flows into another box (I think the color is obvious by now) that flows to many green boxes on the left or another green on the right.

Aauugghh! A demo using an iMac! I'm blind. I'm blind. Roberto types in some code then says, "That's it." A web page shows "endpoints" for a web application. His new code is automagicly deployed and shows up as a new endpoint. Speaking of endpoints, where the end and what's the point?

Back to the slideware code:

ServiceFactory fatory = ServiceFactory.newIntance();
Service service = factory.createService( new
                  URL("http://server:8000...);
...etc. (I won't bore you with the obvious.)

You can have dynamic proxies that are generated on the fly by the JAX-RPC runtime. The tradeoff is that the proxies are generated on the fly by the JAX-RPC runtime.

This session gets a 2.5 out of 10. Afterwards, I proceeded down the three escalators to room 103 for Garbage Collection and the Java Platform Memory Model. While sitting there before the session began it dawned on me that I've been to garbage collection talks during at least three different conferences and none of them were worthwhile. In addition, a good professor and mentor in college taught me the importance of maintaining a useful content repository of dinner conversation material. I don't think many women would be interested in hearing about garbage collection but data mining at least sounds cool. "Data mining for rich clients" is even better. I proceeded back up the three escalators to the Data Mining talk.

Java Specification Request 73 (JSR-73): An Overview of the Data Mining API

The JSR-73 objectives are:

The architecture components are an API, the Data Mining Engine (DME), and the Metadata Repository (MR). A client application goes through the JSR-73 API that calls the JCS resource adapter which calls the DME which calls the database.

The community draft of this JSR was delivered on 3/22/2002. The reference implementation is underway.

A model is a compact representation of knowledge extracted from prepared data. Got it? It's used for scoring, visualization, and direct inspection. When did the topic change from warehouses to supermodels? Never mind, the speaker is discussing neural networks now, so the topic definitely switched from supermodels back to code.

Typical data mining operations that will be performed by the new API include build, test, apply, import, export, shovel, and pan.

Here's some useful code for mining your data: (There may be a few lines missing, but you can figure it out.)

javax.datamining.ConnectionSpec spec = connectionFactory.createConnectionSpec("myDMS", "user1", "pswd");
javax.datamining.Connection dmCms = ...
PhysicalDataSet data = new PhysicalDataSet(uri);
data.getMetadata();
LogicalData ld = new LogicalDaa(data);
LogicalAttribute income = ld.getAttribute("income")
Income.getAttributeType(AttributeType.numerical);
FunctionSettings settings = new ClassificationSettings(ld, "buyMinivan");
settings.setCostMatrix(costs);
buildTask = new BuildTask(data, settings "myModel");
dmsCon.addObject("myBuildTask", buildTask);
dmsCon.save();
ExecutionHandle handle = dmsCon.execute(task);
handle.waitForCompletion();
Model model = (Model)dmsCon.getObject("sexyPose");

Once you mine your data, you'll want to do a transaction. Atomicity is difficult to achieve. Nugget package structures are much more interoperable. In the future JSR-73 will include "ensembles and wrappers" such as boosting and bagging (I'm not making this up).

BOF - New Debugging and Visualization Technologies for Java

After all the interesting BOFs (Birds-of-a-feather-get-laid-off-together sessions) last night were packed, I arrived twenty minutes early for this one. Actually, I just wanted to get a seat near a plug-in for my laptop. No luck.

This talk is given by the founder and CTO of VisiComp (not to be confused with VisiCalc). He starts off with a demo of VisiVue (the French version of VisiCalc) which shows object instance diagrams while your program is running. The next demo is of RetroVue (in beta). It shows the historical execution call stack per thread of your program while it's executing. Your code is on a right-hand side pane and an historical call stack is on the left. At the bottom is the thread timeline with three bars for three threads. A green highlight on a bar cues that it's the currently running thread. His debugger can also single-step backwards. A red highlight is for when a thread blocked because it was waiting on an object that another thread had locked. An arrow from one bar to another displays who has the object locked.

You can bring up another pane that shows the invocation stack per thread. Different colors per line are used to try to show the age of lines on the invocation stack. Useful for loops. Looks like new instructions start out as red and become a darker shade of red until they turn black.

For a given attribute on a method you can also see a listing of every time the attribute changed in value. You can right-click and select run-to-here to rerun and get back to a particular assignment that you're interested in, like a null assignment for example.

To implement their debugger they didn't use the debugger interfaces that are provided by Java. The speaker is concerned by performance but admits it's just his own speculation. They also started before the debug interfaces came into being. Instead they use byte code insertion. In the first phase it looks at all byte code in your application and finds those it considers interesting like assignments. It ignores intermediate steps. Then it inserts byte code around the statements it's interested in.

The performance penalty is a 10-20 times slowdown. For debugging they consider that acceptable. A twenty-second program took 4 minutes to run under their debugger and wrote out a ¾ Gigabyte journal file. An alternate they considered was to instrument only the classes you're interested in. This is not dependable though because using this method the debugger can't guarantee that a value is not null when it says it's not null.

Future work for they're considering includes distributed/remote debugging, performance, conjunction with UML source models, and profiling information. They're still looking at whether to combine the debugger and profiler into one application. So far, the CTO's naming suggestions of "defiler" and "probugger" haven't gone over very well with the marketing department.

After the talk was over everyone got a free T-shirt, "C++: my boss's grade point average". This talk was cool. Email me to let me know if you think I should wear this shirt to work or give it to my boss to wear to work.

BOF - Meet the Java Foundation Classes ("JFC/Swing") API Team

The Swing team is currently working on high priority bugs for the 1.4.1 maintenance release. The 1.5 Tiger release will have improved printing support for text components and others (Jtable, JList, …), addition of the JTreeTable, a skinnable look and feel, and as a result a new and improved Java Look and Feel. No new APIs will appear until the next major release, 1.5.

After about five slides the rest of the session opened up to general Q&A on Swing. The answer to one question about menus brought up that they have patented some technique of using a tree structure for modeling menus but haven't implemented it yet. The details were not mentioned.

I asked a question on behalf of John Bishop. (You would have loved this session by the way John.) There are some hot keys that are implemented by default in the Swing components. For example, one of the function keys will put a split pane into its adjustment mode. How can this default behavior be turned off so that the function keys can be used for something else? The answer is that you can get a handle to the input map and change the key bindings there. (I have no clue, but I'm sure John will say "duh" when he reads this.) They said something about looking at the source code of the Metal Look and Feel for an example.

I'm not sure that I got the email address right, but you can try sending comments and questions to sun-feedback@java.sun.com.

Previous ] [ Index ] [ Next ]   

All images and text on this site are licensed only for viewing on your computer during your visit. No rights to save, copy, print, redistribute, use in derivative works, or in any other manner are allowed or implied without the prior written consent of the author.

All images and text are ©Terry Smith unless otherwise noted. All rights reserved.

terry@terrysmith.net