Search in sources :

Example 6 with AllocationException

use of org.eclipse.winery.repository.exceptions.AllocationException in project winery by eclipse.

the class MinExternalConnections method getPossibleMatches.

@Override
protected List<List<PermutationHelper>> getPossibleMatches(TopologyWrapper topology) {
    List<List<PermutationHelper>> possibilities = new ArrayList<>();
    try {
        for (TNodeTemplate topLevelNT : topology.getTopLevelNTs()) {
            Map<TNodeTemplate, List<TTopologyTemplate>> fragments = fragmentsCache.getAllMatchingFragments(topology, topLevelNT);
            List<PermutationHelper> possibility = new ArrayList<>();
            for (Map.Entry<TNodeTemplate, List<TTopologyTemplate>> entry : fragments.entrySet()) {
                possibility.add(new PermutationHelper(entry.getKey(), entry.getValue()));
            }
            possibilities.add(possibility);
        }
    } catch (AllocationException e) {
        logger.debug("Exception calculating matching fragments: " + e.getMessage());
        return new ArrayList<>();
    }
    return possibilities;
}
Also used : PermutationHelper(org.eclipse.winery.repository.targetallocation.util.PermutationHelper) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) TNodeTemplate(org.eclipse.winery.model.tosca.TNodeTemplate) Map(java.util.Map) AllocationException(org.eclipse.winery.repository.exceptions.AllocationException)

Aggregations

AllocationException (org.eclipse.winery.repository.exceptions.AllocationException)6 ArrayList (java.util.ArrayList)5 List (java.util.List)4 TNodeTemplate (org.eclipse.winery.model.tosca.TNodeTemplate)4 HashMap (java.util.HashMap)3 TTopologyTemplate (org.eclipse.winery.model.tosca.TTopologyTemplate)3 HashSet (java.util.HashSet)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 Map (java.util.Map)1 Set (java.util.Set)1 QName (javax.xml.namespace.QName)1 ServiceTemplateId (org.eclipse.winery.model.ids.definitions.ServiceTemplateId)1 TRequirement (org.eclipse.winery.model.tosca.TRequirement)1 TServiceTemplate (org.eclipse.winery.model.tosca.TServiceTemplate)1 FulfillPolicies (org.eclipse.winery.repository.targetallocation.criteria.fulfillpolicies.FulfillPolicies)1 MinExternalConnections (org.eclipse.winery.repository.targetallocation.criteria.minexternalconnections.MinExternalConnections)1 MinHosts (org.eclipse.winery.repository.targetallocation.criteria.minhosts.MinHosts)1 PermutationHelper (org.eclipse.winery.repository.targetallocation.util.PermutationHelper)1