Google App Engine 1.4.3 veröffentlicht

Siehe http://googleappengine.blogspot.com/2011/03/announcing-app-engine-143-release_30.html. Änderungen in Java:

Java

  • Concurrent Requests: Until now, Java applications relied on starting additional instances to dynamically scale up for higher traffic levels. Now with support for concurrent requests, each application instance may serve multiple user requests at the same time. To start, ensure your application’s code is threadsafe, then enable concurrent requests by adding the <threadsafe> flag to your appengine-web.xml.
  • Java Remote API and Deferred API support: The Remote API andDeferred API libraries have been supported in Python for awhile, and now they can be used with Java, too! The Remote API allows you to perform operations on your application’s datastore from your local machine. This is particularly useful for work that is not well-suited to App Engine’s request/response model. The Deferred API allows users to more easily write and execute ad hoc tasks. Our docs contain more information and examples on how to use the Remote API and Deferred API in Java App Engine.
New and changed APIs
  • Files API: The new Files API in Python and Java allow you to pragmatically read and write data using Blobstore. This API can be used to generate reports, export data, or do anything that your heart desires that requires large, binary objects.

 

File-IO finde ich spannend, noch toller wäre es gewesen, wenn sich Google an NIO2 halten würde.

Guice 3.0 ist raus

Nach laaaanger Wartezeit ist DI-Framework Guice 3.0 veröffentlicht worden. Von http://code.google.com/p/google-guice/wiki/Guice30 die Neuerungen:

  • JSR 330 support
  • New Persist extension
  • ToConstructor Bindings
  • Better OSGi support (and generally improved support for multiple classloaders)
  • New methods in Binder: requireExplicitBindings & disableCircularProxies
  • Much simpler stack traces when AOP is involved
  • Exact duplicate bindings are ignored (instead of an exception being thrown)
  • Repackaged cglib, asm & guava classes are now hidden from IDE auto-imports
  • Source can be built with Maven
  • General extension & SPI improvements:
  • Scope improvements:
    • Scopes.isSingleton
    • toInstance bindings are considered eager singletons in the Scope SPI
    • Singleton providers that return null are now scoped properly.
    • Fail when circularly dependent singletons cannot be proxied (previously two instances may have been created)
  • Provider Method (@Provides) improvements:
    • Logger dependencies now use named instead of anonymous loggers
    • Exceptions produce a simpler stack
  • Private Modules improvements:
    • If a single PrivateModule is passed to Modules.override, private elements can be overridden.
    • If many modules are passed to Modules.override, exposed keys can be overridden.
  • Multibinder & MapBinder extension improvements:
    • permitDuplicates — allows MapBinder to inject a Map<K, Set<V>> and a Map<K, Set<Provider<V>> and Multibinder to silently ignore duplicate entries
    • Expose dependencies in Stage.TOOL, and return a dependency on Injector (instead of null) when working with Elements.
    • Co-exist nicely with Modules.override
    • Work properly with marker (parameterless) annotations
    • Expose details through the new extensions SPI
  • Servlet extension improvements:
    • Added with(instance) for servlet bindings.
    • Support multiple injectors using ServletModule in the same JVM.
    • Support thread-continuations (allow background threads to process an HttpRequest)
    • Support manually seeding a @RequestScope
    • Expose details through new extensions SPI
    • Fix request forwarding
    • Performance improvements for the filter & servlet pipelines
    • Expose the servlet context (ServletModule.getServletContext)
    • Fixed so a single ServletModule instance can be used twice (in, say Element.getElements & creating an Injector)
    • Fix to work with context paths
  • AssistedInject extension improvements
    • New FactoryModuleBuilder for building assisted factories
    • Injection is done through child injectors and can participate in AOP
    • Performance improvements
    • Multiple different implementations can be created from a single factory
    • Incorrect implementations or factories are detected in Stage.TOOL, and more error-checking with better error messages
    • Work better with parameterized types
    • Expose details through new extensions SPI
  • ThrowingProviders extension improvements
    • Added a new CheckedProviders interface that allows more than one exception to be thrown.
    • Added @CheckedProvides allowing @Provides-like syntax for CheckedProviders.
    • Dependencies are checked at Injector-creation time and during Stage.TOOL, so they can fail early
    • Bindings created by ThrowingProviderBinder now return proper dependencies instead of Injector.
  • Struts2
    • The Struts2 extension now works again! (It worked in Guice 1.0 and was somewhat broken in Guice 2.0)
  • Added to Injector: getAllBindings, getExistingBinding, getScopeBindings, getTypeConverterBindings.
  • Added to Key: hasAttributes, ofType, withoutAttributes
  • Various bug fixes / improvements:
    • Prevent child injectors from rebinding a parent just-in-time binding.
    • Non-intercepted methods in a class with other intercepted methods no longer go through cglib (reducing total stack frames).
    • Allow Guice to work on generated classes.
    • Fix calling Provider.get() of an unrelated Provider in a scoping method.
    • MoreTypes.getRawTypes returns the proper types for arrays (instead of Object.class)
    • JIT bindings left in a parent injector when child injectors fail creating a JIT binding are now removed
    • Overriding an @Inject method (if the subclass also annotates the method with @Inject) no longer injects the method twice
    • You can now bind byte constants (using ConstantBindingBuilder.to(byte))
    • Better exceptions when trying to intercept final classes, using keys already bound in child or private module, and many other cases.
    • ConvertedConstantBinding now exposes the TypeConverterBinding used to convert the constant.

JSR 334 (Project Coin) ist im Public Review

