Examples of AntClassLoader


Examples of org.apache.tools.ant.AntClassLoader

     */
    private InputSource classpathLookup(DTDLocation matchingEntry) {

        InputSource source = null;

        AntClassLoader loader = null;
        if (classpath != null) {
            loader = new AntClassLoader(project, classpath);
        } else {
            loader = new AntClassLoader(project, Path.systemClasspath);
        }

        //
        // for classpath lookup we ignore the base directory
        //
        InputStream is
            = loader.getResourceAsStream(matchingEntry.getLocation());

        if (is != null) {
            source = new InputSource(is);
            URL entryURL = loader.getResource(matchingEntry.getLocation());
            String sysid = entryURL.toExternalForm();
            source.setSystemId(sysid);
            log("catalog entry matched a resource in the classpath: '" +
                sysid + "'", Project.MSG_DEBUG);
        }
View Full Code Here

Examples of org.apache.tools.ant.AntClassLoader

           
        // now we need to populate the compiler adapter
        adapter.setRmic(this);

        Path classpath = adapter.getClasspath();
        loader = new AntClassLoader(project, classpath);

        try {
            // scan base dirs to build up compile lists only if a
            // specific classname is not given
            if (classname == null) {
View Full Code Here

Examples of org.apache.tools.ant.AntClassLoader

                        try {
                            Class clazz = null;
                            if (classpath == null) {
                                clazz = Class.forName(className);
                            } else {
                                AntClassLoader al = new AntClassLoader(project,
                                                                       classpath);
                                clazz = al.loadClass(className);
                                AntClassLoader.initializeClass(clazz);
                            }
                            if (clazz != null) {
                                if (!FilterReader.class.isAssignableFrom(clazz)) {
                                    throw new BuildException(className +
View Full Code Here

Examples of org.apache.tools.ant.AntClassLoader

            }
        }

        if (classpath != null) {
            classpath.setProject(project);
            this.loader = new AntClassLoader(project, classpath);
        }

        String appendix = "";
        if (isTask) {
            appendix = " to set property " + property;
View Full Code Here

Examples of org.apache.tools.ant.AntClassLoader

     */
    private boolean checkClass(String classname) {
        try {
            Class requiredClass = null;
            if (ignoreSystemclasses) {
                loader = new AntClassLoader(null, getProject(), classpath,
                                            false);
                if (loader != null) {
                    try {
                        requiredClass = loader.findClass(classname);
                    } catch (SecurityException se) {
View Full Code Here

Examples of org.apache.tools.ant.AntClassLoader

        CommandlineJava.SysProperties sysProperties =
            commandline.getSystemProperties();
        if (sysProperties != null) {
            sysProperties.setSystem();
        }
        AntClassLoader cl = null;
        try {
            log("Using System properties " + System.getProperties(),
                Project.MSG_VERBOSE);
            Path userClasspath = commandline.getClasspath();
            Path classpath = userClasspath == null
                                              ? null
                                              : (Path) userClasspath.clone();
            if (classpath != null) {
                if (includeAntRuntime) {
                    log("Implicitly adding " + antRuntimeClasses
                        + " to CLASSPATH", Project.MSG_VERBOSE);
                    classpath.append(antRuntimeClasses);
                }

                cl = new AntClassLoader(null, project, classpath, false);
                log("Using CLASSPATH " + cl.getClasspath(),
                    Project.MSG_VERBOSE);

                // make sure the test will be accepted as a TestCase
                cl.addSystemPackageRoot("junit");
                // will cause trouble in JDK 1.1 if omitted
                cl.addSystemPackageRoot("org.apache.tools.ant");
                cl.setThreadContextLoader();
            }
            runner = new JUnitTestRunner(test, test.getHaltonerror(),
                                         test.getFiltertrace(),
                                         test.getHaltonfailure(), cl);
            if (summary) {
                log("Running " + test.getName(), Project.MSG_INFO);

                SummaryJUnitResultFormatter f =
                    new SummaryJUnitResultFormatter();
                f.setWithOutAndErr("withoutanderr"
                                   .equalsIgnoreCase(summaryValue));
                f.setOutput(getDefaultOutput());
                runner.addFormatter(f);
            }

            final FormatterElement[] feArray = mergeFormatters(test);
            for (int i = 0; i < feArray.length; i++) {
                FormatterElement fe = feArray[i];
                File outFile = getOutput(fe, test);
                if (outFile != null) {
                    fe.setOutfile(outFile);
                } else {
                    fe.setOutput(getDefaultOutput());
                }
                runner.addFormatter(fe.createFormatter());
            }

            runner.run();
            return runner.getRetCode();
        } finally{
            if (sysProperties != null) {
                sysProperties.restoreSystem();
            }
            if (cl != null) {
                cl.resetThreadContextLoader();
            }
        }
    }
View Full Code Here

Examples of org.apache.tools.ant.AntClassLoader

     */
    private Class loadClass(String classname) throws Exception {
        if (classpath == null) {
            return Class.forName(classname);
        } else {
            AntClassLoader al = new AntClassLoader(project, classpath);
            Class c = al.loadClass(classname);
            AntClassLoader.initializeClass(c);
            return c;
        }
    }
View Full Code Here

Examples of org.apache.tools.ant.AntClassLoader

            try {
                Class c = null;
                if (classpath == null) {
                    c = Class.forName(classname);
                } else {
                    AntClassLoader al = new AntClassLoader(getProject(),
                                                           classpath);
                    c = al.loadClass(classname);
                    AntClassLoader.initializeClass(c);
                }
                dynselector = (FileSelector) c.newInstance();
            }
            catch (ClassNotFoundException cnfexcept) {
View Full Code Here

Examples of org.apache.tools.ant.AntClassLoader

            Class c = null;
            if (classpath == null) {
                c = Class.forName(classname);
            } else {
                AntClassLoader al = new AntClassLoader(getProject(),
                                                       classpath);
                c = al.loadClass(classname);
                AntClassLoader.initializeClass(c);
            }
           
            FileNameMapper m = (FileNameMapper) c.newInstance();
            m.setFrom(from);
View Full Code Here

Examples of org.apache.tools.ant.AntClassLoader

        // only generate a new ClassLoader if we have a classpath
        if (combinedClasspath == null) {
            classpathLoader = getClass().getClassLoader();
        } else {
            classpathLoader = new AntClassLoader(getTask().getProject(), combinedClasspath);
        }

        return classpathLoader;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.