Teil von IntelliJ IDEA wird Open-Source

Laut Blog-Eintrag unter http://blogs.jetbrains.com/idea/2009/10/intellij-idea-open-sourced/ wird es eine freie quelloffene Community-Edition geben:

I believe you’ll like this announcement — IntelliJ IDEA has just gone open-source! Check out the press release as well as the new jetbrains.org community site for the details. We all will soon get a lot of new friends and colleagues in our IntelliJ IDEA community!

Starting with the upcoming version 9.0, IntelliJ IDEA will be offered in two editions: Community Edition and Ultimate Edition. The Community Edition focuses on Java SE technologies, Groovy and Scala development. It’s free of charge and open-sourced under the Apache 2.0 license. The Ultimate edition with full Java EE technology stack remains our standard commercial offering. See the feature comparison matrix for the differences.

Briefly, in the free Community Edition you’ll get all the Java code support — various refactorings and code inspections, coding assistance; debugging, TestNG and JUnit testing; CVS, Subversion and Git support; Ant and Maven build integration; and Groovy and Scala support (through a separate plugin). To learn more and download the Public Preview of IntelliJ IDEA 9 Community Edition, please visit the IntelliJ IDEA Community Edition site.

The IntelliJ platform, the common foundation for all our IDEs (IDEA, RubyMine, WebIDE or MPS), is being open-sourced under the APL 2.0, too.

Das Video http://www.jetbrains.com/idea/training/demos/CE/introduction_to_community_edition.html stellt die Community Edition kurz in einem Video vor.

GWT-Bibliotheken

http://code.google.com/p/kiyaa/. Leistungsfähiges XHTML-Template Framework. Bis zum Google UI-Binder ist a) noch Zeit und b) nutzt Kiyaa einfaches XHTML, was man mit jedem HTML-Editor editieren auf aufbauen kann.

http://code.google.com/p/gwt-mosaic/. “GWT Mosaic is a highly usable, feature rich toolkit for creating Rich Internet Applications and an easy to use API.” http://69.20.122.77/gwt-mosaic/Showcase.html

http://code.google.com/p/cobogw/. In erster Linie Buttons, Button-Gruppen, runde Panels, Rating-Widget. Demo. Weiterhin “GWT emulation of java.sql”, also von Date, Time, Timestamp

http://www.asquare.net/gwttk/. Demo. Seit 2007 kein neues Release

http://code.google.com/p/gwtlib/. MenuBar, PagingBar, Table, PagingTable und StyleListBox. Table hat Renderer. Aktuell

http://code.google.com/p/gwt-masterview/. “GWT-Masterview library is an extension to Google Web Toolkit that provides widgets to filter, sort and paginate your data”

http://code.google.com/p/gwtchismes/. Demo. Rendert nicht ganz sauber die Buttons

http://code.google.com/p/gwt-beans-binding/

http://code.google.com/p/gwt-table/

http://code.google.com/p/gwt-datepicker/

http://code.google.com/p/guwit/

http://gwt-widget.sourceforge.net/. Besteht aus GWT Server Library (GWT-SL) und GWT Widget Library (GWT-WL). http://gwt-widget.sourceforge.net/demo/calc/index.html zeigt einen kleinen Taschenrechner, kann mal praktisch sein… (bin ich zynisch?) Der letzte Blog-Eintrag endete vor exakt 3 Jahren.

http://gwt-vl.sourceforge.net/. GWT Validation Library

http://raibledesigns.com/rd/entry/creating_a_facebook_style_autocomplete 

Noch mehr: http://google.wikia.com/wiki/Google_Web_Toolkit#Widgets

Fehlt was?

guava-libraries — Guava: Google Core Libraries for Java

Wer von den ganzen Apache Commons * noch immer nicht genug hat, kann einen Blick auf http://code.google.com/p/guava-libraries/ werden. Lauf Webseite „This project contains several of Google’s core Java libraries that we use in our myriad Java projects.“ Die Folien (http://guava-libraries.googlecode.com/files/Guava_a_sketchy_overview.pdf) geben Beispiele für einige Pakete der Libs:

