<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' version='2.0'><channel><atom:id>tag:blogger.com,1999:blog-18862554</atom:id><lastBuildDate>Sun, 18 May 2008 11:06:01 +0000</lastBuildDate><title>Java ist auch eine Insel</title><description/><link>http://www.tutego.com/blog/javainsel/</link><managingEditor>noreply@blogger.com (Christian Ullenboom)</managingEditor><generator>Blogger</generator><openSearch:totalResults>226</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-6801471747905898947</guid><pubDate>Sun, 18 May 2008 11:06:00 +0000</pubDate><atom:updated>2008-05-18T13:06:01.415+02:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Insel</category><title>Inselupdate: Generics und Arrays</title><description>&lt;p&gt;Die Typl&amp;#246;schung ist der Grund daf&amp;#252;r, das Arrays nicht so umgesetzt werden k&amp;#246;nnen, wie es sich der Entwickler denkt. Folgendes gibt einen Compilerfehler.&lt;/p&gt;  &lt;p&gt;class TwoBox&amp;lt;T&amp;gt;   &lt;br /&gt;{    &lt;br /&gt;&amp;#160; private T[] array = new T[ 2 ];&amp;#160;&amp;#160; // Cannot create a generic array of T    &lt;br /&gt;&amp;#160; T[] getArray() { return array; }    &lt;br /&gt;}&lt;/p&gt;  &lt;p&gt;Der Grund f&amp;#252;r diesen Fehler ist dann gut zu erkennen, wenn wir &amp;#252;berlegen, zu welchem Programmcode die Typl&amp;#246;schung f&amp;#252;hren w&amp;#252;rde:&lt;/p&gt;  &lt;p&gt;class TwoBox   &lt;br /&gt;{    &lt;br /&gt;&amp;#160; Object[] array = new Object[ 2 ];&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // (1)    &lt;br /&gt;&amp;#160; Object[] getArray() { return array; }    &lt;br /&gt; }&lt;/p&gt;  &lt;p&gt;Der Aufrufer w&amp;#252;rde nun die TwoBox parametrisiert verwenden wollen:&lt;/p&gt;  &lt;p&gt;TwoBox&amp;lt;String&amp;gt; twoStrings = new TwoBox&amp;lt;String&amp;gt;();   &lt;br /&gt;String[] stringArray = twoStrings.getArray();&lt;/p&gt;  &lt;p&gt;Denken wir an diese Stelle wieder an die Typl&amp;#246;schung und an das, was der Compiler generiert:&lt;/p&gt;  &lt;p&gt;TwoBox twoStrings = new TwoBox();   &lt;br /&gt;String[] stringArray = (String[]) twoStrings.getArray(); // (2)&lt;/p&gt;  &lt;p&gt;Jetzt ist es auff&amp;#228;llig: W&amp;#228;hrend (1) ein Object-Array der L&amp;#228;nge 2 aufbaut und auch getArray() dies als Object-Array nach au&amp;#223;en gibt, castet (2) dieses Object-Array auf ein String-Array. Das geht aber nicht, denn diese Beiden Typen sind nicht typkompatibel. Zwar kann nat&amp;#252;rlich ein Object-Array Strings referenzieren, aber das Feld selbst als Objekt ist eben ein Object[] und kein String[].&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Hinweis &lt;/strong&gt;&amp;#160; Die Java-API bietet &amp;#252;ber Reflection eine M&amp;#246;glichkeit, Arrays eines Typs zu erzeugen:&lt;/p&gt;  &lt;p&gt;T[] array = (T[]) Array.newInstance( clazz, 2 );&lt;/p&gt;  &lt;p&gt;Allerdings muss der Class-Typ clazz bekannt sein und m&amp;#252;sste als zus&amp;#228;tzlicher Parameter &amp;#252;bergeben werden. Die Syntax T.class gibt einen Compilerfehler, denn &amp;#252;ber die Typl&amp;#246;schung w&amp;#228;re das ja sowieso immer Object.class, was den gleichen Fehler wie vorher ergibt und kein Fortschritt w&amp;#228;re.&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/05/inselupdate-generics-und-arrays.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-6012079715625473561</guid><pubDate>Sat, 17 May 2008 15:21:00 +0000</pubDate><atom:updated>2008-05-17T17:21:12.046+02:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Java</category><category domain='http://www.blogger.com/atom/ns#'>Open Source</category><title>YUI4JSF: JSF-Komponenten auf der Basis der Yahoo UI Library</title><description>&lt;p&gt;YUI4JSF (&lt;a title="http://yui4jsf.sourceforge.net/" href="http://yui4jsf.sourceforge.net/"&gt;http://yui4jsf.sourceforge.net/&lt;/a&gt;) bietet auf der Basis der &lt;a href="http://developer.yahoo.com/yui/"&gt;The Yahoo! User Interface Library (YUI)&lt;/a&gt; neue JSF-Komponenten:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/accordionMenu.html"&gt;Accordion Menu&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/CommandButton.html"&gt;CommandButton&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/ajaxCommandButton.html"&gt;Ajax CommandButton&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/CommandLink.html"&gt;CommandLink&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/menuButton.html"&gt;Menu Button&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/autoComplete.html"&gt;Auto Complete&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/slider.html"&gt;Slider&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/calendar.html"&gt;Calendar&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/datatable.html"&gt;Datatable&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/column.html"&gt;Column&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/editor.html"&gt;Editor&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/menu.html"&gt;Menu&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/menubar.html"&gt;MenuBar&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/submenu.html"&gt;SubMenu&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/menuitem.html"&gt;Menuitem&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/menuButtonItem.html"&gt;Menu Button Item&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/treeview.html"&gt;TreeView&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/tabview.html"&gt;TabView&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/tab.html"&gt;Tab&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/sortList.html"&gt;SortList&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/slideShow.html"&gt;SlideShow&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/panel.html"&gt;Panel&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/dialog.html"&gt;Dialog&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/simpleDialog.html"&gt;Simple Dialog&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/chooseColor.html"&gt;Choose Color&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/inputColor.html"&gt;Input Color&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/tooltip.html"&gt;Tooltip&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://yui4jsf.sourceforge.net/site/components/logger.html"&gt;Logger&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Die Webseite schreibt &amp;#252;ber das YUI4JSF-Projekt:&lt;/p&gt; &lt;dl&gt;   &lt;blockquote&gt;     &lt;p&gt;&lt;b&gt;&lt;u&gt;Components that wrap around builtin YUI Widgets. &lt;/u&gt;&lt;/b&gt;YUI has many widgets like calendar, slider, autocomplete, treeview, inputColor and etc. YUI4JSF takes these widgets and provides pure JSF Components which take care of the javascript and server side interaction. &lt;/p&gt;      &lt;p&gt;&lt;b&gt;&lt;u&gt;Components powered by YUI Utilities. &lt;/u&gt;&lt;/b&gt;YUI Utilities like DragDrop Utils are used to create custom components like SortList or Accordion Panel. &lt;/p&gt;      &lt;p&gt;&lt;b&gt;&lt;u&gt;AJAX Forms (Beta). &lt;/u&gt;&lt;/b&gt;YUI4JSF Ajax components like ajaxCommandButton ajaxifies your existing forms in few seconds. &lt;/p&gt;      &lt;p&gt;&lt;b&gt;&lt;u&gt;Layout Engine (Experimental). &lt;/u&gt;&lt;/b&gt;YUI4JSF provides a templating engine that helps creating a flexible layout mechanism in your JSF pages. &lt;/p&gt;   &lt;/blockquote&gt; &lt;/dl&gt;  &lt;p&gt;Das &lt;a title="http://www.nightdev.devisland.net/yui4jsf-examples" href="http://www.nightdev.devisland.net/yui4jsf-examples"&gt;Demo (http://www.nightdev.devisland.net/yui4jsf-examples)&lt;/a&gt; zeigt die Komponenten live. Wenn ich allerdings das Look-and-Feel der YUI-&lt;a href="http://developer.yahoo.com/yui/examples/"&gt;Beispiele&lt;/a&gt; mit denen von YUI4JSF vergleiche, kommt YUI4JSF irgendwie schlechter weg.&lt;/p&gt;  &lt;p&gt;License: Apache License V2.0&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/05/yui4jsf-jsf-komponenten-auf-der-basis.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-6751669977200780033</guid><pubDate>Sat, 17 May 2008 14:01:00 +0000</pubDate><atom:updated>2008-05-17T16:01:38.388+02:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Java</category><category domain='http://www.blogger.com/atom/ns#'>Open Source</category><title>VisualVM 1.0 RC</title><description>&lt;p&gt;Vom VisualVM (&lt;a title="https://visualvm.dev.java.net/" href="https://visualvm.dev.java.net/"&gt;https://visualvm.dev.java.net/&lt;/a&gt;) gibt es eine erste 1.0 Version.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;b&gt;&lt;i&gt;May 6th, 2008:&lt;/i&gt;&lt;/b&gt; VisualVM 1.0 RC released. This is mainly a stabilization release: many bugs have been fixed and performance and memory management have been significantly improved. The only new feature is the Start Page which contains useful links to VisualVM documentation and JDK monitoring and troubleshooting guides. Sources for this release are available in &lt;a href="https://visualvm.dev.java.net/source/browse/visualvm/visualvm/?only_with_tag=release10"&gt;&lt;code&gt;release10&lt;/code&gt;&lt;/a&gt; branch.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;img title="Screenshot showing the profiling results when analyzing memory allocation" alt="screenshot of profier tab with profiling results" src="https://visualvm.dev.java.net/images/getstarted/vvm-anagram-profiler.png" /&gt;&lt;/p&gt;  &lt;p&gt;Es sieht so aus, als ob VisualVM in Java 7 als weiteres Tool neben der JConsole einzieht. (Oder vielleicht auch VisualVM sich die JConsole einverleibt und dann VisualVM das &amp;quot;Hauptprogramm&amp;quot; wird. VisualVM erlaubt -- genauso wie auch die JConsole -- Plugins, und eines ist eben f&amp;#252;r MBeans.)&lt;/p&gt;  &lt;p&gt;&lt;img title="Screenshot of Plugins window" alt="screenshot of Plugins window" src="https://visualvm.dev.java.net/images/getstarted/vvm-plugins-window.png" /&gt;&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/05/visualvm-10-rc.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-3330736800631831379</guid><pubDate>Fri, 16 May 2008 18:03:00 +0000</pubDate><atom:updated>2008-05-16T20:04:17.705+02:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Open Source</category><title>JSF-Woodstock Komponenten 4.2</title><description>&lt;p&gt;Die quelloffene JSF-Komponenten-Sammlung  &lt;a href="https://woodstock.dev.java.net/"&gt;https://woodstock.dev.java.net/&lt;/a&gt; ist in einer neuen Version 4.2 veröffentlicht. Demos der Komponenten gibt es unter &lt;a href="http://webdev2.sun.com/example/faces/index.jsp"&gt;http://webdev2.sun.com/example/faces/index.jsp&lt;/a&gt;. Interessant finde ich die Rate-Komponente und das Common Tasks Page.&lt;/p&gt;</description><link>http://www.tutego.com/blog/javainsel/2008/05/jsf-woodstock-komponenten-42.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-2956385886125371174</guid><pubDate>Fri, 16 May 2008 09:39:00 +0000</pubDate><atom:updated>2008-05-16T11:39:22.791+02:00</atom:updated><title>Buchkritik: Agile Java Development with Spring, Hibernate and Eclipse</title><description>&lt;p&gt;Anil Hemrajani. Sams. ISBN 0-672-32896-8. Mai 2006. 360 Seiten&lt;/p&gt;  &lt;p&gt;Lehrb&amp;#252;cher, die anhand eines Beispiels versuchen, die agile testgetriebene Softwareentwicklung mit Ant, Hibernate, HSQLDB und Spring (Web mit Spring MVC) zu zeigen, gibt es meines Wissens keins &amp;#8211; bis auf dieses. Vielleicht ist das auch kein Wunder, denn schon die Themen Spring/Hibernate f&amp;#252;llen dicke B&amp;#252;cher. Hemrajanis Buch will aber gar nicht in die Tiefe gehen, sondern zeigt, wie mit Open-Source Tools ein Online Timesheet System aufgebaut wird. Der Autor streift dabei weitere Technologien, wie die Eclipse IDE, Logging, Profiling, und stellt Links zu vielen Tools &amp;#252;bersichtlich am Ende jedes Kapitels vor. Die Zielgruppe f&amp;#252;r das Buch d&amp;#252;rften Personen sein, die bisher mit dem Standard Java gearbeitet haben, und nun lernen wollen, mit welchen Enterprise Technologien sich Web-Anwendungen bauen lassen. Wer eine detaillierte Beschreibung in JUnit, Hibernate und Spring sucht, ist mit dem Buch sicherlich nicht gut beraten. Schade ist auch, dass Hibernate &amp;#252;ber die HBM.XML-Dateien konfiguriert wird und nicht die Sprachm&amp;#246;glichkeiten &amp;#252;ber Java 5 (Annotationen) und der JPA-Entity-Manager zum Einsatz kommen. Dass nicht Spring 2 den Kern bildet, ist zu verschmerzen, und das statt Spring MVC nicht Spring WebFlow zum Einsatz kommt ist wohl eher eine Frage des didaktischen Wegs und dem Zeitpunkts des Drucks zu verschulden.&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/05/buchkritik-agile-java-development-with.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-389912182295083182</guid><pubDate>Thu, 15 May 2008 11:44:00 +0000</pubDate><atom:updated>2008-05-15T13:44:07.591+02:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Die wöchentliche Dosis Java</category><title>Thema der Woche: Bug-Finder</title><description>&lt;p&gt;Bei jedem Software-Projekt sollte die Qualit&amp;#228;t &amp;#252;ber einen langen Zeitraum konstant hoch sein. Insbesondere bei wechselnden Team-Mitgliedern kommen aber schnell Inkonsistenzen in die Sourcen und die Qualit&amp;#228;t leidet. Code-Analyse Tools versuchen aufgrund bekannter Fehler-Pattern genau diese Schwachstellen zu finden. In Java gibt es eine ganze Reihe von Tools. So f&amp;#252;hrt &lt;a title="http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#Java" href="http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#Java"&gt;http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#Java&lt;/a&gt; auf:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://bandera.projects.cis.ksu.edu/"&gt;Bandera&lt;/a&gt; &amp;#8212; analyzer for Java &lt;/li&gt;    &lt;li&gt;&lt;a href="http://checkstyle.sourceforge.net/"&gt;Checkstyle&lt;/a&gt; &amp;#8212; analyze Java and apply coding standard &lt;/li&gt;    &lt;li&gt;&lt;a href="http://sourceforge.net/projects/classycle/"&gt;Classycle&lt;/a&gt; &amp;#8212; analyze Java class cycles and class and package dependencies (Layers) &lt;/li&gt;    &lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/FindBugs"&gt;FindBugs&lt;/a&gt; &amp;#8212; an open-source static bytecode analyzer for Java (based on &lt;a href="http://en.wikipedia.org/wiki/Jakarta_Project"&gt;Jakarta&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/Byte_Code_Engineering_Library"&gt;BCEL&lt;/a&gt;). &lt;/li&gt;    &lt;li&gt;&lt;a href="http://jlint.sourceforge.net/"&gt;Jlint&lt;/a&gt; &amp;#8212; for Java &lt;/li&gt;    &lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/PMD_%28software%29"&gt;PMD (software)&lt;/a&gt; &amp;#8212; a static ruleset based Java source code analyzer that identifies potential problems. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.sable.mcgill.ca/soot/"&gt;Soot&lt;/a&gt; &amp;#8212; A Java program analysis and compiler optimization framework &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;F&amp;#252;r einige Produkte gibt es &lt;a href="http://www.eclipseplugincentral.com/Web_Links-index-req-viewcatlink-cid-14-orderby-rating.html"&gt;Eclipse-Plugins&lt;/a&gt;. Teste &lt;a href="http://findbugs.sourceforge.net/"&gt;FindBugs&lt;/a&gt; in Eclipse/NetBeans. Studiere die &lt;a href="http://findbugs.sourceforge.net/bugDescriptions.html"&gt;Bugs/Schwachstellen&lt;/a&gt;, die FindBugs automatisch finden kann.&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/05/thema-der-woche-bug-finder.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-6907787651664092453</guid><pubDate>Sat, 10 May 2008 07:20:00 +0000</pubDate><atom:updated>2008-05-10T09:20:40.396+02:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Java 7</category><title>BGGA Closures werden wohl das Rennen in Java 7 machen</title><description>&lt;p&gt;Beim &lt;a title="http://openjdk.java.net/" href="http://openjdk.java.net/"&gt;http://openjdk.java.net/&lt;/a&gt; Projekt ist ein Unterprojekt &lt;a title="http://openjdk.java.net/projects/closures/" href="http://openjdk.java.net/projects/closures/"&gt;http://openjdk.java.net/projects/closures/&lt;/a&gt; eingerichtet worden:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;This goal of this Project is to produce a feature-complete prototype of the Java bytecode compiler (javac) for the draft &lt;a href="http://www.javac.info/closures-v05.html"&gt;BGGA Closures specification&lt;/a&gt;. This Project is sponsored by the OpenJDK &lt;a href="http://openjdk.java.net/groups/compiler/"&gt;Compiler Group&lt;/a&gt;.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Wenn es also Closures in Java schaffen -- einige Stimmen sagen, dass es daf&amp;#252;r noch zu fr&amp;#252;h ist -- dann wohl diese Syntax. Da das Projekt sehr neu ist, befinden sich in der &lt;a href="http://mail.openjdk.java.net/pipermail/closures-dev/"&gt;Mailing-Liste&lt;/a&gt; noch nicht viele Nachrichten.&lt;/p&gt;  &lt;p&gt;Derweil hat sich die Closures-Spezifikation (Homepage &lt;a title="http://www.javac.info/" href="http://www.javac.info/"&gt;http://www.javac.info/&lt;/a&gt;) von der Version 0.5 nicht weiter bewegt und auch die &lt;a href="http://www.javac.info/issues-v05.html"&gt;Open Issues&lt;/a&gt; sind nicht gekl&amp;#228;rt.&lt;/p&gt;  &lt;p&gt;Interessant ist auch die &lt;a title="http://www.javac.info/google-position.html" href="http://www.javac.info/google-position.html"&gt;http://www.javac.info/google-position.html&lt;/a&gt; (Neal Gafter ist Angestellter bei Google)&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;As of April 7, 2008, the following is Google's position on proposals to add support for closures to Java: Google believes Java platform will likely benefit from continued research into closures. To arrive at the best solution, Google is open to multiple parallel investigations but is not currently prepared to commit to any particular proposal. We do not expect these investigations to yield results in time for Java 7, and are of the opinion that it is premature to launch a JSR that forces us down any specific path.&lt;/p&gt;&lt;/blockquote&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/05/bgga-closures-werden-wohl-das-rennen-in.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-4452331687165627671</guid><pubDate>Fri, 09 May 2008 07:51:00 +0000</pubDate><atom:updated>2008-05-09T09:51:05.562+02:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Spring</category><title>Annotationen in Spring 2.0/2.5 für Autowire und neue Beans</title><description>&lt;p&gt;Bis Spring 2.0 gab es im Wesentlichen nur eine M&amp;#246;glichkeit, Spring-Beans zu deklarieren und Bean-Referenzen zu injizieren. Ab Spring 2.0 und besonders in Spring 2.5 gibt es einen Richtungswechsel. Statt Bean-Definitionen und Injizierungsanweisungen ausschlie&amp;#223;lich &amp;#252;ber XML-Dokumente zu beschreiben, kommen Annotationen hinzu. Spring nutzt zum Einen Standard-Annotationen aus Java 6 (Common Annoations) aber auch eigene.&lt;/p&gt;  &lt;p&gt;Nehmen wir zwei Beans an:&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;bean id=&amp;quot;today&amp;quot; class=&amp;quot;java.util.Date&amp;quot; /&amp;gt;   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;bean id=&amp;quot;calendarPrinter&amp;quot;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; class=&amp;quot;com.tutego.spring.annotation.CalendarPrinter&amp;quot; /&amp;gt;    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;Die Bean CalendarPrinter soll ein Datum injiziert bekommen.&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; public class CalendarPrinter {   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public void setDate( Date date ) &amp;#8230;    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#220;ber XML l&amp;#228;sst sich das einfach beschreiben, doch seit Spring 2.5 veranlasst eine Annotation Spring dazu, die Verweise automatisch zu injizieren:   &lt;br /&gt;@Autowired&lt;/p&gt;  &lt;p&gt;@Autowired ist eine Annotation f&amp;#252;r Methoden und Attribute, damit Spring selbst&amp;#228;ndig den Verweis setzt: &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; public class CalendarPrinter {   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; @Autowired    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public void setDate(@Qualifier(&amp;quot;today&amp;quot;) Date d) &amp;#8230;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;Die Annotation @Qualifier ist nur dann n&amp;#246;tig, wenn es mehrere Beans dieses Typs gibt. (Nicht bei uns.)&lt;/p&gt;  &lt;p&gt;Damit Spring &amp;#252;berhaupt die Verkn&amp;#252;pfung vornimmt, ist in der XML-Datei ein Hinweis zu setzen.&lt;/p&gt;  &lt;p&gt;Die erste M&amp;#246;glichkeit ist:&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;bean   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; class=&amp;quot;org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;Eine im Allgemeinen bessere Alternative (die AutowiredAnnotationBeanPostProcessor und CommonAnnotationBeanPostProcessor zusammenfasst) ist&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;context:annotation-config/&amp;gt;&lt;/p&gt;  &lt;p&gt;Die Annotation @Autowired ist genauso g&amp;#252;ltig bei Attributen:&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; public class CalendarPrinter   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; @Autowired Date date; &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public void doIt()   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.out.println( date );    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;  &lt;p&gt;&amp;lt;beans xmlns=&amp;quot;&lt;a href="http://www.springframework.org/schema/beans""&gt;http://www.springframework.org/schema/beans&amp;quot;&lt;/a&gt;    &lt;br /&gt;&amp;#160; xmlns:xsi=&amp;quot;&lt;a href="http://www.w3.org/2001/XMLSchema-instance""&gt;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;/a&gt;    &lt;br /&gt;&amp;#160; xmlns:context=&amp;quot;&lt;a href="http://www.springframework.org/schema/context""&gt;http://www.springframework.org/schema/context&amp;quot;&lt;/a&gt;    &lt;br /&gt;&amp;#160; xsi:schemaLocation=&amp;quot;&lt;a href="http://www.springframework.org/schema/beans"&gt;http://www.springframework.org/schema/beans&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"&gt;http://www.springframework.org/schema/beans/spring-beans-2.5.xsd&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://www.springframework.org/schema/context"&gt;http://www.springframework.org/schema/context&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://www.springframework.org/schema/context/spring-context-2.5.xsd""&gt;http://www.springframework.org/schema/context/spring-context-2.5.xsd&amp;quot;&lt;/a&gt;&amp;gt;    &lt;br /&gt; &amp;lt;context:annotation-config/&amp;gt;    &lt;br /&gt; &amp;lt;bean id=&amp;quot;today&amp;quot; class=&amp;quot;java.util.Date&amp;quot; /&amp;gt;    &lt;br /&gt; &amp;lt;bean id=&amp;quot;calendarPrinter&amp;quot; class=&amp;quot;com.tutego.spring.annotation.CalendarPrinter&amp;quot; /&amp;gt;    &lt;br /&gt;&amp;lt;/beans&amp;gt;&lt;/p&gt;  &lt;p&gt;Java 6 (f&amp;#252;r Java 5 ist ein Extra-Jar n&amp;#246;tig) f&amp;#252;hrt aus JSR-250 die Lebenszyklus-Annotationen @PostConstruct und @PreDestroy sowie @Resource ein.&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; public class CalendarPrinter {   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; @PostConstruct public void initialize() {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.out.println( &amp;quot;init&amp;quot; );    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /* @PreDestroy public void remove() {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.out.println( &amp;quot;destroy&amp;quot; );    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } */    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Beans deklarieren&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Die Verkn&amp;#252;pfung ist durch Autowire automatisiert und minimiert die XML-Konfigurationsdatei.   &lt;br /&gt;Zum Deklarieren von neuen Beans bringt Spring ebenfalls Annotationen mit.    &lt;br /&gt;Statt in der XML-Datei zu schreiben&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;bean id=&amp;quot;calendarPrinter&amp;quot;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; class=&amp;quot;com.tutego.spring.annotation.CalendarPrinter&amp;quot; /&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; k&amp;#246;nnen wir annotieren:    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; @Component class CalendarPrinter&lt;/p&gt;  &lt;p&gt;Damit Spring nach annotierten Beans sucht, ist n&amp;#246;tig:&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;context:component-scan   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; base-package=&amp;quot;com.tutego.spring&amp;quot; /&amp;gt;&lt;/p&gt;  &lt;p&gt;Die Annotation @Component ist an allen Typen erlaubt und nat&amp;#252;rlich zur Laufzeit sichtbar:&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; @Target(value=TYPE)   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; @Retention(value=RUNTIME)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; @Documented    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public @interface Component    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; String value();    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;API zur Eigenschaft: &amp;#8222;The value may indicate a suggestion for a logical component name, to be turned into a Spring bean in case of an autodetected component.&amp;#8220;&lt;/p&gt;  &lt;p&gt;Geben wir dem CalendarPrinter den Bean-Namen &amp;#8222; cal-printer&amp;#8220;:&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; @Component(&amp;quot;cal-printer&amp;quot;)   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public class CalendarPrinter&lt;/p&gt;  &lt;p&gt;Aus dem ApplicationContext genommen folgt:&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; ApplicationContext context =   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; new ClassPathXmlApplicationContext( &amp;#8230; );    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Object bean = context.getBean( &amp;quot;cal-printer&amp;quot; );    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; System.out.println( bean.getClass() );    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // class com.tutego.spring.annotation.CalendarPrinter&lt;/p&gt;  &lt;p&gt;@Component ist eine sehr allgemeine Annotation.&lt;/p&gt;  &lt;p&gt;Besser ist es, semantische Annotationen zu nutzen, die @Component erweitern. Spring liefert drei mit: &lt;/p&gt;  &lt;p&gt;1.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; @Target(value=TYPE) &amp;#8230; @Component   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public @interface Repository &lt;/p&gt;  &lt;p&gt;2.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; @Target(value=TYPE) &amp;#8230; @Component   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public @interface Service &lt;/p&gt;  &lt;p&gt;3.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; @Target(value=TYPE) &amp;#8230; @Component   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public @interface Controller&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/05/annotationen-in-spring-2025-fr-autowire.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-4553159081744842483</guid><pubDate>Thu, 08 May 2008 14:18:00 +0000</pubDate><atom:updated>2008-05-08T16:18:16.288+02:00</atom:updated><title>Borland verkauft CodeGear und damit JBuilder</title><description>&lt;p&gt;&lt;a href="http://www.heise.de/newsticker/Borland-verkauft-CodeGear--/meldung/107585"&gt;Heise&lt;/a&gt; schreibt am 7. Mai, dass Borland CodeGear f&amp;#252;r l&amp;#228;cherliche 23 Millionen Dollar an &lt;a href="http://www.embarcadero.com/"&gt;Embarcadero&lt;/a&gt; verkauft. Damit geht eine lange &amp;#196;ra von Borland Entwicklungswerkzeugen zuende. Was nun aus dem JBuilder wird, ist damit offen. &lt;a href="http://www.embarcadero.com/"&gt;Embarcadero&lt;/a&gt; ist zumindest bei Entwicklern kein Unbekannter, denn das Unternehmen entwickelte das UML-Tool &lt;a href="http://goliath.ecnext.com/coms2/gi_0199-392627/Sun-Microsystems-integrates-Embarcadero-Describe.html"&gt;Describe, was in die Sun-IDE eingeflossen ist&lt;/a&gt;.&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/05/borland-verkauft-codegear-und-damit.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-4450250160552673116</guid><pubDate>Thu, 08 May 2008 11:14:00 +0000</pubDate><atom:updated>2008-05-08T13:14:49.942+02:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Eclipse</category><title>Eclipse 3.4 M7 - letzter Milestone</title><description>&lt;p&gt;Seit dem 2. Mai gibt es den letzten Milestone Eclipse 3.4 M7 vor dem finalen Release geplant im Juni 2008. Die &lt;a href="http://download.eclipse.org/eclipse/downloads/drops/S-3.4M7-200805020100/eclipse-news-M7.html"&gt;New and Noteworthy&lt;/a&gt; lesen sich wie zu erwarten, das heißt, kaum Neuerungen, da es auf die Endversion geht. Interessant ist:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;You should see faster Java compile times when using machines with multiple CPUs. The Eclipse Compiler for Java (aka "ecj") is now taking advantage of the multi-threading capability of multi-CPU machines. The full build of a Java project also takes advantage of this support.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Dann noch eine Kleinigkeit:&lt;/p&gt; &lt;p&gt;&lt;img alt="Debug Hover" src="http://download.eclipse.org/eclipse/downloads/drops/S-3.4M7-200805020100/images/debug-hover.png"&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;- Download: &lt;a title="http://www.eclipse.org/downloads/index.php" href="http://www.eclipse.org/downloads/index.php"&gt;http://www.eclipse.org/downloads/index.php&lt;/a&gt;&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/05/eclipse-34-m7-letzter-milestone.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-6263002996493852920</guid><pubDate>Thu, 08 May 2008 11:08:00 +0000</pubDate><atom:updated>2008-05-08T13:23:36.445+02:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Die wöchentliche Dosis Java</category><title>Thema der Woche: Datum und Zeit</title><description>&lt;p&gt;An der Datum/Zeit-API wird schon ewig rumgemeckert, und jetzt soll es wirklich gut werden. Lies zunächst die API-Dokumentation der zentralen Standard-Klassen:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Date&lt;/li&gt; &lt;li&gt;DateFormat&lt;/li&gt; &lt;li&gt;SimpleDateFormat&lt;/li&gt; &lt;li&gt;Calendar&lt;/li&gt; &lt;li&gt;GregorianCalendar&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Was sind die Argumente der Kritiker?&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a title="http://justinsomnia.org/2007/05/dates-and-java-suck/" href="http://justinsomnia.org/2007/05/dates-and-java-suck/"&gt;http://justinsomnia.org/2007/05/dates-and-java-suck/&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a title="http://robsanheim.com/2006/03/13/top-five-worst-apis-in-java/" href="http://robsanheim.com/2006/03/13/top-five-worst-apis-in-java/"&gt;http://robsanheim.com/2006/03/13/top-five-worst-apis-in-java/&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a title="http://vafer.org/blog/20041128172956" href="http://vafer.org/blog/20041128172956"&gt;http://vafer.org/blog/20041128172956&lt;/a&gt; (Java Dates and other crap)&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Eine hervorragende Open-Source-Biblitohek ist &lt;a title="http://joda-time.sourceforge.net/" href="http://joda-time.sourceforge.net/"&gt;http://joda-time.sourceforge.net/&lt;/a&gt;. Was macht Joda-Time anders/besser?&lt;/p&gt; &lt;p&gt;Die &lt;a title="https://jsr-310.dev.java.net/" href="https://jsr-310.dev.java.net/"&gt;https://jsr-310.dev.java.net/&lt;/a&gt; möchte endlich eine tolle Datums/Zeit-API in das Standard-Java Version 7 bringen. Was unterscheidet Joda-Time von JSR 310?&lt;/p&gt;</description><link>http://www.tutego.com/blog/javainsel/2008/05/thema-der-woche-datum-und-zeit.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-1384022390747679781</guid><pubDate>Thu, 17 Apr 2008 13:19:00 +0000</pubDate><atom:updated>2008-04-17T15:19:41.079+02:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Java</category><category domain='http://www.blogger.com/atom/ns#'>Open Source</category><title>Neue Video-/Audio-Library</title><description>&lt;p&gt;Also wenn&lt;/p&gt; &lt;p&gt;&lt;code&gt;MediaManager.installNativeLibrary(&lt;b&gt;true&lt;/b&gt;);&lt;br&gt;// enable file protocol&lt;br&gt;MediaManager.getInstance().registerProtocol(FileProtocol.URL_PREFIX, FileProtocol.FACTORY);&lt;br&gt;// create Swing frame&lt;br&gt;JFrame frame = &lt;b&gt;new &lt;/b&gt;JFrame();&lt;br&gt;frame.setSize(&lt;b&gt;new &lt;/b&gt;Dimension(480, 300));&lt;br&gt;frame.setLayout(&lt;b&gt;new &lt;/b&gt;BorderLayout());&lt;br&gt;frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br&gt;// add Java2D-based video renderer to Swing frame&lt;br&gt;&lt;b&gt;final &lt;/b&gt;IVideoRenderer renderer = &lt;b&gt;new &lt;/b&gt;Java2DRenderer();&lt;br&gt;frame.add(renderer.getVisualComponent());&lt;br&gt;// show frame&lt;br&gt;frame.setVisible(&lt;b&gt;true&lt;/b&gt;);&lt;br&gt;// open movie file &amp;amp; find stream info (resolution, audio channels,...)&lt;br&gt;AVFormatContext formatContext = AVFormatContext.openFile(FileProtocol.computeUrl(&lt;b&gt;new &lt;/b&gt;File("samples/elephantsdream.avi")));&lt;br&gt;formatContext.findStreamInfo();&lt;br&gt;// create media player&lt;br&gt;&lt;b&gt;final &lt;/b&gt;MediaPlayer player = &lt;b&gt;new &lt;/b&gt;MediaPlayer(renderer);&lt;br&gt;player.open(formatContext);&lt;/code&gt; &lt;p&gt;alles ist, was man für ein Video abzuspielen bracht, dann prima. &lt;em&gt;pulsar&lt;/em&gt; (&lt;a title="http://dev.getpulsar.com/" href="http://dev.getpulsar.com/"&gt;http://dev.getpulsar.com/&lt;/a&gt;) ist eine neue Open-Source Bib mit einer nativen Komponente, zum Abspielen von Audio und Video.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Pulsar includes a media library to encode, decode and playback audio and video files. Pulsar makes use of projects like &lt;a href="http://ffmpeg.mplayerhq.hu"&gt;FFmpeg&lt;/a&gt;, &lt;a href="http://www.videolan.org/developers/x264.html"&gt;X264&lt;/a&gt;, &lt;a href="http://liba52.sourceforge.net"&gt;liba52&lt;/a&gt;, &lt;a href="http://www.audiocoding.com"&gt;FAAD2&lt;/a&gt; and &lt;a href="http://lame.sourceforge.net/"&gt;LAME&lt;/a&gt; to support a variety of codecs like MPEG, H.264, AC3 and MP3. The input can be a local file, a HTTP stream or an arbitrary other input implementing &lt;a href="http://dev.getpulsar.com/docs/javadoc/org/pulsar/media/IMediaProtocol.html"&gt;IMediaProtocol&lt;/a&gt;. The media library is distributed in two files, a Java library "pulsar_media.jar" and a native library "pulsar_media.*". There are precompiled versions of the native library for Windows, Mac OS X and Linux. &lt;/p&gt;&lt;/blockquote&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/04/neue-video-audio-library.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-8623165520486549311</guid><pubDate>Mon, 14 Apr 2008 18:00:00 +0000</pubDate><atom:updated>2008-04-14T20:00:30.272+02:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Die wöchentliche Dosis Java</category><title>Thema der Woche: Inversion Of Control/Dependency Injection</title><description>&lt;p&gt;Komponenten müssen in irgendeiner Weise auf Dienste (Services) zurückgreifen. Diese Dienste könnte entweder in die Komponenten injiziert werden oder eine Komponente bezieht den Dienst über eine zentrale Service-Factory. Vergleiche die Ansätze Service-Locator und IoC (Spring-Beispiele).&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a title="http://martinfowler.com/articles/injection.html" href="http://martinfowler.com/articles/injection.html"&gt;http://martinfowler.com/articles/injection.html&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Spring ist nicht der einzige IoC-Container. Verschaffe einen Überblick über&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a title="http://code.google.com/p/google-guice/" href="http://code.google.com/p/google-guice/"&gt;http://code.google.com/p/google-guice/&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a title="http://hivemind.apache.org/" href="http://hivemind.apache.org/"&gt;http://hivemind.apache.org/&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a title="http://tapestry.apache.org/tapestry5/tapestry-ioc/" href="http://tapestry.apache.org/tapestry5/tapestry-ioc/"&gt;http://tapestry.apache.org/tapestry5/tapestry-ioc/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Ob nun IoC grundsätzlich die Beste Lösung ist, oder ob nicht eine einfache Zentrale reicht, ist Thema von &lt;a title="http://lateralprogramming.wordpress.com/2008/04/07/why-use-spring-if-you-have-a-hashmap-at-hand/" href="http://lateralprogramming.wordpress.com/2008/04/07/why-use-spring-if-you-have-a-hashmap-at-hand/"&gt;http://lateralprogramming.wordpress.com/2008/04/07/why-use-spring-if-you-have-a-hashmap-at-hand/&lt;/a&gt;.&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/04/thema-der-woche-inversion-of.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-7847004257757819435</guid><pubDate>Mon, 07 Apr 2008 08:42:00 +0000</pubDate><atom:updated>2008-04-07T10:42:02.346+02:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Die wöchentliche Dosis Java</category><title>Thema der Woche: Apache Commons</title><description>&lt;p&gt;Die Apache-Group hat mit ihren vielen Projekten irgendwann bemerkt, dass sie einige Dinge immer wieder programmieren. So ist nach und nach &lt;a title="http://commons.apache.org/" href="http://commons.apache.org/"&gt;http://commons.apache.org/&lt;/a&gt; entstanden, ein Projekt, welches viele Hilfsklassen implementiert.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Verschaffe einen groben Überblick über alle Projekte von &lt;a title="http://commons.apache.org/" href="http://commons.apache.org/"&gt;http://commons.apache.org/&lt;/a&gt;, wofür sie da sind und sie leisten.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Vertiefe in &lt;a title="http://commons.apache.org/io/" href="http://commons.apache.org/io/"&gt;http://commons.apache.org/io/&lt;/a&gt; und &lt;a title="http://commons.apache.org/lang/" href="http://commons.apache.org/lang/"&gt;http://commons.apache.org/lang/&lt;/a&gt; und schaue in die Typbeschreibung jeder Klasse/Schnittstelle.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Programme eine Beispielprogramm, bei dem die toString()-Methode generisch über ToStringBuilder aufgebaut wird.&lt;/li&gt; &lt;li&gt;Schreibe ein paar Demos, die Funktionen aus StringUtils, WordUtils nutzen.&lt;/li&gt; &lt;li&gt;Kopiere eine Datei von einer Stelle zur anderen.&lt;/li&gt; &lt;li&gt;Nutze passende Klassen/Funktionen aus org.apache.commons.io.filefilter um in einem Vergleiche alle Dateien zu finden, die (älter ein als gewisses Datum sind UND über einer gewissen Größe liegen) ODER (auf eine bestimmte Dateiendungen, wie doc oder rtf, enden).&lt;/li&gt;&lt;/ul&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/04/thema-der-woche-apache-commons.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-2270361003408310914</guid><pubDate>Mon, 31 Mar 2008 10:58:00 +0000</pubDate><atom:updated>2008-03-31T12:58:01.316+02:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Die wöchentliche Dosis Java</category><title>Thema der Woche: Bytecode und Obfuscator</title><description>&lt;p&gt;Wie jeder weiß, produziert der Java-Compiler in der Regel Bytecode. Um eine Vorstellung davon zu bekommen, sollte man lesen&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a title="http://en.wikipedia.org/wiki/Java_bytecode" href="http://en.wikipedia.org/wiki/Java_bytecode"&gt;http://en.wikipedia.org/wiki/Java_bytecode&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a title="http://java.sun.com/docs/books/jvms/second_edition/html/Compiling.doc.html" href="http://java.sun.com/docs/books/jvms/second_edition/html/Compiling.doc.html"&gt;http://java.sun.com/docs/books/jvms/second_edition/html/Compiling.doc.html&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Dann je nach Wunsch weitere Kapitel aus der &lt;a href="http://java.sun.com/docs/books/jvms/"&gt;Java Virtual Machine Specification&lt;/a&gt;; da ist aber jede Waschmaschine spannender.&lt;/p&gt; &lt;p&gt;Java Bytecode lässt sich disassemblieren, etwa mit &lt;a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javap.html"&gt;javap&lt;/a&gt;. Hier sollte man ein Beispiel ausprobieren.&lt;/p&gt; &lt;p&gt;Um den Bytecode unansehnlich zu machen, lässt sich ein Obfuscater einsetzten. Teste die Möglichkeiten von &lt;a title="http://proguard.sourceforge.net/" href="http://proguard.sourceforge.net/"&gt;http://proguard.sourceforge.net/&lt;/a&gt; an einem Beispiel.&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/03/thema-der-woche-bytecode-und-obfuscator.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-147215433941539210</guid><pubDate>Mon, 31 Mar 2008 10:46:00 +0000</pubDate><atom:updated>2008-03-31T12:46:40.980+02:00</atom:updated><title>JVM auf iPhone</title><description>&lt;p&gt;Apple ist zwar bisher gegen eine Java VM (und auch gegen Flash -- angeblich zu langsam, hahaha), aber Sun hat eine Implementierung für das iPhone angekündigt:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a title="http://www.infoworld.com/article/08/03/07/sun-iphone-java_1.html" href="http://www.infoworld.com/article/08/03/07/sun-iphone-java_1.html"&gt;http://www.infoworld.com/article/08/03/07/sun-iphone-java_1.html&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a title="http://www.macworld.com/article/132451/2008/03/sun.html" href="http://www.macworld.com/article/132451/2008/03/sun.html"&gt;http://www.macworld.com/article/132451/2008/03/sun.html&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a title="http://www.javalobby.org/java/forums/t88464.html" href="http://www.javalobby.org/java/forums/t88464.html"&gt;http://www.javalobby.org/java/forums/t88464.html&lt;/a&gt; (Steve Jobs on iPhone: No Java For You)&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Da das iPhone auf OS X 10 basiert (&lt;a title="http://www.roughlydrafted.com/2007/07/13/iphone-os-x-architecture-the-mach-kernel-and-ram/" href="http://www.roughlydrafted.com/2007/07/13/iphone-os-x-architecture-the-mach-kernel-and-ram/"&gt;http://www.roughlydrafted.com/2007/07/13/iphone-os-x-architecture-the-mach-kernel-and-ram/&lt;/a&gt;), ist es durchaus möglich, das Sun auch für "normale" Apple-Computer ein JDK ausliefert. Wenn bei Sun schon Linux, Solaris und Windows dazugehört, passt OS X auch noch ganz gut rein.&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/03/jvm-auf-iphone.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-2762857797522127846</guid><pubDate>Wed, 26 Mar 2008 14:19:00 +0000</pubDate><atom:updated>2008-03-26T15:19:32.714+01:00</atom:updated><title>Bei Java ist PI dann auch mal 12</title><description>&lt;p&gt;Na klar:&lt;/p&gt; &lt;p&gt;&lt;img alt="" src="http://img.thedailywtf.com/images/200803/pi.png"&gt;&lt;/p&gt; &lt;p&gt;Die Lösung: PI ist die &lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/html/parser/DTDConstants.html#PI"&gt;XML Processing Instruction&lt;/a&gt;. Gefunden auf &lt;a title="http://thedailywtf.com/" href="http://thedailywtf.com/"&gt;http://thedailywtf.com/&lt;/a&gt;.&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/03/bei-java-ist-pi-dann-auch-mal-12.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-5349674168225392326</guid><pubDate>Tue, 25 Mar 2008 10:28:00 +0000</pubDate><atom:updated>2008-03-25T11:28:06.309+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Die wöchentliche Dosis Java</category><title>Thema der Woche: PDF-Dokumente</title><description>&lt;p&gt;PDF ist ein Standard-Dokumentenformat geworden, an dem man nicht vorbeikommt.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a title="http://en.wikipedia.org/wiki/Portable_Document_Format" href="http://en.wikipedia.org/wiki/Portable_Document_Format"&gt;http://en.wikipedia.org/wiki/Portable_Document_Format&lt;/a&gt;. Ist die PDF-Spezifikation offen oder geschlossen? Konzipiert Adobe oder ein Gremium weitere Versionen?&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Java bietet eine Reihe von Bibliotheken an, die PDF-Dokumente verfassen und darstellen. Bekannter sind:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a title="http://www.lowagie.com/iText/" href="http://www.lowagie.com/iText/"&gt;http://www.lowagie.com/iText/&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a title="http://www.jpedal.org/" href="http://www.jpedal.org/"&gt;http://www.jpedal.org/&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a title="https://pdf-renderer.dev.java.net/" href="https://pdf-renderer.dev.java.net/"&gt;https://pdf-renderer.dev.java.net/&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a title="http://www.adobe.com/products/acrviewer/acrvdnld.html" href="http://www.adobe.com/products/acrviewer/acrvdnld.html"&gt;http://www.adobe.com/products/acrviewer/acrvdnld.html&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Was sind Bibliotheken zum Anzeigen und Erstellen? Welche Einschränkungen sind bekannt? Was kann man mit &lt;a title="http://djproject.sourceforge.net/ns/" href="http://djproject.sourceforge.net/ns/"&gt;http://djproject.sourceforge.net/ns/&lt;/a&gt; machen?&lt;/p&gt; &lt;p&gt;Erstelle mit iText aus den Kurzbeispielen &lt;a title="http://itextdocs.lowagie.com/tutorial/" href="http://itextdocs.lowagie.com/tutorial/"&gt;http://itextdocs.lowagie.com/tutorial/&lt;/a&gt; eine PDF mit Absätzen, einfachen Tabellen und Bildern. Zeige die PDF mit dem &lt;a title="https://pdf-renderer.dev.java.net/" href="https://pdf-renderer.dev.java.net/"&gt;https://pdf-renderer.dev.java.net/&lt;/a&gt; an.&lt;/p&gt; &lt;p&gt;Microsoft versucht mit dem XPS-Standard (&lt;a title="http://en.wikipedia.org/wiki/XML_Paper_Specification" href="http://en.wikipedia.org/wiki/XML_Paper_Specification"&gt;http://en.wikipedia.org/wiki/XML_Paper_Specification&lt;/a&gt;) eine Alternative zu etablieren. Gibt es dazu irgendwelche Java-Bibliotheken?&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/03/thema-der-woche-pdf-dokumente.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-7762166781233568532</guid><pubDate>Mon, 24 Mar 2008 10:30:00 +0000</pubDate><atom:updated>2008-03-24T11:30:47.620+01:00</atom:updated><title>Java Swing Framework hat sich wohl erledigt</title><description>&lt;p&gt;Das &lt;a href="https://appframework.dev.java.net/"&gt;AppFramework &lt;/a&gt;(RI von &lt;a href="http://jcp.org/en/jsr/detail?id=296"&gt;JSR 296&lt;/a&gt;) ist wohl tot. &lt;a href="http://www.pushing-pixels.org/?p=282"&gt;Von Pushing-Pixels&lt;/a&gt;:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Hans Muller confirms what many have already guessed. &lt;a href="https://appframework.dev.java.net/servlets/ReadMsg?list=users&amp;amp;msgNo=1445"&gt;His e-mail&lt;/a&gt; on the users mailing list of &lt;a href="https://appframework.dev.java.net/"&gt;AppFramework &lt;/a&gt;(reference implementation of &lt;a href="http://jcp.org/en/jsr/detail?id=296"&gt;JSR 296&lt;/a&gt;) confirms that the development of this project has been dead since last November and will continue to be so through this summer. The subsequent discussion on the mailing list indicates that it is quite unlikely that somebody will step up and be able to provide leadership that is much needed for JSR-level projects. The inclusion in JDK 7 looks like it’s in jeopardy as well.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Hans Muller schreibt dazu:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;I'm the spec lead for JSR-296 and the only developer as well.  I've been neglecting the project for the past several months to focus exclusively on Sun's Java FX initiative.  You can see the results of some of that work in the Scenario project (http:www.scenegraph.dev.java.net), and before too long in the revised ("Reprise") version of the graphics/UI library for the FX Script language.  I'd originally expected to be heads-down on FX for a couple of weeks and then after that return to devoting part of my time to this project.  Unfortunately that hasn't happened and it's unlikely to change through this summer.&lt;/p&gt; &lt;p&gt;I'm proud of how far along Application Framework is and it's inspiring to see how the developer community has responded.  It's particularly gratifying to see questions asked and answered on this list and proposals floated and discussed.  I'd like to restore the project's ability to make some progress, by adding a few developers to the project who'll be able to update the code and make decisions about how to evolve the design.  If you're interested and if you feel you have the time and the right kind of experience, please send me an email. I'm going to try and resolve this in the next week or so.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Tja. Hoffentlich bleibt dann das Bean-Binding stehen. Obwohl -- da schreibt Pushing-Pixels weiter:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;John O’Connor &lt;a href="http://today.java.net/pub/a/2008/03/20/synchronizing-properties-with-beans-binding.html"&gt;has an article&lt;/a&gt; on &lt;a href="https://beansbinding.dev.java.net/"&gt;Beans Binding&lt;/a&gt; (reference implementation of &lt;a href="http://jcp.org/en/jsr/detail?id=295"&gt;JSR 295&lt;/a&gt;). Unfortunately, these two projects are twin victims of JavaFX for the better part of this year, and one could only hope that JavaFX will live up to its promise and to the investment in engineering resources that have been subverted to it.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;So viel zum Thema: "Wir bringen Java zurück zum Desktop. In Java 7." Klar.&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/03/java-swing-framework-hat-sich-wohl.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-774870069661792412</guid><pubDate>Mon, 17 Mar 2008 12:21:00 +0000</pubDate><atom:updated>2008-03-17T13:21:42.337+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Die wöchentliche Dosis Java</category><title>Thema der Woche: Unicode und Kodierungen</title><description>&lt;p&gt;Java verarbeitet Zeichen (bisher) intern in 2-Byte Unicode. Gespeichert werden Daten aber in der Regel in UTF-8 oder, für uns in Europa, in Latin-1. Thema der Woche ist Unicode und die Umkodierungen. Am Anfang sollen &lt;a href="http://cafe.elharo.com/programming/the-ten-commandments-of-unicode/"&gt;The Ten Commandments of Unicode&lt;/a&gt; von Elliotte Rusty Harold stehen:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;I am Unicode, thy character set. Thou shalt have no other character sets before me.&lt;/li&gt; &lt;li&gt;Thou shalt carefully specify the character encoding and the character set whenever reading a text file.&lt;/li&gt; &lt;li&gt;Thou shalt not refer to any 8-bit character set as “ASCII”.&lt;/li&gt; &lt;li&gt;Thou shalt ensure that all string handling functions fully support characters from beyond the Basic Multilingual Plane. Thou shalt not refer to Unicode as a two-byte character set.&lt;/li&gt; &lt;li&gt;Thou shalt plan for additions of future characters to Unicode.&lt;/li&gt; &lt;li&gt;Thou shalt count and index Unicode characters, not UTF-16 code points.&lt;/li&gt; &lt;li&gt;Thou shalt use UTF-8 as the preferred encoding wherever possible.&lt;/li&gt; &lt;li&gt;Thou shalt generate all text in Normalization Form C whenever possible.&lt;/li&gt; &lt;li&gt;Thou shalt avoid deprecated characters.&lt;/li&gt; &lt;li&gt;Thou shalt steer clear of the private use area.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Da schließen sich nun einige Fragen an, die es zu klären gilt:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Was ist der Unterschied zwischen ASCII, Unicode 2 und Unicode 4?&lt;/li&gt; &lt;li&gt;Was ist ein Code-Point? Welche Funktionen in Java 5 sind wegen Unicode 4 hinzugekommen? Welche beiden Funktionen zum Zugriff auf ein Zeichen gibt es? Resultieren daraus Performance-Unterschiede?&lt;/li&gt; &lt;li&gt;Was ist eine Kodierung? Wie wird sie in Java bestimmt? Durch einen String oder durch eine Klasse?&lt;/li&gt; &lt;li&gt;Welchen Funktionen/Konstruktoren der Java Klassenbibliothek nehmen eine Kodierungskennung entgegeben? Nenne mehrere Wege, wie man Strings/Byte-Felder umkodiert.&lt;/li&gt; &lt;li&gt;Gibt es XML-Parser in Java, die Unicode 4 unterstützten? Was sagen die Autoren von XML-Parsern zu Unicode 4?&lt;/li&gt; &lt;li&gt;Warum kann es beim Datenbankzugriff auf Textspalten Probleme geben? Gibt es dokumentierte Probleme/Lösungen?&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Auch neu: &lt;a href="http://www.tutego.com/docs/office/cliparts-clip-art.html"&gt;tutego's Clip-Art Seite&lt;/a&gt;. Links zu weiteren Clip-Art Sammlungen (ohne die lästigen Popup-Menüs) sind willkommen.&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/03/thema-der-woche-unicode-und-kodierungen.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-7722649221548342099</guid><pubDate>Sat, 15 Mar 2008 11:44:00 +0000</pubDate><atom:updated>2008-03-15T12:44:13.747+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Insel</category><title>Insel: Service-Factory, IoC, Lookup, Generics, Services und alles zusammen</title><description>&lt;p&gt;Je größer eine Java-Anwendung wird, desto größer werden die Abhängigkeiten zwischen Klassen und Typen. Um die Abhängigkeiten zu reduzieren, ist zunächst gewünscht, sich nicht so sehr an Implementieren zu binden, sondern an Schnittstellen. (Das gelobte „Programmieren geben Schnittstellen und nicht gegen eine Implementierung.“) Eine Schnittstelle beschreibt dann Dienste, so genannte &lt;i&gt;Services&lt;/i&gt;, auf die an anderer Stelle zurückgegriffen werden kann. Die nächste Frage ist, wie ein Service mit Geschäftslogik zu der Stelle kommt, an denen er benötigt wird, etwa auf der grafischen Oberfläche als Aktion hinter einer Schaltfläche. Hier haben sich zwei Wege herausgestellt:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;b&gt;Service-Fabriken&lt;/b&gt;. Eine Service-Fabrik ist eine Zentrale, an die sich Interessenten wenden, wenn sie einen Service nutzen wollen. Die Fabrik liefert eine passende Implementierung, die immer eine Service-Schnittstelle implementiert. Welche Realisierung – also konkrete Klasse – die Fabrik liefert, soll den Nutzer nicht interessieren; eben Programmieren gegen Schnittstellen. &lt;/li&gt; &lt;li&gt;&lt;b&gt;Dependency Injection&lt;/b&gt;&lt;b&gt;/Inversion of Control (IoC)&lt;/b&gt;. Nach diesem Prinzip fragen die Interessenten nicht aktiv über eine zentrale Service-Fabrik nach den Diensten, sondern den Interessenten wird der Service über eine übergeordnete Einheit gegeben (injiziert). Die magische Einheit nennt sich &lt;i&gt;IoC-Container&lt;/i&gt;. In der Vergangenheit hat sich das &lt;i&gt;Spring-Framework&lt;/i&gt; als De-facto-Standard eines IoC-Containers herauskristallisiert.&lt;/li&gt;&lt;/ul&gt; &lt;h5&gt;Arbeiten mit dem ServiceLoader&lt;/h5&gt; &lt;p&gt;Java SE bietet bisher keine Bibliothek für Dependency Injection aber mit der Klasse java.util.ServiceLoader eine einfache Realisierung für Service-Fabriken. Ein eigenes Programm soll auf einen Grüß-Dienst zurückgreifen, aber welche Implementierung das sein wird, soll an anderer Stelle entschieden werden. &lt;p&gt;ServiceLoader&amp;lt;Greeter&amp;gt; greeterServices = ServiceLoader.load( Greeter.class ); &lt;p&gt;for ( Greeter greeter : greeterServices ) &lt;p&gt;&amp;nbsp; System.out.println( greeter.getClass() + " : " + greeter.greet( "Chris" ) ); &lt;p&gt;ServiceLoader erfragt mit load() eine Realisierung, die die Schnittstelle Greeter implementieren soll. Die Realisierung ist der &lt;i&gt;Service-Provider&lt;/i&gt;. Greeter deklariert eine greet()-Operation: &lt;p&gt;package com.tutego.insel.services; &lt;p&gt;public interface Greeter &lt;p&gt;{ &lt;p&gt;&amp;nbsp; String greet( String name ); &lt;p&gt;} &lt;p&gt;Der Service liefert aber eine konkrete Klasse. Demnach muss es irgendwo eine Zuordnung geben, die einen Typnamen (Greeter) mit einer konkreten Klasse, der Service-Implementierung, verbindet. Dazu ist im Wurzelverzeichnis des Klassenpfades ein Order &lt;i&gt;META-INF&lt;/i&gt; mit einem Unterordner &lt;i&gt;services&lt;/i&gt; anzulegen. In diesem Unterordner ist eine Textdatei (&lt;i&gt;provider-configuration file&lt;/i&gt;) zu setzen, die den gleichen Namen wie die Service-Schnittstelle besitzt: &lt;p&gt;&lt;i&gt;META-INF/&lt;/i&gt; &lt;p&gt;&lt;i&gt;&amp;nbsp; services/&lt;/i&gt; &lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; com.tutego.insel.services.Greeter&lt;/i&gt; &lt;p&gt;Diese Textdatei, die keine Dateiendung aufweist, enthält Zeilen mit voll qualifizierten Klassenamen (&lt;i&gt;binary name&lt;/i&gt; genannt) für die Implementierung, die später hinter diesem Service stehen. Es kann eine Zeile oder durchaus mehrere Zeilen für unterschiedliche Implementierungen angegeben sein. In der Datei &lt;em&gt;META-INF/services/com.tutego.insel.services.Greeter&lt;/em&gt; steht: &lt;p&gt;com.tutego.insel.services.FrisianGreeter &lt;p&gt;FrisianGreeter ist demnach unsere letzte Klasse und eine tatsächliche Implementierung des Services: &lt;p&gt;package com.tutego.insel.services; &lt;p&gt;public class FrisianGreeter implements Greeter &lt;p&gt;{ &lt;p&gt; public String greet( String name ) { &lt;p&gt;&amp;nbsp; return "Moin " + name + "!"; &lt;p&gt; } &lt;p&gt;} &lt;h5&gt;Utility-Klasse Lookup als ServiceLoader-Fassade&lt;/h5&gt; &lt;p&gt;So nett der ServiceLoader auch ist, die API könnte ein wenig kürzer sein. Denn oftmals gibt es nur eine Service-Implementierung und nicht gleich mehrere. Daher soll eine Fassade eine knackigere API anbieten. Eine kurze Methode lookup() liefern genau den ersten Service (oder null) und lookupAll() gibt alle Service-Klassen in einer Sammlung zurück. (Das Listing nutzt mehrere Dinge, die die Insel bisher nicht vorgestellt hat! Dazu zählen Generics, Datenstrukturen, Iterator, Meta-Objekte.) &lt;p&gt;public class Lookup &lt;p&gt;{ &lt;p&gt; public static &amp;lt;T&amp;gt; T lookup( Class&amp;lt;T&amp;gt; clazz ) &lt;p&gt; { &lt;p&gt;&amp;nbsp; Iterator&amp;lt;T&amp;gt; iterator = ServiceLoader.load( clazz ).iterator(); &lt;p&gt;&amp;nbsp; return iterator.hasNext() ? iterator.next() : null; &lt;p&gt; } &lt;p&gt; public static &amp;lt;T&amp;gt; Collection&amp;lt;? extends T&amp;gt; lookupAll( Class&amp;lt;T&amp;gt; clazz ) &lt;p&gt; { &lt;p&gt;&amp;nbsp; Collection&amp;lt;T&amp;gt; result = new ArrayList&amp;lt;T&amp;gt;(); &lt;p&gt;&amp;nbsp; for ( T e : ServiceLoader.load( clazz ) ) &lt;p&gt;&amp;nbsp;&amp;nbsp; result.add( e ); &lt;p&gt;&amp;nbsp; return result; &lt;p&gt; } &lt;p&gt;} &lt;p&gt;Die Nutzung vereinfacht sich damit: &lt;p&gt;System.out.println( Lookup.lookup( Greeter.class ).greet( "Chris" ) ); // Moin Chris! &lt;p&gt;System.out.println( Lookup.lookupAll( Greeter.class ).size() ); // 1 &lt;p&gt;Unverkennbar ist natürlich der Einfluss der NetBeans-Klasse &lt;a title="http://bits.netbeans.org/dev/javadoc/org-openide-util/org/openide/util/Lookup.html" href="http://bits.netbeans.org/dev/javadoc/org-openide-util/org/openide/util/Lookup.html"&gt;http://bits.netbeans.org/dev/javadoc/org-openide-util/org/openide/util/Lookup.html&lt;/a&gt;.&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/03/insel-service-factory-ioc-lookup.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-6557956551468509091</guid><pubDate>Thu, 13 Mar 2008 13:14:00 +0000</pubDate><atom:updated>2008-03-13T14:14:33.509+01:00</atom:updated><title>NetBeans 6.1 Beta</title><description>&lt;p&gt;NetBeans entwickelt sich in rascher Geschwindigkeit, und baut besonders den Bereich Wizards gegenüber Eclipse aus.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a title="http://www.netbeans.org/community/releases/61/" href="http://www.netbeans.org/community/releases/61/"&gt;http://www.netbeans.org/community/releases/61/&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a title="http://wiki.netbeans.org/NB61NewAndNoteWorthy" href="http://wiki.netbeans.org/NB61NewAndNoteWorthy"&gt;http://wiki.netbeans.org/NB61NewAndNoteWorthy&lt;/a&gt;&lt;/li&gt; &lt;li&gt;Download: &lt;a title="http://bits.netbeans.org/download/trunk/nightly/latest/" href="http://bits.netbeans.org/download/trunk/nightly/latest/"&gt;http://bits.netbeans.org/download/trunk/nightly/latest/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Einige Neuigkeiten dokumentieren die folgenden Screenshots.&lt;/p&gt; &lt;p&gt;Woodstock-Komponenten:&lt;/p&gt; &lt;p&gt;&lt;img alt="newJSFComponents.png" src="http://wiki.netbeans.org/attach/NewAndNoteWorthyMilestone1NB61/newJSFComponents.png"&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;RESTful Web Service Plugin&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;img alt="REST_test_client.png" src="http://wiki.netbeans.org/attach/NewAndNoteWorthyMilestone1NB61/REST_test_client.png"&gt;&lt;/p&gt; &lt;p&gt;JSF CRUD Generator&lt;/p&gt; &lt;p&gt;&lt;img alt="persistence-jsfpages.gif" src="http://wiki.netbeans.org/attach/NewAndNoteWorthyMilestone2NB61/persistence-jsfpages.gif"&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;MySQL Support in Database Explorer&lt;/p&gt; &lt;p&gt;&lt;img alt="mysql-node.jpg" src="http://wiki.netbeans.org/attach/NewAndNoteWorthyMilestone2NB61/mysql-node.jpg"&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt;Spring Framework Support (Ob Sun damit über den eigenen Schatten springen muss?) &lt;p&gt;&lt;img alt="spring-completion.png" src="http://wiki.netbeans.org/attach/NewAndNoteWorthyMilestone2NB61/spring-completion.png"&gt;&lt;/p&gt; &lt;p&gt;&lt;img alt="spring-refactoring.png" src="http://wiki.netbeans.org/attach/NewAndNoteWorthyMilestone2NB61/spring-refactoring.png"&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;a href="http://wiki.netbeans.org/JavaScript"&gt;NetBeans 6.1 has a completely redesigned JavaScript support compared to NetBeans 6.0&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;img alt="http://wiki.netbeans.org/wiki/attach/JavaScript/findusages.png" src="http://wiki.netbeans.org/wiki/attach/JavaScript/findusages.png"&gt;&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/03/netbeans-61-beta.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-3896500958350511589</guid><pubDate>Tue, 11 Mar 2008 12:41:00 +0000</pubDate><atom:updated>2008-03-11T13:41:08.672+01:00</atom:updated><title>Neues aus EJB 3.1</title><description>&lt;p&gt;Einige Änderungen aus dem &lt;a href="http://jcp.org/aboutJava/communityprocess/edr/jsr318/index.html"&gt;Preview der EJB 3.1 Specification&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Es gibt neu auch Singleton Session Beans, die mit @Singleton annotiert sind:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;The EJB specification defines stateful, stateless, and &lt;strong&gt;singleton session beans&lt;/strong&gt;. There are differences in&lt;br&gt;the API between stateful session beans, stateless session beans, and singleton session beans.&lt;/p&gt;&lt;/blockquote&gt; &lt;blockquote&gt; &lt;p&gt;4.7 Singleton Session Beans&lt;br&gt;A Singleton session bean is a session bean component that is instantiated once per application. In cases&lt;br&gt;where the container is distributed over many virtual machines, each application will have one bean&lt;br&gt;instance of the Singleton for each JVM.&lt;br&gt;Once instantiated, a Singleton session bean instance lives for the duration of the container in which it is&lt;br&gt;created. It maintains its state between client invocations but that state is not required to survive container&lt;br&gt;shutdown or crash.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Man kann für lokale Beans auf eine Business-Schnittstelle verzichten:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;In EJB 3.x, a local client accesses a session bean through the bean’s local business interface &lt;strong&gt;or through&lt;br&gt;a no-interface client view representing all the public methods of the bean clas&lt;/strong&gt;s. &lt;/p&gt;&lt;/blockquote&gt; &lt;blockquote&gt; &lt;p&gt;3.4.2 Obtaining a Reference to the No-interface Local View&lt;br&gt;A client can obtain a reference to a Session Bean’s No-interface Local View through dependency injection&lt;br&gt;or lookup in the JNDI namespace.&lt;br&gt;For example, the No-interface Local view of the CartBean session bean with bean class com.acme.Cart-&lt;br&gt;Bean may be obtained using dependency injection as follows :&lt;br&gt;@EJB CartBean cart;&lt;br&gt;The CartBean No-interface view could also be looked up via JNDI as shown in the following code segment&lt;br&gt;using the lookup method provided by the EJBContext interface. In this example, a reference to&lt;br&gt;the client bean’s SessionContext is obtained through dependency injection:&lt;br&gt;@Resource SessionContext ctx;&lt;br&gt;...&lt;br&gt;CartBean cart = (CartBean)ctx.lookup(“cart”);&lt;br&gt;Despite the fact that the client reference for the No-interface Local view has type &amp;lt;bean class&amp;gt; , the client&lt;br&gt;never directly uses the new operator to acquire the reference.&lt;/p&gt;&lt;/blockquote&gt; &lt;blockquote&gt; &lt;p&gt;3.4.4 Session Bean’s No-Interface Local View&lt;br&gt;A Session Bean’s no-interface view is a variation of the Local view that exposes the public methods of&lt;br&gt;the bean class without the use of a separate business interface.&lt;br&gt;A reference to the no-interface view may be passed as a parameter or return value of any Local business&lt;br&gt;interface or no-interface view method.&lt;br&gt;The container provides an implementation of a reference to a no-interface view such that when the client&lt;br&gt;invokes a method on the reference, the business method on the session bean instance and any interceptor&lt;br&gt;methods are invoked as needed.&lt;br&gt;Only public methods of the bean class (and any super-classes) may be invoked through the no-interface&lt;br&gt;view. Attempted invocations of methods with any other access modifiers via the no-interface view reference&lt;br&gt;result in the javax.ejb.EJBException.&lt;br&gt;It is invalid to reference a session object that does not exist. If a stateful session bean has been removed,&lt;br&gt;attempted invocations on the no-interface view reference result in the javax.ejb.NoSuchEJBException.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Neu ist, das eine Session-Bean synchron oder asynchron aufgerufen werden kann:  &lt;blockquote&gt; &lt;p&gt;3.4.8 Asynchronous Invocations&lt;br&gt;By default, session bean invocations through the Remote, Local, and no-interface views are synchronous,&lt;br&gt;meaning the client blocks for the duration of the invocation and is returned control only after all&lt;br&gt;invocation processing has completed. Clients can achieve asynchronous behavior by invoking session&lt;br&gt;bean methods that have been designed to support asynchrony.&lt;/p&gt; &lt;p&gt;When a client invokes an asynchronous method, the container returns control to the client and continues&lt;br&gt;processing the asynchronous invocation on a separate thread of execution.&lt;/p&gt;&lt;/blockquote&gt; &lt;blockquote&gt; &lt;p&gt;3.4.8.1 Return Values&lt;br&gt;Asynchronous methods have a return type of void or Future&amp;lt;V&amp;gt;, where V represents the result value&lt;br&gt;of the asynchronous invocation.&lt;br&gt;In the case of a Future&amp;lt;V&amp;gt; return type, the object returned to the client is a container provided object.&lt;br&gt;This object allows the client to retrieve the invocation result value, discover any invocation exception,&lt;br&gt;or attempt to cancel the asynchronous invocation.&lt;/p&gt;&lt;/blockquote&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/03/neues-aus-ejb-31.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-8847894611453048072</guid><pubDate>Tue, 11 Mar 2008 11:39:00 +0000</pubDate><atom:updated>2008-03-11T12:39:22.103+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Die wöchentliche Dosis Java</category><title>Thema der Woche: Reguläre Ausdrücke</title><description>&lt;p&gt;Reguläre Ausdrücke vereinfachen die Abfragen an Strings radikal. Lese zunächst zur Einleitung&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://www.cis.upenn.edu/%7Ematuszek/cit597-2002/Lectures/java-regex.ppt"&gt;Regular Expressions in Java&lt;/a&gt; (PPT)&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Anschließend sollte man die die API-Doku lesen:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a title="http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html" href="http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html"&gt;http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a title="http://java.sun.com/javase/6/docs/api/java/util/regex/Matcher.html" href="http://java.sun.com/javase/6/docs/api/java/util/regex/Matcher.html"&gt;http://java.sun.com/javase/6/docs/api/java/util/regex/Matcher.html&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;In einer Code-Suchmaschine kann man nun einige Beispiele für Pattern-Nutzung ablesen:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a title="http://www.google.com/codesearch?q=lang%3Ajava+%22pattern.matches%22&amp;amp;hl=de&amp;amp;btnG=Code+suchen" href="http://www.google.com/codesearch?q=lang%3Ajava+%22pattern.matches%22&amp;amp;hl=de&amp;amp;btnG=Code+suchen"&gt;http://www.google.com/codesearch?q=lang%3Ajava+%22pattern.matches%22&amp;amp;hl=de&amp;amp;btnG=Code+suchen&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Mehr Beispiele (allerdings auch mit Perl-RegEx, die Java nicht unterstützt) gibt die Seite&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a title="http://regexlib.com/" href="http://regexlib.com/"&gt;http://regexlib.com/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Hier sollte man sich ein paar Beispiele anschauen.&lt;/p&gt; &lt;p&gt;Zum Schluss eine Übung: Schreibe einen RegEx-Ersetzer, der aus einem Satz mit der "Basic text formatting" Regel der Wiki-Syntax (&lt;a title="http://wiki.splitbrain.org/wiki:syntax" href="http://wiki.splitbrain.org/wiki:syntax"&gt;http://wiki.splitbrain.org/wiki:syntax&lt;/a&gt;) HTML erzeugt. Also soll aus &lt;/p&gt;&lt;pre&gt;**bold**&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;folgendes werden:&lt;/p&gt;&lt;pre&gt;&amp;lt;b&amp;gt;bold&amp;lt;/b&amp;gt;&lt;/pre&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/03/thema-der-woche-regulre-ausdrcke.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-18862554.post-4332519112149799871</guid><pubDate>Tue, 11 Mar 2008 10:13:00 +0000</pubDate><atom:updated>2008-03-11T12:23:20.744+01:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Java</category><category domain='http://www.blogger.com/atom/ns#'>Insel</category><title>Inselupdate: Quantifizierer mit Wiederholungen, nicht gierige Operatoren</title><description>&lt;p&gt;&lt;strong&gt;Wiederholungen&lt;/strong&gt; &lt;p&gt;Neben Quantifizierern ? (einmal oder keinmal), * (keinmal oder beliebig oft) und + (einmal oder beliebig oft), gibt es drei weitere Quantifizierer, die es erlauben, die Anzahl eines Vorkommens genauer zu beschreiben. &lt;ul&gt; &lt;li&gt;X{n}. X muss genau n-mal vorkommen&lt;/li&gt; &lt;li&gt;X{n,}. X kommt mindestens n-mal vor&lt;/li&gt; &lt;li&gt;X{n,m}. X kommt mindestens n aber maximal m-mal vor&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;strong&gt;Beispiel&amp;nbsp;&amp;nbsp; &lt;/strong&gt; Eine E-Mail Adresse endet mit einem Domain-Namen, der 2 oder 3 Zeichen lang ist. &lt;p&gt;static Pattern p = Pattern.compile( "[\\w|-]+@\\w[\\w|-]*\\.[a-z]&lt;strong&gt;{2,3}&lt;/strong&gt;" ); &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Gierige und nicht gierige Operatoren&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Die drei Operatoren ?, * und + haben die Eigenschaft, die längste mögliche Zeichenfolge abzudecken – das nennt sich gierig (engl. &lt;i&gt;greedy&lt;/i&gt;). Deutlich wird diese Eigenschaft, bei dem Versuch, in einem HTML-Strings alle fett gesetzten Teile zu finden. Gesucht ist also ein Ausdruck, der im String &lt;p&gt;String string = "Echt &lt;strong&gt;&amp;lt;b&amp;gt;fett&amp;lt;/b&amp;gt;&lt;/strong&gt;. &lt;strong&gt;&amp;lt;b&amp;gt;Cool&amp;lt;/b&amp;gt;&lt;/strong&gt;!"; &lt;p&gt;die Teilfolgen &amp;lt;b&amp;gt;fett&amp;lt;/b&amp;gt; und &amp;lt;b&amp;gt;Cool&amp;lt;/b&amp;gt; erkennt. Der erste Versuch für ein Programm: &lt;p&gt;Pattern pattern = Pattern.compile( &lt;strong&gt;"&amp;lt;b&amp;gt;.*&amp;lt;/b&amp;gt;"&lt;/strong&gt; ); &lt;p&gt;Matcher matcher = pattern.matcher( string ); &lt;p&gt;while ( matcher.find() ) &lt;p&gt;System.out.println( matcher.group() ); &lt;p&gt;Nun ist die Ausgabe aber &amp;lt;b&amp;gt;fett&amp;lt;/b&amp;gt;. &amp;lt;b&amp;gt;Cool&amp;lt;/b&amp;gt;! Das verwundert nicht, denn mit dem Wissen, dass * gierig ist, passt &amp;lt;b&amp;gt;.*&amp;lt;/b&amp;gt; auf die Zeichenkette vom ersten &amp;lt;b&amp;gt; bis zum letzten &amp;lt;/b&amp;gt;. &lt;p&gt;Die Lösung ist der Einsatz eines nicht gierigen Operators (auch „genügsam“, „zurückhaltend“, „non-greedy“, „reluctant“ genannt). Dieser Operator bekommt einfach hinter dem Qualifizierer ein Fragezeichen gestellt. &lt;p&gt;Mit diesem nicht-gierigen Operator lösen wir einfach das Fettproblem: &lt;p&gt;Pattern pattern = Pattern.compile( "&amp;lt;b&amp;gt;.*&lt;strong&gt;?&lt;/strong&gt;&amp;lt;/b&amp;gt;" ); &lt;p&gt;Matcher matcher = pattern.matcher( "Echt &amp;lt;b&amp;gt;fett&amp;lt;/b&amp;gt;. &amp;lt;b&amp;gt;Cool&amp;lt;/b&amp;gt;!" ); &lt;p&gt;while ( matcher.find() ) &lt;p&gt;&amp;nbsp; System.out.println( matcher.group() ); &lt;p&gt;Die Ausgabe ist: &lt;p&gt;&amp;lt;b&amp;gt;fett&amp;lt;/b&amp;gt; &lt;p&gt;&amp;lt;b&amp;gt;Cool&amp;lt;/b&amp;gt;&lt;/p&gt;  </description><link>http://www.tutego.com/blog/javainsel/2008/03/inselupdate-finden-und-nicht-matchen.html</link><author>noreply@blogger.com (Christian Ullenboom)</author></item></channel></rss>