Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Wednesday, 8 February 2012

Digging deep into JBoss AS 7

Recently I had the chance to go through the book:
JBoss AS 7 Configuration, Deployment and Administration by Francesco Marchioni. I was about to publish this review on my NetBeans blog. Unfortunately the current state of the technology is such, that the NetBeans IDE (in its latest version 7.1) still doesn't support the 7.x versions of the famous application server. The reasons for this in my opinion are mostly related to business and areas of influence of the major players, but this is quite a different topic.


Despite the fact that the book can't fit in a NetBeans related blog, after reading it I think it deserves a dedicated review, so here we are. And discussing a technical book on a blog-for-everything doesn't necessarily disperse its significance. On the contrary, I think this emphasizes its quality.
The ones who walked this path before know pretty well that you can't simply read such a book. It requires you to gain a whole lot of (sometimes new) experience - set up a development environment, configure run-times and IDEs, gradually develop sample applications.  If afterwards you have gained new knowledge and skills that can aid you in your work, then the book has done its job well.
After my experience with this book I think it will be helpful for many professionals that intend or are required to utilize the 7-th version of JBoss Application Server.
Here are few points why I think so:
  • The subject is taken and revealed quite in-depth (at least for the given 380 pages) - whole five chapters in the beginning are dedicated to the major aspects of server installation and configuration. 
  • It makes you really see the differences with the former generations (mainly 5.x and 6.x) of the server. The modular approach is emphasized and comparisons are drawn most of the time.
  • This is a modern server, ready for the most popular and demanding paradigms on the web - distributed and cloud computing, modern security, etc. And it equally well performs as a standalone web application provider or as a domain platform. This is shown in the book by gradually introducing the technologies according to their complexity. The server readiness in every case is represented by examples.
In a more detailed fashion, the book consists of the following:
  • Chapter one traditionally gives the points to installing the development environment - the application server, the environment variables, the appropriate IDE (in this case eclipse is the one that is most prepared), the command line interfaces, etc.
  • Chapters two to five are all dedicated to configuring different aspects of the server. If this book is the reader's first encounter with JBoss 7.x these chapters can be crucial to understanding the server's architecture. Especially if they have experience with the previous versions. The directories layout is described to reflect not only the modular structure, but also the two main facets - the traditional standalone server and the backbone of domain distributed applications. Of course every mode is presented with its own configuration file - one big major config file per facet that's capable of preparing many subsystems within a single server instance. Special attention is given to the more popular cases when the system must be configured mainly as a lighter web server or as an enterprise-grade Java application server, which utilizes the APIs of the latest version from Oracle (Java EE 6). Since this is the first version of the application server that introduces the concept of domain, a sole chapter is dedicated to explaining the domain controller, the host controller, process controller, server nodes and the related processes. It is emphasized here that the domain mode aids you not just in distributing an application over numerous server instances - that could be achieved similarly with set of standalone servers. The main reason in having a domain is that you get a single centralized point of management for all the nodes.
  • Chapter six and seven are for the people that put the applications to use in production environment - the deployment and management. Putting the different types of Java resources on the standalone and domain instances is described in all possible ways - manual or automatic, through eclipse, by scripts (using the command line interface), etc. - is not the only concern here. In significant part is explained the evolution of the classloader of JBoss - how it was made to fit the modular architecture and still enforce isolation over the used dependencies. On the next level managing the running applications and the server itself is aided by specialized tools that were always a strong side of JBoss. These are the brand new Command Line Interface (CLI) and the  revamped Web admin console.
  • While the chapter eight makes a detailed example description of clustering and tells why it should not be mistaken with the concept of domains, but both can be successfully combined for productivity, chapter nine deals with the other advanced aspect in the server administration - the load balancing. Both topics are different sides of the strive for performance that is needed on the web. The presentation is broken down to configuring the components that take responsibility for the task at hand. Special attention is given to mod_cluster - presented as the most advanced solution to date in the field of load balancing, and with it we are being gently prepared for what lies just two chapters ahead - the cloud readiness.
  • On the security chapter that follows, hardly can be told anything completely new. After all this is a must-have chapter for any server related book. While not having the ambition to make a complete overlook of the topic, the author builds the chapter around the native Java EE 6 security mechanisms and how they are taken further with built-in security subsystem of JBoss - the PicketBox framework.
  • The last chapter is a look at the future. Future that is actually already here, but is not yet that ubiquitous. After a mild introduction into what cloud computing actually is, the OpenShift project is presented with its two variants of cloud services: Express - the quick and free platform, and Flex - the bigger and more sophisticated sibling. In the end, after going step-by-step through the book, you might have taken your infrastructure to the PaaS state in this chapter. Cloud computing itself (like security) is quite a large topic and looking at  RedHat's OpenShift gives only a glimpse, but this chapter is a good stating point.
