catch (Exception e)
{
String msg = "Failed to load portlet application for "
+ paWar.getPortletApplicationName();
log.error(msg);
throw new RegistryException(msg);
}
// register the portlet application
try
{
registry.registerPortletApplication(pa);
registered = true;
log.info("Registered the portlet application " + paName);
// add to search engine result
if (searchEngine != null)
{
searchEngine.add(pa);
searchEngine.add(pa.getPortletDefinitions());
log.info("Registered the portlet application in the search engine... " + paName);
}
if ( autoCreateRoles && roleManager != null && pa.getWebApplicationDefinition().getSecurityRoles() != null )
{
try
{
Iterator rolesIter = pa.getWebApplicationDefinition().getSecurityRoles().iterator();
SecurityRole sr;
while ( rolesIter.hasNext() )
{
sr = (SecurityRole)rolesIter.next();
if ( !roleManager.roleExists(sr.getRoleName()) )
{
roleManager.addRole(sr.getRoleName());
log.info("AutoCreated role: "+sr.getRoleName()+" from portlet application "+paName+" its web definition");
}
}
}
catch (SecurityException sex)
{
log.warn("Failed to autoCreate roles for portlet application " + paName+": "+sex.getMessage(), sex);
}
}
return pa;
}
catch (Exception e)
{
String msg = "Failed to register portlet application, " + paName;
log.error(msg, e);
if (registered)
{
try
{
unregisterPortletApplication(pa, local);
}
catch (Exception re)
{
log.error("Failed to rollback registration of portlet application" + paName, re);
}
}
throw new RegistryException(msg, e);
}
}