/*TODO RENAME Method. It could be represent that the service is bound and the service operation is called*/ private void manageService(Entity rawEntity) { CloudFoundryService cloudFoundryService; if (rawEntity instanceof CloudFoundryService) { cloudFoundryService = (CloudFoundryService) rawEntity; String serviceName = cloudFoundryService.getConfig(CloudFoundryService.SERVICE_INSTANCE_NAME); if (!Strings.isEmpty(serviceName)) { Entities.waitForServiceUp( cloudFoundryService, cloudFoundryService.getConfig(BrooklynConfigKeys.START_TIMEOUT)); bindingServiceToEntity(serviceName); setCredentialsOnService(cloudFoundryService); cloudFoundryService.operation(getEntity()); } else { log.error( "Trying to get service instance name from {}, but getting null", cloudFoundryService); } } else { log.error( "The service entity {} is not available from the application {}", new Object[] {rawEntity, getEntity()}); throw new NoSuchElementException( "No entity matching id " + rawEntity.getId() + " in Management Context " + getEntity().getManagementContext() + " during entity service binding " + getEntity().getId()); } }
@Override public void waitForEntityStart() { Entities.waitForServiceUp(this); }