use of alien4cloud.paas.exception.LocationMatchingException in project alien4cloud by alien4cloud.
the class DefaultLocationMatcher method match.
@Override
public List<ILocationMatch> match(Topology topology) throws LocationMatchingException {
List<ILocationMatch> matched = Lists.newArrayList();
try {
// get all enabled orchestrators
List<Orchestrator> enabledOrchestrators = orchestratorService.getAll();
if (CollectionUtils.isEmpty(enabledOrchestrators)) {
return matched;
}
Map<String, Orchestrator> orchestratorMap = AlienUtils.fromListToMap(enabledOrchestrators, "id", true);
List<Location> locations = locationService.getOrchestratorsLocations(orchestratorMap.keySet());
for (Location location : locations) {
matched.add(new LocationMatch(location, orchestratorMap.get(location.getOrchestratorId()), null));
}
// filter on supported artifacts
locationMatchNodeFilter.filter(matched, topology);
return matched;
} catch (Exception e) {
throw new LocationMatchingException("Failed to match topology <" + topology.getId() + "> against locations. ", e);
}
}
use of alien4cloud.paas.exception.LocationMatchingException in project alien4cloud by alien4cloud.
the class MockLocationMatcher method match.
@Override
public List<ILocationMatch> match(Topology topology) throws LocationMatchingException {
log.info("Mock location matcher <" + this.getClass().getName() + "> called!");
List<ILocationMatch> matched = Lists.newArrayList();
// get all enabled orchestrators
try {
List<Orchestrator> enabledOrchestrators = orchestratorService.getAllEnabledOrchestrators();
if (CollectionUtils.isEmpty(enabledOrchestrators)) {
return matched;
}
Map<String, Orchestrator> orchestratorMap = AlienUtils.fromListToMap(enabledOrchestrators, "id", true);
List<Location> locations = locationService.getOrchestratorsLocations(orchestratorMap.keySet());
for (Location location : locations) {
matched.add(new LocationMatch(location, orchestratorMap.get(location.getOrchestratorId()), null));
}
new MockLocationMatchOrchestratorFilter(selfContext).filter(matched, topology);
return matched;
} catch (Exception e) {
throw new LocationMatchingException("Failed to match topology <" + topology.getId() + "> against locations. ", e);
}
}
Aggregations