JBoss Portal Fail!

Ok, I do not like to write about useless stuff, but this time, I got into deep troubles because one of my clients ask me to implement a portal page on top of JBoss Portal. My first thought was “Ok, if it is as good as JBoss Application Server, it should be good enough”.

So I downloaded it -the 2.7.2 bundled version. I started working on it, simple configuration and customization. I even bought a book, because, I still do believe that books are good for reference.

Oh Dear God! What a SHAME, the book JBoss Portal Server Development [Packt Publishing] is nothing more than printed version of the online Reference Guide. I read the customers reviews before get the book but to be honest, I found websites with useful tips and post. I believe I will donate the book… for recycling.

About the product, I don’ t have enough word to express my frustration.

Content Management

When you read on JBoss Portal documentation it is not a CMS, it really means it doesn’t even work to store content at all.

  • CMS performance will decrease dramatically as you load and modifies your content. BIG BIG FAIL! TIP JCR performance gets BETTER if you switch the repo to the FS instead of using databases.
  • CMS doesn’ t have Search functionality. Even when JCR has a great index analyser, JBoss Portal fails. I downloaded (svn co) the 2.7.2 version source code from the repos. “core-search” module doesn’t compile. Ant scripts are too fragmented and hard to read. You’ll have to replace and FIX all the jar dependencies to make it work. Note: I didn’t test it, but probably repo works flawless on 2.6.8 version -looking at the scripts and code it could be possible. Once you make it work, the deploy target will not work. Server will consume too memory and then CRASH!
  • Portal Pages and CMS content are not related. I built my own search portlet -fragment of code is at the end of this post. It is not easy to match Portal Pages with CMS content -I didn’ t tried it, however I’m pretty sure it is possible.

Documentation

Official docs are good enough -not great but good to be a Open Source project, however Wiki is a shame, its confusing and incomplete. There are a lot of unexplained things like how to get sources, and how to compile, troubleshooting, and stuff like that.

PortalSwap is a FAIL… it is supposed to be a community place to share portlets but there are like four simple portlets.

Community and DevTeam Support

Well, I was contacted -in some how- by the DevTeam on twitter. The truth, I “tweet” my frustration several weeks ago! and they noticed – At the beginning I was angry about the product but then I realized that IT IS FOR FREE, so let’s try to change and improve things! I wrote a nice email to the DevTeam. All I want is to get paid (from my client) and also to contribute to the project.

I’m still waiting for the answer from DevTeam, without mention that the “Twitter Support” was more like a complain than a “Branding Strategy”. So there is no community support, and DevTeam doesn’t know about Customer Care. My suggestion is, next time you contact a frustrated developer, try to convince to “help DevTeam” instead of debate!

As a recap, JBoss AS is a great product, JBoss Portal is seems to me like a “work in progress” – Maybe it is a students project!

Search Portlet Source

The original code have been edited -please let me know if it works for you.

package xxx;
 
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
 
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
import javax.portlet.PortletException;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.PortletSecurityException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.UnavailableException;
import javax.portlet.WindowState;
 
import org.apache.log4j.Logger;
import org.jboss.portal.cms.CMS;
import org.jboss.portal.cms.CMSException;
import org.jboss.portal.cms.Command;
import org.jboss.portal.cms.model.File;
import org.jboss.portal.core.cms.ui.CMSPortlet;
import org.jboss.portal.search.FederatedQuery;
import org.jboss.portal.search.QueryConversionException;
import org.jboss.portal.search.federation.SearchFederation;
import org.jboss.portal.search.impl.jcr.JCRQuery;
import org.jboss.portal.search.impl.jcr.JCRQueryConverter;
 
public class SearchPortlet extends CMSPortlet {
 
	private static Logger log = Logger.getLogger(SearchPortlet.class);
	private SearchFederation SearchService;
	private CMS CMSService;
 
	public void init(PortletConfig config) throws PortletException {
		super.init(config);
	}
 
	public void destroy() {
		super.destroy();
	}
 
	/*
	 * (non-Javadoc)
	 *
	 * @see javax.portlet.Portlet#init()
	 */
	@Override
	public void init() throws PortletException {
		this.SearchService = (SearchFederation) getPortletContext().getAttribute("SearchFederationService");
		this.CMSService = (CMS) getPortletContext().getAttribute("CMS");
 
		if (this.SearchService == null) {
			throw new PortletException("Search Service Not Available");
		}
 
		if (this.CMSService == null) {
			throw new PortletException("CMS Not Available");
		}
 
		super.init();
	}
 
