Пример #1
0
  private Clusters buildClusters(String name) {
    Validity validity = new Validity();
    long startMilliSecs = new Date().getTime() - (2 * DAY_IN_MILLIS);
    validity.setStart(new Date(startMilliSecs));
    validity.setEnd(new Date());
    org.apache.falcon.entity.v0.process.Cluster cluster =
        new org.apache.falcon.entity.v0.process.Cluster();
    cluster.setName(name);
    cluster.setValidity(validity);

    Clusters clusters = new Clusters();
    clusters.getClusters().add(cluster);
    return clusters;
  }
  private static void bindClusterProperties(
      final Cluster cluster, final Properties extensionProperties) {
    String clusterName =
        extensionProperties.getProperty(ExtensionProperties.CLUSTER_NAME.getName());
    if (StringUtils.isNotEmpty(clusterName)) {
      cluster.setName(clusterName);
    }
    String clusterStartValidity =
        extensionProperties.getProperty(ExtensionProperties.VALIDITY_START.getName());
    if (StringUtils.isNotEmpty(clusterStartValidity)) {
      cluster.getValidity().setStart(SchemaHelper.parseDateUTC(clusterStartValidity));
    }

    String clusterEndValidity =
        extensionProperties.getProperty(ExtensionProperties.VALIDITY_END.getName());
    if (StringUtils.isNotEmpty(clusterEndValidity)) {
      cluster.getValidity().setEnd(SchemaHelper.parseDateUTC(clusterEndValidity));
    }
  }