public MesosSlaveInfo getMesosSlaveInfoForLabel(Label label) { if (!matchesLabel(label)) { return null; } if (label == null) { if (getLabelString() == null) { return this; } else { return null; } } if (label.matches(Label.parse(getLabelString()))) { return this; } if (!containerInfo.getDockerImageCustomizable()) { return null; } String customImage = getCustomImage(label); if (customImage == null) { return null; } return copyWithDockerImage(label.toString(), customImage); }
@Override public boolean equals(Label label) { if (label instanceof ClassificationLabel) { return label.toString().equals(this.toString()); } else { return false; } }
private static String getCustomImage(Label label) { Matcher m = CUSTOM_IMAGE_FROM_LABEL_PATTERN.matcher(label.toString()); if (m.find()) { return m.group(1); } return null; }
private static List<String> makeStringList(List<Label> labels) { if (labels == null) { return Collections.emptyList(); } List<String> strings = Lists.newArrayListWithCapacity(labels.size()); for (Label label : labels) { strings.add(label.toString()); } return strings; }
public Root(Label label) { super(TYPE); setLabel(label.toString()); }
/** * This is used to describe the annotation and method or field that this label represents. This is * used to provide error messages that can be used to debug issues that occur when processing a * method. This should provide enough information such that the problem can be isolated correctly. * * @return this returns a string representation of the label */ public String toString() { return label.toString(); }
private static Label getLabelWithoutCustomImage(Label label, String customDockerImage) { return Label.get(label.toString().replace(CUSTOM_IMAGE_SEPARATOR + customDockerImage, "")); }