Thursday, May 29, 2008

Making friends with WebLogic using WLST

We have been playing around with WebLogic for a few weeks now; but I have only recently watched a course on the Jython based web logic scripting langauge, WLST, that you can use to automate common operations. It turns out that the setup for the tool take a few steps, so lets quickly define an alias that starts the tool with the right environment.

alias wlst '/bin/sh -c "source $WL_HOME/server/bin/setWLSEnv.sh; java -Dpython.cachedir=/tmp/wlst weblogic.WLST \!*"'

You can run WSLT in interactive or scripting mode, we are going to focus on script mode for the moment though. You will tend to use the interactive mode to debug your scripts. All the examples here can be simply placed in a .py file and passed as a parameter to wlst.

The first thing I wanted to do is the automate setting the HTTP/Tunneling preference which is required to enable deployment from within JDeveloper. Since we get new builds quite often I wanted a quick workaround. You can do this with the server running, and the commands are slightly different, but I went with off-line modification of configuration files.

readDomain('/ade/gdavison_wls/wls10/beahome/user_projects/domains/base_domain')
cd ('Server/AdminServer')
set ('TunnelingEnabled', true)
updateDomain()
closeDomain()

Now the server is properly configured you will probably want to start it. There is a script to do this but I figured would be interesting to do this using a WLST:

startServer('AdminServer', 'base_domain', 't3://localhost:7001', 'weblogic', 'weblogic', '/ade/gdavison_wls/wls10/beahome/user_projects/domains/base_domain', 'true')

And of course you might want to shut it down later. Since the AdminServer is the default local connection as I am not worried about clusters for the moment we can connection with the default connection information and force a server shutdown.

connect("weblogic","weblogic")
shutdown(force="true")

Of course this has just scratched the surface of what you can do with this tool. The jython underpinning makes it really easy to do powerful things. For example this blog entry shows how to automate setting up a cluster. You can also impressively record operation when using web console and later use them in scripts to configure another server.

Wednesday, May 28, 2008

Still waiting on Mac support from Sentilla

So I got a Perk pack at JavaOne this year and I am told the wait for a OS X/Linux developement tool is nearly over. Got an email from Spence at Sentilla saying we should have something in 1-2 weeks.

Looking forward to working with this system, still a big cloud over how much each mote will cost for production purposes. I was told I could perhaps buy perk kits after JavaOne; but don't want to commit until I have had some time to play. To be honest after talking to more than a few Sentilla sales people I am not sure they knew quite how they were going to deliver this stuff.

That being said the Java API they provide looks really promising. Nice use of Generics and the JScience API allow you to get typed "temperature" values back for example. The cloud networking protocols are also really easy to work with.

I hope they get there tools delivered and their pricing policy more defined soon. Otherwise they are going to remain curious toys.

Tuesday, May 20, 2008

Some pictures of Manoj and I on stage at JavaOne

In case you are wondering we are trying to tidy the podium whilst answering questions. We are not, as it appears in the photos, laying down some phat tracks as part of a DJ set.

Manoj points out the falicy in the questioners argument.

In real life I have more hair than this, honest.

Thanks to Nilesh, Manoj's boss, for providing these pictures.

Thursday, May 15, 2008

Java One 2008, day four, part two

Right back in blighty so before I forget everything just a few notes on the final day of presentations. Generally the friday isn't as well attended as the rest of the week with quite a few people leaving early; but there was still a lot of good stuff and a whole bunch of repeats of very popular presentations.

The first presentation of the day was TS-5796 JavaFX Patterns which took me a little while to get up to speed on, having never looked at JavaFX properly before, but I was impressed just how easy it to build ui application. The ability to bind variables is the key with the run time environment dealing with pushing updates without having to ever think about dealing with a Thread. In fact the take home message here is that JavaFX is single threaded and if you are using native java threads you are probably going about the problem in the wrong way for most common operations.

One problem with the current builds of JavaFX is there is no automatic binding from Collections to JavaFX sequence and indeed to bean properties on POJOs to JavaFX properties. This mean you have to create a wrapper to access "properties" on POJO which is a real pain. This is something jython has right but I can't speak for the other programming langauges.

Quick break, bumped into my old manager at Oracle standing in front of the big TV screen said hi and then back into some serious sessions.