com.google.common.base
com.google.common.io
com.google.common.primitives
com.google.common.util.concurrent

Mir gefällt besonders gut, das moderne API-Design. Ein Blick ist es wert! Die Doku gibt es unter http://guava-libraries.googlecode.com/svn/trunk/javadoc/index.html. Die Folien versprechen auch eine Unterstützdung von GWT — das wäre wirklich interessant.

Update von Findbugs auf 1.3.9

Findbugs http://findbugs.sourceforge.net/ hat die Versionsnummer erhöht und unter anderem neue Detektoren aufgenommen. Von der Webseite:

Thema der Woche: Programmieren mit einem bisschen Geo

Schreibe eine Klasse Location, die longitude und latitude speichert. Die Attribute sind vom Type double. Gib Setter/Getter an und einen Standard- und parametrisieren Konstruktor. Die Klasse Location soll die Abstands-Utility-Funktionen aus http://www.tutego.de/blog/javainsel/2009/09/latitudelongitude-distance-in-java/ bekommen.

Die Klasse Locations soll beliebig viele Location-Objekte speichern können. Dazu ist eine addLocation()-Methode nötig, die einen Ort als String mit einer Location annimmt und in eine intern Datenstruktur übernimmt. addLocation() soll überladen sein, dass man einmal den Ort über ein Location-Objekt bestimmt und einmal über Longitude und Latitude. Eine toString()-Methode soll angeben, wie viele Orte enthalten sind. Eine Methode Location findLocation(String location) soll die Location für einen Ort zurückgeben. Schreibe eine Methode List within(Location loc, double radius) Methode, die alle Orte liefert, die nicht weiter als radius von dem Ort entfernt sind. Nutzt die passende statische Funktionen aus Location für den Abstand! Nimm eine überladene Methode within() hinzu, die eine maximale Anzahl Elemente in der Rückgabeliste bestimmt.

Schreibe eine Klasse LocationApplication mit einem main(). Füge einige Location-Objekte ein und teste die Bereichsabfrage.

Eine Klasse LocationRepository soll zwei statische Methoden enthalten: Locations loadLocations() und void saveLocations(Locations locations). Die Methoden sollen Locations aus einer Text-Datei lesen und schreiben können. Nutze dazu beliebige Geokoordinaten. Das Dateiformat kann frei bestimmt werden.

Passe die Methode within() an, so dass die Liste sortiert ist nach dem Abstand zum Anfrageort. Schreibe dazu einen DistanceComparator und nutze die Collections.sort()-Methode.

Modelliere mit NetBeans eine grafische Oberfläche, mit zwei Reitern (JTabbedPane). In dem ersten Reiter soll man drei Textboxen haben für Ort, Longitude, Latitude und einen „Hinzufügen“ Button. Damit sollen neue Orte dem Locations hinzugefügt werden. Auf dem zweiten Reiter soll der Anwender Abfragen vornehmen können. Eine Eingabezeile für ein Ort (oder Longitude, Latitude) und Radius soll zu max. 10 Ergebnissen führen.

Installiere Google Earth. Bei einer Bereichsabfrage erzeugte eine KML-Datei mit allen Ergebnissen. Diese Datei soll beim Start von Google Eath als Startparameter mitgegeben werden. Externe Programme startet man mit dem ProcessBuilder. Die Insel gibt ein Beispiel für diese Klasse. Überlegen, wie am einfachsten und effektivsten XML geschrieben werden kann.

Latitude/Longitude distance in Java

