/*
* Deploy a new partition to Auto Scaler.
*/
public boolean addNewPartition(Partition partition) throws InvalidPartitionException {
if (StringUtils.isEmpty(partition.getId())){
throw new InvalidPartitionException("Partition id can not be empty");
}
if (this.partitionExist(partition.getId())) {
throw new InvalidPartitionException(String.format("Partition already exist in partition manager: [id] %s", partition.getId()));
}
if (null == partition.getProvider()) {
throw new InvalidPartitionException("Mandatory field provider has not be set for partition " + partition.getId());
}
try {
validatePartitionViaCloudController(partition);
RegistryManager.getInstance().persistPartition(partition);
addPartitionToInformationModel(partition);
if (log.isInfoEnabled()) {
log.info(String.format("Partition is deployed successfully: [id] %s", partition.getId()));
}
return true;
} catch (Exception e) {
throw new InvalidPartitionException(e.getMessage(), e);
}
}