{
throw new AlreadyExistsInstallationException(
"Installation with name " + installation.getName() + " already exists" );
}
// TODO must be done in the same transaction
Installation storedOne = null;
try
{
String envVarName = this.getEnvVar( installation.getType() );
// override with the defined var name for defined types
if ( StringUtils.isNotEmpty( envVarName ) )
{
installation.setVarName( envVarName );
}
storedOne = installationDao.addInstallation( installation );
}
catch ( ContinuumStoreException e )
{
throw new InstallationException( e.getMessage(), e );
}
try
{
if ( automaticProfile )
{
Profile profile = new Profile();
profile.setName( storedOne.getName() );
profile = profileService.addProfile( profile );
profileService.addInstallationInProfile( profile, storedOne );
}
}
catch ( ProfileException e )