1 19 20 package org.apache.tools.ant.module.bridge.impl; 21 22 import java.io.IOException ; 23 import java.net.URL ; 24 import org.apache.tools.ant.BuildException; 25 import org.apache.tools.ant.ComponentHelper; 26 import org.apache.tools.ant.Project; 27 import org.apache.tools.ant.UnknownElement; 28 import org.apache.tools.ant.helper.ProjectHelper2; 29 import org.apache.tools.ant.taskdefs.Antlib; 30 31 37 public final class NbAntlib extends Antlib { 38 39 46 public static void process(Project p, URL antlib, String uri, ClassLoader l) throws IOException , BuildException { 47 ComponentHelper helper = ComponentHelper.getComponentHelper(p); 48 helper.enterAntLib(uri); 49 Antlib al; 50 try { 51 UnknownElement antlibElement = new ProjectHelper2().parseUnknownElement(p, antlib); 52 al = new NbAntlib(uri, l); 53 al.setProject(p); 54 al.setLocation(antlibElement.getLocation()); 55 al.init(); 56 antlibElement.configure(al); 57 } finally { 58 helper.exitAntLib(); 59 } 60 al.execute(); 61 } 62 63 private NbAntlib(String uri, ClassLoader l) { 64 if (uri != null) { 65 setURI(uri); 66 } 67 setClassLoader(l); 68 } 69 70 } 71 | Popular Tags |