public boolean matchesSlaveAttributes()

in myriad-scheduler/src/main/java/org/apache/myriad/scheduler/constraints/LikeConstraint.java [53:74]


  public boolean matchesSlaveAttributes(Collection<Attribute> attributes) {
    if (!lhs.equalsIgnoreCase(HOSTNAME) && attributes != null) {
      for (Attribute attr : attributes) {
        if (attr.getName().equalsIgnoreCase(lhs)) {
          switch (attr.getType()) {
            case TEXT:
              return this.pattern.matcher(attr.getText().getValue()).matches();

            case SCALAR:
              return this.pattern.matcher(String.valueOf(attr.getScalar().getValue())).matches();

            default:
              LOGGER.warn("LIKE constraint currently doesn't support Mesos slave attributes " + "of type {}. Attribute Name: {}",
                  attr.getType(), attr.getName());
              return false;

          }
        }
      }
    }
    return false;
  }