	/*
	 * (non-Javadoc)
	 *
	 * @see javax.portlet.GenericPortlet#doView(javax.portlet.RenderRequest,
	 * javax.portlet.RenderResponse)
	 */
	@Override
	protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException, UnavailableException {
 
		String portalInstance = request.getWindowID().substring(0, request.getWindowID().indexOf('/', 1));
		PortletRequestDispatcher prd = null;
 
		String operation = (String) request.getParameter("op");
 
		if (operation != null && operation.equals("search")) {
			String queryString = (String) request.getParameter("query");
			if (queryString != null && queryString.length() > 0) {
				request.setAttribute("files", this.getFiles(queryString, portalInstance));
				prd = this.getPortletContext().getRequestDispatcher("/WEB-INF/jsp/results.jsp");
			} else {
				prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/search.jsp");
			}
			prd.include(request, response);
		} else if (operation != null && operation.equals("display")) {
			super.doView(request, response);
		} else {
			prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/search.jsp");
			prd.include(request, response);
		}
	}
 
	/*
	 * (non-Javadoc)
	 *
	 * @see javax.portlet.Portlet#processAction(javax.portlet.ActionRequest,
	 * javax.portlet.ActionResponse)
	 */
	@Override
	public void processAction(ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException {
 
		String operation = (String) request.getParameter("op");
		PortletPreferences prefs = request.getPreferences();
 
		if (operation == null || operation.equalsIgnoreCase("ask")) {
			response.setRenderParameter("op", "ask");
			//FIXME response.setWindowState(WindowState.NORMAL);
		}
		else {
			//FIXME response.setWindowState(WindowState.MAXIMIZED);
			response.setRenderParameter("op", operation);	
 
			if (operation.equals("search")) {
				String queryString = (String) request.getParameter("query");
				if (queryString != null && queryString.length() > 0) {
					response.setRenderParameter("query", queryString);
				}
			}
 
			if (operation.equals("display")) {
				String uri = request.getParameter("uri");
				response.setRenderParameter("uri", uri);
				super.processAction(request, response);
			}
		}
	}
 
	private List getFiles(String queryString, String portal) {
		List files = null;
 
		if (queryString != null && queryString.length() > 0) {
			FederatedQuery query = new FederatedQuery(queryString);
			JCRQueryConverter converter = new JCRQueryConverter();
 
			try {
				Command searchCommand = CMSService.getCommandFactory().createSearchCommand((JCRQuery) converter.convert(query));
				files = (List) CMSService.execute(searchCommand);
				//FIXME: "portal" parameter was used to filter files depending on the portal instance but it was removed for this example!
			} catch (CMSException e) {
				log.error("CMS Error", e);
			} catch (QueryConversionException e) {
				log.warn("Conversion Error", e);
			}
		}
 
		return (files == null) new ArrayList() : files;
	}
}

Include the following lines on your jboss-portlet.xml file.

<service>
	<service-name>CMS</service-name>
	<service-class>org.jboss.portal.cms.CMS</service-class>
	<service-ref>:service=CMS</service-ref>
</service>
 
<service>
	<service-name>SearchFederationService</service-name>
	<service-class>org.jboss.portal.search.federation.SearchFederation</service-class>
	<service-ref>:service=SearchFederationService</service-ref>
</service>

And do not forget to include the following lines on your portlet.xml file.

<portlet>
	<description>DESC</description>
	<portlet-name>SearchPortlet</portlet-name>
	<display-name>NAME</display-name>
	<portlet-class>xxx.SearchPortlet</portlet-class>
	<supports>
		<mime-type>text/html</mime-type>
		<portlet-mode>VIEW</portlet-mode>
	</supports>
	<resource-bundle>Resource</resource-bundle>
	<portlet-info>
		<title>SEARCH</title>
	</portlet-info>
	<portlet-preferences>
		<preference>
			<name>indexpage</name>
			<value>/default/index.html</value>
			</preference>
		<preference>
			<name>setBrowserTitle</name>
			<value>false</value>
		</preference>
	</portlet-preferences>
</portlet>
 
<filter>
	<filter-name>JBoss Portlet Filter</filter-name>
	<filter-class>org.jboss.portlet.filter.JBossPortletFilter</filter-class>
	<lifecycle>ACTION_PHASE</lifecycle>
	<lifecycle>RENDER_PHASE</lifecycle>
</filter>
 
<filter-mapping>
	<filter-name>JBoss Portlet Filter</filter-name>
	<portlet-name>SearchPortlet</portlet-name>
</filter-mapping>

Please THIS IS NOT A PERFECT SOLUTION, but it is a solution. It uses the existing CMSPortlet to display the content -and this approach causes an issue -due to WindowState changes. I hope someone find it useful and improves it. Feel free to contact me if you have any question.


I Ditched Windows…and, So Can You

etiqueta_ubuntu4I bought a new desktop computer like a week ago, a nice desktop PC with a beautiful 22″ screen. The truth is that I was looking for an iMac 24″, but unfortunately here in Colombia it could be have an overprice of USD$500 ~ USD$1000. So as you can tell it could be a trip to U.S. with an iMac on your baggage. I talked to some of my friends and coworkers asking for somebody to bring it, but it wasn’t possible this time -at least shortly.

So I bought a nice computer with Windows Vista Home Premium -as usual and some useless stuff like a remote and MediaCenter. I tried it few days and Vista did its magic -slowing down the newest computer even faster than I thought- so I moved to Windows 7 (64 bits version) -Oh Yeah it is like Windows Vista but better (like G.M. TV commercials with their cars).

A week ago, and after doing a realistic evaluation of my computing needs I decided to switch to Ubuntu 9.04 (64 bits version) and mount a VM with Windows XP Home to keep testing on Internet Explorer 6.0. It was a HUGE improvement in performance – I just remembered D.O.S. days when programs run immediately after being called. Ubuntu offers a lot of advantages in compare to Windows, but obviously we are so attached to Microsoft pseudo-world that just thinking on the switch could be a nightmare. I will not debate on architecture, security or speed. I’ll say this as clear as possible. If you do not have to use MS products like Exchange, or you do not have to use speciallized software that runs on Windows -like AutoCAD or Adobe CS4- you can just switch without fair, it will be the reinvention of the computer processing performance.

There are a lot of Linux Distributions in the market -like Ubuntu- but I have to say that Ubuntu is for soft-users and not hard-crazy linux fans. Ubuntu is nice, is really REALLY REALLY easy to install and if you aren’t sure about replacing your desktop with it, you can try Wubi -it installs Ubuntu as a Windows application -WOW!

Just to clarify, I had been using Ubuntu and other linux distributions for a long time (Fedora is another one) but it is the first time I decided to switch to Linux WITHOUT a Windows partition. My wife -who is a dentist- hates its portable due to its response time, and I did all the normal-not-so-risky tasks to speed up its XPS 1210 (that used to be mine) with Windows XP Home Edition, today we had our first class about linux and she is so happy about the speed and performance, and also the virus/crappy-sw situation that isn’t a critical issue on Ubuntu (Linux) so she is thinking seriously about moving to Ubuntu her portable too.

“So, if you’re using Windows and want to ditch it, click here to begin a less stressful life”

IMPORTANT NOTE: I decided to write this post when a friend of mine sent me a link to a post who has the same title of this one. Thanks to Gregory Ferenstein for such inspiring post -I did’t move to Linux because of his post, but I makes me feel like “I’m not alone, I’m not just a crazy guy that hates Microsoft, I’m not a linux fanboy… we are just right about Windows: it sucks!


What is going on with offshore in Colombia?

OffshoreColombia is a country full of high qualified developers, designers and in general, great web builder experts. However something is going wrong with those lucky guys that work for companies who have offshore contracts. After few months or even years of great work, people start feeling comfortable as well-paid workers and then suddenly and without notice, quality sense of work and care about details fade away. Why? I’m not sure, but I will do my best trying to discover the reasons through this post -and this is because I’m one of those lucky guys working for great company, but I REALLY do not want to start feeling comfortable, and  I REALLY REALLY do not want to start losing my tiny sense of quality and responsibility.

Feeling comfortable about having a job is not bad at all, even more these days during this crisis time, but is it really enough? Dedicated workers stand out from others because they do not feel comfortable, they are always looking for opportunities of doing great and better things. When this comfortable feeling grows more than it should, workers start forgetting that they are in Colombia, and start asking for foreign benefits and privileges, and they even believe that they deserve them. And that’s wrong, that’s totally wrong. It is not bad at all to get few additional benefits, however, it doesn’ t mean we should take them for granted, we are still working in Colombia.

One of the amazing transformations of Colombian workers is: once we get used to a job,  we believe we can decide our own duties and decide what to do and when. Well my friends, most of the time and all around the world, bosses decides what must be done and when. So WTF! I really can’t deal with that, it piss me off. Job is responsibility, it is not about doing “favors” to the managers, it is about to do what it is supposed because you are getting paid for that. It is not because you want, it is because you have to -and I’m talking about legal, non-extra activities of course, but just to point that out.

Another endemic attitude is to look for responsible when there is no other guy doing the job. I will no get into this because… do I need to? A variance of this behaviour: people start doing EXACTLY what they were asked, even if managers are expecting a little support. They perform as machines, they do not evaluate and therefore there is no added value. If there is a misspelled word on their assignment description, they do not fix it, if there is something that requires some additional work or a little of analysis, they will try to delegate it. But, hey! keep in mind they are great developers, keep in mind we are not talking about junior resources. So why they decide to do that? Maybe I just pointed it out, it is because they do not want to assume their responsibility.

This comfortable behaviour is surrounding me for a little while, and I will say NO. I do not want to become one of those lazy but great workers that decide to keep their jobs by giving up their abilities. I will do my best tomorrow, and the day after tomorrow. Not sure what it means but probably I have an idea.


Things my mom didn’t tell me about project management

My Mom Didn't Tell Me There are several things nobody told me before I became PM. Most of these things are deeply related to my background knowledge, but probably, even if you do not work on the same field I work, you will find these tips useful.

