class RuntimeManagementServiceCDI implements RuntimeManagementService {

    @Override
    public ContainerSpecData getContainersByContainerSpec(final String serverTemplateId,
                                                          final String containerSpecId) {
        final ServerTemplate serverTemplate = specManagementService.getServerTemplate(serverTemplateId);
        if (serverTemplate == null) {
            throw new RuntimeException("Server template with id " + serverTemplateId + " not found");
        }
        final ContainerSpec containerSpec = serverTemplate.getContainerSpec(containerSpecId);
        if (containerSpec == null) {
            throw new RuntimeException("Container with id " + containerSpecId + " not found");
        }
        final ContainerList containerList = service.getContainers(serverTemplate,
                                                                  containerSpec);
        final List<Container> containers = Arrays.asList(containerList.getContainers());
        return new ContainerSpecData(containerSpec,
                                     containers);
    }

}