1 4 package com.tc.config.schema; 5 6 import com.tc.config.schema.setup.ConfigurationSetupException; 7 import com.tc.config.schema.setup.FatalIllegalConfigurationChangeHandler; 8 import com.tc.config.schema.setup.L2TVSConfigurationSetupManager; 9 import com.tc.config.schema.setup.StandardTVSConfigurationSetupManagerFactory; 10 11 14 public class ConfigFileValidator { 15 16 private String description; 17 18 public void validate(String [] args) throws ConfigurationSetupException { 19 StandardTVSConfigurationSetupManagerFactory factory; 20 21 factory = new StandardTVSConfigurationSetupManagerFactory(args, true, new FatalIllegalConfigurationChangeHandler()); 22 L2TVSConfigurationSetupManager manager = factory.createL2TVSConfigurationSetupManager(null); 23 description = manager.describeSources(); 24 } 25 26 public String toString() { 27 return this.description; 28 } 29 30 public static void main(String [] args) { 31 ConfigFileValidator validator = new ConfigFileValidator(); 32 33 try { 34 validator.validate(args); 35 System.err.println(validator.toString() + ": VALID."); 36 System.exit(0); 37 } catch (ConfigurationSetupException cse) { 38 Throwable exception = cse; 39 40 System.err.println(validator.toString() + ": INVALID."); 41 42 while (exception != null) { 43 System.err.println(exception.getLocalizedMessage()); 44 exception = exception.getCause(); 45 } 46 47 System.exit(1); 48 } 49 } 50 51 } 52 | Popular Tags |