La famille Google Cloud au grand complet le 12 octobre à Paris

Dans le cadre d’OpenWorld Forum à Paris le 12 Octobre, une matinée complète sera dédiée au Cloud de Google. Non seulement c’est une belle occasion de se mettre à niveau sur les nouveautées de Google AppEngine (comme son arrivée dans des DataCenters européens), mais aussi de découvrir une offre de Cloud complète, désormais avec Google Compute Engine (annoncé à Google I/O en juin dernier), avec BigQuery et avec d’autres encore.

Peut-être plus important encore que les sujets traités, les intervenants seront les directeurs de l’engineering Google responsable de ces produits. Une occasion donc de leur exposer vos problématiques techniques et stratégiques en matière de PaaS, IaaS et autres BigData.

N’oubliez pas de vous inscrire (gratuit) et de venir à l’heure ce vendredi matin, la salle n’étant pas la plus grande. Vous pouvez également indiqué votre venue sur ce Google+ Event.

Project Jigsaw delay, now with a Q&A

Last Friday, Oracle posted a Q&A on Mark Reinhold’s blog as a follow-up to the announcement that Jigsaw would miss the Java 8 train.

With only 23% of people agreeing with the decision (on java.net) and with an “amount of disappointment, and even anger, as Project Jigsaw is deferred for a second time”, I was eager to read the alternate options Oracle would propose.

The part of the Q&A on Maven and OSGi makes for a good read. They’re not related to the Jigsaw change in plans per say but go check them out if you haven’t already. As for the rest, it turns out that everyone loves the new plan…

(Picture removed)

So here’s a short list of additional questions.

Is modularizing the JDK really the best way to prove Jigsaw works?
One of the top questions in the Q&A puts the modularization of the JDK itself as a pre-requisite for jigsaw’s integration in Java 8. While it’s a neat feature, a modular JDK would really mostly serve the JavaME camp, something Oracle, not the broader Java community, is generally interested in. There are many ways to validate the design and the implementation of Jigsaw with real-life Java applications and the JDK is not (by far) the best example of such an app. Modularization of the JDK, an implementation detail, can come later.

How much more time do you need?
The Q&A states that “a lot of progress” was made on Jigsaw, and I trust that to be very true, but what would have been really useful is to assess how much extra time was required to complete the work. Failing to do so simply slams the door on any alternate proposal based on a different release schedule.

Does longer JDK cycles really mean a later Jigsaw?
Speaking of the release cadence, those arguing for longer cycles are really asking for a Java 8 delay because they’re still trying to move to Java 7. So it’s probably safe to say that both those people asking for more frequent releases of Java and those calling for a delayed Java 8 all want Jigsaw earlier than the current 2015 plan. A lot of options would become possible if only Oracle was to reconsider the train model (one that has yet to be implemented anyhow).

By the way, as it stands, DateTime (JSR 310) has become a top-level feature of Java 8. As much as I appreciate its value I can’t help but think about the irony of the situation.

I don’t want to speak for the JavaEE camp but I also don’t believe modularity dropped off of their list of requirements (it was initially slated for Java EE 7). It seems that the requirements of Java EE, arguably one of JavaSE’s very top user and customer, have been ignored. Maybe it will comfort those in the community to know that being a colleague and a top customer comes with no privilege.

This is not a democracy
Of course, whether you and I like it or not, this is not a democracy and just like Twitter can upset its developer ecosystem, Oracle has the right to put its engineering cycles wherever it feels is right. I was hoping that the JDK team at Oracle would try its best to address the community concerns given the promise made less than 2 years ago but instead Java will be moving forward slowly. Very slowly.

(this is still of course my very personal opinion)

Google Developer Live – Tous les contenus, tous les jours

Google Developer Live (GDL) a été lancé peu de temps avant Google I/O 2012 et propose du contenu technique sous forme de vidéos: courtes démonstrations, webinars, présentations complètes ou office hours, qui sont elles interactives par nature avec l’utilisation de hangout on Air (discussion dans un Google + Hangout, (re)diffusion et avec YouTube).

Les sujets traités vont de Android à Chrome en passant par Google+, AppEngine, YouTube, Maps et autres APIs Google.

Coté Cloud, il y a par exemple cette courte présentation des différentes solutions de stockage (Cloud Storage, Datastore et Cloud SQL) et de requêtage (REST, SQL, BigQuery). Il y a aussi des formats plus longs comme ce tutorial sur l’API Search d’AppEngine, un tutorial interactif sur l’API Google MAPS, cette session sur le language Dart couplée à une série de questions sur Google Moderator ou encore ces réflexions de Robert Scoble sur le monde des startups.

