Enterprise grade Java.
You'll read about Conferences, Java User Groups, Java, Integration, Reactive, Microservices and other technologies.

Tuesday, November 27, 2012

I'm speaking at the Oracle Developer Day, OOP 21. - 25. Januar 2013 Munich/Germany

09:37 Tuesday, November 27, 2012 Posted by Test No comments:
, , ,
Short head ups, that I am speaking at the Oracle Developer Day happening during the OOP 2013 happening from 21st to 25th January 2013 Munich/Germany. I will hopefully be able to show you some of Oracle's Java Service Cloud offering and guide you through the most prominent features.
See the complete agenda (in German). And get your free tickets for the special day, the OOP forum and the exhibition hall by registering online.

Tuesday, November 20, 2012

Java Specification Requests in Numbers

14:02 Tuesday, November 20, 2012 Posted by Test No comments:
, ,
You all know about the Java Community Process (JCP), don't you? The JCP is the mechanism for developing standard technical specifications for Java technology. Anyone can register for the site and participate in reviewing and providing feedback for the Java Specification Requests (JSRs), and anyone can sign up to become a JCP Member and then participate on the Expert Group of a JSR or even submit their own JSR Proposals. The ongoing works on transparency is a good sign for this institution and all the individual JSRs to become more relevant to the community finally. But did you ever wonder how many JSRs are there? In which state they are? Or who is the spec-lead? I collected some public information and run some analysis on them.

How many JSRs are there?
According to the JCP Website we have 192 JSRs in the three different platforms. Java EE (47 JSRs), Java SE (60 JSRs) and Java ME (85 JSRs). If you parse the complete list of all JSRs you get a total of 388.

In numbers this means: 31 Dormant, 209 Final, 52 In Progress, 2 Inactive 13 Rejected, 81 Withdrawn. I don't have a good explanation for the difference here. There are even more final JSRs than the 192. Might be an out-dated number.

How many of them are lead by Oracle?
With that impressive Numbers it would be interesting to see, how many of them are actually lead by Oracle:
More than 68 % (177) out of 261 (Final and In Progress State) are lead by Oracle or together with Oracle. The 32% (84). The next biggest number of JSRs run by a company is provided by IBM which leads 9 JSRs followed by North Sixty-One Ltd and Nokia Corporation (7).  RedHat owns 5. Google still has one JSRs sitting in there.

Sunday, November 18, 2012

Devoxx 2012 Trip Report - clouds and sunshine.

17:28 Sunday, November 18, 2012 Posted by Test No comments:
, ,
This has been an exciting week. After leaving JavaOne this was the next conference on my schedule. Somehow insane given the fact, that I hardly had a chance to clear all the work that has been left over. Leaving for Devoxx on a Sunday was a good thing. No rush hour. Everybody was relaxed and I had a perfect pre-event check-in which all the required things at hand.

The venue is for sure special. What is a big cinema center normally turns into a conference venue for this special week in November. Stephan and his crew have been hard at work to deliver all the needed connectivity and infrastructure. A little bit sad to see, that we had to use the side entrance and therefore many cab drivers dropped the passengers to the main entrance which leaves you stumbling around without any true indicator where to go. But this obviously is a first-timer problem only. Which was true for me. During the last few years Devoxx used to be in parallel with the German Oracle User Group conference DOAG Conference. Not this year and it gave me a good chance to take on the challenge of traveling to Belgium.

After I had the pleasure to receive my wrist-band from Stephan himself I was walking around a bit and took the cab back to my hotel. The Scandic Antwerp was far off from anything. Nearly 45minutes public transfer to ride to the center. Probably more than an hour to walk to the venue. Given the fact that it looked better on the map, it turned out to be a disaster. Cold rooms, limited breakfast. I need to remember to give them a 1* rating somewhere.

Monday 12th of November - University
Was the start of the conference. All the cinema rooms have been equipped with wifi and a speakers desc and tons of cables and further recording things. The crowd instantly build up in-front of the registration desks and it took a while until everybody was done. It was the first of two university days. With 18 talks in two days you could imagine that those are longer than usual and contain a more detailed analysis of the topics. I had the pleasure to listen to Paul Bakker and Bert Ertmann and Kirk Knoernschild about modularity today. Very impressive talks with a broad coverage of all the basic principles. Anyway, three hours is a brave thing to do as a speaker. If someone messes up something here you are loosing your audience for the rest of the talk. This is scary and the limited diversification with the long talks didn't work too good for me. Anyway, I believe I wasn't the target audience at all. All in all the lineup was good, the rooms very impressive for a first-timer and  I also liked the tweet wall that was running in-between the talks. All room panels were powered by beagle-boards and JavaFX. Very cool technology.
Monday night was beer-walk time. With 40 registered speakers this could have been a huge crowd walking through the ancient Antwerp on the beer-hunt. At the end of the day it was a smaller group of 20 people walking around and learning about the beer tradition and some of the historic buildings. Thanks to all the attendees for the nice chats and great atmosphere. And thanks to the Devoxx team for organizing this. It was big fun!

