Portlet Web Application Naming Convention

holdorph's picture

Ok, I have an itch, I can't scratch. Sorry, for the poor analogy, but it's pretty close to how I feel. In a lot of the rest of my java development world, there are more or less naming conventions to cover different situations (here's one example). However, I've alway felt like there was not a perfect naming strategy for Portlet Web Applications.

Some of this starts, because there's a philosophical difference between some people on whether each Portlet should be in it's own web application, or whether related Portlets should be grouped in the same web application. I say 'starts' because I'm not confident I have a solution no matter which side of the fence you stand on that issue.

Also related is that to address a Portlet, you need two pieces of information, the portlet web application name and the portlet name (from the portlet.xml file). I feel a good naming convention should not require redundancy. Here's what I'm talking about. lets see some examples.

  • googleportlet.GooglePortlet
  • RssPortlet.RssPortlet
  • BookmarksPortlet.BookmarksPortlet
  • flickrportlet.FlickrPortlet
  • testsuite.TestPortlet

And you should also remember that typically the PortletClass for many of these Portlets is yet that same name one more time (RssPortlet, FlickrPortlet).

So, in my Portlet training class, when I was prepping my examples, I tried at least eliminating Portlet part of the webapp name. In addition I tried to leverage a build.property in multiple places, which led me to a war file named something simpler. For example I might have

  • Hello.HelloWorldPortlet
  • Games.GuessNumberPortlet
  • SpringApps.SpringGuessNumberPortlet

I then tried to apply this naming convention to some things outside of the class. I had similar names

  • ClassSchedule.ClassSchedulePortlet
  • ImageViewer.ImageViewerPortlet
  • ShowImage.ShowImagePortlet

Now my problem was that my directories contained in my tomcat webapps directory have names like Hello, Games, ImageViewer. Also these names tended to be the name in my source tree. I was lacking anything that showed me at the top level that this thing was a Portlet web application.

So googleportlet is no good as a Portlet application name and ImageViewer was no good. I feel like there must be another option.

I'm considering things like the following as possibilities:

  • GooglePortletApp.GoogleSearchPortlet, GooglePortletApp.GoogleMapPortlet
  • ImagePortlets.ImageViewerPortlet, ImagePortlets.ImageLibraryPortlet
  • RssPortletApp.RssPortlet

These are two variations on the first thing I showed, where the Portlet application name contains the Portlet string, but is not a duplicate of the actual Portlet name.

What do people think? Which option do you prefer?

---- Cris J H

My Preferred option for Portlet webapp naming convention

vskumaran's picture

Chris,
I would prefer the first option you have mentioned. Ex: GooglePortletApp.GoogleSearchPortlet, GooglePortletApp.GoogleMapPortlet. I feel that the web application name is detailed enough to indicate that it is a portlet webapp and yet is not redundant with the portlet name.

-- Vidhya