@@ -0,0 +1,3218 @@
+/*%0A * Licensed to the University of California, Berkeley under one or more contributor license%0A * agreements. See the NOTICE file distributed with this work for additional information regarding%0A * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance with the License. You may obtain a%0A * copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software distributed under the License%0A * is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express%0A * or implied. See the License for the specific language governing permissions and limitations under%0A * the License.%0A */%0A%0Apackage tachyon;%0A%0Aimport java.lang.reflect.Field;%0Aimport java.util.HashSet;%0Aimport java.util.Map.Entry;%0Aimport java.util.Set;%0Aimport java.util.regex.Pattern;%0A%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Aimport tachyon.conf.TachyonConf;%0Aimport tachyon.Constants;%0A%0A/**%0A * Validate the TachyonConf object.%0A *%0A */%0Apublic class ValidateConf %7B%0A  private static final Logger LOG = LoggerFactory.getLogger(Constants.LOGGER_TYPE);%0A%0A  private static boolean validate() %7B%0A    Constants constants = new Constants();%0A    Set%3CString%3E validProperties = new HashSet%3CString%3E();%0A    try %7B%0A      // Iterate over the array of Field objects in tachyon.Conatants by reflection%0A      for (Field field : constants.getClass().getDeclaredFields()) %7B%0A        if (field.getType().isAssignableFrom(String.class)) %7B%0A          String name = (String) field.get(constants);%0A          if (name.startsWith(%22tachyon.%22)) %7B%0A            validProperties.add(name.trim());%0A          %7D%0A        %7D%0A      %7D%0A    %7D catch (Exception e) %7B%0A      LOG.error(e.getMessage(), e);%0A    %7D%0A%0A    // There are two properties that are defined in tachyon-default.properties but not declared in%0A    // Tachyon.Constants.%0A    validProperties.add(%22tachyon.version%22);%0A    validProperties.add(%22tachyon.debug%22);%0A%0A    // There are three properties that are auto-generated in WorkerStorage rather than defined in%0A    // Tachyon.Constants.%0A    Pattern aliasPattern = Pattern.compile(%22tachyon.worker.tieredstore.level%5C%5Cd+.alias%22);%0A    Pattern dirsPathPattern = Pattern.compile(%22tachyon.worker.tieredstore.level%5C%5Cd+.dirs.path%22);%0A    Pattern dirsQuotaPattern = Pattern.compile(%22tachyon.worker.tieredstore.level%5C%5Cd+.dirs.quota%22);%0A%0A    TachyonConf tachyonConf = new TachyonConf();%0A    boolean valid = true;%0A    for (Entry%3CString, String%3E entry : tachyonConf.toMap().entrySet()) %7B%0A      String propertyName = entry.getKey();%0A      if (aliasPattern.matcher(propertyName).matches()%0A          %7C%7C dirsPathPattern.matcher(propertyName).matches()%0A          %7C%7C dirsQuotaPattern.matcher(propertyName).matches()) %7B%0A        continue;%0A      %7D%0A      if (propertyName.startsWith(%22tachyon.%22) && !validProperties.contains(propertyName)) %7B%0A        System.out.println(%22Unsupported or deprecated property %22 + propertyName);%0A        valid = false;%0A      %7D%0A    %7D%0A    return valid;%0A  %7D%0A%0A  public static void main(String%5B%5D args) %7B%0A    if (!validate()) %7B%0A      System.exit(-1);%0A    %7D%0A    System.exit(0);%0A  %7D%0A%0A%7D%0A

Implement a main class called ValidateConf which checks the properties provided by system and user