class CapabilityMatcherService implements ICapabilityMatcherService {

    @Override
    public Map<String, Capability> getCompatibleCapabilityByType(NodeTemplate nodeTemplate, String type) {
        Map<String, Capability> capabilities = nodeTemplate.getCapabilities();
        if (capabilities == null) {
            return Collections.emptyMap();
        }

        Map<String, Capability> targetCapabilitiesMatch = Maps.newHashMap();
        for (Map.Entry<String, Capability> capabilityEntry : capabilities.entrySet()) {
            String capabilityTypeName = capabilityEntry.getValue().getType();
            CapabilityType capabilityType = toscaContextFinder.find(CapabilityType.class, capabilityTypeName);

            if (ToscaTypeUtils.isOfType(capabilityType, type)) {
                targetCapabilitiesMatch.put(capabilityEntry.getKey(), capabilityEntry.getValue());
            }
        }
        return targetCapabilitiesMatch;
    }

    public  CapabilityMatcherService();

}