The book is quite detailed where the topic requires it and clears most of the questions that go with the technology incorporated into the server. Of course you have to dig your own path into a real-world application of JBoss in order to meet the real problems that may surpass the book's ability to give answers. But that'd be a long way to go in most of the cases. And this way longer or shorter would be much lighter with JBoss AS 7 Configuration, Deployment and Administration as a companion. In practice you are free to choose and invent whatever best practices you need to. Maybe the best asset of  this book is that it gives more than enough alternatives (in practices and tools, whether they are built-in in the app server of third party) for finding the best steps to make your perfect set-up.
If I have to point out some deficiencies, I can only think of a flaw that is common to most of the technical books. Covering software which lifespan gets shorter and shorter in the recent years (the pace of software evolution is one of the fastest in all industries), requires the book to be released fast on the market (preferably together with the product). This sometimes leads to lowering the quality of writing - tiny grammar and/or syntactical errors, small errors in the fact, etc. They're not even critical to understanding the content, but are there to just tease your sense of natural flow of the language and at worst to distract you from the topic. In this book such errors can be found at times, but they are so insignificant compared to the whole quality of the book, that I'm almost sorry for mentioning them.
As a conclusion I can say that as long as the 7-th version of JBoss is out there playing the work-horse for the business you're involved in this book will be useful. After that it would still be a good historical comparison reference for the technology of the old.

Thursday, 3 April 2008

Portable Development - the JAVA trail

In the previous post most of the questions were only glanced at their surface. Some of the topics deserve more in depth exploration, which cannot be achieved in a single article. Despite that here we'll take one more fast look at the intersection between the PortableApps suite and two of the most powerful and widely used open source tools (IDEs) for JAVA development - NetBeans and eclipse.
I chose them not only because of their popularity but also because they are Platforms and represent two different approaches in creating a platform on which any other desktop application, rich with features can be built.
The glance here focuses on the possible ability of the IDEs to be made portable. As NetBeans is my favorite development tool of all. More articles concerning this one will be posted on its specialized blog.

The Environment
The first thing about development in any platform is preparing the environment - installing the tools involved in the development chain and eventually configuring them. In the JAVA case these are the Virtual Machine (JVM) - the interpreter of the byte code, the Compiler - the major development tool that translates the source code into the interpreted byte code, the documenting tool (javadoc.exe), the packaging tool (packager.exe) and lots of others complementary executables bound together into a JAVA Development Kit (JDK). The details on the ways of installing the Development Kit on portable device are available in this blog.
Once you have these tools detached from the host system, you have enough to simply start coding. In the PA Menu you may install Notepad++ Portable (it is an excellent editor for writing the code, which can be configured to act as a simple IDE for managing very small projects) and Command Prompt Portable (a console which can be configured according to your mobile environment). But even without them any system should provide such minimum tools. Whether you have enough privileges to change the environment variables is a different topic.

The Integrated Development Environments
Generally the eclipse IDE is easier because it has no installer, but the NetBeans' one is flexible enough to let you put it on the USB drive. So let's do it step by step.

*** eclipse ***
Download the ZIP archive of your preferred version from http://www.eclipse.org/downloads/.
Unzip it into the folder 'X:\PortableApps\'. Switch the drive letter to what's relevant for you.
The directory 'eclipse' is created there. Open the PA Menu and refresh it. Two new icons appear. Both of them start the IDE. The second one starts it in a console, so if you don't need this feature, just move the executable to some subfolder and refresh again.
If on the system where you set up your portable environment there is JRE or JDK installed already, if you run your newly imported eclipse, it finds the runtime environment and configures itself according to it.
That is nice of eclipse but is not very portable in our sense. In this case the first time you start the IDE on a system without JAVA, it will cry out for help, asking you to point to it where the JAVA is. So now we're gonna have to fix that.
What I normally would do in the past is to open the 'X:\PortableApps\eclipse\configuration\config.ini' file and change the value of the appropriate variable to point. These days situation is different. In the last version (europa or 3.3) overall configuration is made more sophisticated. Just open Window > Preferences... from the program menu and navigate to Java > Installed JREs and change the default location to point where you installed the JAVA SDK on your USB disk.
Now you're independent of the system specifics.

I'd like to mention here the Aptana Studio IDE. It is not meant for JAVA but is an ultimate Web development tool designed around coding in AJAX, Ruby (the 'On Rails' platform), PHP, etc. Part of its robustness is due to the fact that it is built on the eclipse platform. That's why it can be installed in the PA Menu exactly the same way as the eclipse IDE. And that is the reason I mention it.

*** NetBeans ***
Installing it is quite similar, but let's go through it anyway.
Run the installer you downloaded from http://download.netbeans.org/netbeans/6.0/final/ (the latest stable release) or http://download.netbeans.org/netbeans/6.1/beta/ (the beta of the interesting new version).
I recommend the full version of the installer. After all you may not install everything but it is good to have the rest at hand (just in case).
Customizing what to install is possible on the first 'page' of the wizard. For default just press 'Next'. Then accept the 'License Agreement' and continue to the next page which is the most important step. Here you define the point of install and the source of the runtime. In both cases point to the appropriate folders on your portable device. Here is an example:
Install at: 'X:\PortableApps\NetBeans 6.1 Beta'
Get runtime from: 'X:\tools\jdk1.6.0_03'
Press 'Next' and then 'Install'. Now wait a while for the process to finish. The full installation takes up to 500 MegaBytes on the drive, but that doesn't count the two servers: Apache Tomcat 6.0.14 (about 12 MB more) and the GlassFish v2 (with its additional 142 MB). They both by default are installed in 'C:\Program Files'. If you find it sensible may move them to a portable location and reconfigure them accordingly (me, I wouldn't do it).
After pressing 'Finish' and refresh the PA Menu only the 'uninstall.exe' of the application appears - exactly the one you don't need at the moment.
What you can do is simply to switch places of the two executables. Go to the 'X:\PortableApps\NetBeans 6.1 Beta\bin' directory and move upfolder the 'netbeans.exe' file while placing here the uninstaller. Refresh again the PA Menu and that's it.