public class LongLatUtils
{

/**

* Calculates the great circle distance between two points on the Earth. Uses the Haversine Formula.

*

* @param latitude1 Latitude of first location in decimal degrees.

* @param longitude1 Longitude of first location in decimal degrees.

* @param latitude2 Latitude of second location in decimal degrees.

* @param longitude2 Longitude of second location in decimal degrees.

* @return Distance in meter.

*/

public static double distance( double latitude1, double longitude1, double latitude2, double longitude2 )

{

double latitudeSin = Math.sin( Math.toRadians(latitude2 - latitude1) / 2 );

double longitudeSin = Math.sin( Math.toRadians(longitude2 - longitude1) / 2 );



double a = latitudeSin * latitudeSin

+ Math.cos( Math.toRadians(latitude1)) * Math.cos(Math.toRadians(latitude2) ) * longitudeSin * longitudeSin;



double c = 2 * Math.atan2( Math.sqrt(a), Math.sqrt(1 - a) );



return 6378137 * c;

}





/**

* Converts latitude and longitude from degrees, minutes, and seconds in decimal degrees.

*

* @param degrees

* @param minutes

* @param seconds

* @return Latitude and longitude in decimal degrees.

*/

public static double convertDegreesMinutesSecondsToDecimalDegrees( int degrees, int minutes, int seconds )

{

return degrees + minutes/60. + seconds/3600.;

}



// public static void main(String[] args)

// {

// System.out.println( convertDegreesMinutesSecondsToDecimalDegrees(38, 53, 23 ));

// System.out.println( distance(38.898556, -77.037852, 38.897147, -77.043934));

// }

}

Die Sprachänderungen für Java 7 nun fest

Das schreibt Joseph D. Darcy in seinem Blog http://blogs.sun.com/darcy/entry/project_coin_final_five (und bei Java.net http://weblogs.java.net/blog/forax/archive/2009/08/29/seven-small-languages-changes-will-be-jdk7).

Die Spezifikationen stehen im Einzelnen noch nicht fest.

Raus sind erst einmal

und auch alle anderen Dinge.

Das alles erscheint mir schon mehr merkwürdig in der Auswahl. Improved Exception Handling for Java war so ein heißer Kandidat und wird es nun doch nicht.

Deadline ist Ende Oktober.

Beta 1 von Hibernate 3.5 mit JPA 2.0

Steve Ebersole schreibt auf seinem Blog http://in.relation.to/12153.lace dazu:

This is the first release towards supporting JPA 2. Most of the APIs are implemented. Some know limitations for this beta include:

  • Some of the ‚metamodel‘ APIs are still unimplemented, specifically differentiating between declared attributes and attributes (same wording as java.lang.reflect). The getDeclaredXYZ methods simply return null in this release.
  • ‚criteria‘ query building is fully implemented aside from defining subquery correlations, to the best of my knowledge and current state of the spec. However, compiling criteria queries is unimplemented scheduled for the next release.

Additionally, initial support for fetch profiles has been added in this release. Currently only join-fetching is supported as a strategy in fetch profiles.

The artifacts have all been published to the JBoss Maven repository. Additionally the release bundles have been uploaded to SourceForge.

This is also the first version bundling annotations, entitymanager and envers together with the other core modules. Moving forward all will be versioned and released together.

Swing Application Framework fliegt aus Java 7 raus

Unter http://weblogs.java.net/blog/alexfromsun/archive/2009/08/saf_and_jdk7.html ist von Alexander Potochkin nun zu lesen:

After much discussion it’s become clear that the Swing Application Framework API as it is today hasn’t reached consensus and we feel still needs further design work done.

Since the SAF API was committed to milestone 5 of JDK7 and that time is already here, this date is now impossible, and we need to decommit SAF from any specific JDK 7 milestone

