30 November 2007

Product Axis for WebLogic

The following list shows the different WebLogic Versions and the products that are released with it.

Workshop Studio 3.3 (needs extra license)

  • WebLogic Server 8.1
  • WebLogic Server 9.x

WebLogic Platform 9.2

  • WebLogic Server 9.2
  • WebLogic Portal 9.2 (Codename Adrenaline)
  • WebLogic Integration 9.2
  • Workshop for WebLogic 9.2

WebLogic Portal 10.0

  • Workshop for WebLogic 10.0
  • WebLogic Server 10.0

Workshop for WebLogic 10.1

  • WebLogic Server 9.2 (supports it but not bundled)
  • WebLogic Server 10.0
  • This Workshop release has included the features of Workshop Studio for free!

WebLogic Platform 10.2 (Feb 29th 2008)

  • Workshop for WebLogic 10.2
  • WebLogic Integration 10.2
  • WebLogic Portal 10.2 (Codename Flatirons, next portal's codename will be Sunshine)
  • WebLogic Server 10 MP1

WebLogic Server 10.3

  • WebLogic Server 10.3 (Codename Essex)
  • Workshop for WebLogic 10.3

14 November 2007

Best Practices: WLP10.0: Read Portlet Preferences

The Background

This post addresses the following portal setup:

  • WebLogic Portal 10.0
  • Portal is used in streaming mode (virtual portals, desktops, book/page/portlet instances
The requirements I had to fulfill were the following:
  • From anywhere in the whole portal, the business logic had to be able to read portlet preferences from any portlet instance (even from desktops different than the current desktop)

The Problem
I thought the implementation would be easy by using the PresentationContext API:
PortletPresentationContext px = PortletPresentationContext.getPortletPresentationContext(request);

this worked fine as long as the portlet I was reading the preferences from belongs to the desktop the current request belongs to.
In case the portlet instances was belonging to another desktop, that did not work.

The Workarounds
There are no workaronds...

The Solution
... but a solution! The following code shows
  • How you can get all the preferences of any portlet (getPortletPreferences())
  • How you should retrieve an EJB Home interface

/**
* @return null if portlet has no preferences or if portlet can not be retrieved. otherwise each key represents a preference, the value is Preference through which you retrieve the name, value or anything else from the preference.
*/
public static final Map getPortletPreferences(HttpServletRequest request, PortletView portletView) {
request = getRealRequest(request);
Map map = null;
try {
// init
CustomizationContext customizationContext = new CustomizationContext(Locale.ENGLISH);
getPortalCustomizationManager();
getPreferencePersistenceManager();

// read preferences
PortletInstance preferencesPortletInstance = portletView.getPortletInstance();
PortletPreferencesId portletPreferencesId = new PortletPreferencesId(preferencesPortletInstance.getPortletInstanceId().getId());
map = preferencePersistenceManager.getPreferences(customizationContext, portletPreferencesId);

if (map != null && map.isEmpty()) {
map = null;
}
} catch (Exception e) {
e.printStackTrace();
}
return map;
}

private static PortalCustomizationManager getPortalCustomizationManager() {
if (portalCustomizationManager == null) {
try {
PortalCustomizationManagerHome portalCustomizationManagerHome =
(PortalCustomizationManagerHome)getHome(new InitialContext(),PortalCustomizationManagerHome.LOOKUP_NAME);
portalCustomizationManager = portalCustomizationManagerHome.create();
} catch (Exception e) {
e.printStackTrace();
}
}
return portalCustomizationManager;
}

private static PreferencePersistenceManager getPreferencePersistenceManager() {
if (preferencePersistenceManager == null) {
try {
PreferencePersistenceManagerHome preferencePersistenceManagerHome =
(PreferencePersistenceManagerHome)getHome(new InitialContext(),PreferencePersistenceManagerHome.LOOKUP_NAME);
preferencePersistenceManager = preferencePersistenceManagerHome.create();
} catch (Exception e) {
e.printStackTrace();
}
}
return preferencePersistenceManager;
}

private static Object getHome(InitialContext context, String jndiName) throws NamingException
{
String fullJndiName = ApplicationHelper.getNonVersionedAppName()+ "." + jndiName;
Object obj = context.lookup(fullJndiName);
return obj;
}

/**
* @param request
* @return returns the original Request Object, not the wrapped pageflow request object.
*/
public static HttpServletRequest getRealRequest(HttpServletRequest request) {
if (request instanceof ScopedRequest) {
request = ((ScopedRequest)request).getOuterRequest();
}
return request;
}




Your Feedback
I also posted this in the official portal forum, so feedback is welcome at both places! Thanks.
http://forums.bea.com/thread.jspa?threadID=300003850