Package java.net

Examples of java.net.URLClassLoader$URLJarHandler


      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      URL url = null;
      String propertyName = "roles.properties";

      if (loader instanceof URLClassLoader) {
        URLClassLoader ucl = (URLClassLoader) loader;
        url = ucl.findResource(propertyName);
      }
      if (url == null) {
        url = loader.getResource(propertyName);
      }
      if (url == null) {
View Full Code Here


        }

        // Add in libs for plugins
        ClassLoader runtimeClassloader = getClass().getClassLoader();
        URL[] classPath = classPathRegistry.getClassPathUrls("GRADLE_PLUGINS");
        rootClassLoader = new URLClassLoader(classPath, runtimeClassloader);
    }
View Full Code Here

    private final JUnit4Mockery context = new JUnit4Mockery();

    @Test
    public void loadsPropertiesThenDelegatesToBackingSettingsProcessor() {
        final SettingsProcessor delegate = context.mock(SettingsProcessor.class);
        final URLClassLoader urlClassLoader = new URLClassLoader(new URL[0]);
        final IGradlePropertiesLoader propertiesLoader = context.mock(IGradlePropertiesLoader.class);
        final StartParameter startParameter = new StartParameter();
        final SettingsInternal settings = context.mock(SettingsInternal.class);
        final File settingsDir = new File("root");
        final ScriptSource settingsScriptSource = context.mock(ScriptSource.class);
View Full Code Here

        ScriptSource expectedScriptSource = context.mock(ScriptSource.class);
        Map<String, String> expectedGradleProperties = WrapUtil.toMap("key", "myvalue");
        IProjectDescriptorRegistry expectedProjectDescriptorRegistry = new DefaultProjectDescriptorRegistry();
        StartParameter expectedStartParameter = new StartParameter();
        SettingsFactory settingsFactory = new SettingsFactory(expectedProjectDescriptorRegistry);
        final URLClassLoader urlClassLoader = new URLClassLoader(new URL[0]);
        GradleInternal gradle = context.mock(GradleInternal.class);

        DefaultSettings settings = (DefaultSettings) settingsFactory.createSettings(gradle,
                expectedSettingsDir, expectedScriptSource, expectedGradleProperties, expectedStartParameter, urlClassLoader);
View Full Code Here

        boolean debug = GradleWrapperMain.isDebug();
        File gradleJar = new File(gradleHome, "lib/gradle-launcher-" + version + ".jar");
        if (debug) {
            System.out.println("gradleJar = " + gradleJar.getAbsolutePath());
        }
        URLClassLoader contextClassLoader = new URLClassLoader(new URL[] { gradleJar.toURI().toURL() });
        Thread.currentThread().setContextClassLoader(contextClassLoader);
        Class<?> mainClass = contextClassLoader.loadClass("org.gradle.launcher.GradleMain");
        Method mainMethod = mainClass.getMethod("main", String[].class);
        mainMethod.invoke(null, new Object[] {args});
    }
View Full Code Here

        // We found the desired settings file, now build the associated buildSrc before loading settings.  This allows
        // the settings script to reference classes in the buildSrc.
        StartParameter buildSrcStartParameter = startParameter.newBuild();
        buildSrcStartParameter.setCurrentDir(new File(settingsLocation.getSettingsDir(),
                BaseSettings.DEFAULT_BUILD_SRC_DIR));
        URLClassLoader buildSourceClassLoader = buildSourceBuilder.buildAndCreateClassLoader(buildSrcStartParameter);

        return loadSettings(gradle, settingsLocation, buildSourceClassLoader, startParameter, gradlePropertiesLoader);
    }
View Full Code Here

        this.serializedWorker = serializedWorker;
    }

    public Void call() throws Exception {
        URL[] bootstrapUrls = bootstrapClasspath.toArray(new URL[bootstrapClasspath.size()]);
        URLClassLoader classLoader = new URLClassLoader(bootstrapUrls, ClassLoader.getSystemClassLoader().getParent());
        Class<? extends Callable> workerClass = classLoader.loadClass(
                "org.gradle.process.internal.child.SystemApplicationClassLoaderWorker").asSubclass(Callable.class);
        Callable<Void> main = workerClass.getConstructor(Collection.class, byte[].class).newInstance(
                applicationClasspath, serializedWorker);
        return main.call();
    }
View Full Code Here

        if (new File(scriptCacheDir, EMPTY_SCRIPT_MARKER_FILE_NAME).isFile()) {
            return new AsmBackedEmptyScriptGenerator().generate(scriptBaseClass);
        }
       
        try {
            URLClassLoader urlClassLoader = new URLClassLoader(WrapUtil.toArray(scriptCacheDir.toURI().toURL()),
                    classLoader);
            return urlClassLoader.loadClass(source.getClassName()).asSubclass(scriptBaseClass);
        } catch (Exception e) {
            throw new GradleException(String.format("Could not load compiled classes for %s from cache.",
                    source.getDisplayName()), e);
        }
    }
View Full Code Here

        context.setImposteriser(ClassImposteriser.INSTANCE);
        scriptCompilationHandlerMock = context.mock(ScriptCompilationHandler.class);
        scriptRunnerFactoryMock = context.mock(ScriptRunnerFactory.class);
        cacheRepositoryMock = context.mock(CacheRepository.class);
        cacheMock = context.mock(PersistentCache.class);
        testClassLoader = new URLClassLoader(new URL[0]);
        testScriptFile = new File(tmpDir.getDir(), "script/mybuild.craidle");
        cacheDir = new File(tmpDir.getDir(), "cache");
        expectedScriptCacheDir = new TestFile(cacheDir, "Script").createDir();
        expectedScriptRunner = context.mock(ScriptRunner.class);
        scriptProcessor = new DefaultScriptCompilerFactory(scriptCompilationHandlerMock, scriptRunnerFactoryMock, cacheRepositoryMock);
View Full Code Here

            } else {
                try {
                   
                    IBindingFactory factory;
                    URL[] urls = new URL[] { new File(".").toURL() };
                    URLClassLoader loader = new URLClassLoader(urls);
                    if (cname == null) {
                        factory = BindingDirectory.getFactory(bname, pname,
                            loader);
                    } else {
                        Class clas = loader.loadClass(cname);
                        if (bname == null) {
                            factory = BindingDirectory.getFactory(clas);
                        } else {
                            factory = BindingDirectory.getFactory(bname, clas,
                                loader);
View Full Code Here

TOP

Related Classes of java.net.URLClassLoader$URLJarHandler

Copyright © 2018 www.massapicom. 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.