Package org.apache.tuscany.spi.deployer

Examples of org.apache.tuscany.spi.deployer.CompositeClassLoader


    }

    protected void deployExtension(String name, URL url) {
        // FIXME for now, assume this class's ClassLoader is the Tuscany system classloader
        // FIXME we should really use the one associated with the parent composite
        CompositeClassLoader extensionCL = new CompositeClassLoader(getClass().getClassLoader());

        // see if the URL points to a composite JAR by looking for a default SCDL file inside it
        URL scdlLocation;
        try {
            scdlLocation = new URL("jar:" + url.toExternalForm() + "!/META-INF/sca/default.scdl");
        } catch (MalformedURLException e) {
            // the form of the jar: URL should be correct given url.toExternalForm() worked
            throw new AssertionError();
        }
        try {
            scdlLocation.openStream().close();
            // we connected to the SCDL so let's add the JAR file to the classloader
            extensionCL.addURL(url);
        } catch (IOException e) {
            // assume that the URL we were given is not a JAR file so just use the supplied resource
            scdlLocation = url;
        }
View Full Code Here


    public void load(CompositeComponent parent, CompositeImplementation implementation,
                     DeploymentContext deploymentContext)
        throws LoaderException {
        URL scdlLocation = implementation.getScdlLocation();
        ClassLoader cl = new CompositeClassLoader(implementation.getClassLoader());
        deploymentContext = new ChildDeploymentContext(deploymentContext, cl, scdlLocation);
        CompositeComponentType componentType = loadFromSidefile(parent, scdlLocation, deploymentContext);
        implementation.setComponentType(componentType);
    }
View Full Code Here

            try {
                impl.setScdlLocation(new URL("jar:" + jarUrl.toExternalForm() + "!/META-INF/sca/default.scdl"));
            } catch (MalformedURLException e) {
                throw new AssertionError("Could not convert URL to a jar: url");
            }
            impl.setClassLoader(new CompositeClassLoader(new URL[]{jarUrl}, deploymentContext.getClassLoader()));
        } else if (artifactRepository != null && group != null && version != null) {
            Artifact artifact = new Artifact();
            artifact.setGroup(group);
            artifact.setName(name);
            artifact.setVersion(version);
            artifact.setType("jar");
            artifactRepository.resolve(artifact);
            if (artifact.getUrl() == null) {
                MissingResourceException mre = new MissingResourceException(artifact.toString());
                mre.setIdentifier(name);
                throw mre;
            }
            try {
                impl.setScdlLocation(new URL("jar:" + artifact.getUrl() + "!/META-INF/sca/default.scdl"));
            } catch (MalformedURLException e) {
                throw new AssertionError(e);
            }
            Set<URL> artifactURLs = artifact.getUrls();
            URL[] urls = new URL[artifactURLs.size()];
            int i = 0;
            for (URL artifactURL : artifactURLs) {
                urls[i++] = artifactURL;
            }
            impl.setClassLoader(new CompositeClassLoader(urls, deploymentContext.getClassLoader()));
        }
        return impl;
    }
View Full Code Here

                            artifactRepository.resolve(artifact);
                        }
                        if (artifact.getUrl() != null) {
                            ClassLoader classLoader = deploymentContext.getClassLoader();
                            if (classLoader instanceof CompositeClassLoader) {
                                CompositeClassLoader ccl = (CompositeClassLoader)classLoader;
                                for (URL dep : artifact.getUrls()) {
                                    ccl.addURL(dep);
                                }
                            }
                        }
                    } else {
                        // HACK: [rfeng] Add as an unknown model extension
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.deployer.CompositeClassLoader

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.