  1. Project Managers are responsible for all the work they do not execute. WTF? Back in the school you could say: Hey! I didn’t do it! It wasn’t me! – But now you are forced to assume any responsibility of the work that has been done by others -on your team of course! “Solution doesn’t work”, “There are several bugs”, “It doesn’t fulfill the client expectations” -It doesn’t occur often if you do your homework, but, it happens at least once so you have to be prepared. Fail is natural to human condition. Are you prepared to fail? Are you ready to get over it and assume the responsibility for others code? -from a coder perspective it could mean kill someone!
  2. Project Managers should say client Yes/No and When. Coders aren’t forced to do that -that’s why PM’s estimate. Does it sounds familiar to you? “I’m doing ok with code, it will take like, uhmmm, uhmmm, uhmmm, -then silence- then a value plus extra time for them”.
  3. Project Managers will use email clients, office productivity tools including spreadsheets -a lot of spreadsheets- over the lovely IDE -oh man, that sucks. Even the useful textedit… how I miss you?
  4. Project Managers will have to say at least once “No” and get mad with their bosses while they are Gold-Plating the clients. The awful thing is that once bosses do that, PMs will have to assume again the responsibility to deliver the new extremely-simple-to-do addition while also have to listen the complains of the team.
  5. Project Managers will solve problems between team members. I do no like democracy (democracy is for small cities and countries where  their ability to decide and vote is supported by a deep and clear perspective of the community and its future). PM is only one guy, he/she listen, process and decide -NICE!!! no voting, no democracy.
  6. Hands-on Project Managers will also deliver the projects. It means most of the time, deploy to servers, and do a “lite-end-user qa”.  Not your case? YOU ARE SO LUCKY!
  7. Project Managers will receive more money -it is not always the case, but here in Colombia, IT IS the case.

If you have any additional thing your mom didn’t told you about PM, feel free to post it as a comment.


How to choose the right project management software?

Choose RightTo choose the right software is not a simple process, and to choose the right project management software is then an even more complicated process and decision. Below you will find few tips and proposed procedure to reduce the risk inherit to this decision.

Tip #1

To choose and implement a PM software tool is not the same of implementing a PM process. Many organizations try to implement a software tool expecting a nonexistent-unnatural process improvement. If you do not have a formal process, or even if your process is not working you have to stop thinking that automation will fix/improve/solve your problems. Automation should be used to reinforce a process and minimize the weaknesses.

Tip #2

Every software implementation process includes at least the following steps -of course every company has its own natural process. Public companies have also additional restriction and evaluation/validation processes that will extend the suggested process:

