class NameUtil {

    public static String computeValidContainerName(String organization, String space, String serviceName) {
        String properOrganization = organization.toUpperCase(Locale.US)
                                                .replaceAll(NameRequirements.CONTAINER_NAME_ILLEGAL_CHARACTERS, "_");
        String properSpace = space.toUpperCase(Locale.US)
                                  .replaceAll(NameRequirements.CONTAINER_NAME_ILLEGAL_CHARACTERS, "_");
        String properServiceName = serviceName.toUpperCase(Locale.US)
                                              .replaceAll(NameRequirements.CONTAINER_NAME_ILLEGAL_CHARACTERS, "_");
        return getNameWithProperLength(String.format("%s_%s_%s", properOrganization, properSpace, properServiceName),
                                       NameRequirements.CONTAINER_NAME_MAX_LENGTH).toUpperCase(Locale.US);
    }

    private  NameUtil();

}