log.error(msg, e);
}
if ( paClassLoader == null )
{
// nothing to be done about it anymore: this pa is beyond repair :(
throw new RegistryException(e);
}
//register = false;
}
PortletApplication regPA = null;
lockRegistry(RegistryLock.READ);
try
{
regPA = registry.getPortletApplication(contextName);
}
finally
{
unlockRegistry(RegistryLock.READ);
}
PortletApplication newPA = paWar.createPortletApp();
if (regPA == null)
{
System.out.println("**** New portlet app found - registration required..." + contextName);
regPA = registerPortletApplication(paWar, null, paType, paClassLoader, silent);
}
else
{
String regVersion = getVersion(regPA);
String newVersion = getVersion(newPA);
System.out.print("Reg version is " + regVersion);
System.out.print(", New version is " + newVersion);
if (newVersion.equals(""))
{
System.out.println(" - New Version was NOT provided: registration not required ... " + contextName);
}
else if (newVersion.compareTo(regVersion) > 0)
{
System.out.println(" - **** New Version is greater: registration required... " + contextName);
regPA = registerPortletApplication(paWar, regPA, paType, paClassLoader, silent);
}
else
{
System.out.println(" - New Version is NOT greater: registration not required ... " + contextName);
}
}
if (portletFactory.isPortletApplicationRegistered(regPA))
{
portletFactory.unregisterPortletApplication(regPA);
}
portletFactory.registerPortletApplication(regPA, paClassLoader);
}
catch (Exception e)
{
String msg = "Error starting portlet application " + contextName;
if (!silent || log.isDebugEnabled())
{
log.error(msg, e);
}
throw new RegistryException(msg, e);
}
}