Tuesday, 13th of November - University
Another University day on Tuesday. Same rules, same criticism. I should mention the "Tools in Action Talks". Those are 30 minute talks during the University days in the later afternoon. Here speakers get the opportunity to demonstrate a Java tool that they've created and are passionate about! The rooms have been packed. The same was true for the "Labs Track". The feedback I got was very passionate and positive. Give n the fact, that you get the chance to attend a couple of labs trainings along the conference this is added value for anybody paying the ticket. You normally only get one training for the price of a Devoxx pass.

Let's talk briefly about food. It was conference food. Breakfast mostly consists of pastries. Lunch was a baguette kind of thing or little salads. And a soup. Don't ask me about the little pre-packaged sweets for coffee.
Thank god there are a couple of restaurants around the venue. Even for those which doesn't rely on anything else than coffee, this was hard. The good part: There was plenty of coffee around. From early morning until late evening. Same for all kind of soft-drinks and water. That is awesome! Bottom-line is that you are not going to Devoxx for food. Period.
I should mention the BOFs. Happening every evening throughout the whole conference beginning 19:00 lasting to 22:00. The most impressive schedule I have seen going more than 12h per day. Given that, you should prepare yourself with a good night sleep before you come here. If you get 6h during the day you are a lucky person. Tuesday also was the day the Exhibition Floor opened. Located in the basement surrounded by some nice and quite places to hide and some boxes you could easily walk along the booths in a few minutes. But some nice vendors with a couple of raffles and giveaways. 

Wednesday 14th of November - The start of the sessions
This was the part of the conference I had waited for. A lot of big names on the schedule and the most exciting part is, that Google is allowing their speakers to attend this conference other than they do for JavaOne. The setting changed a bit. We had another impressive line at the registration and the conference got crowded.
If you were wondering where the 3000 people are, you finally knew. All in one place running around from one talk to the other and trying to get one of the mentioned lunch things or drinks. The soft-drink coolers started to empty faster than they were refilled, the afternoon sweets became a reason to wrangle with each other and the bins in the session rooms started to fill up.
The content? One word: Amazing! 97 session. Well known names. A RedHat and Google Keynote. Oracle all over the place with a booth next to Google. How cool was that? Nighthacking with Stephen Chin and interviews and hackers-garden and meetings and networking. Meeting people and talking about upcoming stuff. Nearly all have been there. A true international conference. It was a pleasure to meet sooo many people. If I would try to name them here, I would fail. Thank you all for taking some of the precious time to contribute to the Java community by listening and trying to shape it. This also was the day for David's and my BOF. We had quite a few spec leads around and also the JCP was there. Beside the fact, that we didn't discuss any technical topics we had a nice hour which could have gone for another if we would have been the last BOF of the day.

Thursday 15th of November - More conference
After another short night sleep the Thursday also promised some very interesting sessions. And it had some more stuff in stock. We have seen the short-list of the new names for RedHat's JBoss Application Server (BaseJump, WildFly, jBeret, Petasos, Jocron - jboss.org/vote) and a nice keynote with Nandini Ramini and Tim Bray. My secret favorites were the Naos. Awesome but expensive toys.
The exhibition floor was already partly taken down and the running interviews by the Arquillian team ended up having not enough light and power. It was a rough end for the day.
The good parts were, that we had some nice BOFs. One run by Sonya Barry about Java.Net and I also attended the JBoss AS BOF which was followed by a nice dinner with all the RedHat server guys. Thanks for that Ray and Mark! It was a pleasure meeting you and I need to thank you once again for making this whole Java EE thing even more valuable with all your great OSS projects!
After that it was party time at Devoxx. Stephan rented the Noxx Antwerp which is one of the more famous clubs around. We had a good start with a couple of RedHat sponsored beers and good music. Overall it was a very noisy location and even the announced "more silent room" was still too noisy to have a nice chat. At the end of the day it ended up with a couple of geeks having a great disco night.

Friday 16th of November - It's all over now.
The final day of the conference. Still half a day full of sessions but mostly done now. The exhibition floor has been rebuild completely, some rooms have been closed down. And the remaining attendees tried to make sense from themselves. A typical last day of a conference. I had to leave before noon to catch my flight back. It was a fun week overall. Last but not least my two coworkers added to that with all their jokes and entertaining ideas and problems. Thanks Ralf for the great companion! Thanks J├╝rgen for the location knowledge and your excitement! I am really looking forward to next years Devoxx UK.  Find some more picture impressions on my G+ page.

Tuesday, November 6, 2012

Polyglot Persistence: EclipseLink with MongoDB and Derby

13:43 Tuesday, November 6, 2012 Posted by Test 3 comments:
, , , ,
Polyglot persistence has been in the news since some time now. Kicked off by the famous Fowler post from end 2011 I see more an more nice ideas coming up. Latest one was a company internal student project in which we used Scala as a backend persisting data into MongoDB, PostgreSQL and Apache Solr. I'm not a big fan of Scala and remembered EclipseLink's growing support for NoSQL databases. Given that I simply had to try something like this.

