try
{
Installation stored = getInstallation( installation.getInstallationId() );
if ( stored == null )
{
throw new InstallationException( "installation with name " + installation.getName() + " not exists" );
}
stored.setName( installation.getName() );
if ( alreadyExistInstallationName( installation ) )
{
throw new AlreadyExistsInstallationException(
"Installation with name " + installation.getName() + " already exists" );
}
stored.setType( installation.getType() );
String envVarName = this.getEnvVar( installation.getType() );
// override with the defined var name for defined types
if ( StringUtils.isNotEmpty( envVarName ) )
{
installation.setVarName( envVarName );
}
else
{
stored.setVarName( installation.getVarName() );
}
stored.setVarValue( installation.getVarValue() );
installationDao.updateInstallation( stored );
}
catch ( ContinuumStoreException e )
{
throw new InstallationException( e.getMessage(), e );
}
}