Zusammenfassung der Änderungen von EJB 3.1 und JPA 2

  • Die lokale Schnittstelle (local view) einer lokalen Session Bean kann nun entfallen, da direkt die öffentlichen Methoden als Schnittstelle verwendet werden können. Eine lokale Session Bean muss daher keine Schnittstelle mehr implementieren, um injiziert zu werden und Methoden anzubieten.
  • EJBs müssen nicht mehr in einem EAR-Archiv verpackt sein, sondern können einfach in einem WAR deployed werden. Im Fall von WAR-Archiven liegen dann die Klassen unter WEB-INF/classes.
  • Mit der Annotation @Singleon lässt ein Singleton markieren, sodass sich eine Session Bean (die auch Business Schnittstellen implementieren kann) von unterschieden Stellen nutzen lässt, aber eben nur einmal in der JVM vorhanden ist.
  • Die Annotation @Startup ist ein Zusatz für @Singleton, um über das Hoch-/Runterfahren des Applikationsservers informiert zu werden. Die Callbackmethoden nutzen das bekannte @PostConstruct und @PreDestroy.
  • Der EntityManager erlaubt ein detach().
  • Embeddable’s können in JPA 2.0 geschachtelt sein und Relationen eingehen.
  • Weitere Mappings bei JPA-Tabellen. Map-Keys können nun einfache Objekte, Entities und embedded Entities sein.
  • Bisher konnten etwa 1:n-Assoziationen immer nur Verweise auf Entity-Beans realisieren, aber keine Sammlungen etwa von Strings oder Datums-Objekten. Das ändert sich mit JPA 2.0, das Collections von Elementen erlaubt. Hier zieht JPA eine Collection-Table heran.
  • Die Entities im Persistence Context eines Entity-Managers sind in einem Cache, dem Level 1 Cache. Bei zwei Entity-Managern ist es implementierungsabhängig, wie zum Beispiel zwei gleiche Entity-Beans in den beiden EM gehalten werden. Das bestimmt ein Level 2 Cache. Dieser Level 2 Cache lässt sich über die Shared Cache API von JPA 2.0 rudimentär kontrollieren.
  • Mit einer @Version-Spalte erlaubt JPA 1.0 schon immer optimistisches Locking, allerdings nur optimistische Lese- oder Schreib-Sperren. Mit JPA 2.0 wird über die Enum LockMode nun Optimistisches und auch Pessimistisches Locking unterstützt.
  • Eine neue Criteria-API kommt in JPA 2.0 und damit neue Typen wie QueryBuilder, CriteriaQuery. Die API folgt dem Fluent-Interface Prinzip, etwa wie bei criteriaQuery.select(entity.get(„id“)).where(queryBuilder.cojunction(queryBuilder.equals(…), …)).
  • JPA-QL kennt für Datumswerte nun auch Literale.
  • JPA-QL unterstützt polymorphe Anfragen der Art WHERE CLASS(e) = Klassenname.
  • JPA-QL ermöglicht CASE-Anfragen wie eine Fallunterscheidung.
  • JPA-QL erlaubt in der WHERE-Klausel Zugriff auf den Index einer Liste.

VMware kauft SpringSource

Die Ankündigung von SpringSource liest sich so:

Together, VMware and SpringSource plan to further innovate and develop integrated Platform as a Service (PaaS) solutions that can be hosted at customer datacenters or at cloud service providers. These solutions will allow customers to rapidly build new enterprise and web applications and run and manage these applications in the same dynamic, scalable and cost-efficient vSphere-based internal or external clouds that can also host and manage their existing applications, providing an evolutionary path to the future.

SmartGWT 1.2

Aus dem Blog http://www.jroller.com/sjivan/entry/smartgwt_1_2_released:

SmartGWT 1.2 has been released. I have added several new samples to the Showcase including a real world mini-application. The other new samples can be found under the „New Samples“ side nav item.

This is a feature-complete production ready release. There are only around 20 enhancement requests and 20 low / medium priority issues in the SmartGWT tracker which I think is pretty telling for such a comprehensive library. I hope to get to them over the weeks to come.

Here are some of the key features of this release :

  • GWT 1.7 is fully supported and integration with GWT widgets has been improved significantly. Along with standard GWT widgets, you can now easily add Google Maps or even a Google Visualization Chart to your SmartGWT application
  • Hosted mode performance improvements
  • Fully implemented the highly requested ResultSet API.
  • ListGrid performance improvements
  • Full Support for Safari 4.x
  • Support for Grid editing with all cell editors active
  • Auto-loading of dependent XML schema for loadWSDL() and loadXMLSchema()
  • Extended WebService APIs to allow simplified input data and allow setting SOAP headers
  • Numerous enhancements. See the detailed API Changes document. Around 35 additional enhancements and bug fixes that were logged in tracker
  • Official Maven Repository
  • Enhancements to RPC Tab in Developer Console (shows component that initiated request, if applicable)