Where to start? 
The biggest issue are the missing examples. You find quite a bit stuff about how to change the data-containers (either NoSQL or RDBMS) with EclipseLink but you will not find a single one which exactly uses both technologies seamlessly. Thanks to Shaun Smith and Gunnar Wagenkrnecht we have this great JavaOne talk about Polyglot Persistence: EclipseLink JPA for NoSQL, Relational, and Beyond which talks exactly about this. Unfortunately the sources still haven't been pushed anywhere and I had to rebuild this from the talk.So, credits go to Shaun and Gunnar for this.
The magic solution is called Persistence Unit Composition. You need one persistence unit for every data container. That looks like the following basic example. You have a couple of entities in each PU and a composite PU is the umbrella.
Basic Composition Example

Let's go
You should have MongoDB in place before you're going to start this little tutorial example. Fire up NetBeans and create two java projects. Lets call them polyglot-persistence-nosql-pu and polyglot-persistence-rational-pu. Put the following entities into the nosql-pu: Customer, Address, Order and OrderLine. (Mostly taken from the EclipseLink nosql examples) and put a Product entity into the rational-pu.
The single products go into Derby while all the other entities persist into MongoDB. The interesting part is, where OrderLine has a One-to-One relation to a Product:
  @OneToOne(cascade = {CascadeType.REMOVE, CascadeType.PERSIST})
    private Product product;
This is the point where both worlds come together. More on that later.
Both PUs need to be transaction-type="RESOURCE_LOCAL" and need to contain the following line in the persistence.xml:
 <property name="eclipselink.composite-unit.member" value="true"/>
Don't forget to add the db specific configuration. For MongoDB this is
<property name="eclipselink.nosql.property.mongo.port" value="27017"/>
<property name="eclipselink.nosql.property.mongo.host" value="localhost"/>
<property name="eclipselink.nosql.property.mongo.db" value="mydb"/>
For derby this is something like this:
<property name="javax.persistence.jdbc.url" value="jdbc:derby://localhost:1527/mydb"/>
<property name="javax.persistence.jdbc.password" value="sa"/>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
<property name="javax.persistence.jdbc.user" value="sa"/>
Now we need something to link those two PUs together. The combined-pu resides in a sample polyglot-persistence-web module and looks like this:
<persistence-unit name="composite-pu" transaction-type="RESOURCE_LOCAL">
            <property name="eclipselink.composite-unit" value="true"/>
Watch out for the jar-file path. We are going to package this in a war-archive and because of this, the nosql-pu and the rational-pu will go into WEB-INF/lib folder. As you can see, my example is build with maven. Make sure to use the latest EclipseLink dependency. Even GlassFish still ships with a lower version. MongoDB support has been added beginning with 2.4.
Beside this, you also need to turn GlassFish's classloaders around:
<class-loader delegate="false"/>
Don't worry about the details. I put up everything to github.com/myfear so, you might dig into the complete example later on your own.

Testing it
Let's make some very brief tests with it. Create a nice little Demo servlet and inject the composite-pu to it. Create an EntityManager from it and get a transaction. Now start creating prodcuts, a customer, the order and the separate order-lines. All plain JPA. No further magic here:
    @PersistenceUnit(unitName = "composite-pu")
    private EntityManagerFactory emf;

   protected void processRequest() // [...]

        EntityManager em = emf.createEntityManager();
        // Products go into RDBMS
        Product installation = new Product("installation");

        Product shipping = new Product("shipping");

        Product maschine = new Product("maschine");

        // Customer into NoSQL
        Customer customer = new Customer();
        // Order into NoSQL
        Order order = new Order();
        order.setDescription("Pinball maschine");

        // Order Lines mapping NoSQL --- RDBMS
        order.addOrderLine(new OrderLine(maschine, 2999));
        order.addOrderLine(new OrderLine(shipping, 59));
        order.addOrderLine(new OrderLine(installation, 129));

        String orderId = order.getId();
If you put the right logging properties in place you can see, what is happening:
A couple of sequences are assigned to the created Product entities (GeneratedValue). The Customer entity gets persisted into Mongo with a MappedInteraction. Entities map onto collections in MongoDB.
FINE: Executing MappedInteraction()
spec => null
properties => {mongo.collection=CUSTOMER, mongo.operation=INSERT}
input => [DatabaseRecord(
CUSTOMER.NAME => myfear)]
After that you see the products being inserted into Derby and again the MappedInteraction, that perssits the Order into MongoDB. The really cool part is down at the OrderLines:
ORDER.ORDERLINES => [DatabaseRecord(
 COST => 2999.0
 PRODUCT_ID => 3), DatabaseRecord(
 COST => 59.0
 PRODUCT_ID => 2), DatabaseRecord(
 COST => 129.0
 PRODUCT_ID => 1)]
Orderlines has an object which has the product_id which was generated for the related product entities. Further on you can also find the related Order and iterate over the products and get their descriptions:
Order order2 = em.find(Order.class, orderId);
  for (OrderLine orderLine : order2.getOrderLines()) {
            String desc = orderLine.getProduct().getDescription();
The nice little demo looks like this:
Thanks Shaun, thanks Gunnar for this nice little example. Now go to github.com/myfear and get your hands dirty :)