tag:blogger.com,1999:blog-54841776137312251312024-03-14T03:40:42.296+01:00ekkes corner - eclipse mdsd osgi oaw erpekkes corner - blogging about eclipse as IDE and Platform / Model Driven Software Development (MDSD) using Eclipse Modeling - openArchitectureWare / OSGI - Eclipse Equinox, Eclipse Riena, EasyBeans / ERP softwareekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.comBlogger42125tag:blogger.com,1999:blog-5484177613731225131.post-90866561945533613142009-05-26T09:45:00.004+02:002009-05-26T09:53:33.147+02:00moved ekkes-corner blog to wordpress<span class="Apple-style-span" style=" line-height: 19px; font-size:13px;"><p><span class="Apple-style-span" style="font-size: medium;">Last days I moved my blog "ekkes-corner" from Blogger to <a href="http://ekkescorner.wordpress.com/">Wordpress</a>. I was impressed how easy all my existing blog entries and comments are imported. Some are looking not exactly the same as before, but over all it worked great.</span></p><p><span class="Apple-style-span" style="font-size: medium;">All my new blogs will now be there at Wordpress - hopefully the Feed of Planet Eclipse will be updated soon.</span></p><p><span mce_name="strong" mce_style="font-weight: bold;" class="Apple-style-span" style="font-weight: bold; "><span class="Apple-style-span" style="font-size: medium;">Eclipse 3.5 (Galileo)</span></span><span class="Apple-style-span" style="font-size: medium;"> is coming - and its a good idea for you to become a </span><span mce_name="strong" mce_style="font-weight: bold;" class="Apple-style-span" style="font-weight: bold; "><span class="Apple-style-span" style="font-size: medium;"><a href="http://www.eclipse.org/donate/">Friend of Eclipse</a></span></span></p><p><span class="Apple-style-span" style="font-weight: bold; "><span class="Apple-style-span" style="font-weight: normal; line-height: normal; "><span class="Apple-style-span" style="font-size: medium;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://ekkescorner.wordpress.com/files/2009/05/friendsofgalileo1.gif"><img src="http://ekkescorner.wordpress.com/files/2009/05/friendsofgalileo1.gif" border="0" alt="" style="cursor: pointer; width: 160px; height: 160px; " /></a></span></span><span class="Apple-style-span" style="font-size: medium;"></span></span></p><p><span class="Apple-style-span" style="font-size: medium;">Many new cool things in the area of PDE, Target Platforms, Runtime, Riena, Modeling (EMF, oAW) - I'll report about my experiences and give some tips and tricks in my upcoming blog posts.</span></p><p><span class="Apple-style-span" style="font-size:130%;"><span class="Apple-style-span" style="font-size: 16px;">stay tuned...</span></span></p><b><p><span class="Apple-style-span" style="font-size: medium;"><span class="Apple-style-span" style="font-weight: normal;">ekke</span></span></p></b></span><b></b><p></p>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com0tag:blogger.com,1999:blog-5484177613731225131.post-88264892766022295682009-05-11T06:42:00.006+02:002009-05-11T07:05:27.750+02:00New Ways Around Generation Gap Pattern - VideoCast<div>To demonstrate the use of VetoRedirectStrategy in oAW workflows (see my last blog entry "<a href="http://ekkes-corner.blogspot.com/2009/05/new-ways-around-generation-gap-pattern.html">New Ways Around Generation Gap Pattern</a>") I created a videocast - movie.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SgewokRK9cI/AAAAAAAAAi8/slgMFWkpfn8/s1600-h/episode2_title.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SgewokRK9cI/AAAAAAAAAi8/slgMFWkpfn8/s400/episode2_title.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5334426494620595650" style="cursor: pointer; width: 390px; height: 400px; " /></a></div><div>After publishing my first videocasts I learned that there are sometimes problems to play them in different browsers. So I publish my screencasts in different formats - you can use what fits your environment.</div><div><br /></div><div><ul><li><a href="http://vimeo.com/ekkescorner">http://vimeo.com/ekkescorner</a> as <a href="http://vimeo.com/4558181">HD movie</a></li><li><a href="http://ekkes-corner-tv.org/">http://ekkes-corner-tv.org</a> as <a href="http://web.mac.com/ekkehard.gentz/ekkes-corner-tv/ekkes-corner-desktop/Einträge/2009/5/9_episode_2_-_MDSD_-_new_ways_around_Generation_Gap_Pattern.html">QuickTime</a></li><li><a href="http://www.slideshare.net/ekkescorner">http://www.slideshare.net/ekkescorner </a>as <a href="http://www.slideshare.net/ekkescorner/new-ways-around-generation-gap-pattern">slides</a> (no audio or animation)</li><li>iTunes: as VideoCast for iPod/iPhone or AppleTV/desktop (To subscribe from iTunes Store search for „ekkes-corner“)</li></ul></div><div><br /></div><div>Have fun.</div><div><br /></div><div>ekke</div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com0tag:blogger.com,1999:blog-5484177613731225131.post-3810863429145159242009-05-05T12:06:00.028+02:002009-05-05T13:25:49.385+02:00New Ways Around Generation Gap Pattern<div><div>This blog dsescribes some new ways around "<a href="http://www.research.ibm.com/designpatterns/pubs/gg.html">Generation Gap Pattern (John Vlissides)</a>".</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">ModelDrivenSoftwareDevelopment (MDSD) - Best Practices</span></div><div><br /></div><div>Some<a href="http://www.infoq.com/articles/model-driven-dev-best-practices"> best practises</a> are valid at all MDSD projects:</div><div><br /></div><div><ul><li>generated code should be clearly separated from manually written code</li><li>generated code should not checked into a VersionControlSystem (CVS, SVN, GiT)</li></ul></div><div><br /></div><div>Inside a MDSD (ModelDrivenSoftwareDevelopment) project there are different types of code (see also <a href="http://www.1160pm.net/2009/04/23/generation-gap-pattern/">Heiko Behrens article</a>)</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Manuelly written code</span></div><div><br /></div><div>Code never be generated, always manually written. This can be some base framework classes or code only used at some places not worth to generate like Utility- or Helper classes.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Generated unchanged code</span></div><div><br /></div><div>Such code will be always generated and never changed manually. Classes will be re.generated at each run of the generator - existing files are overwritten or destroyed before.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Generated but editable code</span></div><div><br /></div><div>This is code where its useful or ecpected that the generated code will be changed or extended. If files exist, they will not be overwritten - new files will be added and generated first time. (generate-once)</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Generation Gap Pattern</span></div><div><br /></div><div>The main problem with generated code is always how to combine or separate generated code and manually changed / extended code. That's the point where in most cases the Generation Gap Pattern will be used:</div><div><br /></div><div>Generated classes will be generated into a directory which is cleared before generation. Subclasses will only generated first time into another directory where they can be changed.</div><div><br /></div><div>In practise some problems happen - per ex. "Ghost Classes" after refactorings / renaming. Also you cannot differ between generated and changed Subclasses - so all will be checked into VersionControlSystem.</div><div><br /></div><div>To make this more practicable, Heiko Behrens describes „Conditional Generation“ where generated and changed Classes are clearly separated. oAW Workflow can use a "Vetostrategy": Before generating an artifact it will be tested if there's already a changed artifact into another direcrtory - and if found no new generation happens.</div><div><br /></div><div>This is described in detail in Heiko Behrens article „<a href="http://www.1160pm.net/2009/04/23/generation-gap-pattern/">Generation Gap Pattern</a>“. If you dont have read this article, please do now. I expect that you know the VetoStrategies described by Heiko !</div><div><br /></div><div>Thanks to Heiko Behrens I got the information about oAW „VetoStrategy“ which was new for me - never read about it in the docs or forum. Now I was inspired to find some solutions for my project better then previous workarounds.</div><div><br /></div><div>At first I must say, that I have some problems to use the „Generation Gap Pattern“ as generic pattern if generated code also has to be modified in MDSD projects. Working as softwarearchitect and designing an entity model (esp. in the domain of Enterprise Business Applications), I very carefully think about inheritance strategies / hierarchies. (esp. if all must be mapped from Hibernate or EclipseLink to a database)</div><div><br /></div><div>A really simple inheritance:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SgAY7uZFHWI/AAAAAAAAAg8/W4o2E2pGQHU/s1600-h/simple+inheritance.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SgAY7uZFHWI/AAAAAAAAAg8/W4o2E2pGQHU/s400/simple+inheritance.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5332289373151239522" style="cursor: pointer; width: 273px; height: 240px; " /></a></div><div><br /></div><div>If you follow the „<a href="http://www.research.ibm.com/designpatterns/pubs/gg.html">Generation Gap Pattern (John Vlissides)</a>“ :</div><div><i><span class="Apple-style-span" style="font-size:small;"><span class="Apple-style-span" style="font-style: normal; "><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SgAY7pkxR8I/AAAAAAAAAhE/2Rr5O8pGLZw/s1600-h/generation+gap+vlissides.gif"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SgAY7pkxR8I/AAAAAAAAAhE/2Rr5O8pGLZw/s400/generation+gap+vlissides.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5332289371858094018" style="cursor: pointer; width: 400px; height: 206px; " /></a></span></span></i></div><div><i><span class="Apple-style-span" style="font-size:small;">Image from „</span></i><a href="http://www.research.ibm.com/designpatterns/pubs/gg.html"><i><span class="Apple-style-span" style="font-size:small;">Generation Gap Pattern</span></i></a><i><span class="Apple-style-span" style="font-size:small;">“ (c) 1996 John Vlissides</span></i></div><div><br /></div><div>... separating Classes into one generated (often abstract) Class and one additional (often first-time-generated) editable Subclass ...</div><div><span class="Apple-style-span" style="font-style: italic; "><span class="Apple-style-span" style="font-style: normal; "><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SgAY7-X2QqI/AAAAAAAAAhM/ugpWkEG5_pQ/s1600-h/gap+pattern.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SgAY7-X2QqI/AAAAAAAAAhM/ugpWkEG5_pQ/s400/gap+pattern.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5332289377441039010" style="cursor: pointer; width: 400px; height: 254px; " /></a></span></span></div><div><span class="Apple-style-span" style="font-style: italic; ">use of generation Gap Pattern in many oAW projects</span></div><div><br /></div><div>... then the inheritance - hierarchy becomes "dirty" from my point of view. In big projects suddenly hundreds of classes are "twice" - and the only reason is technically: because its a modeldriven project ?</div><div><br /></div><div>I only want to use abstract / concrete classes or super- / subclasses if I need them from my use-cases or software architecture, but not because I'm using a generator - framework.</div><div><br /></div><div>As always using a pattern you should ask: is it the right pattern or are there other ways to reach the goal ?</div><div><br /></div><div>From my opinion: the "Generation Gap Pattern" helps in many cases, but not always. <a href="http://www.1160pm.net/2009/04/23/generation-gap-pattern/">Heiko Behrens</a> shows how the use of "VetoStrategies" in oAW workflows will help handling the files and folders, but its no solution to avoid getting many classes twice which bloats the architecture.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Protected Areas</span></div><div><br /></div><div>So we again have to find an answer how to separate generated and manually written code without breaking the rules of best practises in MDSD projects. </div><div><br /></div><div>There is another way: „ProtectedAreas“. STOP crying ;-) please read ahead - I try to use protected areas something different then normaly !</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">What are „Protected Areas“ ?</span></div><div><br /></div><div>If there are some parts of the code where its allowed to modify or extend, then the Begin and the End are marked as special comments identified by an unique ID. Inside these protected areas the default code will be generated and the area will be marked as DISABLED, so if regenerating it will be overwritten.</div><div><br /></div><div>If a developer modifies / extends the content af a protected region, then this region has to be ENABLED and the changes are protected after regeneration. Using „Protected Areas“ the structure and inheritance of your classes remain unchanged - exact the same as using it without a generator.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">How are „Protected Areas“ normaly used ?</span></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SgAZbi3ZCaI/AAAAAAAAAhU/kKvgYp6gyWE/s1600-h/pr+standard.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SgAZbi3ZCaI/AAAAAAAAAhU/kKvgYp6gyWE/s400/pr+standard.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5332289919812962722" style="cursor: pointer; width: 400px; height: 256px; " /></a></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Whats the drawback ?</span></div><div><br /></div><div>Now classes have protected areas, can be overwritten if regenerated but then they will be checked into VersionControlSystem - thats bad, because there are many classes without changes: only generated content. That breaks the rule "never check-in generated code".</div><div><br /></div><div>Also you dont see which classes have changes and which are untouched after generation.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Protected Regions using VetoRedirectStrategie</span></div><div><br /></div><div>Here's my solution</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SgAZbtHTT7I/AAAAAAAAAhc/1L7OCuKxiu8/s1600-h/pr+veto+strategie.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SgAZbtHTT7I/AAAAAAAAAhc/1L7OCuKxiu8/s400/pr+veto+strategie.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5332289922564050866" style="cursor: pointer; width: 400px; height: 336px; " /></a></div><div><ul><li>at start of generator-workflow clear „<span class="Apple-style-span" style="font-family:'courier new';">src-gen</span>“ and „<span class="Apple-style-span" style="font-family:'courier new';">veto</span>“</li><li>generator scannes „<span class="Apple-style-span" style="font-family:'courier new';">src-gen-pr</span>“ and caches ENABLED ProtectedAreas</li><li>„only-generated“ classes will be generated into „<span class="Apple-style-span" style="font-family:'courier new';">src-gen</span>“, also classes with „ProtectedRegions“ without a veto</li><li>classes with ENABLED „ProtectedRegions“ are stored in „<span class="Apple-style-span" style="font-family:'courier new';">src-gen-pr</span>“ </li><li>while generating the generator checks using "VetoStrategy" if a class is already in „<span class="Apple-style-span" style="font-family:'courier new';">src-gen-pr</span>“. If found, then the generated output is redirected into „<span class="Apple-style-span" style="font-family:'courier new';">veto</span>“ directory where the new generated class together with ENABLED ProtectedRegions (from cache) is written to</li><li>as last step of generation the files from „<span class="Apple-style-span" style="font-family:'courier new';">veto</span>“ are compared with corresponding files from „<span class="Apple-style-span" style="font-family:'courier new';">src-gen-pr</span>“. Only if they differ, the new ones will be copied into „<span class="Apple-style-span" style="font-family:'courier new';">src-gen-pr</span>“. Now we are sure only really changed files will get a new modified flag and checked into VCS.</li></ul></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">The Workflow</span></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SgAZzXDOdnI/AAAAAAAAAhk/qmhbjURSGyw/s1600-h/veto+workflow.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SgAZzXDOdnI/AAAAAAAAAhk/qmhbjURSGyw/s400/veto+workflow.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5332290328958236274" style="cursor: pointer; width: 373px; height: 400px; " /></a></div><div><br /></div><div>Generated-only and manually changed code now is clearly separated. Only changed artifacts will be commited into VCS and the Inheritance structure is unchanged.</div><div><br /></div><div>Of course I have to watch, that a developer changing „Protected Regions“ doesnt forget to activate them (ENABLED) and to move the file into „<span class="Apple-style-span" style="font-family:'courier new';">src-gen-pr</span>“ if not already there. </div><div>If you want to check if a developer ENABLED a protected region, but forgets to move into „<span class="Apple-style-span" style="font-family:'courier new';">src-gen-pr</span>“ you simply can add a step at start of your workflow: scan „<span class="Apple-style-span" style="font-family:'courier new';">src-gen-pr</span>“ for protected regions - if some enabled are found, stop workflow with warning.</div><div>If you want to check if a developer forgots to enable a protected region after making some changes, you can include something like a checksum into the region and write a component to test these before starting to generate.</div><div>All is possible you see - but its of course a matter of time: each extra step will slowdown generation performance.</div><div>(Tip: sometimes the Local History of Eclipse helps - but there's currently a bug: oAW generator overwrites the last Local History entry instead of inserting a new)</div><div><br /></div><div>Inside the default code of a „ProtectedRegion“ I always insert a comment like:</div><div><br /></div><div>Disabled Protected Region:</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SgAaNxInB8I/AAAAAAAAAh0/glQI_-yGiak/s1600-h/PR+disabled.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SgAaNxInB8I/AAAAAAAAAh0/glQI_-yGiak/s400/PR+disabled.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5332290782636738498" style="cursor: pointer; width: 400px; height: 82px; " /></a></div><div><br /></div><div>Enabled Protected Region:</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SgAaN0KwfJI/AAAAAAAAAhs/uIC1mYCaUrg/s1600-h/PR+enabled.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SgAaN0KwfJI/AAAAAAAAAhs/uIC1mYCaUrg/s400/PR+enabled.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5332290783451053202" style="cursor: pointer; width: 400px; height: 82px; " /></a></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Some Tech Infos HowTo implement a RedirectVetostrategie</span></div><div><br /></div><div>tested using:</div><div><ul><li>Eclipse 3.5M6</li><li>openArchitectureWare 4.3.1 (If you already use the plugins from Eclipse Modeling Project you have to change the namespace)</li><li>Apache Commons IO 1.4 (<a href="http://www.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.apache.commons.io&version=1.4.0&searchType=bundlesBySymbolicName&searchQuery=org.apache.commons.io">SpringSourceEnterpriseBundleRepository </a>- (Eclipse Orbit only has version 1.3.2 from 2007)</li></ul></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Workflow Components</span></div><div><br /></div><div>Workflow Component <span class="Apple-style-span" style="font-family:'courier new';">Directory Cleaner</span> (oAW Component)</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SgAa_mHSz3I/AAAAAAAAAiU/hPeoEqu1I9E/s1600-h/workflow+dir+cleaner.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SgAa_mHSz3I/AAAAAAAAAiU/hPeoEqu1I9E/s400/workflow+dir+cleaner.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5332291638671888242" style="cursor: pointer; width: 400px; height: 115px; " /></a></div><div><span class="Apple-style-span" style="font-family:'courier new';">outlet.src.dir</span> points to <span class="Apple-style-span" style="font-family:'courier new';">src-gen</span>,</div><div><span class="Apple-style-span" style="font-family:'courier new';">outlet.veto.pr.dir</span> points to <span class="Apple-style-span" style="font-family:'courier new';">veto</span>.</div><div><br /></div><div>Workflow Component <span class="Apple-style-span" style="font-family:'courier new';">Outlet</span> with Vetostrategy (Redirect of enabled ProtectedRegions)</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SgAaqGt5vaI/AAAAAAAAAiE/6YeIpXmBvR8/s1600-h/workflow+outlet+with+veto.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SgAaqGt5vaI/AAAAAAAAAiE/6YeIpXmBvR8/s400/workflow+outlet+with+veto.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5332291269466635682" style="cursor: pointer; width: 400px; height: 140px; " /></a></div><div><br /></div><div>This Outlet uses a new Vetostrategy - also the Outlet Class was extended</div><div><span class="Apple-style-span" style="font-family:'courier new';">outlet.src.dir</span> points to <span class="Apple-style-span" style="font-family:'courier new';">src-gen</span>,</div><div><span class="Apple-style-span" style="font-family:'courier new';">outlet.src.pr.dir</span> points to <span class="Apple-style-span" style="font-family:'courier new';">src-gen-pr</span> and</div><div><span class="Apple-style-span" style="font-family:'courier new';">outlet.veto.pr.dir</span> points to <span class="Apple-style-span" style="font-family:'courier new';">veto</span>.</div><div><br /></div><div>Workflow Component „<span class="Apple-style-span" style="font-family:'courier new';">fileReplacer</span>“ (Replace files from <span class="Apple-style-span" style="font-family:'courier new';">src-gen-pr</span> ?)</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SgAaqSgPYbI/AAAAAAAAAiM/Euka3uUpQqY/s1600-h/workflow+file+replace.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SgAaqSgPYbI/AAAAAAAAAiM/Euka3uUpQqY/s400/workflow+file+replace.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5332291272630559154" style="cursor: pointer; width: 400px; height: 140px; " /></a></div><div><br /></div><div>A new Workflow Component compares corresponding files in <span class="Apple-style-span" style="font-family:'courier new';">veto</span> directory and <span class="Apple-style-span" style="font-family:'courier new';">src-gen-pr</span> directory and replaces modified ones.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">A short view inside the new Classes and Interfaces</span></div><div><br /></div><div>Class <span class="Apple-style-span" style="font-family:'courier new';">OutletWithVetoRedirection</span> (extends oAW <span class="Apple-style-span" style="font-family:'courier new';">Outlet</span>)</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SgAbsPVJooI/AAAAAAAAAic/1zk_I_Xyb4Q/s1600-h/outlet+with+vetoredirection+class.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SgAbsPVJooI/AAAAAAAAAic/1zk_I_Xyb4Q/s400/outlet+with+vetoredirection+class.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5332292405650104962" style="cursor: pointer; width: 400px; height: 396px; " /></a></div><div><br /></div><div>Interface <span class="Apple-style-span" style="font-family:'courier new';">VetoRedirectStrategy</span> (extends oAW <span class="Apple-style-span" style="font-family:'courier new';">VetoStrategy</span>)</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SgAbsLhBM6I/AAAAAAAAAik/NI0cI1f9EJs/s1600-h/interface+vetoredirectstrategy.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SgAbsLhBM6I/AAAAAAAAAik/NI0cI1f9EJs/s400/interface+vetoredirectstrategy.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5332292404626142114" style="cursor: pointer; width: 400px; height: 109px; " /></a></div><div><span class="Apple-style-span" style="font-family:'courier new';">vetoRedirectSourcePath</span> points to <span class="Apple-style-span" style="font-family:'courier new';">src-gen</span>,</div><div><span class="Apple-style-span" style="font-family:'courier new';">vetoRedirectOutputPath</span> points to <span class="Apple-style-span" style="font-family:'courier new';">veto</span></div><div><br /></div><div>Class <span class="Apple-style-span" style="font-family:'courier new';">CondGenVetoRedirectStrategy</span> (implements <span class="Apple-style-span" style="font-family:'courier new';">VetoRedirectStrategy</span>)</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SgAcFVLl4xI/AAAAAAAAAis/Yz97elOZCns/s1600-h/class+condGenVetoRedirectStrategy.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SgAcFVLl4xI/AAAAAAAAAis/Yz97elOZCns/s400/class+condGenVetoRedirectStrategy.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5332292836717355794" style="cursor: pointer; width: 400px; height: 277px; " /></a></div><div><span class="Apple-style-span" style="font-family:'courier new';"><br /></span></div><div><span class="Apple-style-span" style="font-family:'courier new';">hasVeto</span> always returns <span class="Apple-style-span" style="font-family:'courier new';">false</span> zurück, because we dont give a veto like from other VetoStrategies described by Heiko Behrens - we only want to redirect the Ouput Path into <span class="Apple-style-span" style="font-family:'courier new';">veto</span> Directory.</div><div><br /></div><div>Classe <span class="Apple-style-span" style="font-family:'courier new';">ReplaceVetoRedirectedFiles</span> (extends oAW <span class="Apple-style-span" style="font-family:'courier new';">AbstractWorkflowComponent2</span>)</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SgAcFvxRARI/AAAAAAAAAi0/E9-dQKcdtBY/s1600-h/class+replace+veto+redirects.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SgAcFvxRARI/AAAAAAAAAi0/E9-dQKcdtBY/s400/class+replace+veto+redirects.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5332292843854692626" style="cursor: pointer; width: 400px; height: 130px; " /></a></div><div><br /></div><div>Using <a href="http://commons.apache.org/io/">Apache Commons IO</a> its very easy to compare file-content and to copy files from one directory to another.</div><div><span class="Apple-style-span" style="font-family:'courier new';">outputFile</span> represents a file from <span class="Apple-style-span" style="font-family:'courier new';">veto</span>,</div><div><span class="Apple-style-span" style="font-family:'courier new';">sourceFile</span> represents a file from src-gen-pr</div><div><br /></div><div>-------------------------------------------------------------------------------------</div><div>Important hint:</div><div>I was inspired to write this blog after reading the excellent article from Heiko Behrens: „<a href="http://www.1160pm.net/2009/04/23/generation-gap-pattern/">Generation Gap Pattern</a>“.</div><div><br /></div><div>Heiko Behrens shows concrete solutions how to better handle „<a href="http://www.research.ibm.com/designpatterns/pubs/gg.html">Generation Gap Pattern (John Vlissides)</a>“ if using oAW (<a href="http://www.openarchitectureware.org/">openArchitectureWare</a>) Workflow und Xpand / XTend. This blog is not an alternate solution - only an extension !</div><div>-------------------------------------------------------------------------------------</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Summary</span></div><div><br /></div><div>From my point-of-view the use of „Protected Areas“ combined with „Conditional Generation“ can be very useful in some projects. <a href="http://www.infoq.com/articles/model-driven-dev-best-practices">Best Practises rules</a> are not broken.</div><div><br /></div><div>But as always: „Its Your Choice“ - it depends from project and use-cases what makes sense.</div><div><br /></div><div>Heiko Behrens showed some strategies - if you add my ProtectedRegion strategy, I think you'll find the right for your project - or perhaps its the starting point to try it out.</div><div><br /></div><div>Inside a big project there's no problem to use different strategies side-by-side.</div><div><br /></div><div>Hope I gave you some new ideas.</div><div><br /></div><div>ekke</div><div><br /></div><div><i><span class="Apple-style-span" style="font-size:small;">Blog in </span></i><a href="http://ekkes-ecke.org/"><i><span class="Apple-style-span" style="font-size:small;">german</span></i></a></div></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com0tag:blogger.com,1999:blog-5484177613731225131.post-42699378899484490082009-05-05T09:41:00.008+02:002009-05-05T09:54:49.764+02:00oAW goes Eclipse Modeling<a href="http://www.openarchitectureware.org/">openArchitectureWare</a><div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/Sf_uExrsPpI/AAAAAAAAAgs/R0puLNA0NjI/s1600-h/oaw-logo.gif"><img style="cursor:pointer; cursor:hand;width: 161px; height: 81px;" src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/Sf_uExrsPpI/AAAAAAAAAgs/R0puLNA0NjI/s400/oaw-logo.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5332242249653436050" /></a><br /><div><br /></div><div>goes --> <a href="http://www.eclipse.org/modeling/">Eclipse Modeling Project</a></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/Sf_uFPfezJI/AAAAAAAAAg0/yoguFZOV-No/s1600-h/eclipse_modeling_project.jpg"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/Sf_uFPfezJI/AAAAAAAAAg0/yoguFZOV-No/s400/eclipse_modeling_project.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5332242257655286930" style="cursor: pointer; width: 286px; height: 193px; " /></a></div><div>During the last months oAW (<a href="http://www.openarchitectureware.org/">openArchitectureWare</a>) was integrated into Eclipse projects - the so-named oAW 5.0 will be in reality the first oAW Eclipse release as part from <a href="http://www.eclipse.org/modeling/">Eclipse Modeling Project</a> inside the Galileo train:</div><div><br /></div><div><ul><li>oAW Workflow --> <a href="http://wiki.eclipse.org/Modeling_Workflow_Engine_(MWE)">Eclipse EMFT Modeling Workflow Engine (MWE)</a></li><li>oAW Xpand/Xtend --> <a href="http://www.eclipse.org/modeling/m2t/?project=xpand">Eclipse M2T Xpand</a></li><li>oAW Xtext --> <a href="http://wiki.eclipse.org/Xtext">Eclipse TMF Xtext</a></li></ul></div><div><br /></div><div>Starting with Eclipse 3.5 M7 it would be great if many oAW user will test, if oAW 4.3.1 projects are running well using Plugins from Eclipse Modeling. (if not please report Bugzillas)</div><div><br /></div><div>Perhaps someone will ask: why is there still an <a href="http://www.openarchitectureware.org/">openArchitectureWare</a> project, if all was moved to Eclipse into different projects from Eclipse Modeling ?</div><div><br /></div><div>Eclipse Modeling contains uncount sub-projects (see also <a href="http://it-republik.de/jaxenter/jax/">JAX</a> session from Jan Köhnlein „<a href="http://www.slideshare.net/schwurbel/eclipse-modeling-overview">Eclipse Modeling Overview</a>“). </div><div><br /></div><div>oAW is something like a distribution - a container of some sub-projects running well together - making it easier für users to find out out the right combination to build projects using oAW-like MDSD.</div><div><br /></div><div>oAW is also a very active community providing much KnowHow and Support for model-driven development - look at the forums <a href="http://www.openarchitectureware.org/forum/?menu=Forum">here</a>.</div><div><br /></div><div>There also exist some additional projects around oAW not moved to Eclipse - so try out the new Eclipse Modeling Workflow (MWE), Xpand (M2T) and Xtext (TMF) but stay tuned at <a href="http://www.openarchitectureware.org/">openArchitectureWare</a>.</div><div><br /></div><div>ekke</div><div><i><span class="Apple-style-span" style="font-size: small;">blog in </span></i><a href="http://ekkes-ecke.org"><i><span class="Apple-style-span" style="font-size: small;">german</span></i></a></div></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com2tag:blogger.com,1999:blog-5484177613731225131.post-35377755540794812042009-04-30T11:59:00.005+02:002009-04-30T12:12:01.508+02:00OSGI Enterprise Applications: Monster Bundles from 3rdParty<div>The (<a href="http://www.osgi.org/Main/HomePage">OSGI</a>) world could be so wonderful, all are brave OSGI citizens:</div><div><br /></div><div><ul><li>one JAR file == one Bundle</li><li>import-package used for common dependencies</li><li>(required-bundles if used only in the own namespace)</li><li>...</li></ul></div><div><br /></div><div>If you have to develope OSGI Enterprise Business Applications, then in most cases you have to integrate 3rdParty bundles, - projects, -frameworks.</div><div><br /></div><div>And then it can happen, that a 3rdParty project looks good on the very first view: some bundles, well structured, dependencies make sense, but..... why is this core bundle so big ?</div><div><br /></div><div><br /></div><div>Here you'll find the answer: „<a href="http://vimeo.com/4389585">looking into 3rdParty OSGI bundles</a>“</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/Sfl2_VQtCuI/AAAAAAAAAgk/fFKa8H35KRg/s1600-h/thumb2.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/Sfl2_VQtCuI/AAAAAAAAAgk/fFKa8H35KRg/s400/thumb2.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5330422464380734178" style="cursor: pointer; width: 394px; height: 358px; " /></a></div><div>Perhaps the Composite Bundles from upcoming OSGI R4.2 (<a href="http://dev.eclipse.org/mhonarc/lists/eclipse-dev/msg08483.html">here</a> and <a href="http://www.eclipsecon.org/2009/sessions?id=534">here</a> and Richard Halls <a href="http://it-republik.de/konferenzen/ext_scripts/v2/php/sessions-popup.php?module=jax&id=10109">Session</a> at JAX09) can help to encapsulate such monster bundles ? I'll try and report....</div><div><br /></div><div>ekke</div><div><i><span class="Apple-style-span" style="font-size:small;">blog in </span></i><a href="http://ekkes-ecke.org/"><i><span class="Apple-style-span" style="font-size:small;">german</span></i></a></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com0tag:blogger.com,1999:blog-5484177613731225131.post-19089918845226963442009-04-30T11:05:00.008+02:002009-04-30T12:08:38.189+02:00JAX09 - HowTo build an OSGI EJB3 Server - Slides online<div>Last week I was at <a href="http://it-republik.de/jaxenter/jax/">JAX</a> conference in Mainz - as always some great days. Most important for me are discussions with friends and networking.</div><div><br /></div><div>On Friday at <a href="http://it-republik.de/jaxenter/jax/sessions/?tid=1177">OSGI Experts Day</a> I had a session and could give an overview of my OSGI EJB3 server:</div><div><br /></div><div>Session "<a href="http://vimeo.com/channels/ekkescorner">HowTo build an OSGI EJB3 Server</a>"</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SflqYNylW3I/AAAAAAAAAgc/cDgT1KBVT7s/s1600-h/thumb1.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SflqYNylW3I/AAAAAAAAAgc/cDgT1KBVT7s/s400/thumb1.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5330408598220921714" style="cursor: pointer; width: 202px; height: 153px; " /></a></div><div><br /></div><div><ul><li><a href="http://eclipse.org/">Eclipse</a> as IDE and Platform for RCP and Server</li><li><a href="http://www.osgi.org/Main/HomePage">OSGI</a> - <a href="http://www.eclipse.org/equinox-portal/">Equinox</a></li><li>Eclipse <a href="http://www.eclipse.org/pde/">PDE</a> (OSGI Bundle Tooling)</li><li>Eclipse <a href="http://www.eclipse.org/riena/">Riena</a> (Remoting, UI)</li><li><a href="http://wiki.easybeans.org/xwiki/bin/view/Main/WebHome">EasyBeans</a> (EJB3 OSGI Bundles)</li><li><a href="http://drools.org/index.html">Drools</a> (Rules Engine, Business-ProcessFlow)</li><li><a href="http://redview.org/">redView</a> (Riena EMF Dynamic Views)</li><li><a href="http://open-erp-ware.org/">open-erp-ware</a> (OSGI - ERP - Enterprise Application)</li><li>Model-Driven Development (oAW - <a href="http://www.openarchitectureware.org/">OpenArchitectureWare</a> XPand, XTend, Xtext, Workflow)</li><li>and more...</li></ul></div><div><br /></div><div>Uploaded the slides, so you can watch them here:</div><div><br /></div><div><ul><li><a href="http://www.slideshare.net/ekkescorner/howto-build-an-osgi-ejb3-server-1362873">SlideShare</a> (without embedded Screencasts)</li><li><a href="http://www.vimeo.com/4392331">Vimeo</a> (as HD Video inclusive Quicktime Screencasts)</li></ul></div><div><br /></div><div>Next days I'll produce some episodes for my VideoPodcasts at <a href="http://ekkes-corner-tv.org/">ekkes-corner-tv.org</a> and publish the session with audio added and some more details.</div><div><br /></div><div>ekke</div><div><span class="Apple-style-span" style="font-size:small;">blog in </span><i><span class="Apple-style-span" style="font-size:small;">german</span></i></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com0tag:blogger.com,1999:blog-5484177613731225131.post-80395021527616167582009-04-08T22:48:00.010+02:002009-04-08T23:34:02.436+02:00redView - Dynamic Views for Business Applications<div>This year at <a href="http://www.eclipsecon.org/2009/">EclipseCon</a> in Santa Clara I presented first time the new Open Source project "<span class="Apple-style-span" style="color:#FF0000;"><a href="http://redview.org/">red</a></span><a href="http://redview.org/">View</a>" - started from Florian Pirchner and me.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/Sd0V9GDpCeI/AAAAAAAAAfk/gtyxiQ6G7Ho/s1600-h/Dynamic+Views+for+Business+Applications_en-poster.jpg"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/Sd0V9GDpCeI/AAAAAAAAAfk/gtyxiQ6G7Ho/s400/Dynamic+Views+for+Business+Applications_en-poster.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5322434473963882978" style="cursor: pointer; width: 400px; height: 300px; " /></a></div><div><br /></div><div>The <a href="http://www.eclipsecon.org/2009/sessions?id=391">session</a> was presented without the usual "slides-to-read-while-speaker-speaks". I was inspired by the book "Zen and the Art of Presentation" to make another kind of presentation.</div><div><br /></div><div>But if you present a session in Zen - style, you couldn't only publish your slides to people not hearing you live. A Zen - style - session is only the half of work - you also have to publish detailed technical informations in an extra document.</div><div><br /></div><div>In this case - those details will be published soon at <span class="Apple-style-span" style="color:#FF0000;"><a href="http://redview.org/">red</a></span><a href="http://redview.org/">view</a>.org to download. </div><div><br /></div><div>If you were not at EclipseCon or visited another slot and want to know what I have presented, you're not lost - you can watch a Video Podcast:</div><div><br /></div><div><span class="Apple-style-span" style="font-size:x-large;">ekkes - corner - tv just started</span></div><div><br /></div><div>As an addition to my blogs in english and german language now I also will publish regular an english Video Podcast at <a href="http://ekkes-corner-tv.org/">ekkes - corner - tv.org</a>:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/Sd0V8-WmrSI/AAAAAAAAAfc/EfddST815Ww/s1600-h/ekkes-corner-tv.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/Sd0V8-WmrSI/AAAAAAAAAfc/EfddST815Ww/s400/ekkes-corner-tv.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5322434471895936290" style="cursor: pointer; width: 400px; height: 252px; " /></a></div><div><br /></div><div>I'll talk about and make live-demos about:</div><div><br /></div><div><ul><li>Eclipse as IDE and Platform for RCP and Server</li><li>OSGI - Equinox</li><li>Eclipse PDE (OSGI Bundle Tooling)</li><li>Eclipse Riena (Remoting, UI)</li><li>EasyBeans (EJB3 OSGI Bundles)</li><li>Drools (Rules Engine, Business Process Flows)</li><li>redView (Riena EMF Dynamic Views)</li><li>open-erp-ware (OSGI - ERP - Enterprise Application)</li><li>Model-Driven Development (oAW - OpenArchitectureWare XPand, XTend, Xtext, Workflow)</li><li>and more...</li></ul></div><div><br /></div><div>If you want to subscribe my Video Podcast:</div><div><br /></div><div>open iTunes Store, search for „ekkes-corner“ and subscribe. There are two different formats available: for<a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=311645152"> iPod/iPhone</a> and for <a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=311645441">Desktop/AppleTV</a>). </div><div><br /></div><div>If you don't use iTunes Store you can read it directly from my web site: <a href="http://ekkes-corner-tv.org/">ekkes-corner-tv.org</a> or subscribe RSS Feed from there.</div><div><br /></div><div>The first episode presents the <span class="Apple-style-span" style="color:#FF0000;"><a href="http://www.eclipsecon.org/2009/sessions?id=391">red</a></span><a href="http://www.eclipsecon.org/2009/sessions?id=391">View Session</a> from EclipseCon.</div><div><br /></div><div>EclipseCon was as usual: very short nights - but also much fun to meet all the friends again and to learn much.</div><div><br /></div><div>Next months will be very hard:</div><div><br /></div><div><ul><li>redView should be published beginning of may 2009</li><li>my OSGI - Equinox - Server should run under Galileo</li><li>my ERP Enterprise App should go live in summer 2009 </li></ul></div><div><br /></div><div>Not to forget: this month is JAX 2009 in Mainz (Germany) where I speak at <a href="http://it-republik.de/jaxenter/jax/sessions/?tid=1177">OSGI Experts Day</a></div><div><br /></div><div>There will be some Blogs and Video Podcasts to reflect all this work... stay tuned...</div><div><br /></div><div>ekke</div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com2tag:blogger.com,1999:blog-5484177613731225131.post-91091626878886451582009-03-19T20:13:00.011+01:002009-03-19T20:47:38.189+01:00Using RCP Views to view UML Diagrams ?<div>Who doesn't know this: </div><div><br /></div><div>You as Software Architect have listen to your business users requirements and designed such great UML diagrams - and now you present them proudly - but your business users don't understand what you designed. They couldn't imagine what all those dependencies, relations, inheritance, 0..1, 0..* mean.</div><div></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/ScKa3nVs2oI/AAAAAAAAAec/PnS5UhMRomw/s1600-h/uml.jpg"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/ScKa3nVs2oI/AAAAAAAAAec/PnS5UhMRomw/s400/uml.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5314980790494091906" style="cursor: pointer; width: 400px; height: 300px; " /></a></div><div><br /></div><div>What if you could generate by-magic RCP views directly from your UML model ? </div><div><br /></div><div>...and your business users can understand what your diagrams mean and also see those little hidden secrets from properties like "length of a String" causing the RCP View to show a single line or multi-line text field ?</div><div><br /></div><div> ...or showing fields marked as index as required with yellow background ?</div><div><br /></div><div>...or showing your Enumerations as SingleChoices or Combos ?</div><div><br /></div><div><span class="Apple-style-span" style="font-size: x-large;">Utopia ?</span></div><div><br /></div><div>No - this is the way to realize it:</div><div><br /></div><div>use <a href="http://www.openarchitectureware.org/">openArchitectureWare</a> to generate from your UML Model Java Code, Configuration Files, EMF Models and more</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/ScKa3r3EFxI/AAAAAAAAAeU/HCGjX7UZdKU/s1600-h/oaw-logo.gif"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/ScKa3r3EFxI/AAAAAAAAAeU/HCGjX7UZdKU/s400/oaw-logo.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5314980791707768594" style="cursor: pointer; width: 161px; height: 81px; " /></a></div><div><br /></div><div>use <a href="http://redview.org/">redView</a> to auto-magically generate dynamic Views from your EMF Models</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/ScKdXU9zfqI/AAAAAAAAAfE/DI_gDp4L-As/s1600-h/128x128_RV.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/ScKdXU9zfqI/AAAAAAAAAfE/DI_gDp4L-As/s400/128x128_RV.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5314983534341095074" style="cursor: pointer; width: 128px; height: 128px; " /></a></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/ScKa3eQynFI/AAAAAAAAAeE/lPjzIaKfQbo/s1600-h/container_redview_de.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/ScKa3eQynFI/AAAAAAAAAeE/lPjzIaKfQbo/s400/container_redview_de.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5314980788057578578" style="cursor: pointer; width: 400px; height: 374px; " /></a></div><div>(Hint: the first 3 TabItems represent 0..1 or 1..1 associations, the last two TabItems contain a Table and represent 0..* or 1..* associations)</div><div><br /></div><div><span class="Apple-style-span" style="font-size: x-large;">Curious ?</span></div><div><br /></div><div>Then visit on Thursday at 2:30pm Room 206 Session</div><div><br /></div><div><a href="http://www.eclipsecon.org/2009/sessions?id=391">Dynamic Views for Business Applications (Riena + Eclipse Modeling: EMF, oAW)</a></div><div><br /></div><div>at <a href="http://www.eclipsecon.org/2009/">EclipseCon</a>!</div><div><br /></div><div>redView is a part of a complex enterprise solution - if you want to know more about my OSGI - Equinox - Riena - Easybeans Serverproject please visit JAX09 in Germany and book the <a href="http://it-republik.de/jaxenter/jax/sessions/?tid=1177">OSGI ExpertsDay</a>.</div><div><br /></div><div>ekke</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/ScKa3uAoQzI/AAAAAAAAAek/oi6FW-agcks/s1600-h/de.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/ScKa3uAoQzI/AAAAAAAAAek/oi6FW-agcks/s400/de.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5314980792284758834" style="cursor: pointer; width: 16px; height: 11px; " /></a> blog in <a href="http://web.mac.com/ekkehard.gentz/ekkes-corner/blog/Einträge/2009/3/19_Mit_RCP_Views_UML_Diagramme_betrachten.html">german</a></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com6tag:blogger.com,1999:blog-5484177613731225131.post-31487118736421242182009-01-29T15:13:00.008+01:002009-01-29T15:30:13.286+01:00Books and Conferences for Eclipse Plug-in Developers<div>Here are my Top 3 of new published books I'm using in my daily work of developing Eclipse Plug-ins in a model-driven way...<br /></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SYG6eeMR69I/AAAAAAAAAdQ/2MKS9afjV50/s1600-h/eclipse+books_.jpg"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SYG6eeMR69I/AAAAAAAAAdQ/2MKS9afjV50/s400/eclipse+books_.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5296719669427825618" style="cursor: pointer; width: 400px; height: 342px; " /></a><br /></div><div><ul><li>OSGI Service Compendium<br /></li><li>EMF - Eclipse Modeling Framework<br /></li><li>eclipse Plug-Ins<br /></li></ul></div><div><br /></div><div>... now I only have to wait for the announced books of RCP and OSGI/Equinox - developing ;-)</div><div><br /></div><div>Yesterday I met Eric Clayberg and Dan Rubel in munich and received one copy of their new „eclipse Plug-ins“ book. Because I couldn't wait, I already had bought it two weeks ago. Now Florian Pirchner has luck, because he'll get this one - think he can use it for his work on redView (Riena EMF Dynamic View).</div><div><br /></div><div>Also good news for UI developers using Riena Ridgets: the integration / code generation from SWTDesigner will be better in the near future, Eric told me.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SYG8I1D1NaI/AAAAAAAAAdw/1LAjjmGlZvU/s1600-h/swtDesigner.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SYG8I1D1NaI/AAAAAAAAAdw/1LAjjmGlZvU/s400/swtDesigner.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5296721496632538530" style="cursor: pointer; width: 130px; height: 21px; " /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SYG6euOoQAI/AAAAAAAAAdY/o8fMd4ArQtY/s1600-h/riena_ei.jpg"></a></div><div> <span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="font-size: x-large;">+</span></span></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SYG6euOoQAI/AAAAAAAAAdY/o8fMd4ArQtY/s1600-h/riena_ei.jpg"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SYG6euOoQAI/AAAAAAAAAdY/o8fMd4ArQtY/s400/riena_ei.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5296719673732644866" style="cursor: pointer; width: 160px; height: 240px; " /></a><br /></div><div><br /></div><div>BTW: Who doesn't know: <a href="http://www.eclipse.org/riena/">Riena</a> is read-to-go for version 1.0. Congratulation !</div><div><br /></div><div>We' ll also try to make it easy to insert dynamic SWT Components (generated from redView) into SWTDesigner.</div><div><br /></div><div>Then you'll be able to design complex views using a comfortable GUI Designer and also include dynamic Components (like adress fields, ...) ... of course including databinding, Riena Markers and more.</div><div><br /></div><div>If you're going to <a href="http://www.eclipsecon.org/2009/">EclipseCon</a> dont miss our session about redView:</div><div><a href="http://www.eclipsecon.org/2009/sessions?id=391">Dynamic Views for Business Applications (Riena + Eclipse Modeling: EMF, oAW) </a></div><div><br /></div><div>And if you couldn't make it or you want to know something more about the whole project - you can come to my session at <a href="http://it-republik.de/jaxenter/jax/">JAX 09</a> / <a href="http://it-republik.de/jaxenter/eclipseforumeurope/">Eclipse Forum Europe 09</a> conference - <a href="http://it-republik.de/jaxenter/jax/sessions/?tid=1177"> OSGI Experts Day</a>:</div><div><a href="http://it-republik.de/konferenzen/efe/sessions/efe/speaker/#633">How to build an OSGI Enterprise EJB3 Server</a>.</div><div><br /></div><div>ekke</div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com0tag:blogger.com,1999:blog-5484177613731225131.post-27069718620165475562009-01-21T15:30:00.007+01:002009-01-21T17:25:22.341+01:00UserInterface in OSGI Enterprise Applications<div>Christmas time is over...</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SXdIhQxLLdI/AAAAAAAAAZc/svOH1NCuKYI/s1600-h/weihnachtsessen.jpg"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SXdIhQxLLdI/AAAAAAAAAZc/svOH1NCuKYI/s400/weihnachtsessen.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5293779623271411154" style="cursor: pointer; width: 301px; height: 197px; " /></a><br /></div><div>... and so its time to publish something. The last weeks ware filled with hard and intensive work to make my OSGI Enterprise Application run. Main work at the moment is the design of the Userinterface(GUI).</div><div><br /></div><div>One part of the GUI - development I'll present at EclipseCon 2009, together with Florian, the Plug-In developer of redView. (redView = Riena - EMF - Dynamic Views)</div><div><br /></div><div>The idea to create the redView project was born some months ago, as I was discussing with Florian the problems to design a GUI for a complex ERP Enterprise solution. Such an Enterprise Application with hundreds of Entities and high quality and comfort for the users to work with should be designed using a GUI Designer.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SXdIji8qoOI/AAAAAAAAAZ8/dO1gDBGu540/s1600-h/name-sm-swtd.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SXdIji8qoOI/AAAAAAAAAZ8/dO1gDBGu540/s400/name-sm-swtd.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5293779662511186146" style="cursor: pointer; width: 130px; height: 21px; " /></a><br /></div><div>I decided to use <a href="http://www.instantiations.com/windowbuilder/swtdesigner/">SWTDesigner from Instantiations</a> as GUI Designer tool - from my experiences a really great application.</div><div><br /></div><div>An ERP Enterprise Application has many high specialized windows (views), but also hundreds of standard - views. Standard views are looking same and most parts of the views can be generated from the Entity - data model.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SXdLSmdUmkI/AAAAAAAAAas/3qJ6E-ySPY0/s1600-h/oaw-logo.gif"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SXdLSmdUmkI/AAAAAAAAAas/3qJ6E-ySPY0/s400/oaw-logo.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5293782669930568258" style="cursor: pointer; width: 161px; height: 81px; " /></a><br /></div><div>Because my ERP Application is model-driven (using <a href="http://www.openarchitectureware.org/">openArchitectureWare</a>) the first idea was to generate the Java code of those views. </div><div><br /></div><div>But if you generate Views there will be always usecases where the business user wants to change "only something". If you do this using SWTDesigner then the Java code will be changed and cannot be generated again. So its difficult to manage this, if the model changes, attributes were added or so. Of course its a good idea to generate the first version of the views to make it easier to start designing. </div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SXdLSobPWmI/AAAAAAAAAak/bh1yVBuFSN4/s1600-h/riena_ei.jpg"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SXdLSobPWmI/AAAAAAAAAak/bh1yVBuFSN4/s400/riena_ei.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5293782670458706530" style="cursor: pointer; width: 160px; height: 240px; " /></a><br /></div><div>My OSGI Enterprise Application already uses <a href="http://www.eclipse.org/riena/">Eclipse Riena</a> for Remote OSGI Services. Riena also has some nice things if you're devloping a GUI.</div><div><br /></div><div>Riena makes the programming of UI easier and uses Ridgets (encapsulated SWT Widgets). You dont lose flexibility because if you need it, you can access the SWT widgets, too. </div><div><br /></div><div>Riena Ridgets also separate UI and Controller and make configuring Eclipse Databinding much easier. </div><div><br /></div><div>In Enterprise Businessapplications you always have to decide:</div><div><br /></div><div><ul><li>should this element be displayed ? (depends on Usecase or Data)<br /></li><li>is this element required ? (the user must enter data)<br /></li><li>is it a read-only element ?<br /></li><li>are there validation rules for this field ? (Phonenumber, email, from-to value, date, ...)<br /></li></ul></div><div><br /></div><div>Riena provides the concept of Marker and Validation making programming these things also much easier- and you're sure that it will always look the same in your whole application.</div><div><br /></div><div>If the code was generated you'll get some informations for Markers and Validation already from the Entity model or Business-Process model. (An attribute marked as Businesskey or Index should be a required field) So you'll get many defaults generated.</div><div><br /></div><div>If you're using Riena there are some problems designing with SWTDesigner, because the code generated from SWT Designer doesnt know the Riena - concept of splitting Controller und UI - but hopefully in the future the integration will become better.</div><div><br /></div><div>Riena also includes a complete UI concept with own LookAndFeel, navigation and nice designed perspectives, where a perspective can be a subapplication of the enterprise application. </div><div><br /></div><div>The Riena UI is clear, easy-to-use and doesn't confuse a business user with all the functionality of Eclipse RCP. But (for me) there's a downside of this concept: Riena always has only one View open at a fix position. There are many UseCases in an ERP Application where I need more then one View opened including Drag'n'Drop between the Views. I'll see if there will be ways in the future to combine this, because I would like to use some of the cool things Riena provides for UI - development.</div><div><br /></div><div>But all of this is no answer how to design Views of Enterprise Applications in model-driven frameworks: what can be generated without losing flexibility in design ?</div><div><br /></div><div>So we're back at my discussions with Florian last autumn. Our vision:</div><div><br /></div><div><span class="Apple-style-span" style="font-style: italic;">Wouldn't it be great to have a GUI including all the comfort from Riena, dynamically created at runtime depending on an EMF Metamodel ?</span></div><div><span class="Apple-style-span" style="font-style: italic;"><br /></span></div><div><span class="Apple-style-span" style="font-style: italic;">... and these EMF models for each View itself are generated using openArchitectureWare from UML Entity- and Businessprocess - models ?</span></div><div><span class="Apple-style-span" style="font-style: italic;"><br /></span></div><div><span class="Apple-style-span" style="font-style: italic;">... and having a graphical designer - editor, where a business user or - programmer can easyli change the generated Views ? (Drag and Drop to change the order / position of elements, add or change validation rules, add or change Riena Markers, Fonts, Colors,....)</span></div><div><span class="Apple-style-span" style="font-style: italic;"><br /></span></div><div><span class="Apple-style-span" style="font-style: italic;">... and wouldn't it be great to combine these changed EMF models with changes from UML models next time generating the Views again ?</span></div><div><br /></div><div>This was a vision in october 2008 - now we're knowing that it works ( I already generated some hundred Views for the ERP project successfully) and we'll present it at EclipseCon 2009:</div><div><a href="http://www.eclipsecon.org/2009/sessions?id=391">Dynamic Views for Business Applications (Riena + Eclipse Modeling: EMF, oAW)</a> </div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SXdJFVWC2xI/AAAAAAAAAaE/MR1B1hDWFL0/s1600-h/mitarbeiter+uml.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SXdJFVWC2xI/AAAAAAAAAaE/MR1B1hDWFL0/s400/mitarbeiter+uml.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5293780242975087378" style="cursor: pointer; width: 305px; height: 329px; " /></a></div><div>an Entity in UML class diagram (MagicDraw)<br /></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SXdJFc2OSaI/AAAAAAAAAaU/kF7_5uD2HDQ/s1600-h/create+labeled+entry.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SXdJFc2OSaI/AAAAAAAAAaU/kF7_5uD2HDQ/s400/create+labeled+entry.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5293780244989102498" style="cursor: pointer; width: 400px; height: 121px; " /></a></div><div>oAW Xtend creates EMF elements using UML model with JPA Persistence Profile<br /></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SXdIjFEBZWI/AAAAAAAAAZk/vnIB5DC15So/s1600-h/UI+Designer+Required.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SXdIjFEBZWI/AAAAAAAAAZk/vnIB5DC15So/s400/UI+Designer+Required.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5293779654488974690" style="cursor: pointer; width: 400px; height: 94px; " /></a></div><div>redView Designer with generated elements - the yellow marked entry field indicates a Riena Marker „required“<br /></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SXdIjutfYFI/AAAAAAAAAZ0/A6udRmGjt9c/s1600-h/outline+required.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SXdIjutfYFI/AAAAAAAAAZ0/A6udRmGjt9c/s400/outline+required.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5293779665668759634" style="cursor: pointer; width: 237px; height: 212px; " /></a></div><div>EMF Outline View with generated elements<br /></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SXdIjT7VtGI/AAAAAAAAAZs/7FvVaqFIsis/s1600-h/properties+required.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SXdIjT7VtGI/AAAAAAAAAZs/7FvVaqFIsis/s400/properties+required.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5293779658479088738" style="cursor: pointer; width: 400px; height: 89px; " /></a></div><div>The Properties View of one GUI element.<br /></div><div><br /></div><div>Its still some work to finish all aspects of databinding, I18N, Platform - independence (at the moment tested on OSX and Windows), and using Styles and Themes.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SXdJFbbkmsI/AAAAAAAAAaM/_iu5rdWrdtk/s1600-h/flo+und+ekke.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SXdJFbbkmsI/AAAAAAAAAaM/_iu5rdWrdtk/s400/flo+und+ekke.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5293780244608883394" style="cursor: pointer; width: 306px; height: 211px; " /></a><br /></div><div><br /></div><div><br /></div><div>Hard weeks, short nights, bit it's fun to work with Florian and to make a vision reality.<br /></div><div><br /></div><div>Now these are the ways to design the GUI of my ERP Enterprise Application:</div><div><br /></div><div><ul><li>Standard Views will be generated using oAW as EMF models<br /></li><li>redView creates dynamic Views from these EMF models<br /></li><li>Spezial Views can be generated first times from oAW<br /></li><li>Standard Views can be designed using redView Designer<br /></li><li>Spezial Views will be designed using SWTDesigner<br /></li><li>Riena Ridgets, Marker and Validation is used<br /></li></ul></div><div><br /></div><div>The last years I was using EMF only indirectly and all my generation of code and artifacts using oAW was based on UML. No I reached the EMF world as so many others, too ;-)</div><div><br /></div><div>The flexibility of EMF and the good integration into oAW is really great - it is so easy to work with UML and EMF together.</div><div><br /></div><div>I'll report in detail about all different aspects of designing UI in Enterprise Applications from my point of view. Because its a complex story, I started a new blog series "UI in OSGI Enterprise Applications". Of course I'll also compare the pros and cons using some of the other great UI projects or how to combine them.</div><div><br /></div><div>... stay tuned.</div><div><br /></div><div>... the other blog series about Logging, Server, Declarative Services will also be continued - all belongs together.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SXdLStYsI-I/AAAAAAAAAac/vO5rKWSFPuw/s1600-h/130x100_speaking_dark_trans.gif"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SXdLStYsI-I/AAAAAAAAAac/vO5rKWSFPuw/s400/130x100_speaking_dark_trans.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5293782671790187490" style="cursor: pointer; width: 130px; height: 100px; " /></a><br /></div><div>ekke</div><div><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-style: italic;"><a href="http://ekkes-ecke.org">the blog in german</a></span></span></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com0tag:blogger.com,1999:blog-5484177613731225131.post-40532354322220421292008-12-18T12:13:00.007+01:002008-12-18T12:35:47.848+01:00EclipseCON 2009 Riena - EMF - oAW and more<div>This time I'll not only visit the eclipseCON - one of my submissions was accepted:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SUo1N4oWHMI/AAAAAAAAAZM/EgALK71ejoI/s1600-h/130x100_speakingEC2009.gif"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SUo1N4oWHMI/AAAAAAAAAZM/EgALK71ejoI/s400/130x100_speakingEC2009.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5281092025701506242" style="cursor: pointer; width: 130px; height: 100px; " /></a><br /></div><div><a href="http://www.eclipsecon.org/2009/sessions?id=391">Dynamic Views for Business Applications (Riena + Eclipse Modeling: EMF, oAW)</a></div><div><br /></div><div>I'm very happy about this. This was the second really good news last time - first was at german <a href="http://www.wjax.de/">W-Jax</a> where I became a member of the oAW Team.</div><div><br /></div><div><span class="Apple-style-span" style="font-style: italic;">redView</span> (Riena - EMF - Dynamic View) is a sub-project of my model-driven OSGI Enterprise Application. <span class="Apple-style-span" style="font-style: italic;">redView</span> will be Open Source (EPL). Dynamic views from <span class="Apple-style-span" style="font-style: italic;">redView</span> can be used stand-alone or in combination with <span class="Apple-style-span" style="font-style: italic;">openArchitectureWare (oAW)</span>. ... I'll talk more about this next weeks </div><div><br /></div><div>This week was a heavy update - week: </div><div><br /></div><div><ul><li>OSX 10.5.6<br /></li><li>MagicDraw 16.0<br /></li><li>openArchitectureWare 4.3.1RC3 und RC4<br /></li><li>Riena M6<br /></li><li>EasyBeans 1.1.0 Snapshots<br /></li></ul></div><div>Thanks to EasyBeans - Team (they added some properties for Declarative Services) I can continue my work to switch from ServiceTracker to Declarative Servics (DS) and there'll be new blogs also coming soon.</div><div><br /></div><div>stay tuned...</div><div><br /></div><div>ekke</div><div><span class="Apple-style-span" style="font-size:small;"><span class="Apple-style-span" style="font-style: italic;">BTW: dont wonder if my submission 391 has no author. I tried to add my assistant as co-author, got an error and now the submissions has lost author and assistant. reported a bugzilla..</span>.</span></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com2tag:blogger.com,1999:blog-5484177613731225131.post-91859893422675922712008-12-10T16:16:00.013+01:002008-12-10T16:38:04.039+01:00Logging in OSGI Enterprise Applications, Part 6<div>This part of my blog series "<span class="Apple-style-span" style="font-style: italic;">Logging in OSGI Enterprise Applications</span>" will talk about <a href="http://www.openarchitectureware.org">openArchitectureWare</a> </div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST_eMzw5aXI/AAAAAAAAAYE/Ro7Sdk0rT7o/s1600-h/oaw-logo.gif"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST_eMzw5aXI/AAAAAAAAAYE/Ro7Sdk0rT7o/s400/oaw-logo.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5278181599936604530" style="cursor: pointer; width: 161px; height: 81px; " /></a><br /></div><div><br /></div><div>...and logging with <a href="http://www.slf4j.org/">SLF4J</a> / <a href="http://logback.qos.ch/">LogBack</a>.<br /></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST_eMohy5zI/AAAAAAAAAX8/VncqXR6pmik/s1600-h/slf4j-logo.jpg"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST_eMohy5zI/AAAAAAAAAX8/VncqXR6pmik/s400/slf4j-logo.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5278181596920473394" style="cursor: pointer; width: 305px; height: 130px; " /></a><br /></div><div>The previous blog entries from this series described logging from the Runtime of an OSGI Enterprise Application. The whole Client / Server Project is model-driven based on Eclipse Modeling Project: EMF, UML2 and as engine the generator framework openArchitectureWare. </div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/ST_ecU0Km9I/AAAAAAAAAYU/umQgoybB6DE/s1600-h/eclipse+and+workspaces.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/ST_ecU0Km9I/AAAAAAAAAYU/umQgoybB6DE/s400/eclipse+and+workspaces.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5278181866506722258" style="cursor: pointer; width: 377px; height: 400px; " /></a><br /></div><div>The MDSD - aspects of the application will be part of another blog series.</div><div><br /></div><div>Now we want to take a look at logging with SLF4J / LogBack while working with openArchitectureWare.</div><div><br /></div><div><span class="Apple-style-span" style="font-size: large;">openArchitectureWare (oAW) in Target Platforms</span></div><div><br /></div><div>If you want to use oAW in a Target Platform with SLF4J / LogBack as Logging Framework together with bridges to Commons Logging and Log4J, you'll notice some problems: Many of the oAW bundles are using Require - Bundles instead of Import - Packages as dependency to logging bundles.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST_e_QiLQmI/AAAAAAAAAYc/WFdq0GN1N6c/s1600-h/oaw+req+bdle.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST_e_QiLQmI/AAAAAAAAAYc/WFdq0GN1N6c/s400/oaw+req+bdle.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5278182466652947042" style="cursor: pointer; width: 400px; height: 165px; " /></a><br /></div><div><br /></div><div>I opened a <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=257828">Bugzilla</a>, but it seems its too late for 4.3.1.</div><div><br /></div><div>If you need it now, thanks to PDE its easy: Import Bundles in your Workspace, change Dependencies to Import Package, then export the Bundle als Plug-In again.</div><div><br /></div><div><span class="Apple-style-span" style="font-size: large;">openArchitectureWare (oAW) Workflows</span></div><div><br /></div><div>There's an own Launcher for oAW Workflows (<span class="Apple-style-span" style="font-family: verdana;">Run Configurations | oAW Workflow</span>) - we have to change the Classpath:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/ST_e__FmpBI/AAAAAAAAAYs/gICetLWx_zs/s1600-h/workflow_run_cp0.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/ST_e__FmpBI/AAAAAAAAAYs/gICetLWx_zs/s400/workflow_run_cp0.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5278182479149573138" style="cursor: pointer; width: 400px; height: 146px; " /></a><br /></div><div>Click on <span class="Apple-style-span" style="font-style: italic;">User Entries</span> and then <span class="Apple-style-span" style="font-style: italic;">Add Projects...</span></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/ST_e_108zFI/AAAAAAAAAY0/OMWZ0yOLmqs/s1600-h/workflow_run_cp0-5.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/ST_e_108zFI/AAAAAAAAAY0/OMWZ0yOLmqs/s400/workflow_run_cp0-5.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5278182476663802962" style="cursor: pointer; width: 360px; height: 400px; " /></a><br /></div><div>...choose the Logging - Projekts from workspace</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/ST_fAcG1PiI/AAAAAAAAAY8/U5PKwl_POpk/s1600-h/workflow_run_cp1.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/ST_fAcG1PiI/AAAAAAAAAY8/U5PKwl_POpk/s400/workflow_run_cp1.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5278182486939352610" style="cursor: pointer; width: 400px; height: 330px; " /></a><br /></div><div>...and save changes with <span class="Apple-style-span" style="font-style: italic;">Apply</span>.</div><div><br /></div><div>You have to put the <span class="Apple-style-span" style="font-family: 'courier new';">logback.xml</span> (or<span class="Apple-style-span" style="font-family: 'courier new';"> logback-test.xml</span>) directly under <span class="Apple-style-span" style="font-family: 'courier new';">src/ </span>into the project which starts the oAWworkflow. In this xml file we configure the logging from the workflow - doesn't matter if the logoutput was originally sent to Log4J, Commons-Logging or OSGI LogServices.</div><div><br /></div><div>To control please start a Workflow with <span class="Apple-style-span" style="font-family: 'courier new';">debug="true"</span> in <configuration debug="true">your <span class="Apple-style-span" style="font-family: 'courier new';">logback.xml</span>.</configuration></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/ST_e_qWPQJI/AAAAAAAAAYk/rxK_pClta8U/s1600-h/wf_console_w_logback.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/ST_e_qWPQJI/AAAAAAAAAYk/rxK_pClta8U/s400/wf_console_w_logback.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5278182473582198930" style="cursor: pointer; width: 400px; height: 147px; " /></a><br /></div><div><br /></div><div>If all is configured right, then the Console will list at first the logback - configuration and then all log - output from the Workflow sent to our configured Appender (Console, Socket, usw)</div><div><br /></div><div><br /></div><div>Blog Series "<span class="Apple-style-span" style="font-style: italic;">Logging in OSGI Enterprise Applications</span>":</div><div><br /></div><div>Part 1: <a href="http://ekkes-corner.blogspot.com/2008/09/logging-in-osgi-enterprise-applications.html">An overview</a></div><div>Part 2: <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications.html">How to catch all log events from "classic" logging - frameworks</a></div><div>Part 3: <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications_11.html">How to catch all log events from OSGI Log Services </a></div><div>Part 4: <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications_20.html">How to start logging bundles the right way inside an OSGI Enterprise application</a></div><div>Part 5: <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications_31.html">Configuration, Fragment-Bundles, Markers</a></div><div>Part 6: Logging and openArchitectureWare Workflows</div><div>Part 7: ... follows (Stay tuned...)</div><div><br /></div><div>Perhaps some of my older blogs about Logging und OSGI are also interesting:</div><div><br /></div><div><a href="http://ekkes-corner.blogspot.com/2008/07/logging-riena-easybeans-equinox.html">Logging (Riena - EasyBeans - Equinox) reloaded</a></div><div><a href="http://ekkes-corner.blogspot.com/2008/06/catch-22-logging-with-osgi-frameworks.html">Catch-22 Logging in OSGI Environments</a></div><div><br /></div><div><br /></div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/ST_eU2N_ebI/AAAAAAAAAYM/goeYcDsLbfU/s1600-h/de.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/ST_eU2N_ebI/AAAAAAAAAYM/goeYcDsLbfU/s400/de.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5278181738034461106" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 16px; height: 11px; " /></a><div><a href="http://ekkes-ecke.org">blog in german</a></div><div><br /></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com0tag:blogger.com,1999:blog-5484177613731225131.post-22165966988594309742008-12-10T09:31:00.012+01:002008-12-10T09:52:48.156+01:00Comparing Files And Folders After Codegeneration<div>Eclipse has great possibilities to compare files and folders with each other or history.<br /></div><div>But I'm also using external tools: </div><div><br /></div><div><a href="http://ekkes-corner.blogspot.com/2008/09/pde-target-platform-rename-bundles-osx.html">Some time ago I blogged</a> how to use <a href="http://www.versiontracker.com/dyn/moreinfo/macosx/31207">NameChanger</a> (Freeware) under OSX to rename files where the bundle names aren't named like eclipse bundles (plug-ins) using "<span class="Apple-style-span" style="font-family: 'courier new';">name_version</span>".</div><div><br /></div><div>Also for creating of target platform - locations I'm using a tool to get unique sets of bundles. My blog „<a href="http://ekkes-corner.blogspot.com/2008/09/pde-target-platform-avoid-duplicate.html">Avoid Duplicate Bundles</a>“ desribes the use of FileMerge (under OSX part of XCode Tools).</div><div><br /></div><div>Now I was looking for an intelligent tool to see if generated code is identical to an older version. This generated code is not checked into a sourcecode repository, because its always regenerated. Before starting the generation those directories werde cleared, so there's also no local history in Eclipse.</div><div><br /></div><div>While testing <a href="http://oawbranch.pluginbuilder.org/releases/4.3.1RC2.20081208-2300PRD/">4.3.1RC2</a> of <a href="http://www.openarchitectureware.org">openArchitectureWare</a> I was interestd to see if the generated code is identical to version 4.3.0.</div><div><br /></div><div>Its not so easy because there are some allowed differences like:</div><div><br /></div><div><span class="Apple-style-span" style="font-family: 'courier new';">* generation started at: 9. Dezember 2008 08:04:13 CET</span></div><div><br /></div><div>Those generation timestamps should be "identical" to lines with another timestamp. FileMerge from OSX was no help, because these files are reported as different.</div><div><br /></div><div>Next try: <a href="http://www.infinitenexus.com/cf/">Compare Folders</a> compares the size of files and also reports added or missing files. If the generation timestamp hase same length, then the files are identical otherwise not: </div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/ST9-90NW4wI/AAAAAAAAAXE/NJMtSlSbyt8/s1600-h/compare+folders.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/ST9-90NW4wI/AAAAAAAAAXE/NJMtSlSbyt8/s400/compare+folders.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5278076888753300226" style="cursor: pointer; width: 400px; height: 156px; " /></a><br /></div><div><br /></div><div>... I also dont know if the other content is identical - I need the compare more detailed. I found <a href="http://www.deltopia.com/">DeltaWalker</a> where I can do waht I want. But the best of all is:</div><div><br /></div><div><span class="Apple-style-span" style="font-size: large;">DeltaWalker is an Eclipse RCP Application :-)</span></div><div><br /></div><div>...and available for OSX, Windows, Linux. Now it was easy to see if the generated code is the same as before:</div><div><br /></div><div>Create a <span class="Apple-style-span" style="font-weight: bold;">File - Filter</span>, where lines of different generation timestamps are identical:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST9_AfkrQNI/AAAAAAAAAXU/h6Uicf4uQFY/s1600-h/filefilter.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST9_AfkrQNI/AAAAAAAAAXU/h6Uicf4uQFY/s400/filefilter.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5278076934753566930" style="cursor: pointer; width: 377px; height: 348px; " /></a><br /></div><div><br /></div><div>Create a <span class="Apple-style-span" style="font-weight: bold;">Folder- Filter </span>ignoring OSX-specific .DS_Store Files:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST9_AlCCd1I/AAAAAAAAAXc/WpQ1ME4qS40/s1600-h/folderfilter.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST9_AlCCd1I/AAAAAAAAAXc/WpQ1ME4qS40/s400/folderfilter.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5278076936218900306" style="cursor: pointer; width: 400px; height: 293px; " /></a><br /></div><div><br /></div><div>Then hitting <span class="Apple-style-span" style="font-style: italic;">Compare</span>::</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST9_AgOCplI/AAAAAAAAAXk/hR2Z3FuFAU8/s1600-h/nothing+found.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST9_AgOCplI/AAAAAAAAAXk/hR2Z3FuFAU8/s400/nothing+found.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5278076934927066706" style="cursor: pointer; width: 400px; height: 174px; " /></a><br /></div><div><br /></div><div>All the same :-)</div><div><br /></div><div><span class="Apple-style-span" style="font-size: large;">congratulations openArchitectureWare</span> </div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST9_OUtrQxI/AAAAAAAAAX0/a52fTmfAdX8/s1600-h/oaw-logo.gif"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST9_OUtrQxI/AAAAAAAAAX0/a52fTmfAdX8/s400/oaw-logo.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5278077172356694802" style="cursor: pointer; width: 161px; height: 81px; " /></a><br /></div><div>- in all my projects no differences found between 4.3.0 and 4.3.1RC2 after re - generation.</div><div><br /></div><div>Without the File - Filter DeltaWalker lists the differences:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/ST9_ALFK2JI/AAAAAAAAAXM/F6wzHbR2zrQ/s1600-h/differences+found.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/ST9_ALFK2JI/AAAAAAAAAXM/F6wzHbR2zrQ/s400/differences+found.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5278076929252710546" style="cursor: pointer; width: 400px; height: 230px; " /></a><br /></div><div><br /></div><div>...think that <span class="Apple-style-span" style="font-style: italic;">DeltaWalker</span> will be a good helper and a great example for RCP Apps.</div><div><br /></div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST9_IzOV2PI/AAAAAAAAAXs/PEikfHkmyGQ/s1600-h/de.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/ST9_IzOV2PI/AAAAAAAAAXs/PEikfHkmyGQ/s400/de.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5278077077467551986" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 16px; height: 11px; " /></a><div><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size: small;"><a href="http://ekkes-ecke.org">blog in german</a></span></span></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com0tag:blogger.com,1999:blog-5484177613731225131.post-48486214503254674162008-12-04T20:23:00.015+01:002008-12-04T21:05:03.361+01:00Properties in OSGI Declarative Services and ServiceTracker<div style="text-align: left;">As proposed in my last blog "<span class="Apple-style-span" style="font-style: italic;"><a href="http://ekkes-corner.blogspot.com/2008/12/dependencies-and-services-in-osgi.html">Dependencies and Services in OSGI Enterprise Applications</a></span>" it seems that a new blog series was started ;-)<br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">ServiceTracker vs Declarative Services</span></div><div><br /></div><div>There was only a short statement last time - now some tips follow how to use properties in ServiceTracker vs Declarative Services (DS).</div><div><br /></div><div>A <span class="Apple-style-span" style="font-family:'courier new';">ServiceTracker</span> from my OSGI Server project was opened with this Filter: </div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">final String filterPool = "("</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">+Constants.OBJECTCLASS</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">+ "="</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">+ JDBCPoolComponent.class.getName()</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">+")";</span></span></div><div><br /></div><div>So the ServiceTracker will get Services of Type <span class="Apple-style-span" style="font-family:'courier new';">JDBCPoolComponent</span> - we are interested into the attribut <span class="Apple-style-span" style="font-family:'courier new';">JndiName</span>:</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">private void processDataSources(JDBCPoolComponent service) {</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="white-space: pre;"><span class="Apple-style-span" style="font-size:small;"> </span></span><span class="Apple-style-span" style="font-size:small;">if (service.getJndiName().equals("foo_entity_data_source_hsql")) {</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="white-space: pre;"><span class="Apple-style-span" style="font-size:small;"> </span></span><span class="Apple-style-span" style="font-size:small;">// do something</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="white-space: pre;"><span class="Apple-style-span" style="font-size:small;"> </span></span><span class="Apple-style-span" style="font-size:small;">}</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">}</span></span></div><div><br /></div><div>How could this be done using Declarative Services (<span class="Apple-style-span" style="font-family:'courier new';">equinox.ds</span>): </div><div><br /></div><div>We're defining a reference to get exactly one specific service of type <span class="Apple-style-span" style="font-family:'courier new';">JDBCPoolComponent</span> to know that a DataSource is ready. </div><div><br /></div><div>A first idea to declare this reference could be:</div><div><div style="text-align: center;"><span class="Apple-style-span" style="text-decoration: underline;"><br /></span></div><div style="text-align: left;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/STg2j_mo4QI/AAAAAAAAAWs/v7Vu0BXvt4w/s1600-h/reference1.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/STg2j_mo4QI/AAAAAAAAAWs/v7Vu0BXvt4w/s400/reference1.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5276026955461353730" style="cursor: pointer; width: 400px; height: 72px; " /></a><br /></div></div><div>Launching the OSGI application, but the reference wasn't resolved. </div><div><br /></div><div>How could we find the reason ? At first we should test if the Filter is correct and there's no typo in the Interface.</div><div><br /></div><div><span class="Apple-style-span" style="font-style: italic;">Tip: Use of Equinox OSGI Console to test the Filter !</span></div><div><br /></div><div>Try this command:</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">services (&(objectclass=org.ow2.easybeans.component.jdbcpool.JDBCPoolComponent)</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">(jndiName=foo_entity_data_source_hsql))</span></span></div><div><br /></div><div>But no Service was found: <span class="Apple-style-span" style="font-family:'courier new';">No registered Services.</span></div><div><br /></div><div>As next we try only to look for Services of Interface <span class="Apple-style-span" style="font-family:'courier new';">JDBCPoolComponent</span>. Now our command looks like: </div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">services (objectclass=org.ow2.easybeans.component.jdbcpool.JDBCPoolComponent)</span></span></div><div><br /></div><div>Some Services were listet - we also see the one we're looking for:</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">{org.ow2.easybeans.component.jdbcpool.JDBCPoolComponent}={classname=org.ow2.easybeans.component.jdbcpo......, xmlconfig=</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;"> Registered by bundle: .../easybeans-component-jdbcpool_1.1.0-M3-SNAPSHOT.jar/</span></span></div><div><br /></div><div>Analyzing the printed text we found:<span class="Apple-style-span" style="font-family:'courier new';"> jndiName="foo_entity_data_source_hsql"</span></div><div>But there's a small difference: its the Property <span class="Apple-style-span" style="font-family:'courier new';">xmlconfig</span> containing the informations. Thats the solution:</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">services (&(objectclass=org.ow2.easybeans.component.jdbcpool.JDBCPoolComponent)</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">(xmlconfig=*foo_entity_data_source_hsql*))</span></span></div><div><br /></div><div>The Service we want to reference will be found and we know how to declare the reference inside the Service Component:</div><div><br /></div><div style="text-align: left;"><span class="Apple-style-span" style="color: rgb(0, 0, 238); text-decoration: underline;"><span class="Apple-style-span" style="color: rgb(0, 0, 0); "><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/STg2kIivdyI/AAAAAAAAAW0/0XnN2tlmbCw/s1600-h/reference2.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/STg2kIivdyI/AAAAAAAAAW0/0XnN2tlmbCw/s400/reference2.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5276026957860927266" style="cursor: pointer; width: 400px; height: 72px; " /></a></span><br /></span></div><div style="text-align: left;"><span class="Apple-style-span" style="text-decoration: underline;"><br /></span></div><div>Why can the ServiceTracker use <span class="Apple-style-span" style="font-family:'courier new';">getJndiName()</span>, but the target Filter can't ?</div><div><span class="Apple-style-span" style="font-family:'courier new';">getJndiName()</span> is a Methode of <span class="Apple-style-span" style="font-family:'courier new';">JDBCPoolComponent</span>, but JndiName isn't registered as Service Property ! </div><div><br /></div><div><span class="Apple-style-span" style="font-style: italic;">Target Filter cannot access methods of implementation - only Service Properties. </span></div><div><br /></div><div>You maybe run into this using 3rdParty bundles where you have to live with their services as-is. If you're in luck its Open Source, you write a Bugzilla or <a href="http://jira.easybeans.org/browse/EZB-324">JIRA and get it fixed in hours</a> :-)</div><div><br /></div><div><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">Remark:</span></span></div><div><span class="Apple-style-span" style="font-size: small;">You can take a look at my blog series about "</span><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size: small;">OSGI Enterprise Applications</span></span><span class="Apple-style-span" style="font-size: small;">" - the index is in the column right beside </span><a href="http://ekkes-corner.blogspot.com/"><span class="Apple-style-span" style="font-size: small;">this blog</span></a><span class="Apple-style-span" style="font-size: small;">.</span></div><div><span class="Apple-style-span" style="font-size: small;">There are also some </span><a href="https://www.eclipsecon.org/submissions/2009/search.php?search=ekkehard"><span class="Apple-style-span" style="font-size: small;">submissions for EclipseCon 2009</span></a><span class="Apple-style-span" style="font-size: small;"> - if you want to hear more about: comments are welcome ;-)</span></div><div><br /></div><div><br /></div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/STg3eSJtHEI/AAAAAAAAAW8/_-Y40B1Yodg/s1600-h/de.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/STg3eSJtHEI/AAAAAAAAAW8/_-Y40B1Yodg/s400/de.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5276027956872682562" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 16px; height: 11px; " /></a><div><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size: small;">blog in </span></span><a href="http://ekkes-ecke.org/"><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size: small;">german</span></span></a></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com2tag:blogger.com,1999:blog-5484177613731225131.post-83996207030818910562008-12-02T20:46:00.018+01:002008-12-02T22:53:16.960+01:00Dependencies and Services in OSGI Enterprise Applications<div>A busy week has started again:<br /></div><div><ul><li>Refactoring my OSGI Enterprise Server: Using <span class="Apple-style-span" style="font-style: italic;">Declarative Services</span> instead of <span class="Apple-style-span" style="font-style: italic;">ServiceTracker</span> where possible. (I'll report soon in my other blog series)<br /></li><li><a href="http://voelterblog.blogspot.com/2008/12/openarchitectureware-431-rc1-available.html">openArchitectureWare 4.3.1RC1</a> is published and has to be tested against my many modeling templates<br /></li><li>Some more tests using <span class="Apple-style-span" style="font-style: italic;">Eclipse 3.5M3</span>: PDE - supporting Declarative Services and Cycles in 3rd Party Bundles<br /></li><li>Development of a new soon-coming project: <span class="Apple-style-span" style="font-style: italic;">redView</span> (Riena - EMF - Dynamic Views) and integration of these dynamic view models into my modeling workflow<br /></li></ul></div><div><br /></div><div>But now lets start and report some of my experiences of:</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Dependencies and Services in OSGI Enterprise Applications</span></div><div><br /></div><div>If you follow my blog series „<span class="Apple-style-span" style="font-style: italic;">HowTo Build an OSGI Enterprise Server</span>“, you probably have read in<a href="http://web.mac.com/ekkehard.gentz/ekkes-corner/blog/Eintr%C3%A4ge/2008/11/21_HowTo_Build_an_OSGI_Enterprise_Server%3A_EasybeansServiceTracker.html"> </a><a href="http://ekkes-corner.blogspot.com/2008/11/howto-build-osgi-enterprise-server_21.html">the last entry</a> that its difficult to use a <span class="Apple-style-span" style="font-family:'courier new';">ServiceTracker</span> with much logic and dependencies inside. Its not so hard to make it run, but hard to manage all the dynamic of an OSGI application. So the next task is to use <span class="Apple-style-span" style="font-family:'courier new';">Declarative Services</span> instead as possible to solve the requirements. While working in this area I noticed some points I want to blog about.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">PDE Tooling</span></div><div><br /></div><div>This is really the first what happens: you'll miss the comfortable PDE tooling.</div><div>You have to describe the service components in a XML file without support:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/STWiH9bbB4I/AAAAAAAAAVc/P23wnYnv5pM/s1600-h/component-xml.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/STWiH9bbB4I/AAAAAAAAAVc/P23wnYnv5pM/s400/component-xml.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5275300796166768514" style="cursor: pointer; width: 400px; height: 154px; " /></a><br /></div><div>... and also an entry in the MANIFEST.MF as reference to this file:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/STWiIQhDv7I/AAAAAAAAAVk/XRPgpvru4Xg/s1600-h/MF-service-component.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/STWiIQhDv7I/AAAAAAAAAVk/XRPgpvru4Xg/s400/MF-service-component.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5275300801290682290" style="cursor: pointer; width: 393px; height: 179px; " /></a><br /></div><div>Good news: Dopwnload and test Eclipse 3.5M3: PDE Tooling supports now Declarative Services :-)</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/STWiIlnG79I/AAAAAAAAAVs/r40IjURcvOs/s1600-h/pde-ds-editor.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/STWiIlnG79I/AAAAAAAAAVs/r40IjURcvOs/s400/pde-ds-editor.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5275300806953201618" style="cursor: pointer; width: 400px; height: 324px; " /></a><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Managing Dependencies</span></div><div><br /></div><div>Under OSGI the management of dependencies is very important and fundamental to get a well structured application achitecture.</div><div><br /></div><div>We already know dependencies using <span class="Apple-style-span" style="font-family:'courier new';">Import-Package</span> or <span class="Apple-style-span" style="font-family:'courier new';">Require-Bundle</span>. We can also look at these dependencies from inside eclipse.</div><div><br /></div><div>The classic way as Plug-In - Dependencies:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/STWiJe4YYsI/AAAAAAAAAV8/IUO06w6xAiA/s1600-h/plugin-dependencies.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/STWiJe4YYsI/AAAAAAAAAV8/IUO06w6xAiA/s400/plugin-dependencies.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5275300822326469314" style="cursor: pointer; width: 400px; height: 165px; " /></a><br /></div><div><br /></div><div>or the easy to understand visuell way:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/STWiJO1YWGI/AAAAAAAAAV0/oBD8RwvErV4/s1600-h/graph+plugin.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/STWiJO1YWGI/AAAAAAAAAV0/oBD8RwvErV4/s400/graph+plugin.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5275300818018916450" style="cursor: pointer; width: 400px; height: 153px; " /></a></div><div>(here's the <a href="http://download.eclipse.org/eclipse/pde/incubator/visualization/site">Updatesite</a> from <span class="Apple-style-span" style="font-style: italic;">Graph Visualization Plug-In</span>)<br /></div><div><br /></div><div>But <span class="Apple-style-span" style="font-style: italic;">bundle - dependencies</span> are only one part - we're missing the <span class="Apple-style-span" style="font-style: italic;">service - dependencies</span>. </div><div><br /></div><div>If you look at the <span class="Apple-style-span" style="font-family:'courier new';">DataSource</span> example from above:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/STWiRUA9cAI/AAAAAAAAAWE/zWtcuWZPrSw/s1600-h/datasource-dependencies.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/STWiRUA9cAI/AAAAAAAAAWE/zWtcuWZPrSw/s400/datasource-dependencies.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5275300956848615426" style="cursor: pointer; width: 209px; height: 84px; " /></a><br /></div><div>There are no more bundle dependencies ? Indirectly we have dependencies from Declarative Services: The <span class="Apple-style-span" style="font-family:'courier new';">DataSourceService</span> will only be provided if exactly one service of Type <span class="Apple-style-span" style="font-family:'courier new';">Ejb3ServerComponentsService</span> and one service of type <span class="Apple-style-span" style="font-family:'courier new';">JDBCPoolComponent</span> is available. These two referenced services are declared in two other bundles.</div><div><br /></div><div>If our declarative Service Component would include <span class="Apple-style-span" style="font-family:'courier new';">bind</span> / <span class="Apple-style-span" style="font-family:'courier new';">unbind</span> methods, then we would have <span class="Apple-style-span" style="font-family:'courier new';">Import-Package</span> dependencies.</div><div><br /></div><div>Till now I couldn't find a tool displaying service - dependencies in a visual graph.</div><div><br /></div><div>And if you think more about service - dependencies: there are some different strategies to use services and you can even mix them in one application:</div><div><br /></div><div><ul><li>Declarative Services<br /></li><li>ServiceTracker<br /></li><li><a href="http://wiki.eclipse.org/Riena_Getting_Started_with_injecting_services_and_extensions">Riena-Service-Injection</a><br /></li><li>...<br /></li></ul></div><div><br /></div><div>As an Software Architekt I like to get an overview of used Bundles, Services and dependencies. Because there's no tool to show the existing dependencies I'll come the way from another direction: my server project is model-driven, so I can model service - dependencies and -strategies :-)</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/STWiRSU3T8I/AAAAAAAAAWM/Bj3anAU9XiE/s1600-h/oaw-logo.gif"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/STWiRSU3T8I/AAAAAAAAAWM/Bj3anAU9XiE/s400/oaw-logo.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5275300956395229122" style="cursor: pointer; width: 161px; height: 81px; " /></a><br /></div><div>using <a href="http://www.openarchitectureware.org/">openArchitectureWare</a> I'll then generate service - components in XML - files or Javacode for ServiceTracker or Riena - Injection ...<br /></div><div><br /></div><div>This will be part of another blog ;-)</div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">debug - trace - log Declarative Services</span></div><div><br /></div><div>While refactoring my project of course from time to time I reached a point asking why a specific declarative service reference is not resolved from eqinox.ds ;-)</div><div><br /></div><div>With the help from Equinox - Newsgroup and some searches I learned some important System Properties I didn't found in the Eclipse Help or Equinox Wiki:</div><div><br /></div><div><ul><li><span class="Apple-style-span" style="font-family:'courier new';">equinox.ds.debug=true</span> switch debugmode on <br /></li><li><span class="Apple-style-span" style="font-family:'courier new';">equinox.ds.print=true</span> prints the trace-logs on the console. I dont need it because I catch the OSGI LogServices and log them by myself.(s.a. blog series Logging)<br /></li><li><span class="Apple-style-span" style="font-family:'courier new';">equinox.ds.perf=true</span> logs the execution times in ms<br /></li><li><span class="Apple-style-span" style="font-family:'courier new';">equinox.scr.waitTimeOnBlock=10000</span> how many ms should equinox.ds wait until a service component is ready. Was very helpful because 10000 ms is default and some 3rdParty components need more then 50000 ms in DEBUG log - mode.<br /></li></ul></div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">ServiceTracker vs Declarative Services</span></div><div><br /></div><div>Can a Service Tracker completely be replaced by Declarative Services ? No - this isn't always possible. </div><div>One example: Using a <span class="Apple-style-span" style="font-family:'courier new';">ServiceTracker</span> you can get access to all methods of a service - using <span class="Apple-style-span" style="font-family:'courier new';">Declarative Services</span> instead you can only use service properties in <span class="Apple-style-span" style="font-family:'courier new';">target</span> - filters.</div><div><br /></div><div><br /></div><div>...enough for the first blog about Declarative Services - there are so many things to talk about in this context, so I can imagine to start a blog series about this - but at first I have to finish the already started blog series ;-)</div><div><br /></div><div>You can take a look at my blog series about <span class="Apple-style-span" style="font-style: italic;">OSGI Enterprise Applications</span> - the index is in the column right beside this blog.</div><div><br /></div><div>There are also some <a href="https://www.eclipsecon.org/submissions/2009/search.php?search=ekkehard">submissions</a> for EclipseCon 2009 - if you want to hear more about: comments are welcome ;-)</div><div><br /></div><div><br /></div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/STWiZcUIJrI/AAAAAAAAAWU/C2jqSUEr_Ww/s1600-h/de.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/STWiZcUIJrI/AAAAAAAAAWU/C2jqSUEr_Ww/s400/de.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5275301096515446450" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 16px; height: 11px; " /></a><div>blog in <a href="http://ekkes-ecke.org/">german</a></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com0tag:blogger.com,1999:blog-5484177613731225131.post-2184573951209291392008-11-21T20:55:00.016+01:002008-11-21T21:22:44.985+01:00HowTo Build an OSGI Enterprise Server: EasybeansServiceTracker<div>We've seen that its not easy to use EasyBeans OSGI - you have to be very carefully how to start bundles, watch many dependencies etc. So we created a „<span class="Apple-style-span" style="font-style: italic;">Server - Agent</span>“ - bundle to control and manage these tasks.</div><div><br /></div><div>This „<span class="Apple-style-span" style="font-style: italic;">Server - Agent</span>“ - bundle contains an <span class="Apple-style-span" style="font-family:'courier new';">EasybeansServiceTracker</span> we'll discuss now. </div><div><br /></div><div>At first we must be sure that all EasyBeans Components are started - there's an easybeans.agent bundle controlling this. EasyBeans Components are:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SScS3Jg-fcI/AAAAAAAAAVE/y8T8KLGTZcA/s1600-h/EZBComponentFactories.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SScS3Jg-fcI/AAAAAAAAAVE/y8T8KLGTZcA/s400/EZBComponentFactories.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5271202627516792258" style="cursor: pointer; width: 400px; height: 66px; " /></a><br /></div><div>Which of these EasyBeans Components you need depends from your reqirements - in this blog series we'll only look at the EJB3 Container.</div><div><br /></div><div>One component is important in our use case: <span class="Apple-style-span" style="font-family:'courier new';">JDBCPool</span> registers data sources as JNDI names and this must be done before EasyBeans can manage the "<span class="Apple-style-span" style="font-style: italic;">EJB - bundles</span>".</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SScS2aIJCCI/AAAAAAAAAU0/CuMnBEj68lE/s1600-h/tracker1.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SScS2aIJCCI/AAAAAAAAAU0/CuMnBEj68lE/s400/tracker1.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5271202614796159010" style="cursor: pointer; width: 314px; height: 400px; " /></a><br /></div><div>If we're sure that all EZB Components are registered and also the <span class="Apple-style-span" style="font-family:'courier new';">JDBCPool</span> Component has registered all data sources, then we can start our „<span class="Apple-style-span" style="font-style: italic;">PersistenceContext - Bundles</span>“ and „<span class="Apple-style-span" style="font-style: italic;">EJB - Bundles</span>“. </div><div><br /></div><div>While creating an EJB3 - Container for each of our „<span class="Apple-style-span" style="font-style: italic;">PersistenceContext - Bundles</span>“ and each of our „<span class="Apple-style-span" style="font-style: italic;">EJB - Bundles</span>“ EasyBeans registers for each Business - Interface (<span class="Apple-style-span" style="font-family:'courier new';">@Local</span>, <span class="Apple-style-span" style="font-family:'courier new';">@Remote</span>) a <span class="Apple-style-span" style="font-family:'courier new';">ManagedService</span>. The <span class="Apple-style-span" style="font-family:'courier new';">EasybeansServiceTracker</span> tracks all Remote - Business - Interfaces and registers them as Riena Remote Endpoints.</div><div><br /></div><div>When the EJB3 Container is completed from EasyBeans - an <span class="Apple-style-span" style="font-family:'courier new';">EZBContainerService</span> will be registered. After checking that <span class="Apple-style-span" style="font-family:'courier new';">EZBContainerServices</span> are registered for all of our EJB - Bundles we can register the <span class="Apple-style-span" style="font-family:'courier new';">RienaEasyBeansServerService</span>: our Server it ready.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SScS2_YCCgI/AAAAAAAAAU8/Q3Zq5IyT7sU/s1600-h/tracker2.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SScS2_YCCgI/AAAAAAAAAU8/Q3Zq5IyT7sU/s400/tracker2.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5271202624794921474" style="cursor: pointer; width: 400px; height: 391px; " /></a><br /></div><div><span class="Apple-style-span" style="font-size:18px;"><br /></span></div><div><span class="Apple-style-span" style="font-size:large;">EasybeansServiceTracker</span></div><div><br /></div><div><span class="Apple-style-span" style="font-size:medium;">You'll have some logic like this in your Tracker:</span></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SScX2tg10oI/AAAAAAAAAVM/W2XmfDkU5oM/s1600-h/addingService.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SScX2tg10oI/AAAAAAAAAVM/W2XmfDkU5oM/s400/addingService.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5271208117558170242" style="cursor: pointer; width: 340px; height: 400px; " /></a><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Is the use of a ServiceTracker the best solution ?</span></div><div><br /></div><div>At first it looks good to have all the logic around the EasyBeans EJB3Container at a central point in our <span class="Apple-style-span" style="font-family:'courier new';">EasybeansServiceTracker</span> - and it works well.</div><div><br /></div><div>Analyzing it in more detail you'll find out that its very complex and difficult to manage - even thinking on multi-threading. Also: does it look like the nature of a dynamic and flexible OSGI solution ? How to react if bundles or services are stopped and started again ?</div><div><br /></div><div>But there's an alternative way: we'll look again how to solve the EJB3 - Container in our OSGI Enterprise Application using <span class="Apple-style-span" style="font-weight: bold;">Declarative Services.</span> Then you can decide what you prefer to use: ServiceTracker or Declarative Services.</div><div><br /></div><div>There's an this index of this blog series in the column right beside the blog entries.</div><div><br /></div><div><br /></div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SScYRo6uDnI/AAAAAAAAAVU/vTxGIuMHS48/s1600-h/de.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SScYRo6uDnI/AAAAAAAAAVU/vTxGIuMHS48/s400/de.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5271208580181003890" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 16px; height: 11px; " /></a><div>blog in <a href="http://ekkes-ecke.org/">german</a>.</div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com2tag:blogger.com,1999:blog-5484177613731225131.post-80680886632575091732008-11-17T18:03:00.004+01:002008-11-17T18:13:32.329+01:00Going to Eclipse SummitSame procedure as every year going to Eclipse Summit or EclipseCon:<div><br /></div><div>Because my OSGI Enterprise solution needs it all:</div><div>Equinox, OSGI, Riena, RCP, Modeling (oAW, EMF, UML), UI, PDE, P2, ....</div><div><br /></div><div>...its so hard to decide which of the sessions to choose ;-)<br /></div><div><br /></div><div>I'll arrive Tuesday evening - so I can't go to the e4 and RT Symposium</div><div><br /></div><div>Hope to see some of you in Ludwigsburg</div><div><br /></div><div>ekke</div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com1tag:blogger.com,1999:blog-5484177613731225131.post-25420153307553954672008-11-17T13:11:00.015+01:002008-11-17T13:39:29.992+01:00HowTo Build an OSGI Enterprise Server: EJB3 ContainerThis entry of my blog series „<span style="font-style: italic;">HowTo build an OSGI Enterprise Server</span>“ will talk about the „<span style="font-style: italic;">EJB3 Container</span>“ managed by EasyBeans. EasyBeans uses by default Felix as OSGI Framework - this blog series describes how to use it all under Eclipse Equinox together with Eclipse Riena.<br /><br />You have to follow some rules how to start the OSGI application: start - levels, start - order, automatic-start ... Please read important instructions in chapter „<span style="font-style: italic;">Server starten</span>“. A short overview:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SSFgkOT0jwI/AAAAAAAAAUM/nCPGtHi14fY/s1600-h/server_starten.png"><img style="cursor: pointer; width: 348px; height: 400px;" src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SSFgkOT0jwI/AAAAAAAAAUM/nCPGtHi14fY/s400/server_starten.png" alt="" id="BLOGGER_PHOTO_ID_5269599214432980738" border="0" /></a><br /><br />Our OSGI Enterprise application automatically starts a „<span style="font-style: italic;">Server Agent - Bundle</span>“ - this agent contains an OSGI Service Tracker watching if EasyBeans initializes all EJB3 Container to see when all is ready.<br /><br />We also start our domain-specific „<span style="font-style: italic;">Server Bundles</span>“ which are tracking to see if our ServerService is registered from „<span style="font-style: italic;">Server Agent</span>“ Bundle.<br /><br /><br /><span style="font-size:130%;">Server - Agent - Bundle and Server - Bundles</span><br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SSFgkBnEmhI/AAAAAAAAAUU/LcmSnjIMFS4/s1600-h/server_bundles.png"><img style="cursor: pointer; width: 400px; height: 139px;" src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SSFgkBnEmhI/AAAAAAAAAUU/LcmSnjIMFS4/s400/server_bundles.png" alt="" id="BLOGGER_PHOTO_ID_5269599211024062994" border="0" /></a><br /><br />Our (domain-specific) „<span style="font-style: italic;">Server - Bundles</span>“ and the „<span style="font-style: italic;">Server - Agent - Bundle</span>“ are started automatically using Default - Start - Level (in our example Level 3).<br /><br />The „<span style="font-style: italic;">Server - Bundles</span>“ are waiting until a <span style="font-family: courier new;">RienaEasyBeansServerService</span> signals, that our Server with Riena- and EasyBeans - Functionality is available.<br /><br />The most important dependencies of our „<span style="font-style: italic;">Server - Agent</span>“ - Bundle:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SSFgkem_zBI/AAAAAAAAAUc/bxr8Xu2vSL0/s1600-h/server_agent_dependencies.png"><img style="cursor: pointer; width: 400px; height: 206px;" src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SSFgkem_zBI/AAAAAAAAAUc/bxr8Xu2vSL0/s400/server_agent_dependencies.png" alt="" id="BLOGGER_PHOTO_ID_5269599218808376338" border="0" /></a><br /><br />The „<span style="font-style: italic;">Server - Agent</span>“<br /><ul><li>tracks Services from EasyBeans using an EasybeansServiceTracker</li><li>registers Remote - „Business - Interfaces“ for Riena - Remoting</li><li>registers RienaEasyBeansServerService when or server is available</li></ul><br /><span style="font-size:130%;">EasybeansServiceTracker - Filter</span><br /><br />An OSGI <span style="font-family: courier new;">ServiceTracker</span> should only track needed Services - so we have to define a <span style="font-family: courier new;">Filter</span> used as Parameter creating a new ServiceTracker. The Filter:<br /><br /><span style="font-family: courier new;">(|(objectClass=org.osgi.service.cm.ManagedServiceFactory)(objectClass=org.ow2.easybeans.api.EZBContainer)(objectClass=org.ow2.easybeans.component.jdbcpool.JDBCPoolComponent)(service.pid=*RemoteManagerI*Bean))</span><br /><br />What kind of OSGI Services we'll get using this Filter ?<br /><br /><br /><span style="font-weight: bold;">ManagedServiceFactory:</span><br /><br />EasyBeans registers for each EasyBeans Component a Service of Type <span style="font-family: courier new;">ManagedServiceFactory</span>:<br /><br /><span style="font-family: courier new;">{org.osgi.service.cm.ManagedServiceFactory}=</span><br /><span style="font-family: courier new;">{service.pid=org.ow2.easybeans.component.carol.carolcomponent,..</span><br /><span style="font-family: courier new;">Registered by bundle:</span><br /><span style="font-family: courier new;">...easyBeans/bundles/easybeans-component-carol_1.1.0-...jar</span><br /><span style="font-family: courier new;">Bundles using service:</span><br /><span style="font-family: courier new;">.../org.eclipse.equinox.cm_1.0.0.v20080509-1800.jar</span><br /><span style="font-family: courier new;">.../org.ekkehard.server.agent_1.0.0.jar</span><br /><br />Tracking these Services we can test if all EasyBeans Components are correct initialized.<br /><br /><span style="font-weight: bold;">EZBContainer:</span><br /><br />After successfully processing our „<span style="font-style: italic;">EJB - Bundles</span>“ and „<span style="font-style: italic;">PersistenceContext - Bundles</span>“ from EasyBeans a Service of Type <span style="font-family: courier new;">EZBContainer</span> is registered:<br /><br /><span style="font-family: courier new;">{org.ow2.easybeans.api.EZBContainer}={service.id=103}</span><br /><span style="font-family: courier new;">Registered by bundle: .../org.ekkehard.foo.datamanager.bean_1.0.0.jar</span><br /><span style="font-family: courier new;">Bundles using service:</span><br /><span style="font-family: courier new;">.../easybeans-core_1.1.0-M3-SNAPSHOT.jar</span><br /><span style="font-family: courier new;">.../org.ekkehard.server.agent_1.0.0.jar</span><br /><br />Tracking these Services we know, that EasyBeans has created an <span style="font-family: courier new;">EJB3Container</span> for our Bundle - and if its a „<span style="font-style: italic;">PersistenceContext - Bundle</span>“ then we also know, that Hibernate has done all the Mapping and Binding.<br /><br /><span style="font-weight: bold;">JDBCPoolComponent:</span><br /><br />EasyBeans <span style="font-family: courier new;">JDBCPoolComponent</span> registers always after initializing a DataSource an OSGI Service of Type <span style="font-family: courier new;">JDBCPoolComponent</span>:<br /><br /><span style="font-family: courier new;">{org.ow2.easybeans.component.api.EZBComponent,</span><br /><span style="font-family: courier new;">org.ow2.easybeans.component.jdbcpool.JDBCPoolComponent}=</span><br /><span style="font-family: courier new;">{... jndiName="foo_data_source_hsql"....</span><br /><br />Using the Property <span style="font-family: courier new;">jndiName</span> we can test if our DataSource is available.<br /><br /><span style="font-weight: bold;">service.pid:</span><br /><br />We also filter Services containing a <span style="font-family: courier new;">service.pid</span> of our pattern for Remote - Business - Interfaces: „<span style="font-family: courier new;">*RemoteManagerI*Bean</span>“. The pattern depends from your naming schema.<br /><br />Tracking those Services will give us OSGI Services of Type <span style="font-family: courier new;">ManagedService</span>. The we do some additional testing to see if some Properties are set from EasyBeans. If true, we know that its a ManagedService created by EasyBeans for one of our <span style="font-family: courier new;">@Remote</span> - „<span style="font-style: italic;">Business - Interfaces</span>“.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SSFgkjOajkI/AAAAAAAAAUk/geWjL0mDItg/s1600-h/filterManagedServiceFactory.png"><img style="cursor: pointer; width: 400px; height: 66px;" src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SSFgkjOajkI/AAAAAAAAAUk/geWjL0mDItg/s400/filterManagedServiceFactory.png" alt="" id="BLOGGER_PHOTO_ID_5269599220047449666" border="0" /></a><br /><br />Now we can register this <span style="font-family: courier new;">@Remote </span>- „<span style="font-style: italic;">Business - Interface</span>“ for Riena Remoting, to provide a Riena Published Endpoint for our Rich Clients.<br /><br />This is also the reason why the „<span style="font-style: italic;">Server - Agent - Bundle</span>“ needs Package-Import-Dependencies to our „<span style="font-style: italic;">Business - Interface - Bundles</span>“ - if you dont use Riena, then you dont need these dependencies.<br /><br /><br /><span style="font-size:130%;">RienaEasyBeansServerService</span><br /><br />If all tracking was successfully, then our „<span style="font-style: italic;">Server - Agent - Bundle</span>“ registers an <span style="font-family: courier new;">RienaEasyBeansServerService</span> as OSGI Service. Because this Service will also be registered as Riena Remote Endpoint, our „<span style="font-style: italic;">Server - Bundles</span>“ and also our „<span style="font-style: italic;">Rich Client - Bundles</span>“ can track if the Server of a specific domain is live and ready-to-go.<br /><br />When knows the „<span style="font-style: italic;">Server - Agent</span>“ that all was successfully processed ?<br /><ul><li>All EasyBeans Components are initialized</li><li>All DataSources are avilable</li><li>All EJB Container are available</li></ul>There are some special tricks how to track and test and start bundles - but this will be part of the next blog.<br /><br />There's an this index of this blog series in the column right beside the blog entries.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SSFgvwW0D3I/AAAAAAAAAUs/N6I1gqxScfA/s1600-h/de.png"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 16px; height: 11px;" src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SSFgvwW0D3I/AAAAAAAAAUs/N6I1gqxScfA/s400/de.png" alt="" id="BLOGGER_PHOTO_ID_5269599412550897522" border="0" /></a> blog in <a href="http://ekkes-ecke.org">german</a>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com3tag:blogger.com,1999:blog-5484177613731225131.post-77652589097801812042008-11-12T20:58:00.012+01:002008-11-14T15:29:56.409+01:00HowTo Build an OSGI Enterprise Server: Entity- and EJB- Bundles<div>This part of the blog series „<span class="Apple-style-span" style="font-style: italic;">HowTo build an OSGI Enterprise Server</span>“ will take a look at the different types of bundles we provide to the EJB3 container. The next chapter „<span class="Apple-style-span" style="font-style: italic;">EJB3 Container“</span> will show you how to use an OSGI ServiceTracker to start and initialize all the right way.</div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">How to divide Entities and EJBs in Bundles</span></div><div><br /></div><div>BTW: you should have knowledge about EJB3 and Annotations. The structure used in this server is only an example and your implementation perhaps is different. We can talk about these issues later after publishing source code. Also you can use Eclipse Link as JPA provider instead of Hibernate - EasyBeans can work with both.</div><div><br /></div><div>We're using following types of bundles:</div><div><br /></div><div><ul><li>Entity - Bundles<br /></li><li>EJB - Bundles<br /></li><li>PersistenceContext - Bundles <br /></li><li>Business Interface - Bundles <br /></li></ul></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SRs4UAgDaTI/AAAAAAAAATU/QbE6CKdkL2c/s1600-h/entity_ejb.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SRs4UAgDaTI/AAAAAAAAATU/QbE6CKdkL2c/s400/entity_ejb.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5267866105522907442" style="cursor: pointer; width: 400px; height: 282px; " /></a><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Entity - Bundles</span></div><div><br /></div><div>@Entity, @Embeddable</div><div>You can use as much Entity - Bundles as you want - perhaps structured vertical for your different domains. These Entity - Bundles will also be used from our Rich Client, so - if you have bundle dependencies only used at server-side, make them optional.</div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">EJB - Bundles</span></div><div><br /></div><div>@Stateless and @Stateful Beans, implementing Business - Interfaces (@Local, @Remote) depending from your requirements. </div><div>These Bundles have dependencies to your Entity - Bundles and to the Business - Interfaces. </div><div>Other EJBs from your PersistenceContext - Bundles can be injected like:</div><div><span class="Apple-style-span" style="font-family:'courier new';">@EJB(mappedName) Business - Interface</span></div><div>The EJB - Bundles will not be used from Rich Client.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:small;">Remark: mappedName must be used at the moment, EZB cannot found the corresponding Business - Interfaces, if they are in different bundles (</span><a href="http://jira.easybeans.org/browse/EZB-322"><span class="Apple-style-span" style="font-size:small;">JIRA EZB-322</span></a><span class="Apple-style-span" style="font-size:small;">)</span></div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">PersistenceContext - Bundles</span></div><div><br /></div><div>@Stateless Beans, containing a PersistenceContext (EntityManager) and - depending from your use-cases - implementing Business - Interfaces (@Local, @Remote).</div><div><span class="Apple-style-span" style="font-family:'courier new';">@PersistenceContext(unit-name)</span> points to your Persistence - Unit.</div><div>Each PersistenceContext - Bundle has a <span class="Apple-style-span" style="font-family:'courier new';">persistence.xml</span> with attributes for the <span class="Apple-style-span" style="font-family:'courier new';">persistence-unit</span> and also <span class="Apple-style-span" style="font-family:'courier new';">jta-data-source</span>.</div><div>PersistenceContext - Bundles need package-imports of the used Entities and implemented Business - Interfaces.</div><div>PersistenceContext - Bundles will not be used at Client-Side.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:small;">Remarks: </span></div><div><ol><li><span class="Apple-style-span" style="font-size:small;">All EJBs, belonging to a peristence-unit, must be in ONE bundle at the moment. (</span><a href="http://jira.easybeans.org/browse/EZB-294"><span class="Apple-style-span" style="font-size:small;">JIRA EZB-294)</span></a><span class="Apple-style-span" style="font-size:small;"><br /></span></li><li><span class="Apple-style-span" style="font-size:small;">The Beans must have an EJB3.mappedName attribute: @Stateless(mappedName), otherwise because of a bug from EasyBeans (</span><a href="http://jira.easybeans.org/browse/EZB-322"><span class="Apple-style-span" style="font-size:small;">JIRA EZB-322</span></a><span class="Apple-style-span" style="font-size:small;">) injected @EJB won't found them.<br /></span></li><li><span class="Apple-style-span" style="font-size:small;">Inside the persistence.xml all Entity- and Embeddable must be listed as class entries. EasyBeans should found the classes itself because of Annotations, but there's a bug if Entities and EJBs are in different Bundles.</span><br /></li></ol></div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Business Interface - Bundles</span></div><div><br /></div><div>@Local, @Remote</div><div>The Business - Interface - Bundles can be structured and separated as you want - perhaps for different sub-applications or domains or...</div><div>These Bundles will also be used from your Rich Client.</div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">EasyBeans Configuration</span></div><div><br /></div><div>EasyBeans needs some configuration - data. If you're using an OSGI Framework Configuration you can add a VM argument: </div><div><span class="Apple-style-span" style="font-family:'courier new';">-Dorg.ow2.easybeans.osgi.conf.dir=${workspace_loc}/config/easybeans/config </span></div><div>In this config folder you must store the <span class="Apple-style-span" style="font-family:'courier new';">easybeans.xml</span>.</div><div>This easybeans.xml contains <span class="Apple-style-span" style="font-family:'courier new';">jdbcpool jndiName</span> entries for each of your Data - Sources. These values are identical with the <span class="Apple-style-span" style="font-family:'courier new';">jta-data-source</span>, described at your Persistence Unit inside<span class="Apple-style-span" style="font-family:'courier new';"> persistence.xml</span> of our PersistenceContext - Bundles.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SR2KoaIWNKI/AAAAAAAAAT8/o1DaoZRFxIM/s1600-h/configuration.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SR2KoaIWNKI/AAAAAAAAAT8/o1DaoZRFxIM/s400/configuration.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5268519565907080354" style="cursor: pointer; width: 361px; height: 400px; " /></a><br /></div><div><span class="Apple-style-span" style="font-size:small;">Remark: The EasyBeans JDBCPool - Component must register first all Data - Sources, before you can start your PersistenceContext - Bundles. s.a. chapter „</span><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">EJB3 Container</span></span><span class="Apple-style-span" style="font-size:small;">“ for details on this.</span></div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">openArchitectureWare - always can help if you're in trouble</span></div><div><br /></div><div>This project is model-driven - details about it will be described in another blog series. Here are some small examples showing you, why I never will miss openArchitectureWare in a project lead by me.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SR2Ko6-Z04I/AAAAAAAAAUE/BaeNsXqZwWo/s1600-h/oaw-logo.gif"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SR2Ko6-Z04I/AAAAAAAAAUE/BaeNsXqZwWo/s400/oaw-logo.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5268519574723744642" style="cursor: pointer; width: 161px; height: 81px; " /></a><br /></div><div>EasyBeans should recognize @Entity and @Embeddable automagically because of annotations - but it doesnt work through borders of bundles, so all @Entity and @Embeddable - classes have to be listed in your persistence.xml - in my ERP project this means more then 800 classen - and the data model isn't static and grows or changes depending from new use-cases and requirements.</div><div><br /></div><div>But thanks to openArchitectureWare (oAW) we only need some lines in a template to get the needed output into the persistence.xml:</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SRs4U1HnP2I/AAAAAAAAATk/wkLmq_WzQAA/s1600-h/generate-classes-list.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SRs4U1HnP2I/AAAAAAAAATk/wkLmq_WzQAA/s400/generate-classes-list.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5267866119647477602" style="cursor: pointer; width: 400px; height: 89px; " /></a><br /></div><div>automatically all was generated from oAW and is in sync with your entity data model:</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SRs4Tx9lbPI/AAAAAAAAATM/JFSMnIqa_8Y/s1600-h/classes-list.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SRs4Tx9lbPI/AAAAAAAAATM/JFSMnIqa_8Y/s400/classes-list.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5267866101620239602" style="cursor: pointer; width: 400px; height: 89px; " /></a><br /></div><div>Another example: EasyBeans should be able to inject @EJB MyBusinessInterface correctly. But because of a bug this isn't possible if Business Interfaces are in another bundle and so we need the @EJB.mappedName attribute.</div><div><br /></div><div>But with oAW its also easy: insert some text into a XPand - Template to add this attribute:</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SRs4Vcdm59I/AAAAAAAAATs/zCH4h-SpsSI/s1600-h/stateless_mapped.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SRs4Vcdm59I/AAAAAAAAATs/zCH4h-SpsSI/s400/stateless_mapped.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5267866130208712658" style="cursor: pointer; width: 400px; height: 113px; " /></a><br /></div><div>... and in your Business Interface:</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SRs4UuduGPI/AAAAAAAAATc/ZDqvlFuzYSI/s1600-h/ezb_mapped_name_constant.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SRs4UuduGPI/AAAAAAAAATc/ZDqvlFuzYSI/s400/ezb_mapped_name_constant.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5267866117861153010" style="cursor: pointer; width: 400px; height: 165px; " /></a><br /></div><div>Now all Beans get the mappedName attribute, the Business Interfaces get a Constant with this mappedName so you can inject easy:</div><div><span class="Apple-style-span" style="font-family:'courier new';">@EJB(mappedName = MyInterface.EZB_MAPPED_NAME) MyInterface mi = null;</span></div><div><br /></div><div>These are positive side-effects of model-driven development: developing of workarounds in hundredrs of classes are funny ;-)</div><div><br /></div><div>BTW: my whole complex ERP - project would not be possible to be realized from me alone without oAW. You'll hear more about this in another blog series - and of course its your decision if you work model-driven or not - I only can show you my way of working.</div><div><br /></div><div> </div><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SRs5JYVJKxI/AAAAAAAAAT0/_JYMMBIBsVk/s400/de.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5267867022452665106" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 16px; height: 11px; " /><div> blog in <a href="http://ekkes-ecke.org/">german</a>.</div><div><br /></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com0tag:blogger.com,1999:blog-5484177613731225131.post-53618937123536507662008-11-11T13:17:00.009+01:002008-11-11T13:52:08.971+01:00HowTo Build An OSGI Enterprise Server: Introduction<div>If you followed my blog series „<span class="Apple-style-span" style="font-style: italic;">Logging in OSGI Enterprise Applications</span>“, you probably know that logging is only one small but important aspect of an <a href="http://osgi.org/">OSGI</a> Enterprise Server.</div><div><br /></div><div>This new blog series „<span class="Apple-style-span" style="font-style: italic;">HowTo Build An OSGI Enterprise Server</span>“ will give you tips from my experiences how to build and configure an OSGI server, how to structure your project and bundles and how to make it all run.</div><div><br /></div><div>Main parts of the server are:</div><div><br /></div><div><ul><li><a href="http://www.eclipse.org/equinox">Equinox</a> (OSGI Framework)<br /></li><li><a href="http://www.eclipse.org/riena">Riena</a> (OSGI RemoteServices, ObjectTransactions)<br /></li><li><a href="http://wiki.easybeans.org/">EasyBeans</a> (OSGI EJB3 Container, Hibernate JPA)<br /></li></ul></div><div><br /></div><div>There will also be a rich client:</div><div><br /></div><div><ul><li>Equinox (OSGI Framework)<br /></li><li>Eclipse RCP<br /></li><li>Riena (OSGI RemoteServices, ObjectTransactions, UI: Ridgets) <br /></li></ul></div><div><br /></div><div><span class="Apple-style-span" style="font-size:small;">(Clients for mobile devices and web will follow.)</span></div><div><br /></div><div>Not only the Runtime Platform is important - the whole project is model-driven:</div><div><br /></div><div><ul><li>Eclipse Modeling (EMF, UML2)<br /></li><li>openArchitectureWare - oAW (Workflow, XPand, Xtend)<br /></li><li>Magicdraw (UML, DSL, oAW Integration)<br /></li></ul></div><div><br /></div><div>Server, Client, oAW Templates, MagicDraw Custom DSL Editor will be published as Open Source (EPL) and are used as core of an ERP - Business Solution.</div><div><br /></div><div>Before giving an overview of the project and then start with chapter „Installation“ I'll jump to chapter „<span class="Apple-style-span" style="font-style: italic;">EasyBeans as OSGI EJB3 Container integrated with Equinox</span>“ because I know some are waiting for this.</div><div><br /></div><div>From readers of my last blog series I learned that its not always easy to read the entries in right order - to help you I'll always update an index of the blog series. You'll find this index in the column right beside the blog entries.</div><div><br /></div><div>I hope to help some others with this new blog series and I'm always thankful for your feedback.</div><div><br /></div><div>Later on blog series will follow "<span class="Apple-style-span" style="font-style: italic;">HowTo build an OSGI Rich Client</span>" and also "<span class="Apple-style-span" style="font-style: italic;">Modeling OSGI Client - Server Applications</span>". </div><div><br /></div><div><br /></div><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SRl-djtMnpI/AAAAAAAAATE/L09cuk6r0j0/s400/de.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5267380285452623506" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 16px; height: 11px; " /><div> blog in <a href="http://ekkes-ecke.org/">german</a>.</div><div><br /></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com4tag:blogger.com,1999:blog-5484177613731225131.post-34947723812396573152008-10-31T15:54:00.003+01:002008-10-31T16:04:55.643+01:00Index BlogSeries Logging in OSGI Enterprise Applications<div>I got responses that its not easy to read the blog series<br /></div><div>"<span class="Apple-style-span" style="font-style: italic;">Logging in OSGI Enterprise Applications</span>" in chronological order.</div><div><br /></div><div>So here's the index:</div><div><div><ul><li>Part 1: <a href="http://ekkes-corner.blogspot.com/2008/09/logging-in-osgi-enterprise-applications.html">An overview</a><br /></li><li>Part 2: <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications.html">How to catch all log events from "classic" logging - frameworks</a><br /></li><li>Part 3: <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications_11.html">How to catch all log events from OSGI Log Services </a><br /></li><li>Part 4: <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications_20.html">How to start logging bundles the right way inside an OSGI Enterprise application</a><br /></li><li>Part 5: <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications_31.html">Configuration, Fragment-Bundles, Markers</a><br /></li></ul></div><div><br /></div><div>...more will follow</div><div><br /></div><div>ekke</div></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com0tag:blogger.com,1999:blog-5484177613731225131.post-55470683269957351382008-10-31T07:38:00.028+01:002008-10-31T14:29:24.442+01:00Logging in OSGI Enterprise Applications, Part 5<div>This (fifth) part of my blog series "<span class="Apple-style-span" style="font-style: italic;">Logging in OSGI Enterprise Applications</span>" will show you some important elements of configuring the logging framework <a href="http://logback.qos.ch/">LOGBack</a> we use as <a href="http://www.slf4j.org/">SLF4J</a> implementation:</div><div><br /></div><div><a href="http://logback.qos.ch/index.html"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SQrsn4v1DiI/AAAAAAAAAR0/ZFlzJtnaPLY/s400/logbacklogo.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5263279284527894050" style="cursor: pointer; width: 260px; height: 140px; " /></a><br /></div><div>I dont want to talk about the configuration of a logging framework itself - you should be familiar with this. If you're using <a href="http://logback.qos.ch/">LOGBack</a> inside an OSGI Enterprise Application there are some special things to watch and problems to solve.</div><div><br /></div><div>If we're logging in a non-OSGI Java Application we normaly want to know which class logs the event. Logging from an OSGI Enterprise Application its also important to know which bundle causes the LogEvent. Using OSGI LogServices you also have this information from BundleContext..</div><div><br /></div><div>Its a good practice to name the Logger with the class name - normaly as static Logger defined in each class. This works with all logging frameworks like Log4J, Commons-Logging, java.util.logging or SLF4J.</div><div><br /></div><div>Using <a href="http://logback.qos.ch/index.html">SLF4J</a> as Logging API you can also describe the source of the Log Event more detailed with:</div><div><ul><li>MDC (Mapped Diagnostic Contexts)<br /></li><li>Marker <br /></li></ul></div><div><br /></div><div>MDC is implemented by Log4J and <a href="http://logback.qos.ch/">LOGBack</a>. MDC is great to store informations from a client user session: per ex. Username, IP etc. Its a Map and you're free to store what you like. To access these informations in the Layout of an Appender is easy: </div><div> <span class="Apple-style-span" style="font-family:'courier new';">...N:%X{username}... </span></div><div>produces</div><div> <span class="Apple-style-span" style="font-family:'courier new';"> ...N:JohnDoe...</span></div><div>The LOGBack User Manual chapter 7 (<a href="http://logback.qos.ch/manual/mdc.html">here</a>) explains it in detail and gives you some examples.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:x-large;">Marker and Bundles</span></div><div><br /></div><div><a href="http://www.slf4j.org/apidocs/org/slf4j/Marker.html">Marker</a> are part of the <a href="http://www.slf4j.org/apidocs/index.html">SLF4J API</a> and they mark (as the name says ;-) Log Messages. At the moment only LOGBack implements Marker. </div><div>From the <a href="http://www.slf4j.org/apidocs/org/slf4j/MarkerFactory.html">MarkerFactory</a> for a given String we always get the same Marker: </div><div> <span class="Apple-style-span" style="font-family:'courier new';">Marker marker = MarkerFactory.getMarker("MyMarker");</span></div><div><br /></div><div>Marker can reference other Marker - so you can build an object graph of Marker:</div><div> <span class="Apple-style-span" style="font-family:'courier new';">Marker special = MarkerFactory.getMarker("special");</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"> special.add(MarkerFactory.getMarker("init"))</span></div><div><br /></div><div>In our OSGI Enterprise Application we're using Marker to log the Name of the bundle.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SQrsoLckKVI/AAAAAAAAAR8/Ca5VfOSqqb0/s1600-h/bundleMarker.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SQrsoLckKVI/AAAAAAAAAR8/Ca5VfOSqqb0/s400/bundleMarker.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5263279289547368786" style="cursor: pointer; width: 400px; height: 162px; " /></a><br /></div><div>For each bundle we define once (per ex. in the Activator):</div><div><br /></div><div> <span class="Apple-style-span" style="font-family:'courier new';">private static final Logger logger = LoggerFactory.getLogger(MyActivator.class);</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"> public static final String ID = "my.bundle.symbolic.name";</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"> public static final Marker bundleMarker = createBundleMarker();</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"> private static final Marker createBundleMarker() {</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"> Marker bundleMarker = MarkerFactory.getMarker(ID);</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">bundleMarker.add(MarkerFactory.getMarker("IS_MARKER"));</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">return bundleMarker;</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"> }</span></div><div><br /></div><div>In all the other classes of a bundle we define:</div><div><br /></div><div> <span class="Apple-style-span" style="font-family:'courier new';">import static MyActivator.bundleMarker;</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"> private static final Logger logger = LoggerFactory.getLogger(Foo.class);</span></div><div><br /></div><div>Then the logging statements are looking like:</div><div><br /></div><div> <span class="Apple-style-span" style="font-family:'courier new';"> logger.debug(bundleMarker,"This is my {} message",xyz);</span></div><div><br /></div><div><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">Remark: LOGBack replaces</span></span><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;"> {}</span></span></span><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;"> with </span></span><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">xyz. toString()</span></span></span><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">. More details later.</span></span></div><div><br /></div><div>To get the marker in the logging - output we can simply use</div><div> <span class="Apple-style-span" style="font-family:'courier new';">... %marker ... </span></div><div>in the Layout of an Appender. </div><div><br /></div><div>In our application we want to test if a Marker is a BundleMarker and then handle formatting the output different, per ex.: </div><div> <span class="Apple-style-span" style="font-family:'courier new';">... - [B:my.symbolic.bundle.name] ...</span></div><div><br /></div><div>To do this we have to extend <span class="Apple-style-span" style="font-family:'courier new';">ch.qos.logback.classic.pattern.ClassicConverter </span>and overwrite the methode <span class="Apple-style-span" style="font-family:'courier new';">public String convert(LoggingEvent le)</span>.</div><div><br /></div><div>In our LOGBack configuration (<span class="Apple-style-span" style="font-family:'courier new';">logback.xml</span> or <span class="Apple-style-span" style="font-family:'courier new';">logback-test.xml</span>) we have to insert a new <span class="Apple-style-span" style="font-family:'courier new';">ConversionRule</span>:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SQrsogAV-GI/AAAAAAAAASE/pLnp31mpjLU/s1600-h/conversionrule.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SQrsogAV-GI/AAAAAAAAASE/pLnp31mpjLU/s400/conversionrule.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5263279295066142818" style="cursor: pointer; width: 400px; height: 35px; " /></a><br /></div><div>then we can use it in the Layout of an Appender:</div><div> <span class="Apple-style-span" style="font-family:'courier new';">... %bundle ...</span></div><div>and we get as output</div><div> <span class="Apple-style-span" style="font-family:'courier new';">... - [B:my.symbolic.bundle.name] ...</span></div><div>or an empty String if the Marker is no BundleMarker.</div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:x-large;">Fragment Bundles</span></div><div><br /></div><div>But thats not all - because the <span class="Apple-style-span" style="font-family:'courier new';">logback.classic Bundle</span> doesnt know our <span class="Apple-style-span" style="font-family:'courier new';">BundleConverter</span> class we need a <span class="Apple-style-span" style="font-family:'courier new';">Fragment-Bundle</span>:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SQrsoqM6yJI/AAAAAAAAASM/yhb3VAjTYzg/s1600-h/logback-util-fragment-mf.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SQrsoqM6yJI/AAAAAAAAASM/yhb3VAjTYzg/s400/logback-util-fragment-mf.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5263279297803241618" style="cursor: pointer; width: 400px; height: 117px; " /></a><br /></div><div><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">You remember: We already use another Fragment to use our configuration file from Logback Core Bundle:</span></span></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SQrso5hZKoI/AAAAAAAAASU/NpXcvFNPorI/s1600-h/logback-config-fragment.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SQrso5hZKoI/AAAAAAAAASU/NpXcvFNPorI/s400/logback-config-fragment.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5263279301915650690" style="cursor: pointer; width: 400px; height: 117px; " /></a><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SQrs_l5wvmI/AAAAAAAAASc/0zbJSigKDBE/s1600-h/fragmente.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SQrs_l5wvmI/AAAAAAAAASc/0zbJSigKDBE/s400/fragmente.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5263279691786141282" style="cursor: pointer; width: 400px; height: 192px; " /></a><br /></div><div><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">Remark: perhaps you have noticed that the Manifest files above are using logback Version 0.9.11: there are new versions of </span></span><a href="http://www.slf4j.org/"><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">SLF4J</span></span></a><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;"> (</span></span><a href="http://www.slf4j.org/download.html"><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">Download</span></span></a><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;"> Version 1.5.5) and </span></span><a href="http://logback.qos.ch/"><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">LOGBack</span></span></a><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;"> (</span></span><a href="http://logback.qos.ch/download.html"><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">Download</span></span></a><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;"> Version 0.9.11). Because at the moment they are not found from SpringSource EnterpriseBundleRepository we have to build them by ourself. How to do this is explained in </span></span><a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications.html"><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">part 2 </span></span></a><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">of this blog series.</span></span></div><div><br /></div><div><span class="Apple-style-span" style="font-size:x-large;">Logoutput twice</span></div><div><br /></div><div>It looks so good: we catch all LogEvents from all Logging Frameworks used from other Bundles and also from OSGI LogServices. But it can happen that you found some messages twice in your log output. What happens ? If you're using per ex. Eclipse Riena M4 you got messages twice:</div><div><br /></div><div>Riena uses Listener to catch OSGI Logservices and logs them using Log4J. Log4J will found the way to our SLF4J / LOGBack implementation. So long so good.</div><div>But our own Logging Bundle org.ekkehard.osgi.over.slf4j also catches OSGI Logservices and loggs them using SLF4J / LOGBack.</div><div>And now we got some messages twice.</div><div><br /></div><div>The good news first: in some days Riena will publish Milestone M5 and then you should be able to switch these Listeners from Riena-Logging off.</div><div>Because it can happen every day again using other 3rdParty bundles, here's the solution. We need an entry in our LOGBack configuration file logback.xml:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SQrs_nxkRBI/AAAAAAAAASk/H66h-bs87E0/s1600-h/riena-logging-OFF.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SQrs_nxkRBI/AAAAAAAAASk/H66h-bs87E0/s400/riena-logging-OFF.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5263279692288640018" style="cursor: pointer; width: 382px; height: 61px; " /></a><br /></div><div>This will hide those output from <span class="Apple-style-span" style="font-family:'courier new';">org.eclipse.riena</span>. </div><div><br /></div><div>Riena uses Equinox Extended OSGI Logservices, which contain an own Logger. We catch those ExtendedLogEvents and log the message using the Loggername from ExtendedLogEntry. To distinguish Logging - Output from our Listeners we add a prefix:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SQrs_3DHzhI/AAAAAAAAAS0/7fJEtmiVdwY/s1600-h/xlogger.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SQrs_3DHzhI/AAAAAAAAAS0/7fJEtmiVdwY/s400/xlogger.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5263279696388804114" style="cursor: pointer; width: 400px; height: 136px; " /></a><br /></div><div>Now we know where the Logging - Output comes from and as a side-effect its easy to log all LogEvents originally logged from Equinox <span class="Apple-style-span" style="font-family:'courier new';">ExtendedLogServices</span> per ex. at DEBUG Level:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SQrs_mYMQ5I/AAAAAAAAASs/rppoNjYhsqo/s1600-h/config-log-X.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SQrs_mYMQ5I/AAAAAAAAASs/rppoNjYhsqo/s400/config-log-X.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5263279691913773970" style="cursor: pointer; width: 384px; height: 91px; " /></a><br /></div><div>Here's an example logging output catched by our Listener and logged to LOGBack:</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">23:25:41.846 DEBUG [X.o.e.r.c.publisher.ServicePublishBinder] - [B:org.eclipse.riena.core] service endpoints count: 792</span></div><div><br /></div><div>ExtendedLogEntry uses this as Loggername:</div><div> <span class="Apple-style-span" style="font-family:'courier new';">org.eclipse.riena.communication.publisher.ServicePublishBinder</span></div><div>We add the prefix "X."</div><div>You also see a Bundlename (from our BundleConverter)<br /></div><div> <span class="Apple-style-span" style="font-family:'courier new';">org.eclipse.riena.core</span></div><div>We got the name from Context of the catched ExtendedLogEntry: </div><div> <span class="Apple-style-span" style="font-family:'courier new';"> getBundle().getSymbolicName()</span></div><div><br /></div><div>Using Marker from LOGBack is an easy way to get the information of the Bundle logging the event and also not to loose the Bundlename if rooting LogEvents from OSGI LogServices to SLF4J/LOGBack.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:x-large;">What happens next ?</span></div><div><br /></div><div>This blog series isn't finished, but we already talked about the most important informations about Logging in OSGI Enterprise Applications. Of course I'll continue this series next months because there are some more aspects to look at in detail. But expect next blog entries in a time-frame of 2-3 weeks for each.</div><div><br /></div><div>Blog Series "<span class="Apple-style-span" style="font-style: italic;">Logging in OSGI Enterprise Applications</span>":</div><div><br /></div><div><div><ul><li>Part 1: <a href="http://ekkes-corner.blogspot.com/2008/09/logging-in-osgi-enterprise-applications.html">An overview</a><br /></li><li>Part 2: <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications.html">How to catch all log events from "classic" logging - frameworks</a><br /></li><li>Part 3: <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications_11.html">How to catch all log events from OSGI Log Services </a><br /></li><li>Part 4: <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications_20.html">How to start logging bundles the right way inside an OSGI Enterprise application</a><br /></li><li>Part 5: Configuration, Fragment-Bundles, Markers<br /></li><li>Part 6: ... follows (Stay tuned...)<br /></li></ul></div><div><br /></div></div><div>Perhaps some of my older blogs about Logging und OSGI are also interesting:<br /></div><div><br /></div><div><ul><li><a href="http://ekkes-corner.blogspot.com/2008/07/logging-riena-easybeans-equinox.html">Logging (Riena - EasyBeans - Equinox) reloaded</a><br /></li><li><a href="http://ekkes-corner.blogspot.com/2008/06/catch-22-logging-with-osgi-frameworks.html">Catch-22 Logging in OSGI Environments</a><br /></li></ul></div><div><br /></div><div><span class="Apple-style-span" style="font-size:x-large;">New blog series coming soon</span></div><div><br /></div><div>Now I'll also starting a <span class="Apple-style-span" style="font-weight: bold;">new blog series</span> :</div><div><br /></div><div>„<span class="Apple-style-span" style="font-style: italic;">HowTo build an Equinox-Riena-EasyBeans-OSGI-Server</span>“. </div><div><br /></div><div>After working through that blog series you'll get a complete server as Open Source (EPL) to try it out by yourself. This server of course also contains all of the logging aspects I talked about.<br /></div><div><br /></div><div><br /></div><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SQrtLO5dOEI/AAAAAAAAAS8/aPFzNj3Zl1A/s400/de.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5263279891769276482" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 16px; height: 11px; " /><div>this blog in <a href="http://ekkes-ecke.org/">german</a></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com0tag:blogger.com,1999:blog-5484177613731225131.post-85209784467045064012008-10-20T00:05:00.013+02:002008-10-20T01:05:38.767+02:00Logging in OSGI Enterprise Applications, Part 4<div>Part 4 will demonstrate how to start the logging - framework and all the bridges inside an OSGI Enterprise Application.<br /></div><div><br /></div><div>To remember: At the end of the last (third) part of my blog - series "<span class="Apple-style-span" style="font-style: italic;">Logging in OSGI Enterprise Applications</span>" we were able to log all events from „<span class="Apple-style-span" style="font-style: italic;">classic</span>“ log-frameworks, OSGI LogServices, BundleEvents and FrameworkEvents using a SLF4J Log - implementation (LOGBack):</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SPuwCstg6xI/AAAAAAAAAQk/nXc36eTTbFU/s1600-h/catch_all.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SPuwCstg6xI/AAAAAAAAAQk/nXc36eTTbFU/s400/catch_all.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5258990550293474066" style="cursor: pointer; " /></a><br /></div><div>If we want to use it all inside a complex OSGI Enterprise Application its important to start the bundles using the right start-level. We also have to decide which bundles can be auto-started from the framework and which not. </div><div><br /></div><div>As an example I'll use again my OSGI - Equinox - Riena - EasyBeans - Hibernate - Server. I'll talk in detail about this server later in one of the follow-ups.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SPuwD045cWI/AAAAAAAAARE/UhQhCdhxoNk/s1600-h/start-order.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SPuwD045cWI/AAAAAAAAARE/UhQhCdhxoNk/s400/start-order.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5258990569668571490" style="cursor: pointer; " /></a><br /></div><div>From OSGI Launch Configuration:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SPuwC-UeNwI/AAAAAAAAAQs/PzANpo8QXYU/s1600-h/launch-config-start-level.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SPuwC-UeNwI/AAAAAAAAAQs/PzANpo8QXYU/s400/launch-config-start-level.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5258990555020277506" style="cursor: pointer; " /></a><br /></div><div>Default Start - Level is set to 3. </div><div>Our <span class="Apple-style-span" style="font-family: 'courier new';">osgi-over-slf4j - Bundle</span> must be started before (Start-Level = 2) and the <span class="Apple-style-span" style="font-family: 'courier new';">EasyBeans - Agent - Bundle</span> later (Start-Level = 4)</div><div><br /></div><div>We also have to watch that some bundles cannot be started with Auto-Start = true ! These bundles will be started under control from EasyBeans Agent bundle.</div><div><br /></div><div><span class="Apple-style-span" style="font-size: large;">What happens now starting the OSGI server application ?</span></div><div><br /></div><div><ol><li>The OSGI - Framework Equinox will be started<br /></li><li>Our <span class="Apple-style-span" style="font-family: 'courier new';">org.ekkehard.osgi.over.slf4j </span>bundle will be started. The Activator calls in the <span class="Apple-style-span" style="font-family: 'courier new';">start() </span>method <span class="Apple-style-span" style="font-family: 'courier new';">SLF4JBridgeHandler.install()</span> to catch all log - events from <span class="Apple-style-span" style="font-family: 'courier new';">java.util.logging</span> - also the Activator contains <span class="Apple-style-span" style="font-family: 'courier new';">Logger</span> - Statements. All this causes starting and activating <span class="Apple-style-span" style="font-family: 'courier new';">SLF4J - API</span> and <span class="Apple-style-span" style="font-family: 'courier new';">SLF4J - implementation (LOGBack) - bundles</span>: our Logging Framework is alive !<br /></li><li>All bundles with <span class="Apple-style-span" style="font-family: 'courier new';">Auto-Start = true</span> will be started then from the Framework. This includes all <span class="Apple-style-span" style="font-family: 'courier new';">Eclipse Riena</span> bundles. Riena uses <span class="Apple-style-span" style="font-family: 'courier new';">LOG4J</span> - so the LOG4J - bridge will be started. Riena also uses <span class="Apple-style-span" style="font-family: 'courier new';">Equinox - Extended - OSGI - Log - Services</span>.<br /></li><li>After starting all Default - Start - Level - bundles, the <span class="Apple-style-span" style="font-family: 'courier new';">easybeans.agent</span> will be started. This agent starts all <span class="Apple-style-span" style="font-family: 'courier new';">EasyBeans components</span> and <span class="Apple-style-span" style="font-family: 'courier new';">Hibernate</span>. EasyBeans uses <span class="Apple-style-span" style="font-family: 'courier new';">Commons - Logging</span> and<span class="Apple-style-span" style="font-family: 'courier new';"> java.util.logging</span> - Hibernate uses <span class="Apple-style-span" style="font-family: 'courier new';">SLF4J</span>. Then all our logging - framework - bridges are started and active. EasyBeans then starts all Entity - bundles and EJB3 - bundles from our server and registers the EJB3 - Business - Interfaces (Local oder Remote) als OSGI - Services.<br /></li><li>The <span class="Apple-style-span" style="font-family: 'courier new';">org.ekkehard.server </span>bundle tracks OSGI Managed Services and recognizes, when all required services are configured from EasyBeans and Hibernate and ready-to-go. Then org.ekkehard.server registers Services as <span class="Apple-style-span" style="font-family: 'courier new';">Remote Services</span> for Eclipse Riena.<br /></li></ol></div><div><br /></div><div><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-style: italic;">Remark: This is only a small part of all the activities and tasks happening while starting the server. More about 4. and 5. later in another blog series. Lets first finishing the logging.</span></span></div><div><br /></div><div><span class="Apple-style-span" style="font-size: large;">No black holes ?</span></div><div><br /></div><div>If we did it all well, then our SLF4J - Implementation LOGBack should start so early that we get all log - events and nothing is lost in space. </div><div><br /></div><div>To test this we configure our<span class="Apple-style-span" style="font-family: 'courier new';"> logback-test.xml</span> as follows: set Root Level to DEBUG, output to Console, swich DEBUG - Mode of the configuration itself on and start the server.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SPuwDMIRnWI/AAAAAAAAAQ0/3h77bxpnZ8E/s1600-h/minimal-config.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SPuwDMIRnWI/AAAAAAAAAQ0/3h77bxpnZ8E/s400/minimal-config.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5258990558727216482" style="cursor: pointer; " /></a><br /></div><div>You should get a log like this:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SPuwDHJNjtI/AAAAAAAAAQ8/e7RlBbwrhAs/s1600-h/console-log.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SPuwDHJNjtI/AAAAAAAAAQ8/e7RlBbwrhAs/s400/console-log.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5258990557388967634" style="cursor: pointer; " /></a><br /></div><div><ul><li>Line 1: equinox - osgi - Console<br /></li><li>Line 2 - 7: Debug-output from LOGBack configuration<br /></li><li>Line 8 - 9: Logging-output from osgi-over-slf4j - bundle<br /></li></ul></div><div><br /></div><div>There's no other logging-output on the console before starting SLF4J / LOGBack :-)</div><div><br /></div><div>The next blog will look at the configuration of LOGBack and some special Fragment - Bundles for configuration and also extending the LOGBack - implementation.</div><div><br /></div><div><div><ul><li>Part 1: <a href="http://ekkes-corner.blogspot.com/2008/09/logging-in-osgi-enterprise-applications.html">An overview</a><br /></li><li>Part 2: <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications.html">How to catch all log events from "classic" logging - frameworks</a><br /></li><li>Part 3: <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications_11.html">How to catch all log events from OSGI Log Services </a><br /></li><li>Part 4: How to start logging bundles the right way inside an OSGI Enterprise application<br /></li><li>Part 5: ... follows (Stay tuned...)<br /></li></ul></div><div><br /></div><div><br /></div><div>Perhaps some of my older blogs about Logging und OSGI are also interesting:</div><div><br /></div><div><ul><li><a href="http://ekkes-corner.blogspot.com/2008/07/logging-riena-easybeans-equinox.html">Logging (Riena - EasyBeans - Equinox) reloaded</a><br /></li><li><a href="http://ekkes-corner.blogspot.com/2008/06/catch-22-logging-with-osgi-frameworks.html">Catch-22 Logging in OSGI Environments</a><br /></li></ul></div><div><br /></div></div><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SPuwSLqRmaI/AAAAAAAAARM/o61o17s54yw/s400/de.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5258990816299424162" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; " /><div> the blog in <a href="http://ekkes-ecke.org/">german</a>.</div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com4tag:blogger.com,1999:blog-5484177613731225131.post-47253615159458246702008-10-11T15:55:00.034+02:002008-10-12T12:35:26.212+02:00Logging in OSGI Enterprise Applications, Part 3<div>Part 3 explains how to catch all log events logged by OSGI Bundles using OSGI Log Services. <br /></div><div><div><br /></div><div>In <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications.html">part 2</a> you've seen that catching log entries from "classic" Log - Frameworks was very easy:</div><div><ul><li>✓ Choose the right bundles<br /></li><li>✓ Create a config - file <br /></li></ul></div><div>-thats all :-)</div><div><span class="Apple-style-span" style="font-size:small;"><span class="Apple-style-span" style="font-style: italic;">Remark:<span class="Apple-style-span" style="font-family:'courier new';"> java.util.logging</span> needs also this one-liner: <span class="Apple-style-span" style="font-family:'courier new';">SLF4JBridgeHandler.install();</span></span></span></div><div><br /></div><div>Running an OSGI Enterprise Application you'll also find bundles logging their log - entries using OSGI Services:</div><div><ul><li><span class="Apple-style-span" style=" ;font-family:'courier new';">org.osgi.service.log.LogService </span><br /></li><li><span class="Apple-style-span" style=" ;font-family:'courier new';">org.osgi.service.log.LogReaderService </span><br /></li></ul></div><div><br /></div><div>You have also to watch for Services extending the "<span class="Apple-style-span" style="font-style: italic;">normal</span>" OSGI Log Services: Eclipse <a href="http://www.eclipse.org/riena/">Riena</a> per ex. uses from Equinox Incubator:</div><div><ul><li><span class="Apple-style-span" style=" ;font-family:'courier new';">org.eclipse.equinox.log.ExtendedLogService </span><br /></li><li><span class="Apple-style-span" style=" ;font-family:'courier new';">org.eclipse.equinox.log.ExtendedLogReaderService</span><br /></li></ul></div><div><br /></div><div>You can read Log entries using the <span class="Apple-style-span" style="font-family:'courier new';">LogReaderService</span>. You only have to register your <span class="Apple-style-span" style="font-family:'courier new';">LogListener</span>. </div><div>The <span class="Apple-style-span" style="font-family:'courier new';">LogListener</span> gets all <span class="Apple-style-span" style="font-family:'courier new';">LogEntry</span> (<span class="Apple-style-span" style="font-family:'courier new';">ExtendedLogEntry</span>), then you can log them using <a href="http://www.slf4j.org/">SLF4J</a>-API to your <a href="http://logback.qos.ch/">LOGBack</a> Implementation. </div><div><br /></div><div>You have to use the same config file (<span class="Apple-style-span" style="font-family:'courier new';">logback.xml</span> or <span class="Apple-style-span" style="font-family:'courier new';">logback-test.xml</span>) as described in <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications.html">part 2</a> (logging the entries from „classic“ Log - frameworks). Details about configuration will follow in another Blog of this series.</div><div><br /></div><div>Short overview:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SPDNXje5OVI/AAAAAAAAAP0/AOxVnfs6H_o/s1600-h/osgi-log-services-and-slf4j.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SPDNXje5OVI/AAAAAAAAAP0/AOxVnfs6H_o/s400/osgi-log-services-and-slf4j.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5255926569686874450" style="cursor: pointer; " /></a><br /></div><div>We already have following bundles used as <a href="http://www.slf4j.org/legacy.html">bridges</a> between „<span class="Apple-style-span" style="font-style: italic;">classic</span>“ Log-Frameworks and <a href="http://www.slf4j.org/">SLF4J</a> / <a href="http://logback.qos.ch/">LOGBack</a>:</div><div><br /></div><div><ul><li><span class="Apple-style-span" style=" ;font-family:'courier new';">slf4j.api</span><br /></li><li><span class="Apple-style-span" style=" ;font-family:'courier new';">jul.to.slf4j</span><br /></li><li><span class="Apple-style-span" style=" ;font-family:'courier new';">log4j.over.slf4j</span><br /></li><li><span class="Apple-style-span" style=" ;font-family:'courier new';">jcl.over.slf4j</span><br /></li></ul></div><div><br /></div><div>There are also the bundles of the <a href="http://www.slf4j.org/">SLF4J</a> - implementation <a href="http://logback.qos.ch/">LOGBack</a>:</div><div><br /></div><div><ul><li><span class="Apple-style-span" style=" ;font-family:'courier new';">logback.core</span><br /></li><li><span class="Apple-style-span" style=" ;font-family:'courier new';">logback.classic</span><br /></li></ul></div><div><br /></div><div>You'll find more details in <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications.html">part 2</a> of this Blog series.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Bundle <span class="Apple-style-span" style="font-family:'courier new';">osgi.over.slf4j</span> (a bridge between OSGI Service and LOG4J)</span></div><div><br /></div><div>We need a bundle as bridge between OSGI Log Services and SLF4J / LOGBack. Please create a Plug-In project using PDE:</div><div><br /></div><div><ul><li><span class="Apple-style-span" style=" ;font-family:'courier new';">my.namespace.osgi.over.slf4j</span><br /></li></ul></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SPDMWwK0x2I/AAAAAAAAAPE/B-BZXvXd93M/s1600-h/bridge-osgi-over-slf4j.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SPDMWwK0x2I/AAAAAAAAAPE/B-BZXvXd93M/s400/bridge-osgi-over-slf4j.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5255925456400861026" style="cursor: pointer; " /></a><br /></div><div>Your <span class="Apple-style-span" style="font-family:'courier new';">MANIFEST.MF</span> should look like:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SPDMZmbMZoI/AAAAAAAAAPk/eR0EJH2OAGs/s1600-h/manifest-osgi-over-slf4j.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SPDMZmbMZoI/AAAAAAAAAPk/eR0EJH2OAGs/s400/manifest-osgi-over-slf4j.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5255925505324770946" style="cursor: pointer; " /></a><br /></div><div>This <span class="Apple-style-span" style="font-family:'courier new';">osgi.over.slf4j</span> - bundle has its own <span class="Apple-style-span" style="font-family:'courier new';">org.slf4j.Logger</span>:</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SPDNYMI0owI/AAAAAAAAAP8/77WwRDq9Fd8/s1600-h/slf4j_Logger.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SPDNYMI0owI/AAAAAAAAAP8/77WwRDq9Fd8/s400/slf4j_Logger.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5255926580600152834" style="cursor: pointer; " /></a></div><div>We'll use this Logger to log events from this bundle itself and also to log all catched LogEntry from other bundles.<br /></div><div><br /></div><div>To track <span class="Apple-style-span" style="font-family:'courier new';">LogReader</span> Services we can use a <span class="Apple-style-span" style="font-family:'courier new';">ServiceTracker</span>:</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SPDNZBJGqKI/AAAAAAAAAQE/xEThG1R8q1w/s1600-h/start+servicetracker.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SPDNZBJGqKI/AAAAAAAAAQE/xEThG1R8q1w/s400/start+servicetracker.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5255926594828413090" style="cursor: pointer; " /></a><br /></div><div>We create our LogServiceTracker with this filter to get only services from type <span class="Apple-style-span" style="font-family:'courier new';">LogReaderService</span> or <span class="Apple-style-span" style="font-family:'courier new';">ExtendedLogReaderService</span>:</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">(|(objectClass=org.osgi.service.log.LogReaderService) (objectClass=org.eclipse.equinox.log.ExtendedLogReaderService))</span></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SPDMYy9a0WI/AAAAAAAAAPc/MGnLcG_Ox9s/s1600-h/LogServiceTracker.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SPDMYy9a0WI/AAAAAAAAAPc/MGnLcG_Ox9s/s400/LogServiceTracker.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5255925491509678434" style="cursor: pointer; " /></a><br /></div><div><br /></div><div><br /></div><div>A LogListener for „<span class="Apple-style-span" style="font-style: italic;">normal</span>“ OSGI LogServices:</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SPDNXVAOVqI/AAAAAAAAAPs/X02kRMRHQOc/s1600-h/NLoglistener.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SPDNXVAOVqI/AAAAAAAAAPs/X02kRMRHQOc/s400/NLoglistener.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5255926565800138402" style="cursor: pointer; " /></a></div><div><span class="Apple-style-span" style="font-family:'courier new';">LogEntry</span> will be logged using the <span class="Apple-style-span" style="font-family:'courier new';">Logger</span> of our <span class="Apple-style-span" style="font-family:'courier new';">osgi.over.slf4j</span> - bundle.<br /></div><div><br /></div><div>A LogListener for „<span class="Apple-style-span" style="font-style: italic;">extended</span>“ Equinox OSGI LogServices:</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SPDNZh5YNUI/AAAAAAAAAQM/H8-D7tKhKdw/s1600-h/XLogListener.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SPDNZh5YNUI/AAAAAAAAAQM/H8-D7tKhKdw/s400/XLogListener.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5255926603620824386" style="cursor: pointer; " /></a></div><div><span class="Apple-style-span" style="font-family:'courier new';">ExtendedLogEntry</span> already contains an own <span class="Apple-style-span" style="font-family:'courier new';">Logger</span>. <br /></div><div>We'll use an <span class="Apple-style-span" style="font-family:'courier new';">org.slf4j.Logger</span> with same name - but to distinguish we use a prefix („<span class="Apple-style-span" style="font-family:'courier new';">X.</span>“). Details will follow in another Blog.</div><div><br /></div><div>Then we delegate <span class="Apple-style-span" style="font-family:'courier new';">LogEntry</span> and <span class="Apple-style-span" style="font-family:'courier new';">ExtendedLogEntry</span> to the o<span class="Apple-style-span" style="font-family:'courier new';">rg.slf4j.Logger</span>:</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SPDMX5LaxOI/AAAAAAAAAPU/CAT0M6dHP4U/s1600-h/loglogentry.png"><img src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SPDMX5LaxOI/AAAAAAAAAPU/CAT0M6dHP4U/s400/loglogentry.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5255925475999139042" style="cursor: pointer; " /></a></div><div>We have to map the OSGI LogService Levels. We can get the origin message and (optional) exception from <span class="Apple-style-span" style="font-family:'courier new';">LogEntry</span> and delegate to our Logger.<br /></div><div><br /></div><div>Different from Log4J or Commons-Logging is using a <span class="Apple-style-span" style="font-family:'courier new';">Marker</span>. Markers are part of the SLF4J API, but at the moment only the LOGBack - implementation uses them. We are using Marker to print the bundle-name and perhaps also the service-name. Then we know which bundle / service originally creates the <span class="Apple-style-span" style="font-family:'courier new';">LogEntry</span> or <span class="Apple-style-span" style="font-family:'courier new';">ExtendedLogEntry</span>. </div><div><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">Remark: More about Marker you'll find in one of the next Blogs of this series.</span></span></div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Logging BundleEvent and FrameworkEvent </span></div><div><br /></div><div>Its a good idea also to log <span class="Apple-style-span" style="font-family:'courier new';">org.osgi.framework.BundleEvent </span>and <span class="Apple-style-span" style="font-family:'courier new';">org.osgi.framework.FrameworkEvent</span>. </div><div><br /></div><div>To do this we need these Listener:</div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SPDMXcErirI/AAAAAAAAAPM/GrAzKi_5q1k/s1600-h/bundleAndFrameworkListener.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SPDMXcErirI/AAAAAAAAAPM/GrAzKi_5q1k/s400/bundleAndFrameworkListener.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5255925468186249906" style="cursor: pointer; " /></a></div><div>Dependent from the Event - Type we create the message and level.<br /></div><div><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:small;">Remark: More about SLF4J - Marker in one of the follow-ups.</span></span></div><div><br /></div><div>--------------------------------------------------------------------------------</div><div><br /></div><div>Now we are ready to catch and log all events from „<span class="Apple-style-span" style="font-style: italic;">classic</span>“ Log-Frameworks, OSGI LogServices, BundleEvents or FrameworkEvents using SLF4J / LOGBack:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SPHStYU6iJI/AAAAAAAAAQc/Ou1hAZyonZU/s1600-h/catch_all.png"><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SPHStYU6iJI/AAAAAAAAAQc/Ou1hAZyonZU/s400/catch_all.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5256213917184198802" style="cursor: pointer; " /></a><br /></div><div>This was the third part of my blog series "<span class="Apple-style-span" style="font-style: italic;">Logging in OSGI Enterprise Applications</span>":</div><div><br /></div><div><ul><li>Part 1: <a href="http://ekkes-corner.blogspot.com/2008/09/logging-in-osgi-enterprise-applications.html">An overview</a><br /></li><li>Part 2: <a href="http://ekkes-corner.blogspot.com/2008/10/logging-in-osgi-enterprise-applications.html">How to catch all log events from "classic" logging - frameworks</a><br /></li><li>Part 3: How to catch all log events from OSGI Log Services <br /></li><li>Part 4: ... follows (Stay tuned...)<br /></li></ul></div><div><br /></div><div><br /></div><div>Perhaps some of my older blogs about Logging und OSGI are also interesting:</div><div><br /></div><div><ul><li><a href="http://ekkes-corner.blogspot.com/2008/07/logging-riena-easybeans-equinox.html">Logging (Riena - EasyBeans - Equinox) reloaded</a><br /></li><li><a href="http://ekkes-corner.blogspot.com/2008/06/catch-22-logging-with-osgi-frameworks.html">Catch-22 Logging in OSGI Environments</a></li></ul></div><div><br /></div><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SPDN39_pUCI/AAAAAAAAAQU/ITfaKc49Jyo/s400/de.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5255927126559379490" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; " /><div>the blog in <a href="http://ekkes-ecke.org/">german</a>.</div></div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com0tag:blogger.com,1999:blog-5484177613731225131.post-23711897101688682262008-09-24T17:42:00.030+02:002008-09-25T16:18:37.866+02:00Logging in OSGI Enterprise Applications, Part 1<a href="http://www.slf4j.org/"><img style="cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_Xv6Yjx9z9no/SNtMgWjN45I/AAAAAAAAAN0/YfwPDPhCLFI/s400/slf4j-logo.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5249873909323260818" /></a><br /><br /><div>Logging is an important part of ERP Applications and should be easy using a modern logging framework ;-)</div><div><br /></div><div>My actual work-in-progress (german ERP solution) contains: <a href="http://www.eclipse.org/equinox/">Equinox</a> as OSGI Framework, Eclipse <a href="http://www.eclipse.org/riena/">Riena</a> for Remote Services + UI, <a href="http://wiki.easybeans.org/xwiki/bin/view/Main/WebHome">EasyBeans</a> as EJB3 Container + JPA (<a href="http://hibernate.org/">Hibernate</a>) etc.</div><div><br /></div><div>This means I have to integrate different logging - frameworks:</div><div><br /></div><div><ul><li>org.osgi.service.log<br /></li><li>org.eclipse.equinox.log (Extended Log Services from 1.1.0.HEAD)<br /></li><li>org.apache.commons.logging<br /></li><li>org.apache.log4j<br /></li><li>org.slf4j<br /></li><li>java.util.logging (JSR47)<br /></li></ul></div><div><br /></div><div>If you already followed some of my blogs, then you probably know that its not easy to design a clean OSGI architecture for a complex business application.</div><div><br /></div><div>Actually I was confronted with the newest snapshot of EasyBeans containing a new Hibernate release (3.4) now using <a href="http://www.slf4j.org/">SLF4</a> as logging framework. This causes me to rethink my logging architecture.</div><div><br /></div><div>The logging solution should make my OSGI client / server - application independent from logging frameworks. I'll explain all in detail later. At first I'll give you an overview to see the differences between "<span class="Apple-style-span" style="font-style: italic;">classic</span>" Java logging frameworks and OSGI Logging Services.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:x-large;">"</span><span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-size:x-large;">Classic</span></span><span class="Apple-style-span" style="font-size:x-large;">" Java Logging Frameworks</span></div><div><br /></div><div><ul><li> <a href="http://commons.apache.org/logging/">Apache Commons - Logging</a> (JCL)<br /></li><li> <a href="http://logging.apache.org/log4j/">Log4J</a> - Logging<br /></li><li> <a href="http://www.slf4j.org/">SLF4J</a> - Logging<br /></li><li> <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/package-summary.html">JDK</a> - Logging (java.util.logging)<br /></li></ul></div><div><br /></div><div>Usually logging works this way:</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Logger definition:</span></div><div><br /></div><div>Commons-Logging:</div><div><span class="Apple-style-span" style="font-family:'courier new';">private static Log logger = LogFactory.getLog(MyClass.class);</span></div><div>Log4J:</div><div><span class="Apple-style-span" style="font-family:'courier new';">private static Logger logger = Logger.getLogger(MyClass.class.getName());</span></div><div>SLF4J:</div><div><span class="Apple-style-span" style="font-family:'courier new';">private static Logger logger = LoggerFactory.getLogger(MyClass.class);</span></div><div>JDK:</div><div><span class="Apple-style-span" style="font-family:'courier new';">private static Logger logger = Logger.getLogger(MyClass.class.getName());</span></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Logging a message:</span></div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">logger.info(„my message“)</span></div><div><br /></div><div>Because concatenating Strings is slowly we also find: </div><div><span class="Apple-style-span" style="font-family:'courier new';"><br /></span></div><div><span class="Apple-style-span" style="font-family:'courier new';">if (logger.isDebugEnabled())</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"> logger.debug("message part 1" + aVar</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"> + "message part 2");</span></div><div><br /></div><div><span class="Apple-style-span" style="font-style: italic;">Remark:</span> <span class="Apple-style-span" style="font-size:small;">If you're using SLF4J (</span><a href="http://www.slf4j.org/faq.html#logging_performance"><span class="Apple-style-span" style="font-size:small;">FAQ</span></a><span class="Apple-style-span" style="font-size:small;">) in many cases you can simple use a parameterized message string:</span></div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">logger.debug("message part 1 {} message part 2", aVar);</span></div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Configuring logging - frameworks:</span></div><div><br /></div><div>Configuration can be made using Java code - but mostly you'll find a configuration file - wether in properties or XML format. </div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Whats different if you're using these logging frameworks under OSGI ?</span></div><div><br /></div><div><ul><li>you need a bundle for each JAR. You can find bundles for Commons-Logging, LOG4J and SLF4J partly in Eclipse or get them from a bundle repository<br /></li><li>logging itself is the same as in normal Java applications<br /></li><li>you have to place the configuration file into a Fragment-Bundle<br /></li></ul></div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:x-large;">OSGI Logging Services</span></div><div><br /></div><div>Under OSGI you can use Logging Services:</div><div><br /></div><div><ul><li>Standard OSGI : org.osgi.log (OSGI Logging, implemented by org.equinox.log)<br /></li><li>Extended: org.equinox.log (1.1.0.HEAD Version from CVS or Riena download), extended Logging)<br /></li></ul></div><div><br /></div><div>OSGI Logging uses Services and Listeners. Equinox implements OSGI Log Services as ManagementServices. </div><div><br /></div><div><ul><li>LogService or ExtendedLogService - writes all log messages<br /></li><li>LogReaderService or ExtendedLogReaderService - where you can read log messages from<br /></li><li>LogListener - gets the messages from ReaderService and you can handle them<br /></li></ul></div><div><br /></div><div>OSGI LogService can be compared with the Logger from "<span class="Apple-style-span" style="font-style: italic;">classic</span>" Java logging. Its a good idea to place LogService Logger objects into the Activator of a bundle.</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">LogService logger = ...</span></div><div><br /></div><div>Logging a message is nearly the same as logging in non - OSGI environments - of course we have to test if the service is available:</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">if (logger != null) {</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"> logger.log(LogService.LOG_INFO, „my message“);</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">}</span></div><div><br /></div><div>The LogEvent can then be read using the LogReaderService. You can "track" this ReaderService and add your own LogListener. This LogListener gets all messages and you can persist the messages or print to console or use one of the "<span class="Apple-style-span" style="font-style: italic;">classic</span>" logging frameworks.</div><div><br /></div><div>Equinox allows you to configure how many messages should be cached from LogReader Service and at which Log Level. But important to know: The LogReaderService sends always all messages to all registered LogListener independent from your configuration !</div><div><br /></div><div><span class="Apple-style-span" style="font-size:x-large;">"<span class="Apple-style-span" style="font-style: italic;">Classic</span>" Logging or OSGI Log Services ?</span></div><div><br /></div><div>Lets look at the differences between "<span class="Apple-style-span" style="font-style: italic;">classic</span>" Java - logging und OSGI - Log Services:</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">a) Which messages will be logged - and when ?</span></div><div><br /></div><div>"<span class="Apple-style-span" style="font-style: italic;">Classic</span>" Logging only creates log - messages if the Logger answers "<span class="Apple-style-span" style="font-style: italic;">yes</span>" to <span class="Apple-style-span" style="font-style: italic;">„should I really log this message at those level for 'the.logger.name'</span>“ ? It depends from the content of your configuration file, what you want to log at which level. If the Logger answers "<span class="Apple-style-span" style="font-style: italic;">no</span>" - nothing will be logged.</div><div><br /></div><div>OSGI Log Services always log ALL messages. The Log Reader Service gets them ALL. The Log Reader Service will inform all Log Listeners about all logged messages. Also the Log Reader Service will cache a configurable amount of messages.</div><div>The main task of a Log Listener is to filter the messages and to persist or print them.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">b) What will be logged ? And whats the content of the Log Messages</span></div><div><br /></div><div>Here you'll see the most important content of a Log Entry:</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SNtMgCqLaCI/AAAAAAAAANs/qTJkTiPBHxk/s1600-h/was-wird-geloggt.png"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SNtMgCqLaCI/AAAAAAAAANs/qTJkTiPBHxk/s400/was-wird-geloggt.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5249873903983749154" style="cursor: pointer; " /></a><br /></div><div><br /></div><div>The different logging frameworks are also using different Log Levels, so they have to be mapped.</div><div>The logged Message is a String or will be created from myObject.toString().</div><div>MDC (<a href="http://logback.qos.ch/manual/mdc.html">Mapped Diagnostic Context</a>) - a Thread - local Map where you can store context informations, per ex. user info of client sessions.</div><div>Marker - a tree of Strings you can mark messages with.</div><div><br /></div><div>In an OSGI environment its very useful to log informations about the Bundle (and perhaps the Service Reference) where the logged message comes from.</div><div>Using OSGI Log Services you'll get this for free. If you're using SLF4J / LOGBack you can also store Bundle- and Service Names. (Using the Marker - more about this later)</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">c) Whats the best to use ? "Classic" Logging Frameworks or OSGI Log Services ?</span></div><div><br /></div><div>Don't ask this question if you're developing an OSGI Enterprise - Application ;-)</div><div><br /></div><div>Why not ? </div><div><br /></div><div><ul><li>You'll never know in advance, which (foreign) projects you'll have to integrate while the whole life-cycle of your business application. <br /></li><li>You have to live with 3rdParty Bundles using all kind of logging - frameworks and -strategies. (Sometimes they change it as with Hibernate happened)<br /></li></ul></div><div><br /></div><div>But you have to find the answer, HOW to combine and integrate them all without loosing flexibility. If you've solved this issue, then it also doesn't matter what you're using in your own bundles, because your logging architecture consumes it all :-)</div><div>Perhaps specific use cases can force you to use '<span class="Apple-style-span" style="font-style: italic;">classic</span>' logging and OSGI Log Services.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:x-large;">Integration of all Logging Frameworks and Log Services</span></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SNtMfxUNu5I/AAAAAAAAANk/Ta-U7LISQQI/s1600-h/framework-flow.png"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SNtMfxUNu5I/AAAAAAAAANk/Ta-U7LISQQI/s400/framework-flow.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5249873899328224146" style="cursor: pointer; " /></a><br /></div><div><br /></div><div>The heart of my solution is <a href="http://www.slf4j.org/">SLF4J</a> with <a href="http://logback.qos.ch/">LOGBack</a> as native implementation. </div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SNtqViU18KI/AAAAAAAAAOM/5DasO_3Nrtw/s1600-h/logbacklogo.jpg"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SNtqViU18KI/AAAAAAAAAOM/5DasO_3Nrtw/s400/logbacklogo.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5249906708854468770" style="cursor: pointer; " /></a><br /></div><div>SLF4J (Logback) has already bridges for all '<span class="Apple-style-span" style="font-style: italic;">classic</span>' logging frameworks: this enables you to use bundles logging to Commons-Logging (JCL), Log4J, JDK (java.util.logging) or SLF4J. All logged messages will be transparently routed to LOGBack.</div><div><br /></div><div>Also all OSGI LogServices - wether Standard or Extended - will be catched from Log Listeners and delegated to SLF4J (LOGBack) delegiert.</div><div><br /></div><div>So you have ONE place to handle all your logging :-) It depends only from your configuration, if LOGBack prints messages to Console or sends them to a socket (local or remote), to your filesystem, RDBMS or to a LogServer or ... </div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:x-large;">(Logging) - Integration of Eclipse Riena</span></div><div><br /></div><div><a href="http://www.eclipse.org/riena/"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SNtMguphryI/AAAAAAAAAOE/K1wfEOfOfZo/s400/riena_ei.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5249873915792174882" style="cursor: pointer; " /></a><br /></div><div>If you're using Eclipse <a href="http://www.eclipse.org/riena/">Riena</a> M4 there are currently two small problems to solve:</div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">1. Log4J-over-SLF4J</span></div><div><br /></div><div>The bridge Log4J-over-SLF4J only provides the package org.apache.log4j, but org.eclipse.riena.core has a dependency to org.apache.log4j.xml. Please change this to "optional" in the MANIFEST.MF:</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">Import-Package: org.apache.log4j,</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">org.apache.log4j.xml;<span class="Apple-style-span" style="color: rgb(255, 0, 0);"><span class="Apple-style-span" style="font-weight: bold;">resolution:=optional</span></span>,</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">org.osgi.framework;version="1.3.0",</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">org.osgi.service.cm;version="1.2.0",</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">org.osgi.service.log;version="1.3.0"</span></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">2. multiple log entries</span></div><div><br /></div><div>Starting with M5 Riena's logging can be configured and its promised that you can switch it all OFF. While using M4 you'll notice two extra messages printed from Rienas LogListener to Console. (Bugzilla <a href="http://bugs.eclipse.org/247680">247680</a>)</div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:x-large;">(Logging) - Integration of EasyBeans OSGI</span></div><div><br /></div><div><a href="http://wiki.easybeans.org/xwiki/bin/view/Main/WebHome"><img src="http://2.bp.blogspot.com/_Xv6Yjx9z9no/SNtMgXMXnSI/AAAAAAAAAN8/7XhB-6IMEJY/s400/easybeans.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5249873909495864610" style="cursor: pointer; " /></a><br /></div><div><a href="http://wiki.easybeans.org/xwiki/bin/view/Main/WebHome">EasyBeans</a> logging is now transparently routed to LOGBack without any problems. Since some days the Snapshots of EasyBeans 1.1.0 includes Hibernate 3.4, which itself now is using SLF4J. This also causes no problems because LOGBack is native Implementation of SLF4J.</div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-size:x-large;">additional informations</span></div><div><br /></div><div>This blog is only the first one of a serie about Logging and OSGI. Perhaps it makes sense that you also take a look at my (older) blogs to know the hard way I went ;-)</div><div><br /></div><div><ul><li><a href="http://ekkes-corner.blogspot.com/2008/07/logging-riena-easybeans-equinox.html">Logging (Riena - EasyBeans - Equinox) reloaded</a><br /></li><li><a href="http://ekkes-corner.blogspot.com/2008/06/catch-22-logging-with-osgi-frameworks.html">Catch-22 Logging in OSGI Environments</a><br /></li></ul></div><div><br /></div><div><span class="Apple-style-span" style="font-size:large;">Links:</span></div><div><ul><li>Simple Logging Facade for Java (<a href="http://www.slf4j.org/">SLF4J</a>)<br /></li><li><a href="http://logback.qos.ch/">LOGBack</a> - Loggingframework, native SLF4J implementation<br /></li><li>Eclipse <a href="http://www.eclipse.org/riena/">Riena</a> (Remote Services, UI enhancements)<br /></li><li>Eclipse <a href="http://www.eclipse.org/equinox">Equinox</a> (OSGI Framework)<br /></li><li><a href="http://wiki.easybeans.org/xwiki/bin/view/Main/WebHome">EasyBeans</a> OSGI (EJB3 Container as OSGI bundles)<br /></li><li><a href="http://hibernate.org/">Hibernate</a> (JPA - integrated into EasyBeans)<br /></li></ul></div><div><br /></div><div><span class="Apple-style-span" style="font-size:x-large;">How goes it on ?</span></div><div><br /></div><div>This blog is only part 1 of the series „<span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-weight: bold;">Logging in OSGI Enterprise Applications</span></span>“ giving only a short overview - the following themes will be later discussed in detail with source codee examples - so stay tuned.</div><div><br /></div><div><ul><li>HowTo registrier OSGI Logging Services<br /></li><li>Tracking (standard and extended) OSGI Logging Reader Services<br /></li><li>Adding Log Listeners to LogReader Services<br /></li><li>HowTo configure LOGBack for OSGI<br /></li><li>Mapping of LogLevels<br /></li><li>Details of used Bundles, Manifest - files, dependencies,...<br /></li><li>Fragment-Bundles<br /></li><li>OSGI Launch configurations<br /></li><li>Testing the whole stuff<br /></li><li>Use of EasyBeans JDBC Pooling to persist messages from LOGBack in RDBMS<br /></li><li>Performance issues (frameworks, "<span class="Apple-style-span" style="font-style: italic;">classic</span>" logging vs. OSGI LogServices)<br /></li><li>HowTo migrate existing code<br /></li><li>Useful Eclipse PlugIns (Log4E, LogBack Console)<br /></li><li>Client-/Server Logging Strategy, Remote Services, MDC - Userinfo...<br /></li><li>The „black hole“: how to log before the services are ready ?<br /></li><li>Use of SLF4J Marker to put Bundle- und Service - informations into<br /></li><li>What happens if other bundles are also using Log Listeners and log messages ?<br /></li><li>...<br /></li></ul></div><div><br /></div><div><span class="Apple-style-span" style="font-style: italic;">Remark</span>:<span class="Apple-style-span" style="font-size:small;"> In my article I'm not covering </span><a href="http://wiki.ops4j.org/confluence/display/ops4j/Pax+Logging"><span class="Apple-style-span" style="font-size:small;">PAX OSGI Logging</span></a><span class="Apple-style-span" style="font-size:small;">. PAX uses Log4J as implementation and also integrates some logging frameworks (JCL, JDK, SLF4J, Avalon). Perhaps you should also take a look at PAX before deciding how to use logging in your OSGI application.</span></div><div><br /></div><div>A more detailed complete article is already in work about <span class="Apple-style-span" style="font-style: italic;">„<span class="Apple-style-span" style="font-weight: bold;">Logging in OSGI Enterprise Applications</span></span>“ - and I'll continue this blog series.</div><div><br /></div><div>Examples with sourcecode will also follow - I'm jst preparing a sample of my Equinox -based <span class="Apple-style-span" style="font-weight: bold;">Riena-Easybeans-Server</span>, where the logging of course is an important aspect.</div><div><br /></div><div><a href="http://eclipse.org/equinox"><img src="http://1.bp.blogspot.com/_Xv6Yjx9z9no/SNtqVzKU_CI/AAAAAAAAAOU/MnoqVwEOEH8/s400/equinox5.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5249906713373768738" style="cursor: pointer; " /></a><br /></div><div><br /></div><div>Hopefully you can get some ideas from my experiences and ideas how to solve the logging problem. I promise: if you're developing OSGI enterprise applications - one day you'll run into logging problems, so its better you're prepared.</div><div><br /></div><div><br /></div><img src="http://3.bp.blogspot.com/_Xv6Yjx9z9no/SNtsR0rWMLI/AAAAAAAAAOc/AGmbtiF9MXg/s400/de.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5249908844084474034" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; " /><div> in <a href="http://web.mac.com/ekkehard.gentz/ekkes-corner/blog/blog.html">german</a>.</div>ekkehttp://www.blogger.com/profile/12524911202665703266noreply@blogger.com8