1 17 package org.alfresco.repo.dictionary; 18 19 import java.util.ArrayList ; 20 import java.util.List ; 21 22 23 26 public class TestModel 27 { 28 29 public static void main(String [] args) 30 { 31 if (args != null && args.length > 0 && args[0].equals("-h")) 32 { 33 System.out.println("TestModel [model filename]*"); 34 System.exit(0); 35 } 36 37 System.out.println("Testing dictionary model definitions..."); 38 39 List <String > bootstrapModels = new ArrayList <String >(); 42 bootstrapModels.add("alfresco/model/dictionaryModel.xml"); 43 bootstrapModels.add("alfresco/model/systemModel.xml"); 44 bootstrapModels.add("alfresco/model/contentModel.xml"); 45 bootstrapModels.add("alfresco/model/applicationModel.xml"); 46 47 for (String arg: args) 49 { 50 bootstrapModels.add(arg); 51 } 52 53 for (String model : bootstrapModels) 54 { 55 System.out.println(" " + model); 56 } 57 58 NamespaceDAO namespaceDAO = new NamespaceDAOImpl(); 60 DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl(namespaceDAO); 61 62 try 64 { 65 DictionaryBootstrap bootstrap = new DictionaryBootstrap(); 66 bootstrap.setModels(bootstrapModels); 67 bootstrap.setDictionaryDAO(dictionaryDAO); 68 bootstrap.bootstrap(); 69 System.out.println("Models are valid."); 70 } 71 catch(Exception e) 72 { 73 System.out.println("Found an invalid model..."); 74 Throwable t = e; 75 while (t != null) 76 { 77 System.out.println(t.getMessage()); 78 t = t.getCause(); 79 } 80 } 81 } 82 } | Popular Tags |