<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Sophisticated IT</title>
	
	<link>http://sophisticated-it.de</link>
	<description>IT-Architektur-Blaupausen von Marc Neumann</description>
	<lastBuildDate>Fri, 15 Jul 2011 21:28:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/sophisticatedIT" /><feedburner:info uri="sophisticatedit" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>JPA Entity Id in Google App Engine nach persist auslesen</title>
		<link>http://feedproxy.google.com/~r/sophisticatedIT/~3/czuyu8V1VZA/</link>
		<comments>http://sophisticated-it.de/2011/07/jpa-entity-id-in-google-app-engine-nach-persist-auslesen/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 21:11:24 +0000</pubDate>
		<dc:creator>Marc Neumann</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://sophisticated-it.de/2011/07/jpa-entity-id-in-google-app-engine-nach-persist-auslesen/</guid>
		<description><![CDATA[Google App Engine für Java unterstützt JPA und JDO. Beide Implementierungen sind nicht 100% vollständig. Nicht unterstütze JPA-Features sind in der Google Dokumentation genannt (ganz unten). Zusätzlich sollte jeder Google-Cloud-Aspirant wissen: Primärschlüssel von Entitäten in AppEngine müssen den Typ com.google.appengine.api.datastore.Key haben. Dies ist nicht konform zur JPA-Spezifikation. Nach Aufruf von EntityManager.persist ist die Id des <a href='http://sophisticated-it.de/2011/07/jpa-entity-id-in-google-app-engine-nach-persist-auslesen/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Google App Engine für Java <a href="http://code.google.com/intl/de-DE/appengine/docs/java/datastore/jpa/overview.html">unterstützt JPA</a> und JDO. Beide Implementierungen sind nicht 100% vollständig. Nicht unterstütze JPA-Features sind in der Google Dokumentation genannt (ganz unten). Zusätzlich sollte jeder Google-Cloud-Aspirant wissen:</p>
<ol>
<li>Primärschlüssel von Entitäten in AppEngine müssen den Typ <a href="http://code.google.com/intl/de-DE/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Key.html">com.google.appengine.api.datastore.Key</a> haben. Dies ist nicht konform zur JPA-Spezifikation. </li>
<li>Nach Aufruf von EntityManager.persist ist die Id des persistierten Entity-Objekts nicht gesetzt. Dies ist ebenso nicht JPA-Spec-konform. </li>
</ol>
<p>Ein Aufruf an EntityManager.refresh hilft, damit die Id gesetzt ist und z.B. an den Client zurückgeliefert werden kann, wie folgendes Beispiel zeigt:</p>
<pre class="csharpcode">QuestEntity questEntity = <span class="kwrd">new</span> QuestEntity();
questEntity.setMessage(quest.message);
entityManager.persist(questEntity);
entityManager.refresh(questEntity); <span class="rem">// to retrieve the id</span>
assert questEntity.getId() != <span class="kwrd">null</span>;
quest.id = KeyFactory.keyToString(questEntity.getId());</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Mit einer JPA-Implementierung wie Hibernate oder EclipseLink wäre questEntity.id bereits nach Aufruf von “persist()” gesetzt. Vermutlich hat dies etwas mit dem Fakt zu tun, dass App Engine mit der verteilten Objektdatenbank <a href="http://labs.google.com/papers/bigtable.html">Big Table</a> arbeitet und nicht mit einer relationalen Datenbank.</p>
]]></content:encoded>
			<wfw:commentRss>http://sophisticated-it.de/2011/07/jpa-entity-id-in-google-app-engine-nach-persist-auslesen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://sophisticated-it.de/2011/07/jpa-entity-id-in-google-app-engine-nach-persist-auslesen/</feedburner:origLink></item>
		<item>
		<title>Multi-Modul Testabdeckungsanalyse mit JaCoCo</title>
		<link>http://feedproxy.google.com/~r/sophisticatedIT/~3/AgFiLxcvLoQ/</link>
		<comments>http://sophisticated-it.de/2011/06/multi-modul-testabdeckungsanalyse-mit-jacoco/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 15:48:46 +0000</pubDate>
		<dc:creator>Marc Neumann</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://sophisticated-it.de/2011/06/multi-modul-testabdeckungsanalyse-mit-jacoco/</guid>
		<description><![CDATA[Testmodule Maven-Module verwalten Produktiv- und Testcode in getrennten Verzeichnissen (src/main und test). Das Packaging (z.B. als JAR) exkludiert Testklassen und -ressourcen. Damit andere Module Test-Hilfsklassen, Mock-Implementierungen, etc. verwenden können, müssen diese in src/main liegen. Elemente von src/test bleiben für andere Module verborgen. Um Testklassen wiederzuverwenden, lagert man in diese in ein separates Testmodul aus. Das <a href='http://sophisticated-it.de/2011/06/multi-modul-testabdeckungsanalyse-mit-jacoco/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<h1>Testmodule</h1>
<p>Maven-Module verwalten Produktiv- und Testcode in getrennten Verzeichnissen (src/main und test). Das Packaging (z.B. als JAR) exkludiert Testklassen und -ressourcen. Damit andere Module Test-Hilfsklassen, Mock-Implementierungen, etc. verwenden können, müssen diese in src/main liegen. Elemente von src/test bleiben für andere Module verborgen. Um Testklassen wiederzuverwenden, lagert man in diese in ein separates Testmodul aus. Das sieht z.B. wie folgt aus:</p>
<p><a href="http://sophisticated-it.de/wp-content/uploads/2011/06/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://sophisticated-it.de/wp-content/uploads/2011/06/image_thumb.png" width="240" height="199" /></a> </p>
<p>Der Testcode und die Hilfsklassen für “framework” sind nach “framework-test” ausgelagert worden. Die Test-Hilfsklassen operieren auf “framework”-Klassen. Die Testklassen benötigen die Testhilfsklassen. Würden die Tests innerhalb von “framework” liegen gebe es einen Modulzyklus. Dies ist weder sinnvoll noch von Maven erlaubt.</p>
<p><a href="http://sophisticated-it.de/wp-content/uploads/2011/06/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://sophisticated-it.de/wp-content/uploads/2011/06/image_thumb1.png" width="240" height="199" /></a>&#160;</p>
<p>Wer seine Testabdeckung automatisiert ermittelt bekommt mit dieser Modulaufteilung Probleme. Per Default ermitteln Cobertura, Clover, Emma die Unit-Test-Abdeckung nur pro Modul. Obwohl umfangreiche Tests für den Code in “framework” existieren, liefert eine Messung 0% Abdeckung. </p>
<h1>Lösung mit JaCoCo</h1>
<p>JaCoCo wird von den Emma-Machern entwickelt und arbeitet über Byte-Code-Instrumentation zur Laufzeit mittels eines JVM-Agents. </p>
<p>Mittels JaCoCo-Agent und dem JaCoCo-Sonar-Plugin lässt sich das Testabdeckungsproblem lösen und sogar die Abdeckung für Integrationstests messen. Das im Folgenden beschriebene Setup umfasst Jenkins / Hudson sowie Sonar Konfiguration und Anpassungen an Euren Maven POMs.</p>
<h2></h2>
<h5>1. JaCoCo bereitstellen</h5>
<p>Das “jacoco-agent.jar” wird auf dem System, welches die Tests ausführt (z.B. Euer CI Server), benötigt.</p>
<ol>
<li>ZIP <a href="http://bit.ly/jQkauX">herunterladen</a> (wget …) z.B. nach /var/lib/jacoco. Achte darauf, dass Deine Sonar-Installation zum JaCoCo-Agent kompatibel ist oder entschließe Dich, Deine Sonar-Installation upzugraden. </li>
<li>unzip </li>
</ol>
<h5>2. POM anpassen</h5>
<p>Das Surefire Plugin muss den JaCoCo-Agent einbinden, wenn es die Tests ausführt. Der Agent muss Coverage-Informationen für alle Eure Module in dieselbe Datei schreiben.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.35%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; height: 231px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">profiles</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">profile</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">id</span><span style="color: #0000ff">&gt;</span>ci<span style="color: #0000ff">&lt;/</span><span style="color: #800000">id</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>       <span style="color: #0000ff">&lt;</span><span style="color: #800000">build</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">pluginManagement</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>           <span style="color: #0000ff">&lt;</span><span style="color: #800000">plugins</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>             <span style="color: #0000ff">&lt;</span><span style="color: #800000">plugin</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>               <span style="color: #0000ff">&lt;</span><span style="color: #800000">artifactId</span><span style="color: #0000ff">&gt;</span>maven-surefire-plugin<span style="color: #0000ff">&lt;/</span><span style="color: #800000">artifactId</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>                 <span style="color: #0000ff">&lt;</span><span style="color: #800000">configuration</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>                   <span style="color: #0000ff">&lt;</span><span style="color: #800000">argLine</span><span style="color: #0000ff">&gt;</span>-javaagent:${jacoco.agent.path}=destfile=${jacoco.unit.path}<span style="color: #0000ff">&lt;/</span><span style="color: #800000">argLine</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>                 <span style="color: #0000ff">&lt;/</span><span style="color: #800000">configuration</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>               <span style="color: #0000ff">&lt;/</span><span style="color: #800000">plugin</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>             <span style="color: #0000ff">&lt;/</span><span style="color: #800000">plugins</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>           <span style="color: #0000ff">&lt;/</span><span style="color: #800000">pluginManagement</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>       <span style="color: #0000ff">&lt;/</span><span style="color: #800000">build</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>   <span style="color: #0000ff">&lt;/</span><span style="color: #800000">profile</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">profiles</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<h5>3. Jenkins / Hudson Job konfigurieren</h5>
<p>Jenkins muss die Variablen “jacoco.agent.path” und “jacoco.unit.path”. Dazu bei “Goals und Optionen” in der Job-Konfiguration z.Bsp. folgendes angeben: </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">clean install -P ci -Djacoco.agent.path=&quot;/var/lib/jacoco/lib/jacocoagent.jar&quot; -Djacoco.unit.path=&quot;/tmp/mapgame-jacoco-unit&quot;</pre>
<p></div>
<p>Gib bei der Sonarkonfiguration des CI-Jobs die Option “-Dsonar.jacoco.itReportPath=/tmp/mapgame-jacoco-it“ an. Das JaCoCo-Sonar-Plugin erkennt diese System-Property und findet dadurch die Report-Datei. </p>
<p><a href="http://sophisticated-it.de/wp-content/uploads/2011/06/image2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://sophisticated-it.de/wp-content/uploads/2011/06/image_thumb2.png" width="682" height="213" /></a></p>
<h5>4. Sonar JaCoCo Plugin installieren</h5>
<p>Installiere im Sonar Update Center das Plugin “JaCoCo”. Konfiguriere unter Sonar – Settings – Core – Code Coverage Plugin den Wert “jacoco”. Hast Du alles korrekt gemacht, so wirst Du auf Deinem Sonar-Dashboard nach Lauf des CI-Jobs im Jenkins / Hudson den korrekten Wert für die Unit-Testabdeckung sehen. </p>
<p><a href="http://sophisticated-it.de/wp-content/uploads/2011/06/image3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://sophisticated-it.de/wp-content/uploads/2011/06/image_thumb3.png" width="363" height="182" /></a> <a href="http://sophisticated-it.de/wp-content/uploads/2011/06/image4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://sophisticated-it.de/wp-content/uploads/2011/06/image_thumb4.png" width="298" height="181" /></a></p>
<p>&#160;</p>
<h1>Trennung Unit- und Integration-Tests</h1>
<p>JaCoCo kann natürlich auf die Integration-Test-Abdeckung messen. Dies solltest Du getrennt von der Unit-Test-Messung halten. Mit Unit-Tests kann nach TDD entwickelt werden, mittels Integration-Tests nicht wirklich, welche Change &amp; Test-Phase zu lang dauert und Unit-Tests eine viel lokalere Betrachtung erlauben. Dadurch ist Bugfixing bei Testfehlschlägen effizienter. </p>
<p>Für Integrationstests sollte das “maven-failsafe-plugin” verwendet werden, da es Aufräumarbeiten nach Integrationstests (Server stoppen, etc.) besser beherrscht (post-integration-test Phase wird bei Test-Fehlschlägen aufgerufen. Dies ist bei Surefire nicht der Fall.).</p>
<h5>1. POM erweitern</h5>
<p>Die Code-Abdeckung in den Integration-Tests selbst soll gemessen werden:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">&lt;</span><span style="color: #800000">plugin</span><span style="color: #0000ff">&gt;</span>  <span style="color: #0000ff">&lt;</span><span style="color: #800000">artifactId</span><span style="color: #0000ff">&gt;</span>maven-failsafe-plugin<span style="color: #0000ff">&lt;/</span><span style="color: #800000">artifactId</span><span style="color: #0000ff">&gt;</span>  <span style="color: #0000ff">&lt;</span><span style="color: #800000">configuration</span><span style="color: #0000ff">&gt;</span>    <span style="color: #0000ff">&lt;</span><span style="color: #800000">argLine</span><span style="color: #0000ff">&gt;</span>-javaagent:${jacoco.agent.path}=destfile=${jacoco.it.path}<span style="color: #0000ff">&lt;/</span><span style="color: #800000">argLine</span><span style="color: #0000ff">&gt;</span>  <span style="color: #0000ff">&lt;/</span><span style="color: #800000">configuration</span><span style="color: #0000ff">&gt;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">plugin</span><span style="color: #0000ff">&gt;</span></pre>
<p></div>
<p>Natürlich musst Du den JaCoCo-Agent auch in den getesteten Systemen einbinden. Bei mir ist dies die lokale Google App Engine.</p>
<div id="codeSnippetWrapper">
<pre id="codeSnippet" class="csharpcode"><span class="kwrd">&lt;</span><span class="html">profiles</span><span class="kwrd">&gt;</span>  <span class="kwrd">&lt;</span><span class="html">profile</span><span class="kwrd">&gt;</span>    <span class="kwrd">&lt;</span><span class="html">id</span><span class="kwrd">&gt;</span>ci<span class="kwrd">&lt;/</span><span class="html">id</span><span class="kwrd">&gt;</span>    <span class="kwrd">&lt;</span><span class="html">build</span><span class="kwrd">&gt;</span>      <span class="kwrd">&lt;</span><span class="html">pluginManagement</span><span class="kwrd">&gt;</span>        <span class="kwrd">&lt;</span><span class="html">plugins</span><span class="kwrd">&gt;</span>          <span class="kwrd">&lt;</span><span class="html">plugin</span><span class="kwrd">&gt;</span>            <span class="kwrd">&lt;</span><span class="html">groupId</span><span class="kwrd">&gt;</span>net.kindleit<span class="kwrd">&lt;/</span><span class="html">groupId</span><span class="kwrd">&gt;</span>            <span class="kwrd">&lt;</span><span class="html">artifactId</span><span class="kwrd">&gt;</span>maven-gae-plugin<span class="kwrd">&lt;/</span><span class="html">artifactId</span><span class="kwrd">&gt;</span>            <span class="kwrd">&lt;</span><span class="html">executions</span><span class="kwrd">&gt;</span>              <span class="kwrd">&lt;</span><span class="html">execution</span><span class="kwrd">&gt;</span>                <span class="kwrd">&lt;</span><span class="html">id</span><span class="kwrd">&gt;</span>start-app-engine<span class="kwrd">&lt;/</span><span class="html">id</span><span class="kwrd">&gt;</span>                <span class="kwrd">&lt;</span><span class="html">phase</span><span class="kwrd">&gt;</span>pre-integration-test<span class="kwrd">&lt;/</span><span class="html">phase</span><span class="kwrd">&gt;</span>                <span class="kwrd">&lt;</span><span class="html">goals</span><span class="kwrd">&gt;</span>                  <span class="kwrd">&lt;</span><span class="html">goal</span><span class="kwrd">&gt;</span>start<span class="kwrd">&lt;/</span><span class="html">goal</span><span class="kwrd">&gt;</span>                <span class="kwrd">&lt;/</span><span class="html">goals</span><span class="kwrd">&gt;</span>                <span class="kwrd">&lt;</span><span class="html">configuration</span><span class="kwrd">&gt;</span>                  <span class="kwrd">&lt;</span><span class="html">javaAgent</span><span class="kwrd">&gt;</span>${jacoco.agent.path}=destfile=${jacoco.it.path}<span class="kwrd">&lt;/</span><span class="html">javaAgent</span><span class="kwrd">&gt;</span>                <span class="kwrd">&lt;/</span><span class="html">configuration</span><span class="kwrd">&gt;</span>              <span class="kwrd">&lt;/</span><span class="html">execution</span><span class="kwrd">&gt;</span>            <span class="kwrd">&lt;/</span><span class="html">executions</span><span class="kwrd">&gt;</span>          <span class="kwrd">&lt;/</span><span class="html">plugin</span><span class="kwrd">&gt;</span>        <span class="kwrd">&lt;/</span><span class="html">plugins</span><span class="kwrd">&gt;</span>      <span class="kwrd">&lt;/</span><span class="html">pluginManagement</span><span class="kwrd">&gt;</span>    <span class="kwrd">&lt;/</span><span class="html">build</span><span class="kwrd">&gt;</span>  <span class="kwrd">&lt;/</span><span class="html">profile</span><span class="kwrd">&gt;</span><span class="kwrd">&lt;/</span><span class="html">profiles</span><span class="kwrd">&gt;</span></pre>
<p></div>
<p>
  </p>
<h5>2. Jenkins / Hudson CI Job erweitern</h5>
<ul>
<li>Zusätzlicher Parameter bei “Goals und Optionen”: -Djacoco.it.path=&quot;/tmp/mapgame-jacoco-it&quot; </li>
<li>Zusätzlicher Parameter bei Sonar MAVEN_OPTS: -Dsonar.jacoco.itReportPath=/tmp/mapgame-jacoco-it </li>
</ul>
<h5>3. Sonar Dashboard erweitern</h5>
<ol>
<li>Im Sonar Dashboard “configure widgets” klicken </li>
<li>“IT coverage widget” hinzufügen </li>
</ol>
<p>&#160;</p>
<h1>Fazit</h1>
<p>JaCoCo funktioniert!</p>
<blockquote>
<p>Hohe Code-Abdeckung durch gut strukturierte Unit- und Integrationstests, die jeweils nur eine “Sache” testen, sind die halbe Miete für gute Softwarequalität!</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://sophisticated-it.de/2011/06/multi-modul-testabdeckungsanalyse-mit-jacoco/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://sophisticated-it.de/2011/06/multi-modul-testabdeckungsanalyse-mit-jacoco/</feedburner:origLink></item>
		<item>
		<title>Android Performance Analyse</title>
		<link>http://feedproxy.google.com/~r/sophisticatedIT/~3/v987udVQnQc/</link>
		<comments>http://sophisticated-it.de/2011/05/android-performance-analyse/#comments</comments>
		<pubDate>Thu, 19 May 2011 14:28:59 +0000</pubDate>
		<dc:creator>Marc Neumann</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://sophisticated-it.de/2011/05/android-performance-analyse/</guid>
		<description><![CDATA[Hier kurz für Euch und mich mein Vorgehen zur Performance Analyse von Android Apps. Es geht darum relevante Stellen im Code zu finden, deren Optimierung sich lohnt. Zwei Wege: Analyse über (1) Memory Allocations und (2) Ausführungszeit der Methoden .. alles basierend auf Eclipse. Memory Allocation App in Eclipse mittels Android Development Tools (ADT) starten. <a href='http://sophisticated-it.de/2011/05/android-performance-analyse/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Hier kurz für Euch und mich mein Vorgehen zur Performance Analyse von Android Apps. Es geht darum relevante Stellen im Code zu finden, deren Optimierung sich lohnt. Zwei Wege: Analyse über (1) Memory Allocations und (2) Ausführungszeit der Methoden .. alles basierend auf Eclipse.</p>
<h3>Memory Allocation</h3>
<ol>
<li>App in Eclipse mittels Android Development Tools (ADT) starten. </li>
<li>App in den Zustand versetzen ab der die Untersuchung relevant ist (bei mir: in Spielewelt einloggen)</li>
<li>In Eclipse-Perspektive DDMS wechseln.</li>
<li>Den Prozess im Emulator / Device auswählen, der Eurer App entspricht.</li>
<li>Auf den Reiter “Allocation Tracking” wechseln</li>
<li>Button “Start Tracking” klicken     <br /><a href="http://sophisticated-it.de/wp-content/uploads/2011/05/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sophisticated-it.de/wp-content/uploads/2011/05/image_thumb.png" width="686" height="296" /></a> </li>
<li>Abwarten bis aus Eurer Sicht genug Daten gesammelt sind (bei mir ein paar Animation-Frames)</li>
<li>“Get Allocations” Button klicken um die gesammelten Informationen anzuzeigen</li>
<li>Interessant für Optimierungen sind für mich häufig auftretende Allokation an denselben Code-Stellen. Dazu die Tabelle nach “Allocated In” sortieren. Für jede Allokation kann im unteren Teil der View der Stack-Trace betrachtet werden um die verantwortliche Stelle im eigenen Code zu identifizieren.      <br /><a href="http://sophisticated-it.de/wp-content/uploads/2011/05/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sophisticated-it.de/wp-content/uploads/2011/05/image_thumb1.png" width="638" height="474" /></a> </li>
</ol>
<p>Anhand dieser Analysen habe ich Stellen identifiziert in den z.B. unnötig Collection-Objekte erzeugt wurden. Diese habe ich durch Caching der verwendeten Collection in Instanzvariablen des längerlebigen Objekts optimiert (Vermeidung von Allokationen).</p>
<h3>Ausführungszeiten von Methoden</h3>
<p>Analog zu den Speicherallokationen können die Ausführungszeiten – genauer der Anteil der Ausführungszeit einzelner Methoden an der Gesamt-Ausführungszeit der App – analysiert werden. Effizienter Code für Android Apps wie Spiele ist zum Einen essentiell für eine akzeptable Frame-Rate und zum Anderen für die Optimierung des Batterieverbrauchs. Wer schon mal Angry Birds gespielt und danach Kopfschüttelnd zum Ladekabel gegriffen hat, kann das sicher nachvollziehen.</p>
<p>Die Infos zu Ausführungszeiten schreibt Emulator / Device auf die SD-Card. Daher muss das “AndroidManifest.xml” die entsprechende Permission anfordern:</p>
<blockquote><p><font face="Courier New">&lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;</font></p>
</blockquote>
<p>Um die Analyse durchzuführen zunächst die Schritte 1 – 4 von oben wie bei Memory Allocations ausführen, dann</p>
<p>5. “Start Method Profiling” Icon-Button klicken   <br /><a href="http://sophisticated-it.de/wp-content/uploads/2011/05/image2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sophisticated-it.de/wp-content/uploads/2011/05/image_thumb2.png" width="686" height="388" /></a>     <br />6. Warten bis genug Daten gesammelt sind (ein paar Frames in meinem Spiel)    <br />7. “Stop Method Profiling” Icon-Button klicken    <br />8. Trace-File vom Emulator / Device herunterladen    <br /><a href="http://sophisticated-it.de/wp-content/uploads/2011/05/image3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sophisticated-it.de/wp-content/uploads/2011/05/image_thumb3.png" width="686" height="123" /></a> </p>
<p>9. Trace-File mittels Trace-View-Tool des Android SDK (liegt bei mir unter “D:\java\android-sdk-windows\tools\traceview.bat”) öffnen. Optimalerwise verknüpft Ihr die Endung “.trace” mit dem Trace-View-Tool in Windows. Dann sieht das Ergebnis in Trace-View wie folgt aus:   <br /><a href="http://sophisticated-it.de/wp-content/uploads/2011/05/image4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sophisticated-it.de/wp-content/uploads/2011/05/image_thumb4.png" width="686" height="246" /></a> </p>
<p>10. Die Prozent-Angaben der Spalte “Incl %” waren für mich relevant. In welchen, möglichst tief in der Aufrufhierarchie liegenden Methoden, wird sehr viel Zeit verbraucht? In einem ersten Schritt habe ich TreeMaps durch eine eigene Implementierung ersetzt, die für meine Zwecke effizienter ist. Ohne diese Analyse mit Trace-View fällt die Identifikation der optimierungsrelevanten Stellen schwer.</p>
<h1>Fazit</h1>
<p>Optimiert Eure Apps nicht ins Blaue hinein. Aufwand und Nutzen müssen in gesundem Verhältnis stehen. Mit den oben beschrieben Ansätzen lassen sich schnell Stellen für Optimierungspotential finden. Mindestens genauso wichtig ist die Erfolgsprüfung Eurer Optimierungsmaßnahmen und die Nachhaltung über automatisierte Tests.</p>
]]></content:encoded>
			<wfw:commentRss>http://sophisticated-it.de/2011/05/android-performance-analyse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://sophisticated-it.de/2011/05/android-performance-analyse/</feedburner:origLink></item>
		<item>
		<title>grepcode.com</title>
		<link>http://feedproxy.google.com/~r/sophisticatedIT/~3/Q2qjineQQX0/</link>
		<comments>http://sophisticated-it.de/2011/03/grepcode-com/#comments</comments>
		<pubDate>Sat, 19 Mar 2011 18:01:41 +0000</pubDate>
		<dc:creator>Marc Neumann</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://sophisticated-it.de/?p=154</guid>
		<description><![CDATA[Gerade konfiguriere ich die Ausführung des Android Emulator mit Jenkins Continuous Integration. Mir hat gerade sehr geholfen, eine Fehlermeldung des Plugin über grepcode.com zu finden. Diese Site erlaubt die konfortable Navigation im Quellcode vieler Open-Source-Projekte. Sehr hilfreich.]]></description>
			<content:encoded><![CDATA[<p>Gerade konfiguriere ich die Ausführung des Android Emulator mit Jenkins Continuous Integration. Mir hat gerade sehr geholfen, eine Fehlermeldung des Plugin über <a href="http://grepcode.com">grepcode.com</a> zu <a href="http://grepcode.com/file/repo1.maven.org/maven2/org.jvnet.hudson.plugins/android-emulator/1.6/hudson/plugins/android_emulator/AndroidEmulator.java#AndroidEmulator.validateAndroidToolsInPath%28hudson.Launcher%29">finden</a>. Diese Site erlaubt die konfortable Navigation im Quellcode vieler Open-Source-Projekte. Sehr hilfreich.</p>
]]></content:encoded>
			<wfw:commentRss>http://sophisticated-it.de/2011/03/grepcode-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://sophisticated-it.de/2011/03/grepcode-com/</feedburner:origLink></item>
		<item>
		<title>Multi Activity Android App beenden</title>
		<link>http://feedproxy.google.com/~r/sophisticatedIT/~3/J9CrnkhoAac/</link>
		<comments>http://sophisticated-it.de/2011/03/multi-activity-android-app-beenden/#comments</comments>
		<pubDate>Sun, 06 Mar 2011 22:18:37 +0000</pubDate>
		<dc:creator>Marc Neumann</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://sophisticated-it.de/?p=124</guid>
		<description><![CDATA[In Android teilt sich eine App in Activities auf. In der Android API fehlt die Möglichkeit eine App komplett zu beenden. Meine Lösung verwendet startActivityForResult, onActivityResult, setResult und finish. In meiner Tower Defense App durchläuft der Benutzer drei Activities: WelcomeActivity, WorldSelectActivity und WorldActivity = Spielen. Die Klassenhierarchie wie folgt: Die im folgenden beschriebenen Methoden sind Bestandteil des Layer-Supertypes AbstractActivity. Der <a href='http://sophisticated-it.de/2011/03/multi-activity-android-app-beenden/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://sophisticated-it.de/wp-content/uploads/2011/03/android-logo.png"><img class="size-thumbnail wp-image-140 alignright" title="android-logo" src="http://sophisticated-it.de/wp-content/uploads/2011/03/android-logo-150x150.png" alt="" width="150" height="150" /></a>In Android teilt sich eine App in <a href="http://developer.android.com/reference/android/app/Activity.html">Activities </a>auf. In der Android API fehlt die Möglichkeit eine App komplett zu beenden. Meine Lösung verwendet <a href="http://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)">startActivityForResult</a>, <a href="http://developer.android.com/reference/android/app/Activity.html#onActivityResult(int, int, android.content.Intent)">onActivityResult</a>, <a href="http://developer.android.com/reference/android/app/Activity.html#setResult(int)">setResult</a> und <a href="http://developer.android.com/reference/android/app/Activity.html#finish()">finish</a>.</p>
<p>In meiner Tower Defense App durchläuft der Benutzer drei Activities: WelcomeActivity, WorldSelectActivity und WorldActivity = Spielen. Die Klassenhierarchie wie folgt:</p>
<p><a href="http://sophisticated-it.de/wp-content/uploads/2011/03/activity-hierarchy.png"><img class="alignnone size-full wp-image-125" title="activity-hierarchy" src="http://sophisticated-it.de/wp-content/uploads/2011/03/activity-hierarchy.png" alt="" width="360" height="230" /></a></p>
<p>Die im folgenden beschriebenen Methoden sind Bestandteil des <a href="http://martinfowler.com/eaaCatalog/layerSupertype.html">Layer-Supertypes</a> <code>AbstractActivity</code>. Der Nutzer drückt &#8220;quit&#8221; im Menu der WorldActivity, dann soll die aktuelle und alle vorher aufgerufenen Activities der App beendet werden.</p>

<div class="wp_codebox"><table><tr id="p1245"><td class="code" id="p124code5"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> onOptionsItemSelected<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Amenuitem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">MenuItem</span></a> _item<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>_item.<span style="color: #006633;">getItemId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">case</span> R.<span style="color: #006633;">id</span>.<span style="color: #006633;">menuEntryQuit</span><span style="color: #339933;">:</span>
        quitApp<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">default</span><span style="color: #339933;">:</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onOptionsItemSelected</span><span style="color: #009900;">&#40;</span>_item<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Beim Beenden der Activity muss ein entsprechender Result-Code gesetzt werden, &#8230;</p>

<div class="wp_codebox"><table><tr id="p1246"><td class="code" id="p124code6"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> quitApp<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    setResult<span style="color: #009900;">&#40;</span>RESULT_QUIT_APP<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    finish<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>&#8230;damit die aufrufende Activity das Beenden der App erkennt und sich ebenfalls beendet.</p>

<div class="wp_codebox"><table><tr id="p1247"><td class="code" id="p124code7"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> onActivityResult<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> _requestCode,
      <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> _resultCode, <span style="color: #000000; font-weight: bold;">final</span> Intent _data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>_resultCode <span style="color: #339933;">==</span> RESULT_QUIT_APP<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      quitApp<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onActivityResult</span><span style="color: #009900;">&#40;</span>_requestCode, _resultCode, _data<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Obwohl die aufrufende Activity kein echtes Ergebnis der Folge-Activity erwartet, muss es die folgende Actvity in Erwartung eines Ergebnisses starten um das Result-Ergebnis <code>RESULT_QUIT_APP</code> über <code>onActivityResult</code> zu erhalten:</p>

<div class="wp_codebox"><table><tr id="p1248"><td class="code" id="p124code8"><pre class="java" style="font-family:monospace;">startActivityForResult<span style="color: #009900;">&#40;</span>intent, REQUEST_WORLD<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Drückt also der Nutzer &#8220;quit&#8221; so beenden sich alle Activities im Stack der App. Dieser Blog-Post zerstört sich im Übrigen auch in 10 Sekunden selbst <img src='http://sophisticated-it.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://sophisticated-it.de/2011/03/multi-activity-android-app-beenden/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://sophisticated-it.de/2011/03/multi-activity-android-app-beenden/</feedburner:origLink></item>
		<item>
		<title>Subversion Migration</title>
		<link>http://feedproxy.google.com/~r/sophisticatedIT/~3/aAA9ZyxLGHo/</link>
		<comments>http://sophisticated-it.de/2011/03/subversion-migration/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 20:30:18 +0000</pubDate>
		<dc:creator>Marc Neumann</dc:creator>
		
		<guid isPermaLink="false">http://sophisticated-it.de/?p=118</guid>
		<description><![CDATA[Gerade habe ich eines meiner Subversion Repositories auf einen neuen Server umgezogen. Das war recht einfach und funktioniert wie folgt&#8230; 1. Dump erzeugen auf altem Subversion-Repository svnadmin dump /pfad/deines/subversion/repositories &#124; gzip &#62;svn.dmp.gz 2. Dump auf neuen Server kopieren scp svn.dmp.gz du@deinserver.de:. 3.  Neues Subversion Repository anlegen und Dump einspielen cd /pfad/zum/parent-verzeichnis/des/neuen/repositories (z.B. /var/svn) svnadmin create repository-name <a href='http://sophisticated-it.de/2011/03/subversion-migration/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Gerade habe ich eines meiner Subversion Repositories auf einen neuen Server umgezogen. Das war recht einfach und funktioniert wie folgt&#8230;</p>
<p><span id="more-118"></span></p>
<h4>1. Dump erzeugen auf altem Subversion-Repository</h4>
<pre><span style="font-size: 13px; font-weight: normal;">svnadmin dump /pfad/deines/subversion/repositories | gzip &gt;svn.dmp.gz</span></pre>
<h4><span style="font-size: 15px; font-weight: bold;">2. Dump auf neuen Server kopieren</span></h4>
<pre>scp svn.dmp.gz du@deinserver.de:.</pre>
<h4>3.  Neues Subversion Repository anlegen und Dump einspielen</h4>
<ol id="internal-source-marker_0.8891520167235285">
<li>
<pre>cd /pfad/zum/parent-verzeichnis/des/neuen/repositories (z.B. /var/svn)</pre>
</li>
<li>
<pre>svnadmin create repository-name</pre>
</li>
<li>
<pre>gzip -cd svn.dmp.gz |  svnadmin load repository-name</pre>
</li>
</ol>
<p>Wenn Du Subversion über Apache betreibst, solltest Du die Befehle unter (3) als User www-data ausführen (su www-data). Danach:</p>
<pre>chown -R www-data:subversion /pfad/zum/neuen/repository</pre>
]]></content:encoded>
			<wfw:commentRss>http://sophisticated-it.de/2011/03/subversion-migration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://sophisticated-it.de/2011/03/subversion-migration/</feedburner:origLink></item>
		<item>
		<title>Bassdrive</title>
		<link>http://feedproxy.google.com/~r/sophisticatedIT/~3/ojSMQef6X5w/</link>
		<comments>http://sophisticated-it.de/2011/03/bassdrive/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 17:25:38 +0000</pubDate>
		<dc:creator>Marc Neumann</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://x107.xanadu.fastwebserver.de/blog-marc/?p=107</guid>
		<description><![CDATA[Es soll IT-Architekten geben, die in der Kernarbeitszeit tatsächlich länger am Stück arbeiten.  Kommt bei mir auch vor. Großprojekte mit vielen Kollegen sind sehr anregend für den eigenen Wissenshorizont, jedoch nur bedingt gut für die Konzentration. Ich empfehle daher zur Begünstigung unterbrechungsfreien Arbeitens den 24h-Drum&#8217;n'Bass Radio-Stream Bassdrive.  Bei durchschnittlichen 175 bpm arbeite ich einfach schneller und <a href='http://sophisticated-it.de/2011/03/bassdrive/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Es soll IT-Architekten geben, die in der Kernarbeitszeit tatsächlich länger am Stück arbeiten.  Kommt bei mir auch vor. Großprojekte mit vielen Kollegen sind sehr anregend für den eigenen Wissenshorizont, jedoch nur bedingt gut für die Konzentration.<br />
Ich empfehle daher zur Begünstigung unterbrechungsfreien Arbeitens den <a href="http://petelo.streams.bassdrive.com:80">24h-Drum&#8217;n'Bass Radio-Stream Bassdrive</a>.  Bei durchschnittlichen 175 bpm arbeite ich einfach schneller und konzentrierter. Bei mir läuft gerade Bassdrive auf <a href="http://www.mediamonkey.com/">Media-Monkey</a>.<br />
Und ja, in der restlichen Zeit gebrauchen IT-Architekten Ihr loses Mundwerk und zeichnen Pfeile, Kreise und Rechtecke auf Flipcharts in großen Meetingräumen.</p>
]]></content:encoded>
			<wfw:commentRss>http://sophisticated-it.de/2011/03/bassdrive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://sophisticated-it.de/2011/03/bassdrive/</feedburner:origLink></item>
		<item>
		<title>Generierung WebService-Client für mehrere WSDLs mit Maven</title>
		<link>http://feedproxy.google.com/~r/sophisticatedIT/~3/YxlttNR4-Ww/</link>
		<comments>http://sophisticated-it.de/2009/01/generierung-webservice-client-fur-mehrere-wsdls-mit-maven/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 15:59:55 +0000</pubDate>
		<dc:creator>Marc Neumann</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://sophisticated-it.de/?p=84</guid>
		<description><![CDATA[Um die Java-Klassen für WebService-Clients zu generieren empfiehlt sich das JAX-WS-Plugin für Maven. Dieses klinkt sich bei Verwendung von &#8220;wsimport&#8221; in die Build-Phase &#8220;generate-sources&#8221; ein. Für mich ist es sinnvoll, die WSDL-Dateien des anzusprechenden Services direkt in &#8220;src/wsdl&#8221; meines Projekts abzulegen statt diese über eine URL einzubinden. Dies hat den Vorteil, dass ich Änderungen an <a href='http://sophisticated-it.de/2009/01/generierung-webservice-client-fur-mehrere-wsdls-mit-maven/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Um die Java-Klassen für WebService-Clients zu generieren empfiehlt sich das <a href="https://jax-ws-commons.dev.java.net/jaxws-maven-plugin/">JAX-WS-Plugin</a> für Maven. Dieses klinkt sich bei Verwendung von &#8220;wsimport&#8221; in die Build-Phase &#8220;generate-sources&#8221; ein.</p>
<p>Für mich ist es sinnvoll, die WSDL-Dateien des anzusprechenden Services direkt in &#8220;src/wsdl&#8221; meines Projekts abzulegen statt diese über eine URL einzubinden. Dies hat den Vorteil, dass ich Änderungen an der Schnittstelle des Service in der Subversion-Historie nachvollziehen kann. Muss mein Projekt mehrere Service ansprechen, so lege ich die WSDL- plus die Schema-Datei (XSD) jedes Service im genannten Verzeichnis ab.<br />
<span id="more-84"></span></p>
<p>Ich verwende pro Service im Client-Projekt eine <a href="http://java.sun.com/webservices/docs/1.5/tutorial/doc/JAXBUsing4.html">JAXB-Binding</a>-Datei um ein Mapping von Datentypen der Service-Schnittstelle auf bestehende Java-Klassen zu definieren. Diese Binding-XML-Dateien liegen per Default des JAXWS-Plugins im Verzeichnis &#8220;src/jaxws&#8221;. So sieht zum Bsp eine solche Mapping-Datei bei mir aus:</p>

<div class="wp_codebox"><table><tr id="p8411"><td class="code" id="p84code11"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jxb:bindings</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">xmlns:jxb</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/xml/ns/jaxb&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">xmlns:xs</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jxb:bindings</span> <span style="color: #000066;">schemaLocation</span>=<span style="color: #ff0000;">&quot;../wsdl/Service1_schema1.xsd&quot;</span> <span style="color: #000066;">node</span>=<span style="color: #ff0000;">&quot;/xs:schema&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jxb:bindings</span> <span style="color: #000066;">node</span>=<span style="color: #ff0000;">&quot;//xs:complexType[@name='type1']&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jxb:class</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;com.corp.package.Type1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/jxb:bindings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jxb:bindings</span> <span style="color: #000066;">node</span>=<span style="color: #ff0000;">&quot;//xs:complexType[@name='type2']&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jxb:class</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;com.corp.package.Type2&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/jxb:bindings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jxb:bindings</span> <span style="color: #000066;">node</span>=<span style="color: #ff0000;">&quot;//xs:simpleType[@name='typeEnum']&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jxb:typesafeEnumClass</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;com.corp.package.TypeEnum&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/jxb:bindings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/jxb:bindings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/jxb:bindings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Ist in der pom.xml das JAX-WS-Plugin ohne zusätzliche Einstellungen (also Defaults) für &#8220;wsimport&#8221; eingebunden, so gibt es den folgenden Fehler:</p>
<pre class="code">
[ERROR] "file:/[...]_schema1.xsd" is not a part of this compilation.
Is this a mistake for "file:/[...]Service_schema1.xsd"?
  line 5 of file:/[...]bindings_[...].xml
</pre>
<p>Um diesen Fehler zu vermeiden, muss Maven das JAX-WS-Plugin für jede WSDL-Datei getrennt in Verbindung mit der richtigen JAXB-Binding-Datei aufrufen.</p>
<p>Dies kann in der pom.xml durch Konfiguration nach folgendem Schema erreicht werden:</p>

<div class="wp_codebox"><table><tr id="p8412"><td class="code" id="p84code12"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.codehaus.mojo<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jaxws-maven-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.11<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>wsimport Service1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>wsimport<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;staleFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${project.build.directory}/jaxws/stale/wsdl.Service1.done<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/staleFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;packageName<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.corp.package1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/packageName<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wsdlFiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wsdlFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Service1.wsdl<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wsdlFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wsdlFiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bindingFiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bindingFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>bindings_service1.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bindingFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bindingFiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>wsimport Service2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>wsimport<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;staleFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${project.build.directory}/jaxws/stale/wsdl.Service2.done<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/staleFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;packageName<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.corp.package2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/packageName<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wsdlFiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wsdlFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Service2.wsdl<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wsdlFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wsdlFiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bindingFiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bindingFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>bindings_service2.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bindingFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bindingFiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Die Java-Klassen für den WebService-Client liegen dann unter &#8220;target/jaxws/import&#8221;. Ich hoffe mit diesen Zeilen kann ich wieder ein paar armen Seelen helfen, Aspirin zu sparen.</p>
]]></content:encoded>
			<wfw:commentRss>http://sophisticated-it.de/2009/01/generierung-webservice-client-fur-mehrere-wsdls-mit-maven/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://sophisticated-it.de/2009/01/generierung-webservice-client-fur-mehrere-wsdls-mit-maven/</feedburner:origLink></item>
		<item>
		<title>Exploded EAR Deployment in Glassfish V2 mit Seam 2.1</title>
		<link>http://feedproxy.google.com/~r/sophisticatedIT/~3/GEZ_StuMd1E/</link>
		<comments>http://sophisticated-it.de/2008/11/exploded-ear-deployment-in-glassfish-v2-mit-seam-21/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 10:38:49 +0000</pubDate>
		<dc:creator>Marc Neumann</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://sophisticated-it.de/?p=75</guid>
		<description><![CDATA[Zuletzt habe ich über das Beschleunigen von lokalen JEE-Deployments geschrieben. Für das Beschleunigen von JEE-Deployments ist meiner Einschätzung nach zwingend das exploded Deployment notwendig. Dabei wird ein EAR oder WAR nicht als Archiv-Datei sondern als entpackte Verzeichnisstruktur deployt. Leider ist das Deployment von exploded EARs und WARs noch nicht durch die JEE-Spezifikation abgedeckt. Daher hat <a href='http://sophisticated-it.de/2008/11/exploded-ear-deployment-in-glassfish-v2-mit-seam-21/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Zuletzt habe ich über das <a href="http://sophisticated-it.de/index.php/2008/10/21/entwicklungsumgebung-fur-jee-apps-beschleunigen/">Beschleunigen von lokalen JEE-Deployments</a> geschrieben. Für das Beschleunigen von JEE-Deployments ist meiner Einschätzung nach zwingend das exploded Deployment notwendig. Dabei wird ein EAR oder WAR nicht als Archiv-Datei sondern als entpackte Verzeichnisstruktur deployt. Leider ist das Deployment von exploded EARs und WARs noch nicht durch die JEE-Spezifikation abgedeckt. Daher hat jeder JEE Container dabei so seine Eigenheiten. Die folgenden Zeilen liefern ein paar wichtige Informationen zum lokalen Deployment von explodierten EARs unter Glassfish V2.<br />
<span id="more-75"></span></p>
<p><strong>Explodierte Verzeichnisstruktur</strong></p>
<p>Für alle Schnell-Checker: So sieht das Verzeichnis-Layout meiner Beispiel-Applikation aus:</p>
<div id="attachment_76" class="wp-caption aligncenter" style="width: 510px"><a href="http://sophisticated-it.de/wp-content/uploads/2008/11/glassfish_exploded_ear__dirs.png"><img src="http://sophisticated-it.de/wp-content/uploads/2008/11/glassfish_exploded_ear__dirs.png" alt="Explodierte EAR-Verzeichnisstruktur für Glassfish" title="glassfish_exploded_ear__dirs" width="500" height="318" class="size-full wp-image-76" /></a><p class="wp-caption-text">Explodierte EAR-Verzeichnisstruktur für Glassfish</p></div>
<p>Der Deskriptor &#8220;application.xml&#8221; des EAR sieht wie folgt aus:</p>
<pre class="code"><span style="color: #0000FF; ">&lt;?</span><span style="color: #FF00FF; ">xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;</span><span style="color: #0000FF; ">?&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">application </span><span style="color: #FF0000; ">xmlns:xsi</span><span style="color: #0000FF; ">=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span><span style="color: #FF0000; ">
    xmlns</span><span style="color: #0000FF; ">=&quot;http://java.sun.com/xml/ns/javaee&quot;</span><span style="color: #FF0000; "> xmlns:application</span><span style="color: #0000FF; ">=&quot;http://java.sun.com/xml/ns/javaee/application_5.xsd&quot;</span><span style="color: #FF0000; ">
    xsi:schemaLocation</span><span style="color: #0000FF; ">=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd&quot;</span><span style="color: #FF0000; ">
    version</span><span style="color: #0000FF; ">=&quot;5&quot;</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
    </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">display-name</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">codis vc</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">display-name</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
    </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">module</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
        </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">ejb</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">jboss-seam-2.1.0.SP1.jar</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">ejb</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
    </span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">module</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
    </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">module</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
        </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">ejb</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">codis_base.jar</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">ejb</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
    </span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">module</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
    </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">module</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
        </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">ejb</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">vc_core.jar</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">ejb</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
    </span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">module</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
    </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">module</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
        </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">ejb</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">vc_business.jar</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">ejb</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
    </span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">module</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
    </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">module</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
        </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">web</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
            </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">web-uri</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">vc_web.war</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">web-uri</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
            </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">context-root</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">vc</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">context-root</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
        </span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">web</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
    </span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">module</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
    </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">library-directory</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">/lib</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">library-directory</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">application</span><span style="color: #0000FF; ">&gt;</span></pre>
<p>Wichtig ist, dass alle Module des EAR explodiert vorliegen. Ein Mischbetrieb von explodierten und verpackten Modulen innerhalb einer Applikation wird von Glassfish V2 <a href="https://glassfish.dev.java.net/issues/show_bug.cgi?id=3386">nicht unterstützt</a>. Daher muss auch das verwendete Seam-Framework, welches als EJB-Modul einzubinden ist, entpackt vorliegen. Dies ist zum Beispiel in JBoss 4.2.2 anders.</p>
<p>Die Verzeichnisnamen der explodierten EAR-Module sind die URIs aus &#8220;application.xml&#8221; mit dem Unterschied, dass Glassfish statt &#8220;.jar&#8221; den Suffix &#8220;_jar&#8221; bzw. statt &#8220;.war&#8221; den Suffix &#8220;_war&#8221; voraussetzt.</p>
<p>Diese Besonderheiten sind sicherlich ein Grund, warum das Glassfish-Plugin für Eclipse WTP aktuell kein Deployment von explodierten EARs unterstützt.</p>
<p><strong>Exploded JARs innerhalb des EAR-Verzeichnis</strong></p>
<p>Zur Strukturierung der Applikation ist die Aufteilung in mehrere Softwareprojekte notwendig, die jeweils ein Artefakt (JAR bzw. WAR) erzeugen. Durch diese Unterteilung werden Abhängigkeiten innerhalb des Systems über die Projektabhängigkeiten schon grob eingeschränkt.</p>
<p>Um JAR-Dateien auch explodiert innerhalb des EAR deployen zu können, müssen diese als Module im Deskriptor &#8220;application.xml&#8221; definiert werden. Bisher habe ich keine andere elegante Möglichkeit gefunden. Möglich wäre noch die Angabe von Classpath-Referenzen auf die JAR-Verzeichnisse mittels &#8220;META-INF/manifest.mf&#8221; in den EAR-Modulen, welche die JARs benötigen.</p>
<p>Module die in &#8220;application.xml&#8221; als JAR definiert werden, sind nach JEE-Spezifikation die Application Clients. Dies kann zum Beispiel eine Swing-Anwendung sein, die als Client fungiert. Im EAR-Deskriptor sieht ein JAR-Modul wie folgt aus:</p>
<pre class="code"><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">module</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">java</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">vc_core.jar</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">java</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">module</span><span style="color: #0000FF; ">&gt;</span></pre>
<p>Glassfish versucht diese JAR-Module per Java WebStart bereitzustellen. Dabei prüft der Glassfish Deployer die Datei &#8220;META-INF/MANIFEST.MF&#8221; auf den Eintrag &#8220;Main-class&#8221;. Dieser Eintrag muss den vollqualifizierte Klassenname der Startklasse enthalten, für welche die <span class="code">main</code>-Methode aufgerufen wird. Ist dieser Eintrag nicht vorhanden, so meldet Glassfish eine Warnung:</p>
<pre class="code">
[#|2008-11-16T08:50:38.859+0100|WARNING|sun-appserver9.1|javax.enterprise.system.tools.deployment|
_ThreadID=15;_ThreadName=Timer-40;vc_business.jar;_RequestID=5
16b05a8-8e7f-4bd9-a448-ea5184b4280e;|App client vc_business.jar did not specify
Main-Class in its manifest as described in the Java EE specification;
no annotations in this app client will be processed|#]
</pre>
<p>Kurz danach wirft Glassfish eine Exceptions ins "server.log":</p>
<pre class="code">
[#|2008-11-16T08:50:41.187+0100|SEVERE|sun-appserver9.1|javax.enterprise.system|
_ThreadID=15;_ThreadName=Timer-40;_RequestID=516b05a8-8e7f-4bd9-a448-ea5184b4280
e;|Error updating Java Web Start information for application vc_app
java.lang.NullPointerException
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportInfo.prepareApplication(AppclientJWSSupportInfo.java:1221)
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportInfo.startJWSServicesForApplication(AppclientJWSSupportInfo.java:475)
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportManager.handleApplicationEvent(AppclientJWSSupportManager.java:156)
</pre>
<p>Das ist unschön, trotzdem ist das JAR-Modul deployt. Andere Module im EAR können auf die Klassen des JAR-Modules zugreifen.</p>
<p>Um den obigen Fehler im Log zu vermeiden, verwende ich statt dessen EJB-Module, obwohl ich aktuell gar keine EJBs sondern ausschließlich Seam-Beans verwende. Lediglich ein Dummy-EJB muss in jedem EJB-Modul enthalten sein, sonst beschwert sich Glassfish (<span class="code"></code>) und deployt das EJB-Modul nicht.</p>
<p>Damit ist für mich das Thema exploded Deployment in Glassfish V2 gelöst. Bleibt nur zu hoffen, dass folgende JEE-Spezifikationen das explodierte Deployment endlich standardisieren. Für die effiziente Entwicklung von JEE-Applikationen ist das aus meiner Sicht absolut notwendig.</p>
]]></content:encoded>
			<wfw:commentRss>http://sophisticated-it.de/2008/11/exploded-ear-deployment-in-glassfish-v2-mit-seam-21/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://sophisticated-it.de/2008/11/exploded-ear-deployment-in-glassfish-v2-mit-seam-21/</feedburner:origLink></item>
		<item>
		<title>Entwicklungsumgebung für JEE-Apps beschleunigen</title>
		<link>http://feedproxy.google.com/~r/sophisticatedIT/~3/2UKboYK_Jzc/</link>
		<comments>http://sophisticated-it.de/2008/10/entwicklungsumgebung-fur-jee-apps-beschleunigen/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 20:06:59 +0000</pubDate>
		<dc:creator>Marc Neumann</dc:creator>
				<category><![CDATA[Build]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://sophisticated-it.de/?p=66</guid>
		<description><![CDATA[Schneller, höher, weiter! Das Entwickeln von JEE-Applikationen ist bestimmt durch Round-Trips aus Code-Änderung, Kompilierung, Re-Deployen und Testen. Da sich diese Round-Trips in kurzen Abständen (Minutenbereich) wiederholen, sollte das Kompilieren und Re-Deployen so wenig Zeit möglich in Anspruch nehmen. Zum einen lässt das schlicht mehr Zeit zum Programmieren und Testen. Zum anderen macht das Arbeiten den <a href='http://sophisticated-it.de/2008/10/entwicklungsumgebung-fur-jee-apps-beschleunigen/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Schneller, höher, weiter! Das Entwickeln von JEE-Applikationen ist bestimmt durch Round-Trips aus Code-Änderung, Kompilierung, Re-Deployen und Testen. Da sich diese Round-Trips in kurzen Abständen (Minutenbereich) wiederholen, sollte das Kompilieren und Re-Deployen so wenig Zeit möglich in Anspruch nehmen. Zum einen lässt das schlicht mehr Zeit zum Programmieren und Testen. Zum anderen macht das Arbeiten den Programmierern so einfach mehr Spaß! (&#8230; und die Zufriedenheit des Programmierers ist direkt proportional zur Lebensdauer seiner Tastatur).</p>
<p><span id="more-66"></span></p>
<p><strong>Re-Deployment vermeiden</strong></p>
<p>Einige Änderungen im Code benötigen gar kein Re-Deployment. </p>
<p>Einfache Änderungen im Java-Code lassen sich direkt über die Debugging-Schnittstelle in den Application Server übertragen. Eclipse muss also per Remote Debugger mit dem Application Server verbunden sein in welchem die JEE-App läuft. Alternativ kann der Application Server auch direkt mittels Eclipse WTP im Debugging-Modus gestartet sein. Aber Vorsicht: Nach dem Neustarten des Servers sind die Änderungen wieder weg, da die Class-Dateien des Deployments geladen werden.</p>
<p>Einfache Änderungen beziehen sich auf das Verändern von Methodenblöcken (Method Body). Wichtig für das Funktionieren von Hot Code Replacement in Eclipse ist, dass Auto-Build (Kompilieren) aktiv ist. Wartet der Debugger gerade per Breakpoint in der veränderten Methode, so wird der aktuelle Frame vom Ausführungsstack gepoppt und die Methode wird quasi erneut mit denselben Argumenten aufgerufen.</p>
<p>Das Ändern der Klassensignatur ist nicht mittels Hot Code Replacement (HCR) möglich. Die Klassensignatur ändert sich zum Beispiel durch neue Methoden oder Felder, Umbenennen von Methoden oder Feldern, sowie durch Verändern von Methodensignaturen. Eclipse zeigt in diesem Fall folgendes Meldungsfenster an:</p>
<p><a href="http://sophisticated-it.de/wp-content/uploads/2008/10/article_redeploy_opt__hcr_failed.png"><img src="http://sophisticated-it.de/wp-content/uploads/2008/10/article_redeploy_opt__hcr_failed.png" alt="" title="Hot Code Replace failed in Eclipse" class="aligncenter size-full wp-image-68" /></a></p>
<p>Dann ist in der Regel ein Re-Deployment notwendig. Das Neustarten des Application-Servers dauert länger und sollte vermieden werden.</p>
<p><strong>Re-Deployment beschleunigen</strong></p>
<p>Wenn Hot Code Replace nicht ausreicht, wird also ein Re-Deployment notwendig. Die Code-Änderungen müssen inkrementell kompiliert und dem Application Server bereitgestellt werden. Eclipse kompiliert bereits inkrementell. Warum also eine gesonderte Kompilierung per Ant durchführen? Das kostet Zeit.</p>
<p>Das Kopieren von Class-Dateien in das &#8220;explodierte&#8221; Deployment-Verzeichnis kostet ebenso Zeit. Praktisch ist die Verwendung von symbolischen Verzeichnislinks im Dateisystem. Entsprechende Verzeichnisse im Deployment-Verzeichnis zeigen auf die Verzeichnisse mit den Class-Dateien in Eclipse.</p>
<p>Folgendes Bild veranschaulicht die Verzeichnislinks bei einem meiner Projekt, welches ein Maven-Setup verwendet (erkennbar an den Verzeichnissen &#8220;target/classes&#8221;):<br />
<a href="http://sophisticated-it.de/wp-content/uploads/2008/10/article_redeploy_opt__symlinks.png"><img src="http://sophisticated-it.de/wp-content/uploads/2008/10/article_redeploy_opt__symlinks.png" alt="" title="Symlinks für explodiertes Deployment" width="500" height="474" class="aligncenter size-full wp-image-71" /></a></p>
<p>Die symbolischen Links werden mittels Ant-Skript und dem <a href="http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx">freien Windows-Tool Junction</a> angelegt. Folgendes Ant-Fragment kann dabei helfen, dasselbe im eigenen Projekt zu machen:</p>
<pre><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">target </span><span style="color: #FF0000; ">name</span><span style="color: #0000FF; ">=&quot;_create_symlink&quot;</span><span style="color: #FF0000; "> description</span><span style="color: #0000FF; ">=&quot;Creates a symbolic link&quot;</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">fail </span><span style="color: #FF0000; ">unless</span><span style="color: #0000FF; ">=&quot;from.path&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">fail </span><span style="color: #FF0000; ">unless</span><span style="color: #0000FF; ">=&quot;to.path&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">

</span><span style="color: #008000; ">&lt;!--</span><span style="color: #008000; "> junction executable must use absolute path since it operates in a different work directory </span><span style="color: #008000; ">--&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">property </span><span style="color: #FF0000; ">name</span><span style="color: #0000FF; ">=&quot;to.path.abs&quot;</span><span style="color: #FF0000; "> location</span><span style="color: #0000FF; ">=&quot;${to.path}&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">

</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">dirname </span><span style="color: #FF0000; ">file</span><span style="color: #0000FF; ">=&quot;${from.path}&quot;</span><span style="color: #FF0000; "> property</span><span style="color: #0000FF; ">=&quot;from.path.dir&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">basename </span><span style="color: #FF0000; ">file</span><span style="color: #0000FF; ">=&quot;${from.path}&quot;</span><span style="color: #FF0000; "> property</span><span style="color: #0000FF; ">=&quot;from.path.name&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">

</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">echo </span><span style="color: #FF0000; ">level</span><span style="color: #0000FF; ">=&quot;info&quot;</span><span style="color: #FF0000; "> message</span><span style="color: #0000FF; ">=&quot;Creating symlink ${from.path} -&gt; ${to.path.abs}&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">basename </span><span style="color: #FF0000; ">file</span><span style="color: #0000FF; ">=&quot;&quot;</span><span style="color: #FF0000; "> property</span><span style="color: #0000FF; ">=&quot;&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">exec </span><span style="color: #FF0000; ">executable</span><span style="color: #0000FF; ">=&quot;${project.root.tools.dir}/junction.exe&quot;</span><span style="color: #FF0000; "> dir</span><span style="color: #0000FF; ">=&quot;${from.path.dir}&quot;</span><span style="color: #FF0000; "> failonerror</span><span style="color: #0000FF; ">=&quot;true&quot;</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;${from.path.name}&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;${to.path.abs}&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">exec</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">echo </span><span style="color: #FF0000; ">file</span><span style="color: #0000FF; ">=&quot;${from.path}_readme.txt&quot;</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
  ${symlink.src.name} represents a symbolic link and it is not intended to be handled like a normal directory.
  Under Windows use the junction.exe tool to manage it!
</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">echo</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">target</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">

</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">target </span><span style="color: #FF0000; ">name</span><span style="color: #0000FF; ">=&quot;_del_symlink&quot;</span><span style="color: #FF0000; "> description</span><span style="color: #0000FF; ">=&quot;Deletes a symbolic link&quot;</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">fail </span><span style="color: #FF0000; ">unless</span><span style="color: #0000FF; ">=&quot;from.path&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">

</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">dirname </span><span style="color: #FF0000; ">file</span><span style="color: #0000FF; ">=&quot;${from.path}&quot;</span><span style="color: #FF0000; "> property</span><span style="color: #0000FF; ">=&quot;from.path.dir&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">basename </span><span style="color: #FF0000; ">file</span><span style="color: #0000FF; ">=&quot;${from.path}&quot;</span><span style="color: #FF0000; "> property</span><span style="color: #0000FF; ">=&quot;from.path.name&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">

</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">echo </span><span style="color: #FF0000; ">level</span><span style="color: #0000FF; ">=&quot;info&quot;</span><span style="color: #FF0000; "> message</span><span style="color: #0000FF; ">=&quot;Deleting symlink ${from.path}&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">exec </span><span style="color: #FF0000; ">executable</span><span style="color: #0000FF; ">=&quot;${project.root.tools.dir}/junction.exe&quot;</span><span style="color: #FF0000; "> dir</span><span style="color: #0000FF; ">=&quot;${from.path.dir}&quot;</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;-d&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;${from.path.name}&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">exec</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">delete </span><span style="color: #FF0000; ">file</span><span style="color: #0000FF; ">=&quot;${from.path}_readme.txt&quot;</span><span style="color: #FF0000; "> failonerror</span><span style="color: #0000FF; ">=&quot;false&quot;</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">target</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
</span></pre>
<p>In einem meiner Projekte (Großprojekt, JEE, Automotive) haben wir sehr viele Klassen explodiert deployt (aktuell 7299). Man kann sich Vorstellen wie viel Zeit täglich durch den Wegfall des Kopierens beim Re-Deployment gespart wird.</p>
<p><strong>Re-Deployment anstossen</strong></p>
<p>Nachdem die neuen Class-Dateien jetzt im Deployment-Verzeichnis bereit stehen, kann re-deployt werden. Der Application Server stoppt und entlädt die JEE-App. Dabei werden geladene Class-Dateien freigegeben. Anschließend wird die JEE-App wieder geladen und gestartet.</p>
<p>Das Anstoßen eines Re-Deployments ist abhängig vom Application Server. Unter JBoss funktioniert dies einfach über das Verändern des Deployment-Deskriptors. Für ein EAR-Deployment muss der Deskriptor &#8220;META-INF/application.xml&#8221; modifiziert werden. Dies lässt sich mit Ant wie folgt realisieren:</p>
<pre><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">touch </span><span style="color: #FF0000; ">file</span><span style="color: #0000FF; ">=&quot;${deploy.ear.exploded.dir}/META-INF/application.xml&quot;</span><span style="color: #0000FF; ">/&gt;</span></pre>
<p>Unter BEA Weblogic 8 können die Weblogic Admin Tools in Ant verwendet werden:</p>
<pre><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">java </span><span style="color: #FF0000; ">classname</span><span style="color: #0000FF; ">=&quot;weblogic.Deployer&quot;</span><span style="color: #FF0000; "> fork</span><span style="color: #0000FF; ">=&quot;true&quot;</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">classpath</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">
    </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">pathelement </span><span style="color: #FF0000; ">location</span><span style="color: #0000FF; ">=&quot;${weblogic.lib.dir}/weblogic.jar&quot;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">classpath</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; ">

  </span><span style="color: #008000; ">&lt;!--</span><span style="color: #008000; "> options </span><span style="color: #008000; ">--&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;-adminurl&quot;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;${domain.admin.url}&quot;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;-username&quot;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;${domain.admin.user}&quot;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;-password&quot;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;${domain.admin.pwd}&quot;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;-name&quot;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;${domain.deployment.packaged.name}&quot;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;-targets&quot;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;${domain.deployment.exploded.business.name}@${domain.deployment.target}&quot;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;-verbose&quot;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">

  </span><span style="color: #008000; ">&lt;!--</span><span style="color: #008000; "> action </span><span style="color: #008000; ">--&gt;</span><span style="color: #000000; ">
  </span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">arg </span><span style="color: #FF0000; ">value</span><span style="color: #0000FF; ">=&quot;-redeploy&quot;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; ">
</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">java</span><span style="color: #0000FF; ">&gt;</span></pre>
<p>Ich hoffe Eure Entwicklungsumgebung ist so schnell wie meine. Ja? Dann können wir mal um die Wette coden&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://sophisticated-it.de/2008/10/entwicklungsumgebung-fur-jee-apps-beschleunigen/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://sophisticated-it.de/2008/10/entwicklungsumgebung-fur-jee-apps-beschleunigen/</feedburner:origLink></item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/


Served from: sophisticated-it.de @ 2012-02-09 16:07:10 -->

