use of alien4cloud.model.orchestrators.ArtifactSupport in project alien4cloud by alien4cloud.
the class LocationMatchNodesArtifactsElector method isEligible.
private boolean isEligible(AbstractInstantiableTemplate template, LocationMatchNodeFilter.NodeMatchContext matchContext) {
if (template == null) {
return true;
}
ArtifactSupport artifactSupport = matchContext.getArtifactSupport();
// if no supported artifact defined, then return true
if (artifactSupport == null || ArrayUtils.isEmpty(artifactSupport.getTypes())) {
return true;
}
String[] supportedArtifacts = artifactSupport.getTypes();
AbstractInstantiableToscaType indexedArtifactToscaElement = matchContext.getElement(AbstractInstantiableToscaType.class, template.getType());
if (MapUtils.isNotEmpty(indexedArtifactToscaElement.getInterfaces())) {
for (Interface interfaz : indexedArtifactToscaElement.getInterfaces().values()) {
for (Operation operation : interfaz.getOperations().values()) {
if (operation.getImplementationArtifact() != null) {
String artifactTypeString = operation.getImplementationArtifact().getArtifactType();
ArtifactType artifactType = matchContext.getElement(ArtifactType.class, artifactTypeString);
// stop the checking once one artifactType is not supported
if (!isFromOneOfTypes(supportedArtifacts, artifactType)) {
return false;
}
}
}
}
}
return true;
}
Aggregations