Next up was TS - 6547 which covered the Hudson build integration system. Never met it before but was pleasantly surprised about how well it deals with common actions. Although I do wonder how well the, admittedly swish, web ui will scale up to deal with more complicated systems. That being said the system is extensible so it should be possible to add some graphs to make build / test dependencies cleared. This is specially important when building and testing multiple modules.

I like the ability to run a <100k web start app on your machine and add it to the build pool. A nice thing to do when you go home at night or away on holiday. Might save buying even more dedicated machines.

This presentation wins the prize for the most inappropriate metaphor used at Java One this year. The "Omaha Beach" pattern used to describe throwing many build systems at a problem.

After a bit of lunch, out of the infected convention center just to make sense, I took a bit out of the closing session of the Grizzly presentation. This builds on top of NIO to provide a very scalable server backbone. Used in many place such as the cometd server mentioned previously and of course at the core of glassfish. Very powerful stuff but not generally something that you will use directly. Interesting note that 1.8 will support the new full asynchronous NIO.2 API I talked about earlier. They reckon they get 10% better performance in that configuration. Of course you would have to risk you production sever on a JDK 7 label!

Last nugget of information of the day comes from TS - 6145 which looked at some pratical examples of using D-Trace with java. I did find the syntax required to talk monitor java using "d" to be a bit over complicated. Mostly this is due to the need to pass in lengths for all the string properties. How C.

There was a java API both for defining probe points, and hence making the "d" less complication, and doing d-trace monitoring from java. (These live in the "com.sun.tracing.*" package) Of course these only exist on Solaris and OS X so you need to consider you options when running on different platforms.

The presenters were very good reminding me of Simon Day when he was on a roll. The key point to take away is that D-Trace should be used as a way of getting answers to questions rather than a more general profiling tool. For example if I know that a method is called too many times and I can quickly ask D-Trace for stats on how often it is called in each place. Can be really powerful stuff. Sadly my day-to-day development environment, Linux, wont have support for D-Trace for some time as the Linux maintainers appear to want to create a new technology rather than reuse this one.

At that point my brain was really quite full so it was time to quit the conference and spend a little bit of time not learning anything. Ah the Metreon and "Iron Man" there I went.

Errata for our java one presentation TS-5318

Well it turns out that not matter how many times you read it the transition to powerpoint tends to make code that doesn't run or compile

Slide: Callback Implementation for JAX-WS

Notice extra brackets to make the code compile, and the change of variable name in the loop.

// Deal with response

@Resource WebServiceContext wsContext;

