catch (Exception e)
{
String msg = "Failed to load portlet application for "
+ paWar.getPortletApplicationName();
log.error(msg, e);
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
this.updateSearchEngine(false, pa);
// and add to the current node info
nodeManager.addNode(new Long(pa.getId().toString()), pa.getName());
// grant default permissions to portlet application
grantDefaultPermissions(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, (paType == MutablePortletApplication.LOCAL));
}
catch (Exception re)
{
log.error("Failed to rollback registration of portlet application" + paName, re);
}
}
throw new RegistryException(msg, e);
}
}