Looking ahead there are several exciting new features that are going to be in the next release. Deep level of customization of pretty much any widget is going to be supported. For example you’ll be able to fully customize grid headers, provide your own widget implementation to use as a Tile in a TileGrid, or even customize pretty much any aspect of the Calendar component.

NetBeans 6.8 Milestone 1

Gibt es nun auch zum Downloaden unter http://bits.netbeans.org/netbeans/6.8/m1/. Und die News gibt es hier unter http://wiki.netbeans.org/NewAndNoteworthyNB68. Interessant ist:

  • Milestone1 enables basic support for development of applications for Java Enterpise Edition v6.
  • support for JPA 2.0
  • Initial PHP 5.3 support
  • Upgraded bundled JRuby to 1.3.1
  • Support for creating Rails 2.3.2 apps with dispatchers
  • Neue Profiling tools für C++
  • Issue tracking integration now supports JIRA

iPhone-Applikationen mit Java entwickeln (XMLVM)

Ein großartiges Projekt ist http://www.xmlvm.org/. Es steht zwar erst am Anfang, aber der sieht sehr vielversprechend aus. Die Idee von XMLVM ist einfach: Man nehme den Bytecode, repräsentierte diesen als XML, transformiere den über XSLT in Objective C und kompilieren dann.

XMLVM Overview Diagram

(Bilder von der Webseite)

 

XMLVM Frontend

Die Stack-Operationen vom Java-Bytecode werden über XSLT einfach in Objective C abgebildet, wobei die Stack-Operationen beibehalten werden. Die Mühe über einen internen AST oder so macht man sich nicht.

<xsl:template match=“jvm:irem“>
  <xsl:text>
    _op2.i = _stack[–_sp].i; // Pop operand 1
    _op1.i = _stack[–_sp].i; // Pop operand 2
    _stack[_sp++].i = _op1.i % _op2.i; // Push remainder
  </xsl:text>
</xsl:template>

Das gibt zwar für den GCC ‘ne Menge zu optimieren, aber das ist der einfachste Weg der Transformation. Später sieht das dann so aus:

@interface org_xmlvm_test_HelloWorld : java_lang_Object
+ (void) main___java_lang_String_ARRAYTYPE :(NSMutableArray*)n1;
@end
@implementation org_xmlvm_test_HelloWorld;
+ (void) main___java_lang_String_ARRAYTYPE :(NSMutableArray*)n1
{
    XMLVMElem _stack[2];
    XMLVMElem _locals[1];
    int _sp = 0;
    XMLVMElem _op1, _op2, _op3;
    int _i;
    for (_i = 0; _i <1; _i++) _locals[_i].o = nil;
    NSAutoreleasePool* _pool = [[NSAutoreleasePool alloc] init];
    _locals[0].o = n1;
    _op1.o = [java_lang_System _GET_STATIC_java_lang_System_out];
    _stack[_sp++].o = _op1.o;
    _stack[_sp++].o = @“Hello World“;
    _sp -= 2;
    [((java_io_PrintStream*) _stack[_sp].o) println___java_lang_String:_stack[_sp + 1].o];
    [_pool release];
    return;
}
@end

 

Weitere Beispiele gibt http://xmlvm.org/showcase/ und der Blog http://www.cokeandcode.com/aboidblog.

Insgesamt ein sehr spannendes Projekt, welches auch die Frage Android –> iPhone Entwicklung angeht, und .NET -> Java Cross-Compilation bietet. Mal sehen, wie sich das Entwickeln wird. MONO für iPhone ist auch bald bereit und dann wird iPhone Entwicklung wirklich einfach. (Bekommen wir dann noch mehr Schrott im Store?)

Über die Sicherheitsarchitektur von Google Android

Vom 25.-30. Juli lief in in den USA die Sicherheitsmesse Black Hat. Dort hat Jesse Burns in einem Vortrag die Sicherheitsarchitektur von Android vorgestellt. Sein Paper dazu kann man hier (alternativ unter http://www.isecpartners.com/files/iSEC_Securing_Android_Apps.pdf) runterladen.

Weiterhin lesenswert ist