1 16 17 package org.apache.cocoon.bean.helpers; 18 19 import org.w3c.dom.Document ; 20 import org.apache.cocoon.bean.CocoonBean; 21 import org.apache.cocoon.bean.helpers.OutputStreamListener; 22 import org.apache.cocoon.bean.helpers.BeanConfigurator; 23 24 32 public class AntDelegate { 33 34 public static int process(Document xconf, String uriGroup) throws Exception { 35 CocoonBean cocoon = new CocoonBean(); 36 OutputStreamListener listener = new OutputStreamListener(System.out); 37 cocoon.addListener(listener); 38 BeanConfigurator.configure(xconf, cocoon, "", uriGroup, listener); 39 40 System.out.println(CocoonBean.getProlog()); 41 42 if (!cocoon.isPrecompileOnly() && cocoon.getTargetCount() ==0) { 43 listener.messageGenerated("Please, specify at least one starting URI."); 44 System.exit(1); 45 } 46 47 cocoon.initialize(); 48 cocoon.process(); 49 cocoon.dispose(); 50 51 listener.complete(); 52 return listener.isSuccessful() ? 0 : 1; 53 } 54 } 55 56 | Popular Tags |