public void getPriceResponse(String _return)
{
 SOAPHeader sh = ((SOAPMessageContext)wsContext   
  .getMessageContext()).getMessage().getSOAPHeader();
    
 String relatesToMessageId = null;
 for (Iterator it =
  sh.getChildElements(AddressingVersion.W3C.relatesToTag);
  it.hasNext(); ) {
      SOAPHeaderElement obj =(SOAPHeaderElement)it.next();
      relatesToMessageId = obj.getTextContent();  break;
}

We found out later that if you are using RI then this code wont work because the message context is never of type SOAPMessageContext. So you might need to use code that looks something like the following block. Anoyingly this code wont work with non-RI based implements. (See also)

// Deal with response

@Resource WebServiceContext wsContext;

public void getPriceResponse(String _return)
{
 HeaderList hl = context.getMessageContext().get(JAXWSProperties.INBOUND_HEADER_LIST_PROPERTY);
 Header h = hl.get(AddressingVersion.W3C.relatesToTag);
 String relatesToMessageId = h.getStringContent();
}

You could of course be using a Handler which will have a consistent SOAPMessageContext; but I find it makes the code just much harder to follow.

Every slide

Interestingly each and every slide has a url starting "java.dun.com", I have no idea how that typo got in there!

Wednesday, May 14, 2008

Running wsgen easily from within JDeveloper

It occured to me that in my previous post if you are deploying to a jax-ws platform that is pre 2.1.4, and need to run wsgen, you might like an easier way of doing it that doesn't require you to shell out to ant. (For example JAX-WS deployed to BEA WLS 10.2 and 10.3 tech preview or deployed to earlier builds of glassfish)

The easiest way to do this is to go to Tools->External Tools and create a new tool entry. On the first page of the wizard enter the path to wsgen(.sh|.bat)? on your platform, this is in the "bin" directory under JDK 6. Run directory isn't important; but in the arguments box put the following code:

-d ${project.outputdirectory} -s ${project.first.sourcepath} -keep -cp ${project.outputdirectory} ${target.class}

On the next page I will leave it up to you to put the right entries in for display as this is down to personal preference. On the integration page you probably want:

  • Only add to "Navigator Context Menu"
  • Before tool starts "Save All"
  • After tool exits "Reload Open Files"
  • Log output to message console

On the avaliability page make sure you only enable this for "Java Source" file types. It is probably not a good idea to allow this on other types. And thats it, you can now right click on a java web service and generate the extra boiler plate classes when you start fom the java class and work your way up. (Also known as bottom up)

You might have to refresh the navigator to see new files when they are generated, I am going to raise a bug for this and try to see if we can get JDeveloper to do this for you.

Update 9th June 2009

I noticed a slight bug in the above command line as it is missing the project classpath, this can cause the task to fail if you are using EJB for example. (Make sure you swap the ; for a : if you are on unix/mac.

-d ${project.outputdirectory} -s ${project.first.sourcepath} -keep -cp ${project.outputdirectory};${project.classpath ${target.class}

JAX-WS RI 2.1.4 released

JAX-WS RI progresses at a pace. Has a the "simplified" bottom-up deployment model that you have been able to enjoy in OC4J for a while.

They also have a nice example of using the sun-jaxws.xml file to speficy dual bindings for the same class file:

<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime' version='2.0'>
    <endpoint
        name='soap'
        implementation='dual_binding.server.AddNumbersImpl'
        port='{http://server.dual_binding/}soap'
        url-pattern='/soap'/>
    <endpoint
        name='rest'
        implementation='dual_binding.server.AddNumbersImpl'
        port='{http://server.dual_binding/}rest'
        binding="http://jax-ws.dev.java.net/rest"
        url-pattern='/rest'/>
</endpoints>

It is nice to have the standard evolve so quickly.

KeepResident alternative

I stopped using windows some time ago as developement is so much faster on both Linux and OS X so it has been a long time since I have looked at keepResident. An alternative is to the use "sun.awt.keepWorkingSetOnMinimize" system property and set it to true. If you are starting JDeveloper this will look like:

jdev -J-Dsun.awt.keepWorkingSetOnMinimize=true

This will prevent JDeveloper from being swapped out when minimized; but it wont help with the other memeory issues. For that you need anything else bug Windows as you developer platform.

Sunday, May 11, 2008

Java One 2008, day four, part one

Started the day with the always impression Gossiling demo-on-keynote. As every he is a joy to watch and always brings some really interesting projects to the stage.

First up was the visual vm which is best decribed as a lightweight vm profiling and debugging tool. It can connect to any running VM, although it has more features on JDK 6. I like the ability to dump all stack and indeed dump the heap for an already running process without the need to know in advance of starting the debugger. Can be extended too for things like service monitoring, can see this would be a very valuable tool to have in the box.

Next was the javascript support in netbeans that did some very cool type inferance, which is no mean trick with a weakly type languages like javascript. Only support debugging in Firefox, I am pretty sure JDeveloper does IE aswell. (Go go JDeveloper)

The next topic was game development, covering DarkStar and JMonkeyEngine which are server and client engines repectively. Very interesing to see just how good 3D games are in Java these days, specially with a MMO engine like DarkStar.

The presentation ended up with bits on CERN and JMars. CERN uses Java to run just about everything and NASA has most of there visualization software for mars project in java. Used everyday to find landing sites.

Sentilla also did bit; but it wasn't that impressive. Still I have there dev kit now I wonder how far I will get with it.

First presentation of the day was TS-5796 JavaFX Pattern but that will have to wait for another day, time to think about getting on the plane...

Java One 2008, day three

You will have to excuse the lack of cross references to session id in this post, I am writing it at SF airport after a lovely day on the cable cars and down by fisherman's key.

Started the day with NIO.2 or N^2IO depending on who you ask. This is a task to complete the job of filling out the APIs for nio introduced quite some time ago. (Although most people still wont use it directly you will find it underneath most network operations)

The focus in JDK 7 will be to provide a "proper" file system API with methods than throw usefull exceptions rather than just returning the very so useless "false". There is a default "FileSystem"; but the opportunity exists to implement new custom file systems. Where you would normally use File instead you might now use FileRef and Path but there are helper methods to convert in both directions.

There is a new channel type called SeekableByteChannel which is the equivalent of RandomAccessFile in nio. I suspect that most people will be sticking with streams though until and just making use of the extended create operations. In general any method of File has a much better version of FileRef and you can replace "file.move(...)" with "file.getPathRef.move(...)" and get an incremental upgrade to the new API.

There is also some quite cool stuff to down with support for symbolic links and file system attribute models for different platforms. Finally there is support for file system eventing. This allows you to monitor a file or directory for updates. Much better than having to ask for hte lastUpdated flag of each file when you flick focus back to an IDE for example.

Oh and a proper scallable way of getting directory listing that doesn't just block on network drives, about time too!

The presentation then went of to talk about true asynchronous channels. These provide an API very similar to the JAX-WS client API; but with more control over how threads are managed internally. I must find out how to take control of the threads in the JAX-WS client model. This should improve performance in Coment applications, the Grizzly bloke reported at least a 10% speed increase in 1.8 with JDK 7 support. (But that information didn't get to me until later on that day, the joys of writing on past tense.)

Finally the presentation briefly covered better multicast support, although to be honest this isn't used particlarly often but is good to know all the same.

Next up was the TS-5415 Servlets 3.0 presentation, again the key topic of conversation appeared to be asynchronous interfaces. The new specification provide support for suspending and restarting data flow in particlar this helps with comet style application as it now longer required one thread per request. Instead "idle" connections can be parked until some event wake them up and requires a thread for some work to be done in them. This is not going to be production until '09 though as it need to sync with JEE6 although I guess the open source bods will have an implementation much sooner.

They have also gone a long way to update the programming model to take into account the changes to the programming langauges. You can now do an annotation based servlet that looks very similar to the JAX-RS specification, indeed the HTTP operation type parameters are shared. So you servlet might now look like:

@Servlet(urlMaping = "/foo")
public HelloServlet
{

   @GET
   public void doGetOperation(...)
   {
   }

}

Personally I am not 100% sure that this style of programming makes sense in this context; but I am willing to see it tried. A bit of my still like interfaces for this kind of stuff. But having said that composition is better in the long run than inheritance so we will just have to see how it goes.

They have also done some work to change the deployment model. For of all web.xml is optional, and if required can be split up into easier to manage fragments. There is also a programatic API that does much of what web.xml does, this will hopefully work around much of the boiler plate that you end up typing in when you want to use 'clever' framework X.

One final nice change is the ability to deploy an EJB in the war file. This might not seem like much but things get complicated packaging wise. You either have to duplicate the EJB interface in both the ear and war or create a shared jar file to contain it.

I did then briefly go to TS-7477 101 ways to interoperation with .NET which was a dissapointment and I didn't stay long; but I did walk away with a Microsoft/Java dual marketed pen drive. I wish I had gone to TS-6128 which was more about WS interop, I did pull the powerpoint though so hopefully there is anough in there to get me going. (Otherwise Sun will eventually get around to publishing the presentations as web casts.)

The last, and probably one of the best presentations of the day was TS-5186 Design Patterns Reconsidered. (You can find more stuff on this here, I am not sure I can do it justice.) It was a quick walk though although I could quite happily given this chap me ears for two or three hours.

He started the presentation by bashing singletons, which always get a presenter in my good books, covering the normal points about how hard it makes testing/ slash know what the hell the code is going to do next. As I would expect he doesn't critise the idea of holding onto a single object; just how it is implemented. Instead he quite rightly suggets using DI to managed and inject a refernece to the object as required, much better.

He covered the template patter and how it makes the code much harder to evolve all very good points. Suggested that composition is a much better way to go, which I agree with, and that perhaps this is even easier with some closure proposals as you don't end up having to define n interfaces for n injection points.

He skipped over proxy which is a shame, but when spent quite a bit of time on the Visitor pattern. Again this can make it very hard to evolve your system to include new types. In particular he suggested closured might make it much easier to do the visitor pattern in a flexible way. You might have something like:

for walkModel(model,
              {Node n => n....// get next node},   // Stratergy
              {Node n => if (n.getName().equals("foo") break;}); 

Could be a really powerfull syntax, he also had a real nice catagorization of visitor types which I will shamelessles copy here:

  • "Collector" : gather a sub set of nodes from the model
  • "Finder" : find one particular node and exit
  • "Event" : walk the model and generate events, like the DOM->Sax bridge
  • "Transform" : modify the model, could be real dangerous
  • "Validation" : check the data in the model

Again well worth looking his his website and watching the presentation when it becomes avaliable.

Last presentation of the night was one of writing java implementations for Quicklook and Spotlight on OS X given by my friend Tim and he work collegue John. You can get the code from sf, but theirs was one of the few presentations where the demos to get a geniun round of applause. Mike from apple took question at the end; but as expected didn't resolve the 32bit intel mac issue. Grrr all my macs are 32bit.

Did bump into some BEA engineers, hi Mykola and Hang, and we swapped experiences of working for Oracle in line whilst waiting to get into the concert. They seem jolly nice chaps and I will look forward to working with them in the future as they happen to work on the web services stack in web logic. The gods of networking were smiling on me this evening.

Then up to the Bueno Yeuna gardens for a bit of beer food and music. Turns out to be a bit cold up there so after a few sets we went along the road to the thirsty bear for some beer and tapas. Then back to hte Nikko with my brain buzzing again from all the stuff I have been trying to learn.

Saturday, May 10, 2008

Java One 2008, very much over

Still have a few days worth of notes to write up; but java one is closed and the center packed up. My head is full of new stuff, and I am worried someone will ask me to learn something tommorrow and my head will explode! I bought some noise cancelling headphones just in case, not sure if that will help. :-)

In case you are wondering quite a bit of business did get done, I met face-2-face and hopefully made some new friends both in oracle and the soon to be oracle parts of BEA. New directions have been taken with regard to the abbot/costello project, or at least we have an understanding of where we need to take it. And maybe just maybe we made some people think......

I a few hours in SF tommorrow morning, hoping to pop over and see some tall ships in the morning; otherwise it is off to the MOMA for me. Then off to the airport for the slow drag back to blightly.

Java One 2008, day two

Gosh it is friday and I have only written up my notes for tuesday. Time certainly flies here. I resolved to take it a little bit easier, and say eat or something, on tuesday.

So the day started with the Oracle keynote, quite a good one as generally I don't find much of interest in there for an Oracle developer. Lots of good stuff using web center and bea stuff we so recently aquired. Indeed the crowd around me seem suitable impressed with this enterprise 2.0 demo.

The first session of the day was TS-5579 Closures Cookbook presented by Neal Gafter of the BGGA proposal. So we were looking a one possible solution; but one that was strangly compelling.

So the presentation was focused around the languages changes required to support the following time general call:


public void timeWithNoReturn()
  throws MyException
{
   time(“opName”, {=>
      // some statements that can throw MyException
   });
}

public int timeWithReturn()
  throws MyException
{
   time(“opName”, {=>
     // Note the return is from the "timeWithReturn" and will bypass anything
     // except finally blocks

     return ...compute result...;
   });
}

Looks simple enough? Well when you follow the presentation though you come accross several issues. For example in the return case you will end up with a compile error because there is not guarenteed return from the second method. Also with the current type system it would be hard to define multiple throws types in the API. Take a look at the API, with some annotations added to show new language features.


// Note "throws X" this generic type can have multiple Exceptions defined for it
// R is type "Void" in the non-return case and
// R is type "Nothing" which is a special type which signal the tool that the 
// operation never really returns, think of System.exit(...) which should never 
// return

interface Block {
  R execute() throws X;
}

public  R time(
  String opName, Block block) throws X {
    long startTime = System.nanoTime();
    boolean success = true;
    try {
      R ret = block.execute();
      // In the return case you never get to this statement; but the 
      // finaly statement is run
      return ret;
    } catch (final Throwable ex) {
 
      // Notice the "final" in the catch clause, this allows us to rethrow
      // Throwable without having to delcare that in the operation definition.

      success = false;
      throw ex;
    } finally {
      recordTiming(
        "opName", System.nanoTime() - startTime, success);
    }
}

Another example is a closure for making sure streams are closed out, a very common issue, here a function type is used rather than an interface:


// Note function type takes as parameter C that returns X and throws X.


R withStream(C c, { C ==> R throws X } block)
  throws X, IOException {

  try {
    return block.invoke(c);
  } finally {
    c.close();
  }
}

// So code might look like, note the simplified syntax

withStream (InputStream s = getInputStream())
{
   // Do somethign
}

There are other examples particularly with the "for" loop modifier so that the closure can properly use break and continue. But you will need to look into the proposals for more information.

Still not suggestion that a choice has been made as to which of the closure proposals is the best though.... hopefully in time for JDK 7.

Next up was TS-5286 which focused on Web Beans which is very similar to the functionality seen in Spring 2.5. Use of Meta or Annotation on Annotations in order to guide how things are put together. Not entirely sure whether this is more valuable as a component, or just something that is a retreat of other work. Intereesting design all the same.

I then popped into TS-5535 which was about tying java service together in a restfull way. Unfortunately it appear to cover much of the TS and BOF I have talked about before so I decided to take a walk over to the Alumin lounge to take my mind off the upcoming presentation. Just down the road as the crow flies in the intercontinental, there was also the promise of the gift but apparently that doesn't work if you are also a presenter. Oh well.

Then it was back to the session for my presentation with Manoj. (TS-5318) This appeared to go okay, and indeed appeared to go over okay based on feedback from people in the audience. I apparently did talk a little bit to fast so my "jokes" might have been lost as the audience was used to proper English. Still 3-400 people and not a large number of people left which I take to be a good sign

[Interestingly Manoj went to a Metro presentation on Friday and one of the questions was whether they were going to do an async annotation like we had been talked about. Luckily Manoj was on hand to give his card to the sun folks and re-inforce the point. Nice to know we had some effect and were presenting something that they people were going to be interested in]

Left the room with a real buzz, met a nice chap from Venzuila, I think, he is going to get in touch next week. Stupid me for not taking any business cards.

I tried to go to "TS-6213 Boldly going where java..." which started with Terracotta but I kinda lost focus and decided to crawl the Pavillion a little bit. I am not saying that the ability to automatically sync data between VMs is interesting, I just wasn't in the mood. But more on my adventures in the pavillion in another post.

The last session of the day was BOF-5661 which gave a nice introduction to Comet and a mind blowing technology called "Reverse-Ajax". So Comet is a style of programming where the server pushed events to the client asynchronously. The name comet has been picked to be a generic term withouth out any clever agenda. In general though the web page has the normal socket open along with a second that provide a channel for the server to update the client.

The astute amoung you will know that a particlar server can only deal with so many threads and therefore open connections at a time. There are ways to work around this that are dealt with in Servlet 3.0 and NIO.2; but there are servers you can use for this that know how to keep up connections without loading up the number of threads. In particular cometd was metioned.

Now once you have a connection you can update the client, this generally involves lot of script in the browser a whole bunch of clients were presented that allow the java on the server to update the HTML page either with partial updates or just blocks of java script to be run on all of the clients. Really very cool stuff, blew my mind for the evening.

With that I was off to the pub with a few friends from NJ. Though it was best to eat properly for a change!

Friday, May 9, 2008

Norwalk like virus outbreak at JavaOne

Hmm, now wash your hands. The nasty thing is that can catch if off frabrics, glad I am not flying out tonight. Could turn into a scene from an horror film!

@AsyncWebService in BEA Weblogic

Had a nice chat with the bods on the BEA stand today amoungst other things I found out how to do the equivalent of the @AsyncWebService annotation that we have been working on in OC4J. Turns out it was just staring me in the face and that they just use different terminology. (Need to use the buffered and callback features)

So to compare this is our version:


@WebService
@AsyncWebService
public class StockQuote
{
   public float getStockQuote(String ticker)
   {
      return 100f;
   }
}

So the basic version for stock quote would look like:


@WebService(...)
@WLHttpTransport(...)
@BufferQueue(name="my.jms.queue")

public class StockQuote {


  @Callback
  private StockQuoteResponse _response;


  @WebMethod()
  @MessageBuffer(retryCount=10, retryDelay="10 seconds")
  @Oneway()

  public void getStockPrice(String ticker) {
    _response.getStockPriceResponse(100f);

  }
}

The downside is that at least based on the documentation I have is that you cannot do this with JAX-WS. This might be something they have fixed in the 10.3 build; but I haven't got my hands on this yet to take a look. I will drill down with the BEA people as we have contact to find out how this is resolved in 10.3.

Asynchronicity is real theme of JavaOne 2008

Although the official theme is "Java One and You" the unofficial theme seems to be asynchronicity in various for. Whether it be in the "New New IO" API (N^2IO), the Fork/Joint concurrency proposal, reverse AJAX, comet, Servlets 3.0 and indeed my own presentation the main focus was dealing with the fact that the world is no synchronous.

It is interesting that similer problems result in similar solutions. For example the N^2IO API uses the same form as the JAX-WS client generation. Although it does give some control over the thread for the callback which the JAX-WS doesn as far as I know.

All very cool stuff.

Thursday, May 8, 2008

Java One 2008, day one, part two

Where was I? Ah the JAX-RS presentation. A few more things have come to mind since I finished that post. With JAX-RS you end up wanting to wrap your domain model element rather than liter them with JAX-RS annotations and structures. There appears to be a wizard to do this for you in Netbean; but not command line tool to make this sharable from other platforms.

The afternoon general session was more JavaFX stuff, looks to be an interesting technology when it finally arrives. Would appear to make it possible to a lot of nice graphical stuff for very little work. Fortunately those API are also going to be avaliable to the normal java developer as it is all based on the same VM. They showed a cool demo of Parleysport of JavaFX from its current flash implementation. Very impressive, very rich might even stand a change against Silverlight... specially with the JDKu10 release which will improve the user experience in many ways. And it is about time too!

Oh and a bit about packaging, going to support OSGi aswell as an new Java packaging standard called JAM. Should make a few people very happy.

The next presentation for me was TS-6169 which covered the new feature in spring 2.5. I wont go into all the details here as there is a fine artical here but sufficive to say it looks as clean and powerful as ever. A lot more annotations in this release mean that there is rather less of a need for the big old spring configuration files.

Interesting figures at the start of the slide showing that apparently the vast majoriy of BEA users have spring in the mix. Although to be fair any user of SOA 11 will be using spring, they just wont know about it. (The innards of SOA are put together using spring there are even a few aspects in there)

There appears to be a trend of annotations on annotations. In particular in the basis of providing marked to wire stuff up. This was also seen it the WebBeans presentation which I have seen [sic] tommorrow.

Final note is that Spring 3.0 will be a bit restfull, will be rolled out to the entire platform.

TS-6589 turing WTF code into a learning experience was presented by one of the developers in find bugs. Showed some common examples, for example synchronizing on a string constant or that DateFormat is never thread safe, but looked more at the process of trying to abstract out the programmer error. Interesting they say that writing test for findbugs is quite hard but they will write one for you if you come up with a suitable example. (They did say that writing tests in PMD and jackpot is much easier)

A section on equals methods was interesting as it presented the following three options for implementing the equals method: object equality, value equality or behavioural equality. The single equals method is not expressive enough. Indeed I can see the point here that This should never have been part of the API; but instead a seperate comparator interface for each case.

TS-6127 looked at a DIY implementation of a multitouch "table". Lots of good stuff about wood work and how to get a webcam to see in IR. Really quite fun. An interesting if obvious point is that you have to track the order of the fingers in order to do much of the gesture recognition for multitouch. So even if you rotate a figure the order of the "touches" has to stay the same in order to make the UI work properly. Not much new; but fun to hear how it was made.

BOF-5031 was a follow on from an earlier presentation, TS-5581. I liked the new annotations on of other elements proposal, JSR-308. This allows the use of declarative constraints such as @Immutable and @NotNullable which can be enforced by the compiler, those are described in JSR-305. The safe rethrow looks also quite useful, it is best explained with the code from the presentation seen below. If you want to log all exceptions when they go past you have a problem as you cannot rethrow Throwable without having to expose them in the throws clause:

void m() throws X1,X2 {
  try { /* Something that can throw X1,X2 */ }
  catch (Throwable e) {
   logger.log(e);
   throw e; // Error: Unreported exception Throwable
  }
}

Instead with the use of the final keyword you can tell the compiler that this is okay and to pass it on:

void m() throws X1,X2 {
  try { /* Something that can throw X1,X2 */ }
  catch (final Throwable e) { // Not extra final keywork
   logger.log(e);
   throw e; // Compiles OK; can throw X1,X2
  }
}

Very usefull because it means that you can register stuff like OutOfMemory errors and close transactions without having to muck up the API or use that sun.misc.Unsafe class.

No mention of closures though....

The last BOF of the day, 5613, focused on JAX-RS. I am pretty sure it was interesting; but I think I was very sleepy at this stage and appear to not to have taken any notes. Still it was after 9pm after a early start and a flight from Scotland via London. Back to the hotel for some well earned rest.

The Spoiler Question

You always get at least one person who asks a question just to try and make the person on stage look stupid. We had one today at the end of our async web services presentation.

I was along the lines of have you considered technology X? Unfortunately I hadn't and I said so; but the questioner went on to badger us for a few more question even though we admitted it was something we will have to look at. The questioners tone at the time seem a little bit off a the time but when I got out of the presentation I found out that the person asking the question was a spec lead for X. This really anoyed me as I think it is only polite to declare an interest if you are going to ask some questions. It is not as if we can actually see the questioner due to the spot lights on us.

I don't mind being told I am wrong or have missed something; but it was the tone and sneakiness of the questioner that makes me feel it was a spoiler rather than a question meant to help move everybody understanding forwards.

(I do know what technology X does in that case know, and I am not 100% convinced that it is that much better, than what we presented)

Wednesday, May 7, 2008

Java One 2008, day one, part one

It turns out that American's do infact eat donuts for breakfast, or at least that is what I am going to assume after trying to get something to eat at the conference venue this morning. I decided not to eat at my hotel as I was running late; but most of the breakfast packaging appeared to be made up of Scones, Donuts, Muffins and something made out of chocolate. To my point of view these are thing you ear after the main course.... certainly not for breakfast!

The main topic of JavaOne this year is "Java and you" and the keynote presentations continues these themes. A lot of very cool demos of Java FX, with the new media support this is looking to being a serious competitor to Flash and Flex. They are really going to the rich client. One cool feature they presented was the ability to "tear" off applets from a web page and save if for later web start style. I wonder if they have managed to save client side java from the brink?

Note this is where the curse of the demo'08 starts, and from the demo I have seen this will continue up to at least my presentation tommorrow. After the kindle demo went wrong, every other demo appeared to fail in some way. One FX demo that did work had something like 200 running HD movie traiolers spinning on a 3D globe, they do appears to have solve a lot of performance issues dealing with media and java.

Interesting aside of the new glassfish micro-kernel, much like the BEA one, comes in at around 98k and takes on 1 second to boot. This does mean you can for instance just instance the kernel and basic HTML server technology to create the right combination for an embedded media server. Will be interest to see how this works out.

My first real session of the day was TS-5425 JAX-RS. This was really interesting if only for the elegance of the JAX-RS programming model. I can see this being a very productive enviroment to work in. Will write up some more notes once I have had some time to play with it a little bit more. Not going to be finished until September though and will not contain any client libraries. (Although there is one as part of Jersey)

Tuesday, May 6, 2008

Finally Java One is here

So here I am with my body clock in what apparently appears to be in the right time zone sitting in my hotel room just a few blocks away from the Moscone center. A very long day yesterday traveling from Edinburgh after a wedding on Sunday only to fly past again a few hours later on the way over to the US. But for one reason or another I managed to stay up and then wake up at a reasonable time. I suspect I might crash at some point this afternoon.

Presentation appears to be on track, timming have me a taking a couple of minutes more than I have. Generally the 'fear of the stage' will deal with any minor timing overruns. Going to meet up with Manoj my co-presenter today and run through the entire presentation for the first time and possibly the last before we go on stage! Certainly more exciting this way; but I think we are both prepared.

The swag in the JavaOne bag is properly light very little rubbish in there that is non-recyclable which is how it should be. Speakers gift is a wind up tourch which is actually quite good and without a batter which would take up some of the eco-cred. Not yet decided whether this is going to make it back as part of the post-conference pot-latch. Not sure I am going to find time to walk over the the Intercontental to find out what the Alumni gift is.

Lots of public sessions today, although the first interesting technical session is TS-5425 which relates is about JAX-RS which is the restful, possibly evil depending on how you feel about it, twin of the JAX-WS spec. Should be quite interesting as I have be watching this spec grouw over the months. Then later on todat possibly a presentation on Multitouch and Amazon EC2. No SoyLatte presentation though, appears to have been yanked at the last minute. Prehaps rumors of sun taking over apple jdk developement are going to come true. I hope so as the recently released JDK wont run on any of my Intel macs.

Right better get some breaky and get over to the conference. Hoping to meet up with Alex Ruiz today if only to put a name to a face.