Coté Android, il y a les Office Hours (horaire Européen) pour poser ses questions et les Friday App Review (ici avec Reto Meier).

Vous trouverez un agenda complet sur le site Google Developer Live ainsi que tous le contenu archivé sur YouTube. Il se passe quelque chose tous les jours!

“Bon, et le contenu en français c’est pour quand?” Stay tuned!

API Google Maps: gratuit ou pas?

Pour certains ce sera un rappel ou une clarification, pour d’autres peut-être une information nouvelle.

L’API Google Maps est une des toutes premières API proposée par Google et probablement aussi une des plus populaire auprès des développeurs.


Cartes stylisées ou pas, l’usage gratuit de l’API est limité à 25 000 chargements de cartes par jour. Au delà il en coutera $0.50 pour 1000 chargements supplémentaires (après avoir initiallement été de $4). Les détails sont disponibles sur cette page. Il est important de comprendre qu’un chargement de carte (map load) est en réalité une instanciation de l’API Maps et non pas l’affichage de chaque tuile (tile). De telles limites existent également pour le geocoding, l’API Image Street View, etc.

Google estime à moins de 0,5% le nombre de sites concernés par cette règle des 25 000 chargements quotidiens. Dans les faits, les sites qui dépasseront cette limite tous les jours pendant plus de 90 jours consécutifs seront contactés par Google. Pas d’arrêt de service à prévoir en cas de popularité soudaine d’un site ou d’un service. Le meilleur moyen de mesurer sa consommation est de se connecter sur la Console Google API.

Tout ceci est applicable lorsque le site ou service qui utilise l’API Google Maps est librement accessible à tous. Les détails sont disponibles ici. Dans le cas contraire (éditeur de logiciel embarquant l’API par exemple), Google propose Maps API for Business.

Si vous avez besoin d’un “rafraichissement” sur l’API Google Maps, je vous invite à regarder cette présentation récente en français. Au rang des anecdotes, vous y apprendrez par exemple que Google Maps utilise une variante de la projection Mercator ou que ses tuiles sont des images 256×256 pixels. Si vous ne l’avez pas encore fait, la migration vers l’API v3 est fortement encouragée.

Comme pour toutes ses technologies, Google vous invite à poser vos question techniques sur StackOverflow et à suivre sa page Google+.

Enfin coté actualité produit, il y a désormais la possibilité de télécharger des cartes entières pour une utilisation hors-ligne, l’arrivée dans certaines villes du projet helicopter (vues à 45 degrés) et de nouvelles offres SaaS pour l’entreprise : Google Maps Engine, ou Google Maps Coordinate.

Thoughts on the Jigsaw debacle

Disclaimer: this is a personal piece of opinion and in absolutely no way does it necessarily reflect the views of my current employer. I have spent 13 years at Sun/Oracle (5 of which in the GlassFish team which had a modularity experience of its own) and I still care very much about the future of Java. I now work at Google.

Runtime modularity in Java has been promised since JSR 277 was filed in 2005 and I wrote how excited I was about its potential back then. Seven (7!) years, a fair amount of OSGi lobbying and politics, Sun’s acquisition, and a plan B promise later, we’ve come to this day to learn that it’ll be pushed further out to 2015 which really means 2016 for a stable release and probably 2020 for a wide adoption. After being promised Java 8 with Jigsaw in late 2012 by Oracle, we’re now taking another 3-year hit because the project missed “the train”.

About resources and goals
Jigsaw has been Mark Reinhold’s baby project for all this time (Mark is the Chief Architect of Java) and I’m now hearing excuses about staffing issues. “Oracle failed to staff Java modularity effort for years”. Hey, now that’s a much better headline! The reality I believe is that Oracle still doesn’t know why it’s doing Jigsaw and thus giving it the proper priority is hard. Modularize the JRE itself to help with JavaME and JavaFX adoption? Offer a modules system for Java’s longer-term viability? A business case can certainly be put together to shrink down the JRE to get Oracle upper management on board. On the other hand, bringing the JVM, the compiler, and the language together around a modules system seems, sadly, to be falling off of Oracle’s radar.

About that train
The common wisdom is that the Eclipse way of shipping software is the best way to get a community of developers building on a platform. You’ve probably also heard of “release early release often”. Eclipse is a very special project which is really about providing a baseline for the Foundation members to build upon and I’d argue that Eclipse IDE users on the other side are not benefiting much from this release model. When it comes to Java, we’re talking about something that also has a diverse audience and I think developers remain far more important than vendors and that a cadenced release model is actually harmful. It’s easy to agree on shipping software when it’s fully baked but the two-year cycle is really the key issue here. Oracle should be able to declare Jigsaw a strategic goal and deliver it with an extra 6 to 12 months (which, by the way, would still mean 2+ years from now!).

