Peaberry source

June 8th, 2008

I’ve hoisted a zip file up to downloadables. Contained therein is a buildable tree for peaberry, including the helloworld web service.

peaberry.zip


Flabbergasted

April 4th, 2008

Slowly the circuits twixt my brain and fingers are becoming ossified. It’s not been obvious, since the biggest transition they’ve had to make these past 20 years was from c++ to java. Not much of a transition. Then came flex. It’s a bit different, and many’s a time I’ve done ‘esc-x oops’ on my emacs. But I’ve managed well enough. Til now. Now I am trying to learn objective-c. I’d do no worse if I turned my keyboard upside down and blindfolded myself. What an odd language…


Peaberry overview

January 7th, 2008

The working version is fairly simple. My main goal for peaberry is to support flex client deployments. Flex (referring to the latest beta of version 3) has good support for consuming SOAP services. Peaberry is supposed to be a long-running container of java services, exposed to the local Flex client via web service interfaces. I want the services to be as light as can be had.

Thus far, I have a file sweeper which scans for jar files. When found, the jar file is added to the classpath. I’ve wired up a ClassPathBeanDefinitionScanner with include filters for javax.jws.WebService and javax.annotations.Resource. When the bean scanner encounters one of these two, it creates a bean definition. These get deployed in the sweeper.

I’ve written a BeanNameGenerator which will inspect bean definitions for the Resource annotation. Resource beans get deployed using the mappedName attribute of the annotation. If no mappedName is defined, then the name attribute is used. If no name attribute is found, then Spring generates the name per its usual algorithm.

I’ve written a post-processor which provide will create a javax.xml.ws.Endpoint for the WebService beans. As mentioned in an earlier post, J2SE includes a web server, and this is used to host the Endpoints. I’ve written a handler for the J2SE web server which will serve files in the deployment tree.

What this all adds up to is a very simple deployment for the web services. For example, I have a HelloWorld pojo which requires a HelloDAO. The annotations used to configure the pojo and provide the web service interfaces are stock J2SE. The deployed service has no dependency on Spring. The service and dao follow.

HelloWorld.java

HelloWorldDAO.java


And now, for something completely different…

December 28th, 2007

I’ve all but abandoned swing as my UI implementation tech of choice. I’ve been working with Adobe Flex for the past few months. There exists a problem space for which swing is the superior choice, but that problem space is nowhere near my landing zone. However, I do not plan to sell Flex from here. I’m still carrying on with Pretty Things and ElectricBits, after a bit of realignment.

Flex does not have much in the way of ‘backend’ services; one cannot build a 2-tier application with Flex. Flex does have a nifty code generating wizard which eats WSDL and spits out a SOAP client. The first step, then, is to separate client from server. Next, the server must speak SOAP. This requirement has really dogged me. SOAP servers, in my experience, are big, complicated beasts. I’m against big and complicated when it come to Pretty Things, so I’ve been scouring the land for something small and simple with which to provide web services. This blog post (by Young Yang) was a watershed:

JAX-WS Web Services Without Java EE Containers

Turns out, JSR 181 is built in to java 6 SE. I had no idea! I wired up a small test, pointed Flex builder at it, and it worked! My next breakthrough was not quite as amazing, but at least as useful.

I have experimented with a few of the IoC containers in the past. My goal has been to create a simple container for Pretty Things, so that new Pretty Things could be dropped onto a running instance. I looked at Fuse, Guice, Pico, and Nano. I skipped Spring, because of my aversion to ‘big and complicated’. None of the above was satisfactory, and there I stopped. Pretty Things had been dead in the water because of this (plus, I’ve been quite busy!) My next break came from 2 directions. A friend of mine has been advocated Spring (much more to come on this!), and I was encouraged to give the 2.5 release a second look. My investigation led me to this blog post by Seema Richard:

Annotation based configuration in Spring

As of now, I have a desktop container which uses Spring 2.5. I’m calling it ‘peaberry’. It sweeps a deployment directory, looking for jars which contain WebService annotations. These it auto-deploys. java 6 se also contains a small HTTP server, which is used to host the SOAP endpoints. To this, I added a handler which will serve whatever .html files it finds in the deployment tree. Thus, the desktop container will serve whatever flash content it finds in the deployment tree. I can deploy a web service and a Flex-based client to go with.

My dependencies are:

Running, it looks like this:

Sweeping: ../deploy. Fri Dec 28 11:03:15 EST 2007
Dynamically added file:/C:/ktm/peaberry/dist/bin/../deploy/helloWorld/helloWorld.jar to classLoader
published web service: /peaberry-ws/net.electricbits.peaberry.webservice.HelloWorld


DataBrowser - code grinder’s DB tool

April 11th, 2007

DataBrowser has replaced squirrel in my toolbox.  It is everything that squirrel was, plus it has much better SQL support.  And DataBrowser is WAY more stable.

While you are at the site, take a look around.  jmatrix.net was a dev portal before most of us knew the meaning of the word.


Next Page »