1 package net.sf.invicta; 2 3 import java.lang.reflect.InvocationTargetException ; 4 import net.sf.invicta.process.InvictaMainFlow; 5 import net.sf.invicta.template.InvictaTemplateException; 6 7 11 public class Invicta { 12 13 17 public static void main(String [] args) { 18 19 try { 21 Invicta invicta = new Invicta(); 22 boolean wasProcessed = invicta.process(); 23 if (wasProcessed) { 24 Logger.info("**** Invicta processed and modified its output files."); 25 Logger.info("**** You should rerun your ANT build script."); 26 Logger.info("**** Ignore the \"BUILD FAILED\" message !"); 27 System.exit(2); 28 } 29 30 } catch (InvictaTemplateException e) { 31 Logger.error(e.getMessage()); 32 if (Logger.isDebugMode()) { 33 e.printStackTrace(); 34 if (e.getCause() != null) 35 e.getCause().printStackTrace(); 36 } 37 System.exit(1); 38 } catch (Exception e) { 39 Throwable actualException = e; 40 if (e instanceof InvocationTargetException ) { 41 actualException = ((InvocationTargetException )e).getTargetException(); 42 } 43 Logger.error(actualException.getMessage()); 44 if (Logger.isDebugMode()) { 45 actualException.printStackTrace(); 46 } 47 System.exit(1); 48 } 49 System.exit(0); 50 } 51 52 57 public boolean process() throws InvictaException { 58 InvictaMainFlow mainFlow = new InvictaMainFlow(); 59 mainFlow.process(); 60 return mainFlow.getWasProcessed(); 61 } 62 63 } 64 | Popular Tags |