Package org.apache.xbean.classloader

Examples of org.apache.xbean.classloader.ResourceHandle


        }

        List<URL> urls = new ArrayList<URL>();
        for (ResourceLocation location : boundClassPath)
        {
            ResourceHandle resourceHandle = location.getResourceHandle(resourceName);
            if (resourceHandle != null)
            {
                urls.add(resourceHandle.getUrl());
            }
        }
        if (!urls.isEmpty()) return Collections.enumeration(urls);

View Full Code Here


                    // convert the class name to a file name
                    String resourceName = className.replace('.', '/') + ".class";

                    // find the class file resource
                    ResourceHandle resourceHandle = location.getResourceHandle(resourceName);

                    if (resourceHandle == null) throw new ClassNotFoundException(className);

                    byte[] bytes;
                    Manifest manifest;
                    try
                    {
                        // get the bytes from the class file
                        bytes = resourceHandle.getBytes();

                        // get the manifest for defining the packages
                        manifest = resourceHandle.getManifest();
                    }
                    catch (IOException e)
                    {
                        throw new ClassNotFoundException(className, e);
                    }

                    // get the certificates for the code source
                    Certificate[] certificates = resourceHandle.getCertificates();

                    // the code source url is used to define the package and as the security context for the class
                    URL codeSourceUrl = resourceHandle.getCodeSourceUrl();

                    // define the package (required for security)
                    definePackage(className, codeSourceUrl, manifest);

                    // this is the security context of the class
View Full Code Here

    public InputStream getInputStreamForResource(int location, String path) throws IOException
    {
        if (location < 0 || location >= resourceLocations.size()) throw new IOException("Resource location index is out of bounds");

        ResourceLocation resourceLocation = resourceLocations.get(location);
        ResourceHandle handle = resourceLocation.getResourceHandle(path);

        if (handle == null) throw new IOException("Path does not correspond to a resource");

        return handle.getInputStream();
    }
View Full Code Here

    public InputStream getInputStreamForResource(int location, String path) throws IOException
    {
        if (location < 0 || location >= resourceLocations.size()) throw new IOException("Resource location index is out of bounds");

        ResourceLocation resourceLocation = resourceLocations.get(location);
        ResourceHandle handle = resourceLocation.getResourceHandle(path);

        if (handle == null) throw new IOException("Path does not correspond to a resource");

        return handle.getInputStream();
    }
View Full Code Here

TOP

Related Classes of org.apache.xbean.classloader.ResourceHandle

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.