<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3347364779886537900</id><updated>2011-07-29T05:12:21.933-04:00</updated><category term='java decompiler disassembler jad jd-gui fedora rhel'/><category term='intellij idea ide fedora gnome setup install'/><title type='text'>Tidbits on Open Source Enterprise Java</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://freshjava.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3347364779886537900/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://freshjava.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>ips</name><uri>http://www.blogger.com/profile/04467965115809770939</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/_vo2NqSooVV0/SPzYxWcMDwI/AAAAAAAAAGU/vhBnIKkA-IM/S220/me-200x215.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3347364779886537900.post-2629413070640508720</id><published>2011-05-27T16:47:00.004-04:00</published><updated>2011-05-31T22:29:30.089-04:00</updated><title type='text'>Making Links Work Right in a SmartGWT App on IE</title><content type='html'>The GUI of RHQ 4.0 and later is built upon SmartGWT. In many places in the SmartGWT app, we embedded raw HTML to render fragment links (e.g. #Inventory/Servers) to other places in the app. We used raw HTML, rather than widgets, for a few reasons:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;SmartGWT does not provide a link widget. GWT provides the HyperLink and InlineHyperLink widgets, but we try to avoid using non-SmartGWT widgets when possible to prevent layout issues or CSS issues caused by straying from the SmartGWT framework. A SmartGWT Label or HTMLFlow can be extended to simulate a link using a ClickHandler but it will not be rendered as an 'a' tag and so will not inherit the CSS styles used for 'a' tags and will not display the link's URL in the browser status bar when the user hovers over the link.&lt;/li&gt;&lt;li&gt;Many of our links are inside ListGrid cells. There is no straightforward reliable way to embed arbitrary widgets in ListGrid cells. I tried using the mechanism http://www.smartclient.com/smartgwt/showcase/#grid_cell_widgets described here and encountered overflow and wrapping issues, which I was unable to overcome. The CellFormatter interface only supports returning a String, but that String can include HTML, so that's what we ended up using for cells that need to contain a link.&lt;/li&gt;&lt;li&gt;For FormItems that need to contain links, CanvasItem can be extended in order to embed GWT HyperLink widgets, but using a StaticTextItem with HTML embedded in its value is more straightforward.&lt;/li&gt;&lt;/ol&gt;Unfortunately, we noticed that clicking on any of our raw HTML fragment links in IE caused a full page refresh, which is not at all desirable in a GWT app, which is intended to be pure AJAX. Further investigation revealed that this is a longstanding quirk (aka bug) in IE; rather than simply generating a history event for the URL with the updated fragment, it sends an unnecessary request for the URL to the server. If you use the GWT HyperLink widget, GWT uses some JavaScript fanciness involving iframes to circumvent the IE bug and make fragment links work properly. However, since we were using raw HTML for all the links in the RHQ GUI, this magic was not there for us. Converting all our HTML links would be a ton of work and was simply not a viable option for links in ListGrid cells for the reasons described above, so we needed to find a way to execute GWT's magic when any of our raw HTML links were clicked. The answer ended up being to add a native preview event handler that intercepts browser click events and executes the magic if the click was on one of our 'a' tags. We did this by making our EntryPoint class implement the GWT Event.NativePreviewHandler interface as follows:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;    public void onPreviewNativeEvent(Event.NativePreviewEvent event) {&lt;br /&gt;        if (SC.isIE() &amp;&amp; event.getTypeInt() == Event.ONCLICK) {&lt;br /&gt;            NativeEvent nativeEvent = event.getNativeEvent();&lt;br /&gt;            EventTarget target = nativeEvent.getEventTarget();&lt;br /&gt;            if (Element.is(target)) {&lt;br /&gt;                Element element = Element.as(target);&lt;br /&gt;                if ("a".equalsIgnoreCase(element.getTagName())) {&lt;br /&gt;                    // make sure it's not a hyperlink that GWT already&lt;br /&gt;                    // handles&lt;br /&gt;                    if (element.getPropertyString("__listener") == null) {&lt;br /&gt;                        String url = element.getAttribute("href");&lt;br /&gt;                        String historyToken = getHistoryToken(url);&lt;br /&gt;                        if (historyToken != null) {&lt;br /&gt;                            GWT.log("Forcing History.newItem(\"" +&lt;br /&gt;                                historyToken + "\")...");&lt;br /&gt;                            History.newItem(historyToken);&lt;br /&gt;                            nativeEvent.preventDefault();&lt;br /&gt;                        }&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private static String getHistoryToken(String url) {&lt;br /&gt;        String token;&lt;br /&gt;        if (url.startsWith("#")) {&lt;br /&gt;            token = url.substring(1);&lt;br /&gt;        } else if (url.startsWith("/#")) {&lt;br /&gt;            token = url.substring(2);&lt;br /&gt;        } else if (url.contains(Location.getHost()) &amp;&amp; url.indexOf('#') &gt; 0) {&lt;br /&gt;            token = url.substring(url.indexOf('#') + 1);&lt;br /&gt;        } else {&lt;br /&gt;            token = null;&lt;br /&gt;        }&lt;br /&gt;        return token;&lt;br /&gt;    }&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;We then add the native preview handler at app load time by adding the following line to our EntryPoint class:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;Event.addNativePreviewHandler(this);&lt;/code&gt;&lt;/pre&gt;This solution is working great. However, we still might eventually go back and switch over to using GWT HyperLinks, rather than raw HTML, in places where it is feasible, such as FormItems, since it is generally better to use widgets rather than raw HTML to keep things object-oriented and leave the generation of HTML, CSS, and JavaScript to the framework.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3347364779886537900-2629413070640508720?l=freshjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://freshjava.blogspot.com/feeds/2629413070640508720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3347364779886537900&amp;postID=2629413070640508720' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3347364779886537900/posts/default/2629413070640508720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3347364779886537900/posts/default/2629413070640508720'/><link rel='alternate' type='text/html' href='http://freshjava.blogspot.com/2011/05/making-links-work-right-in-smartgwt-app.html' title='Making Links Work Right in a SmartGWT App on IE'/><author><name>ips</name><uri>http://www.blogger.com/profile/04467965115809770939</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/_vo2NqSooVV0/SPzYxWcMDwI/AAAAAAAAAGU/vhBnIKkA-IM/S220/me-200x215.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3347364779886537900.post-2693274394662964236</id><published>2011-05-27T15:12:00.007-04:00</published><updated>2011-06-17T13:45:22.937-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='intellij idea ide fedora gnome setup install'/><title type='text'>Setting Up IntelliJ IDEA on Fedora</title><content type='html'>JetBrains does not provide rpm's for IDEA, so setting it up on Fedora requires a bit of extra work. Here are the steps that I do.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Unzip the Distribution&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;# cd /opt&lt;br /&gt;# tar -xzvf /path/to/ideaIC-10.5.tar.gz&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This will create the directory /opt/idea-IC-107.105.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Create Symbolic Links&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;# cd /opt&lt;br /&gt;# ln -sf /opt/idea-IC-107.105 /opt/idea&lt;br /&gt;# ln -s /opt/idea/bin/idea.sh /usr/local/bin/idea&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;I overwrite the /opt/idea symlink each time I install a new version of IDEA. Creating the /usr/local/bin/idea symlink effectively adds idea to the system PATH. You'll only need to create this one the very first time you install IDEA.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Set JDK Environment Variable&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;idea.sh checks the IDEA_JDK, JDK_HOME and JAVA_HOME environment variables, in that order of preference, to determine the JVM it will use to run IDEA. Make sure one of these points to a JDK 6 installation. I am currently using JRockit, but the Sun JDK or OpenJDK will also work.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update idea.vmoptions&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The projects I work on are usually quite large, and my box is pretty beefy, so I always pump up the JVM's heap size and permgen size.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;# cd /opt/idea/bin&lt;br /&gt;# mv idea.vmoptions idea.vmoptions.orig&lt;br /&gt;# cp /path/to/my/idea.vmoptions .&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;For reference, here's my idea.vmoptions file, though you will probably not want to use it verbatim:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;-Xms1500M&lt;br /&gt;-Xmx3000M&lt;br /&gt;-XX:MaxPermSize=500M&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;Create a GNOME .desktop File&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This will add an application launcher to the GNOME Applications menu. As root, create a file named idea.desktop in /usr/share/applications with the following contents:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;[Desktop Entry]&lt;br /&gt;Encoding=UTF-8&lt;br /&gt;Version=1.0&lt;br /&gt;Name=IntelliJ IDEA&lt;br /&gt;GenericName=Java IDE&lt;br /&gt;Comment=IntelliJ IDEA is a code-centric IDE focused on developer productivity. The editor deeply understands your code and knows its way around the codebase, makes great suggestions right when you need them, and is always ready to help you shape your code.&lt;br /&gt;Exec=idea&lt;br /&gt;Icon=/opt/idea/bin/idea_CE128.png&lt;br /&gt;Terminal=false&lt;br /&gt;Type=Application&lt;br /&gt;Categories=Development;IDE&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If you wish to tweak this file at all, the syntax for .desktop files can be found &lt;a href="http://developer.gnome.org/desktop-entry-spec/"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3347364779886537900-2693274394662964236?l=freshjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://freshjava.blogspot.com/feeds/2693274394662964236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3347364779886537900&amp;postID=2693274394662964236' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3347364779886537900/posts/default/2693274394662964236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3347364779886537900/posts/default/2693274394662964236'/><link rel='alternate' type='text/html' href='http://freshjava.blogspot.com/2011/05/setting-up-intellij-idea-on-fedora.html' title='Setting Up IntelliJ IDEA on Fedora'/><author><name>ips</name><uri>http://www.blogger.com/profile/04467965115809770939</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/_vo2NqSooVV0/SPzYxWcMDwI/AAAAAAAAAGU/vhBnIKkA-IM/S220/me-200x215.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3347364779886537900.post-112484813887251266</id><published>2010-01-26T09:33:00.008-05:00</published><updated>2011-05-31T22:33:49.201-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java decompiler disassembler jad jd-gui fedora rhel'/><title type='text'>JD-GUI on 64-bit Fedora 12</title><content type='html'>I just setup JD-GUI, a Java decompiler, on my 64-bit Fedora 12 box. I went with JD-GUI, because, unlike JAD, it supports Java 5 and 6 class files and is actively maintained. &lt;br /&gt;&lt;br /&gt;A 32-bit Linux binary can be downloaded from the &lt;a href="http://java.decompiler.free.fr/"&gt;JD-GUI homepage&lt;/a&gt;. The tar.gz file just contains a single binary executable. I installed it as follows:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;tar -xzvf jd-gui-0.3.3.linux.i686.tar.gz &lt;br /&gt;sudo mv jd-gui /usr/local/bin&lt;/code&gt;&lt;/pre&gt;Since my box is 64-bit, I was missing a handful of 32-bit libraries on which JD-GUI depended. Fortunately, these were all available from the default Fedora yum repos and can be installed using the following command:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;sudo yum install libcanberra-gtk2.i686 PackageKit-gtk-module.i686 gtk2-engines.i686&lt;/code&gt;&lt;/pre&gt;These are the packages for Fedora 12 or later. If you're on Fedora 11, suffix the package names with .i586, rather than .i686. For Fedora 10, use .i386 as the suffix.&lt;br /&gt;&lt;br /&gt;If you're using GNOME as your desktop environment, you may also want to associate .class files with JD-GUI. To do so, open File Browser and find a .class file. Right-click on the class file and select Properties. Select the Open With tab, click the Add button, select "Use a custom command", enter "/usr/local/bin/jd-gui", and finally click the Add button. Now when you double-click on a .class file from the File Browser, it will open that file using JD-GUI.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3347364779886537900-112484813887251266?l=freshjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://freshjava.blogspot.com/feeds/112484813887251266/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3347364779886537900&amp;postID=112484813887251266' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3347364779886537900/posts/default/112484813887251266'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3347364779886537900/posts/default/112484813887251266'/><link rel='alternate' type='text/html' href='http://freshjava.blogspot.com/2010/01/jd-gui-on-64-bit-fedora-12.html' title='JD-GUI on 64-bit Fedora 12'/><author><name>ips</name><uri>http://www.blogger.com/profile/04467965115809770939</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/_vo2NqSooVV0/SPzYxWcMDwI/AAAAAAAAAGU/vhBnIKkA-IM/S220/me-200x215.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3347364779886537900.post-7234464958561141502</id><published>2008-10-14T17:29:00.009-04:00</published><updated>2008-10-20T12:50:18.698-04:00</updated><title type='text'>Embedded Jopr - An Open Source Admin Console for JBossAS</title><content type='html'>&lt;a href="http://www.jboss.org/embjopr/"&gt;Embedded Jopr&lt;/a&gt; (pronounced "jopper") is an exciting new open source project that has just been released by JBoss. In a nutshell, it's a web application that can be dropped into the deploy directory of a JBossAS 4.2.x instance to provide a user-friendly front end for administering the app server. Version 1.0 includes support for:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;monitoring metrics for the server itself and for webapps&lt;br /&gt; &lt;li&gt;monitoring metrics and editing configurations for datasources, connection factories, JMS topics and queues, and the host JVM&lt;br /&gt; &lt;li&gt;creating and deleting datasources, connection factories, and JMS topics and queues&lt;br /&gt; &lt;li&gt;executing scripts that reside within the JBossAS bin directory&lt;/ul&gt;&lt;br /&gt;Under the hood, Embedded Jopr is based on the &lt;a href="http://www.jboss.org/jopr/"&gt;Jopr&lt;/a&gt; project, which is in turn based on the &lt;a href="http://www.rhq-project.org/"&gt;RHQ&lt;/a&gt; project. RHQ is an open source enterprise management infrastructure framework, which includes a simple yet full-featured API for writing management plugins for managing just about anything under the sun. RHQ also bundles a set of plugins for managing popular open source products such PostgreSQL and Apache Web Server. The Jopr project consists of the RHQ platform, along with a set of additional plugins for managing JBossAS and other JBoss projects - Hibernate, JBossWeb, etc.&lt;br /&gt;&lt;br /&gt;To understand how Embedded Jopr leverages RHQ and Jopr, let's first take a step back and look at the architecture of Jopr. It consists of a single Server with multiple Agents reporting into it. There is one Agent running on each machine that is hosting applications to be discovered and managed by Jopr. Each Agent contains a Plugin Container that in turn contains plugins for each of the supported managed products. The Agent essentially wraps the Plugin Container in a standalone process that can communicate with the remote Jopr Server. The Server stores all data reported by the Agents in a central database and provides a web-based GUI for viewing and updating that data.&lt;br /&gt;&lt;br /&gt;The goals of Embedded Jopr were considerably less complex than those of its older sibling Jopr. Embedded Jopr sought only to manage a single JBossAS instance. Because we did not need to manage multiple products running in separate OS processes, and because the JBossAS instance being managed was a Java-based application server, we could &lt;i&gt;embed&lt;/i&gt; the Jopr Plugin Container inside an application deployed to the JBossAS instance itself - no need for a separate Agent process.&lt;br /&gt;&lt;br /&gt;As for what type of application in which to embed the Plugin Container, we had a couple requirements:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;provide a way to bootstrap the embedded Plugin Container when the JBossAS instance starts up&lt;br /&gt; &lt;li&gt;provide a web-based interface to the management data collected by the Plugin Container - real-time monitoring only&lt;/ol&gt;&lt;br /&gt;Since we only needed to provide real-time monitoring, there was no need to persist any of the collected management data, which meant we didn't require a database or Hibernate, EJB, etc. The Servlet spec provided the necessary APIs for running our bootstrap code at webapp deployment time, and JSF (which is bundled with JBossAS 4.2 and later) provided a nice framework for building a GUI. So the most sensible type of application in which to embed the Plugin Container was a webapp. We were also able to leverage Facelets, Seam, and RichFaces - extensions to JSF that allowed us to create a robust and maintainable web application.&lt;br /&gt;&lt;br /&gt;Jopr includes RHQ plugins for managing a number of different products - JBossAS, Apache Web Server, PostgreSQL, Oracle, etc. Embedded Jopr did not need to include all of these plugins - it only needed the plugins required to manage JBossAS, its deployed services, and its host JVM. This allowed us to keep Embedded Jopr relatively lean (about 9 MB).&lt;br /&gt;&lt;br /&gt;With such powerful foundational technologies, Embedded Jopr promises to soon become one of the nicest administration consoles out there. We hope to see lots of participation from the community, since this is one project that will greatly benefit all JBossAS users. The main goal for Embedded Jopr 1.1 is to add support for JBossAS 5.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3347364779886537900-7234464958561141502?l=freshjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://freshjava.blogspot.com/feeds/7234464958561141502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3347364779886537900&amp;postID=7234464958561141502' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3347364779886537900/posts/default/7234464958561141502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3347364779886537900/posts/default/7234464958561141502'/><link rel='alternate' type='text/html' href='http://freshjava.blogspot.com/2008/10/embedded-jopr-open-source-admin-console.html' title='Embedded Jopr - An Open Source Admin Console for JBossAS'/><author><name>ips</name><uri>http://www.blogger.com/profile/04467965115809770939</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/_vo2NqSooVV0/SPzYxWcMDwI/AAAAAAAAAGU/vhBnIKkA-IM/S220/me-200x215.jpg'/></author><thr:total>0</thr:total></entry></feed>