Details unter http://blogs.sun.com/darcy/entry/project_coin_jsr_334_pr (Download des Drafts unter http://jcp.org/aboutJava/communityprocess/pr/jsr334/index.html).

Allerdings gibt es Unmut, weil zwar alle so schön “Oracle-open” sein soll, aber nichts dokumentiert ist. Daher ist völlig offen, ob seit dem letzten Pre-Release Vorschläge von der Community angenommen wurden, und wenn ja, welche, und wenn nein, warum nicht.

Java SE 7 Developer Preview Release verfügbar

Oracle schreibt im Blog http://blogs.oracle.com/java/2011/02/java_se_7_developer_preview_release_now_available.html , dass die Java SE 7 Developer Preview Release verfügbar ist. Download unter http://jdk7.java.net/preview/.

Interessant ist, dass JSR 308 nicht Teil von Java 7 sein wird und gemachte Änderungen wieder rausfliegen: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7015156.

Eine echtere Änderung ist auch http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7012540, hier muss ich in der Insel etwas umbenennen.

Weiterhin sind NIO2 Methoden hinzugekommen, auch etwas, was ich für die kommende Version aktualisieren muss: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7006126. Die neue Files-Klasse geht in Richtung Google Guava.

Auch http://hg.openjdk.java.net/jdk7/jdk7/jdk/rev/82c8c54ac1d5 ist gefixt.

Thema der Woche: Kindle-HTML auf Korrektheit prüfen

Der eBook-Reader Kindle kann HTML-Seiten anzeigen, ist allerdings mit dem HTML etwas eingeschränkt. So sind nur ganz bestimmte HTML-Tag und dann auch nicht alle Attribute erlaubt. Der Anhang “Appendix. Supported HTML tags" in der PDF “Amazon Kindle Publishing Guidelines. How to make books available for the Kindle platform” erklärt welche.

Aufgabe: Schreibe ein Java-Programm, welches eine HTML-Datei (wir können vereinfacht annehmen XHTML) analysiert, ob nur unterstützte HTML-Tags und Attribute vorkommen und andernfalls eine Fehlermeldung ausgibt. Hinweis: Natürlich soll das Programm nicht aus 100 Fallunterscheidungen bestehen, sondern das ganze soll etwas clever programmiert werden. Könnte ein Guava Typ wie com.google.common.collect.Mulimap vielleicht helfen?

JBoss jBPM in der Version 5

Die Hauptseite http://www.jboss.org/jbpm zählt als Neuerungen auf:

jBPM5 is the latest community version of the jBPM project.  It is based on the BPMN 2.0 specification and supports the entire life cycle of the business process (from authoring through execution to monitoring and management).

The current jBPM5 snapshot offers open-source business process execution and management, including

  • embeddable, lightweight Java process engine, supporting native BPMN 2.0 execution
  • BPMN 2.0 process modeling in Eclipse (developers) and the web (business users)
  • process collaboration, monitoring and management through the Guvnor repository and the web console
  • human interaction using an independent WS-HT task service
  • tight, powerful integration with business rules and event processing

Contracts für Java

Ein neues Projekt eines Google-Mitarbeiter verspricht Zusicherungen zur Laufzeit zu prüfen. Ankündigung: http://google-opensource.blogspot.com/2011/02/contracts-for-java.html, Projekt unter http://code.google.com/p/cofoja/. Mal sehen wie sich das entwickelt, im .NET Umfeld ist da einiges im Gange. In Java 7 waren mal einige Annotationen geplant, die sind aber gestorben. @NotNull und so weiter hat sich als sehr nützlich erwiesen, das funktioniert in der Praxis.

JDK 7 ist eigentlich schon fertig

so schreibt es Mark Reinholt http://mreinhold.org/blog/jdk7-fc/. Was das heißt?

This means that all of the planned features have been implemented and integrated into the master forest, along with their unit tests, and all other planned tests have been written and run on a representative set of platforms.

Zwei Detailverbesserungen fehlen allerdings noch, was zu XML und JMX.

Spezifikation werden parallel geupdated wenn das nötig wird.

Thema der Woche: Valide XML

  • XML-Dokumente müssen well-formed und können valide sein. Was heißt das?
  • Kann man mit JDOM eine nicht well-formed XML erstellen?
  • XML-Validierung über Schema ist die übliche Art die Korrektheit von XML-Dokumenten zu garantieren. Was kann XML-Schema für Kriterien garantieren, was nicht?
  • Suche aus dem Internet ein XML-Schema und generiere eine XML-Datei mit Standard-DOM. Aktiviere die Validierung und versuche etwas nicht-valides zu schreiben. Welche Fehler werden produziert und wie kann man sie behandeln?

Thema der Woche(n): Java 2D

Erste Woche:

Zweite Woche

  • Lies und verfolge die Diashows und Beispiele unter http://www.matheprisma.de/Module/Lmayer/index.htm. Nur das Kapitel “erster Blick”, “L-Systeme und Kröten 1 2” (3 und weiter ist nicht nötig).
  • Was beschreibt die Regel F F+FF+F ?
  • Die Vorschrift lässt sich in einer Methode modellieren, in dem für F eine Methode f(), und für +, – Methoden left() und right() angenommen werden. f() selbst ruft sich rekursiv auf, etwa so: void f() { f(); left(); f(); right(); right(); f(); … }. Allerdings fehlt da noch etwas für den Winkel und die aktuelle Zeichenlänge; wie kommt die Paramater mit ins Spiel? Was bestimmt das Rekursionsende?
  • Schreibe eine Methode f(), die die Kochkurvemit Java 2D zeichnet.