About the community
Jigsaw has been presented for many many years by Sun and later Oracle as a key feature in numerous keynotes and conferences and promised in Java 7, Java 8 (in fact I’ve done my share of such promotion while at Oracle) and now Java 9. That has created a lot of expectations in the community. In fact, it’s not only about Java SE as a large portion of the Java ecosystem is also waiting for a standard modularity solution: JavaME, Java EE (see this sample IBM reaction when modularity had to be removed from EE 7), Groovy and other JVM languages and probably by many developers building non-trivial applications with Java. Surely there’s got to be a better way to convey bad news to the community than “sorry, we’ve missed the train!”. In retrospect, the plan A/plan B approach was a brilliant communication plan with Plan A really not being an option and the community rallying behind Plan B. It’s often about how things are conveyed, not only about what they convey.

About open source
I hear some say that this would not have happened if Java was truly open source with a community, not a company, overlooking its destiny. First, my definition of Open Source remains. IP and governance are (ideally) orthogonal to the license and no simple solution exists for all software projects. But more importantly, this is a sad case of a project’s failed risk mitigation (sadly a very common failure in our industry). To consider that a different governance model would have changed anything is wishful thinking. Innovative carefully crafted designs always come from a very small number of talented engineers and in fact, this may even be a case where going open source and transparent was not a good idea but rather a fatal distraction.

About what’s next
As I wrote above, Oracle has the resources to declare Jigsaw a strategic goal. I can agree that it may be hard to deliver by late 2013 but waiting for 2016 is effectively killing Jigsaw and encouraging everyone to look at alternatives which will jeopardize yet even more Jigsaw’s chances of ever seeing the light of day. In fact, even Oracle is considering profiles in Java 8, an ugly band-aid if you ask me. One you’ll need to painfully tear off to get proper modularity in the platform. Jigsaw really shouldn’t be seen as “a new feature”, to me it’s really the Java reboot some people have been calling for a long time. Only a compatible one.

Now of course this is all my personal take and I don’t pretend to know what’s good for Java nor represent the community at large. So getting some hard data about what the community expects from Jigsaw would be a good start before making any decision. I believe this has not been done so far. The closest I’ve seen is the recent JAXenter poll which isn’t very scientific (self-selected, somewhat biased questions).

So in the end, if the community wants Java 8 with its updated and stripped-down content (Lambda, maybe JSR 310, what else?) in 2013, Oracle and the JCP should deliver just that. Again, it’s about meeting expectations. But shipping a Java 8.5 with Jigsaw sooner than later should also be considered. And if there really needs to be a train release model, it has to be a yearly one and not every release needs to be a major one.

In a world where standing still is perceived as fossilization, bringing proper modularity to Java is what moving Java forward ™ is really about.

Google Developer Expert (GDE) en France

Parmi les annonces que vous n’avez peut-être pas vu passer lors de Google I/O 2012, il y a le programme Google Developer Experts.

Avec ce nouveau programme, Google propose à des individus d’obtenir un titre d’expert à l’année pour l’un des domaines de prédilection de Google (Android, Cloud, HTML5, Chrome, Social, Geo, etc…).

Il ne s’agit bien entendu pas d’un rôle de porte-parole mais plus d’une reconnaissance apportée à une personne à la fois technique, experte et visible (présentations publiques, blog, commits, etc…). Ce titre lui permettra d’entretenir une relation avec Google (contact avec les developer advocates, access aux previews et plus encore) et de présenter lors de conférences développeurs.

Initiallement piloté en Israel et au Japon, le programme est désormais publique et actif en France comme l’indique la page des Experts actifs. Sa gestion est effectuée localement par Google France.

Maj: voici un billet sur GDE rédigé par le responsable du program au niveau mondial.

CloudSQL for the busy Java Developer

CloudSQL, Google’s fully-managed and highly-available MySQL-based relational database service, can be accessed directly by Java IDE’s or used as a target for on-premise running Java application servers, and of course it can be seamlessly used from AppEngine Java applications. Here’s how.

Pre-requisites

This paper assumes you have a CloudSQL database instance configured and (ideally) populated. You should have authorized your local machine using OAuth and the command-line tool and have the CloudSQL JDBC driver handy (it’s in the AppEngine SDK in lib/impl). If you need help on any of this, consider reading this Getting Started paper.

Here are the values used here :

  1. Cloud SQL instance name : scott-tiger:scott
  2. Database Name : jpetstore
  3. JDBC Driver Class Name : com.google.cloud.sql.Driver
  4. JDBC URL : jdbc:google:rdbms://scott-tiger:scott/jpetstore

By default the CloudSQL instance can be accessed with user root and an empty password.

This paper uses NetBeans (7.x) as the IDE and GlassFish (ships with NetBeans) as the local Java Application Server but everything should be easily adaptable for other tools such as Eclipse and other runtimes (tomcat, JBoss, etc).

NetBeans & CloudSQL

The NetBeans IDE offers a JDBC database explorer feature which you can use to access your CloudSQL database instance. In the NetBeans Services tab, chose Databases > Drivers and create a new driver configuration by pointing to the google_sql.jar archive and using com.google.cloud.sql.Driver as the JDBC driver name (should be auto-detected). Right-click this newly created JDBC driver and select “Connect With…” to create a new connection. Provide the username, the password and the full JDBC URL (jdbc:google:rdbms://scott-tiger:scott/jpetstore in my case) and test the connection.

You should now be able to navigate the database schema, view table content, manipulate data, and execute any SQL statement.

WebApp Project

We’ll now create a web application using JPA entities manipulating data from the Cloud SQL instance discussed above. We’ll deploy this application first to GlassFish, then to App Engine.

Within NetBeans, create a (Maven) Web Application project with GlassFish as the default target. Right-click on the project to select the “New Entity Classes from Database” wizard. Create a new data source using the JDBC connection defined in the previous step. Select the tables you want to create JPA entities for and do not check the “Create Persistence Unit” option (we’ll get back to this later). This generates standard JPA 2.0 @Entity-annotated classes for every table selected from CloudSQL.

Here’s a proper persistence.xml that will work with CloudSQL. Notice how this JPA persistence unit uses RESOURCE_LOCAL and not a JTA data source :

<persistence version="2.0">
  <persistence-unit name="CloudSQLPU" transaction-type="RESOURCE_LOCAL">
    <properties>
      <property name="javax.persistence.jdbc.url" value="jdbc:google:rdbms://scott-tiger:scott/jpetstore"/>
      <property name="javax.persistence.jdbc.user" value="user"/>
      <property name="javax.persistence.jdbc.password" value="pw"/>
      <property name="javax.persistence.jdbc.driver" value="com.google.cloud.sql.Driver"/>
    </properties>
  </persistence-unit>
</persistence>

Once this is setup, you can get a hold of this persistence unit in the servlet created by default the typical way you would in an servlet :

EntityManagerFactory emf = 
        Persistence.createEntityManagerFactory("CloudSQLPU");
EntityManager em = emf.createEntityManager();

A simple use to exercise the data could be to list all the names stored in the Category table (using its JPA entity representation) :

CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
cq.select(cq.from(Category.class));
List<Category> categories = em.createQuery(cq).getResultList();

for (Category category : categories) {
    out.println(category.getName() + "<br/>");
}

Deploying this simple application to the GlassFish application server shouldn’t require any other changes. Obviously with this architecture, the performance is not ideal given the server is not exactly close to the data. Nevertheless, this demonstrates the standalone capabilities of CloudSQL

Ship it all to the cloud!

A better approach is to probably to use CloudSQL from a Google AppEngine-hosted application where all sorts of optimisations will quick in. To do so, only limited changes to the standard application described above are required.

The first simple change is to add the AppEngine-specific deployment descriptor appengine-web.xml :

<?xml version="1.0" encoding="UTF-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <application>MyCloudSQLApp</application>
    <version>1</version>
    <threadsafe>true</threadsafe>
</appengine-web-app>

You’ll also need to change the name of the JDBC driver in persistence.xml (a more elegant solution could be to use Maven profiles to keep the project fully portable) :

- <property name="javax.persistence.jdbc.driver"
-          value="com.google.cloud.sql.Driver"/>
+ <property name="javax.persistence.jdbc.driver"
+         value="com.google.appengine.api.rdbms.AppEngineDriver"/>;

The JDBC URL remains the same.

Finally, you’ll need to bundle JPA / EclipseLink and BeanValidation / Hibernate Validator by making them runtime-scope dependencies. The Servlet and AppEngine SDK API artifacts should use the default scoping. Your mileage may vary when it comes to the implementation versions. Here is my complete set of Maven dependencies :

<dependencies>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <version>2.3.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>javax.persistence</artifactId>
            <version>2.0.3</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.2.0.Final</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-api-1.0-sdk</artifactId>
            <version>1.7.0</version>
        </dependency>        
    </dependencies>

Make sure the AppEngine application is authorized to access the CloudSQL instance (use the API Console for that). Once this is all done, simply deploy the application to AppEngine :

$ appcfg.sh update target/MyCloudSQLApp-1.0.0-SNAPSHOT

You’ll find the CloudSQL developer documentation here.