use of org.opentosca.toscana.plugins.util.TransformationFailureException in project TOSCAna by StuPro-TOSCAna.
the class ServiceHandler method addServiceCommands.
/**
* Add the needed services to the deploymentscript and try to match a suitable service from the provider.
*
* @param alreadyHandledServices services which are already created, so there have not to created twice
* @param showAllServiceOfferings if yes then adds all service offerings to deploymentscript
*/
public List<String> addServiceCommands(Boolean showAllServiceOfferings, List<String> alreadyHandledServices) {
try {
logger.info("Try to read service offerings of provider");
List<String> adaptServiceList = readProviderServices(alreadyHandledServices);
if (showAllServiceOfferings) {
if (application.getProvider() != null && !application.getServices().isEmpty() && application.getConnection() != null) {
logger.debug("List all possible services in the an extra file");
addProviderServiceOfferings();
}
}
return adaptServiceList;
} catch (IOException e) {
throw new TransformationFailureException("Fail to add services to deployment Script", e);
}
}
use of org.opentosca.toscana.plugins.util.TransformationFailureException in project TOSCAna by StuPro-TOSCAna.
the class Connection method createCloudFoundryOperations.
/**
* create a Connection to a cloud foundry instance.
* A CLoudFoundryOperation could send cf commands
*/
private CloudFoundryOperations createCloudFoundryOperations() {
CloudFoundryOperations cloudFoundryOperations;
try {
DefaultConnectionContext connectionContext = DefaultConnectionContext.builder().apiHost(apiHost).build();
TokenProvider tokenProvider = PasswordGrantTokenProvider.builder().password(password).username(userName).build();
ReactorCloudFoundryClient reactorClient = ReactorCloudFoundryClient.builder().connectionContext(connectionContext).tokenProvider(tokenProvider).build();
cloudFoundryOperations = DefaultCloudFoundryOperations.builder().cloudFoundryClient(reactorClient).organization(organization).space(space).build();
} catch (Exception e) {
logger.error("Cant connect to Cloud Foundry instance");
throw new TransformationFailureException("Could not connect to Cloud Foundry instance, Please check your credentials", e);
}
logger.info("Connect successfully to Cloud Foundry instance");
return cloudFoundryOperations;
}
Aggregations