  • Identify needs
  • Define selection criteria
  • Create a list of options
  • Create the request for information
  • Evaluate responses
  • Reduce the list of options
  • Ask for demonstrations or pilot programs
  • Choose one

Tip #3

Try to isolate your needs by using the following dimensions to measure the products you are considering:

  • Scale – how big the change will be?
    • Simple: are you going to organize your projects?
    • Personal: are you going to automate estimation and planning on you projects
    • Collaborative: are you going to support a team? are you going to share information? do you need to centralize team communications?
    • Enterprise: are you affecting the whole company? are you going to bill to your clients using your projects’ data? do you have virtual teams all around the globe?
  • Management Paradigm – do you and your team follow a traditional or agile approach to project management?
  • Process Maturity – how formal/strong is your process?
    • Chaotic: No evidence of documented processes or best practices
    • Active: Documented processes carried out, but not formalized
    • Efficient: Consistent discipline started
    • Responsive: Ubiquitous and measured
    • Business driven: Provides data and information to drive business decisions
  • Implementation model – are you going to buy the product and support it by yourself? are you going to adopt the SaaS model?
  • Budget -

Tip #4

Set your goals – do not expect to do everything better and to include any improvement during the first phase (or the initial implementation cycle). Prioritize to get faster results. Below you will find a list of possible goals that you could address with a PM software tool

  • Improve project reporting and tracking
  • Improve estimating and scheduling
  • Reduce cost or speed process up by automating workflows
  • Improve resource assignments
  • Improve project communication
  • Improve project team collaboration
  • Improve overall project process

Every goal will impact different functional areas within an organization. You should plan your implementation to impact those areas and improve those process that will add the most value.

References: