Package org.apache.openjpa.lib.util

Examples of org.apache.openjpa.lib.util.MultiClassLoader


    /**
     * Automatically load global values from the system's
     * {@link ProductDerivation}s, and from System properties.
     */
    public boolean loadGlobals() {
        MultiClassLoader loader = (MultiClassLoader) AccessController
            .doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
        loader.addClassLoader((ClassLoader) AccessController.doPrivileged(
            J2DoPrivHelper.getContextClassLoaderAction()));
        loader.addClassLoader(getClass().getClassLoader());
        ConfigurationProvider provider = ProductDerivations.loadGlobals(loader);
        if (provider != null)
            provider.setInto(this);

        // let system properties override other globals
View Full Code Here


    /**
     * Automatically load global values from the system's
     * {@link ProductDerivation}s, and from System properties.
     */
    public boolean loadGlobals() {
        MultiClassLoader loader = AccessController
            .doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
        loader.addClassLoader(AccessController.doPrivileged(
            J2DoPrivHelper.getContextClassLoaderAction()));
        loader.addClassLoader(getClass().getClassLoader());
        ConfigurationProvider provider = ProductDerivations.loadGlobals(loader);
        if (provider != null)
            provider.setInto(this);

        // let system properties override other globals
View Full Code Here

        // spring needs to use the envLoader first for all class resolution,
        // but we must still fall back on application loader
        ClassLoader loader = repos.getConfiguration().
            getClassResolverInstance().getClassLoader(cls, null);
        if (envLoader != null && envLoader != loader) {
          MultiClassLoader mult = new MultiClassLoader();
          mult.addClassLoader(envLoader);

          // loader from resolver is usually a multi loader itself
          if (loader instanceof MultiClassLoader)
            mult.addClassLoaders((MultiClassLoader)loader);
          else
            mult.addClassLoader(loader);
          loader = mult;
        }
   
        XMLPersistenceMetaDataParser xmlParser = getXMLParser();
        xmlParser.setClassLoader(loader);
View Full Code Here

        if (_preloadComplete == true) {
            return;
        }


        MultiClassLoader multi = AccessController.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
        multi.addClassLoader(AccessController.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction()));
        multi.addClassLoader(AccessController.doPrivileged(J2DoPrivHelper
            .getClassLoaderAction(MetaDataRepository.class)));
        // If a ClassLoader was passed into Persistence.createContainerEntityManagerFactory on the PersistenceUnitInfo
        // we need to add that loader to the chain of classloaders
        ClassResolver resolver = _conf.getClassResolverInstance();
        if (resolver != null) {
            ClassLoader cl = resolver.getClassLoader(null, null);
            if (cl != null) {
                multi.addClassLoader(cl);
            }
        }

        Set<String> classes = getPersistentTypeNames(false, multi);
        if (classes == null || classes.size() == 0) {
View Full Code Here

            _conf = null;
        }
    }

    private MultiClassLoader getConfigPropertiesResourceLoader() {
        MultiClassLoader loader = AccessController
                .doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
        loader.addClassLoader(getClassLoader());
        loader.addClassLoader(AccessController.doPrivileged(
                J2DoPrivHelper.getClassLoaderAction(_conf.getClass())));       
        return loader;
    }
View Full Code Here

        // If pooling EMFs, this method may be invoked more than once. Only perform this work once.
        if (_preloadComplete == true) {
            return;
        }

        MultiClassLoader multi = AccessController.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
        multi.addClassLoader(AccessController.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction()));
        multi.addClassLoader(AccessController.doPrivileged(J2DoPrivHelper
            .getClassLoaderAction(MetaDataRepository.class)));

        Set<String> classes = getPersistentTypeNames(false, multi);
        if (classes == null || classes.size() == 0) {
            throw new MetaDataException(_loc.get("repos-initializeEager-none"));
View Full Code Here

            _jarFiles = new ArrayList<URL>();
        _jarFiles.add(jar);
    }

    public void addJarFileName(String name) {
        MultiClassLoader loader = (MultiClassLoader) AccessController
            .doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
        loader.addClassLoader(getClass().getClassLoader());
        loader.addClassLoader(MultiClassLoader.THREAD_LOADER);
        URL url = (URL) AccessController.doPrivileged(
            J2DoPrivHelper.getResourceAction(loader, name));
        if (url != null) {
            addJarFile(url);
            return;
View Full Code Here

        if (_preloadComplete == true) {
            return;
        }


        MultiClassLoader multi = AccessController.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
        multi.addClassLoader(AccessController.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction()));
        multi.addClassLoader(AccessController.doPrivileged(J2DoPrivHelper
            .getClassLoaderAction(MetaDataRepository.class)));
        // If a ClassLoader was passed into Persistence.createContainerEntityManagerFactory on the PersistenceUnitInfo
        // we need to add that loader to the chain of classloaders
        ClassResolver resolver = _conf.getClassResolverInstance();
        if (resolver != null) {
            ClassLoader cl = resolver.getClassLoader(null, null);
            if (cl != null) {
                multi.addClassLoader(cl);
            }
        }

        Set<String> classes = getPersistentTypeNames(false, multi);
        if (classes == null || classes.size() == 0) {
View Full Code Here

            _locs = Collections.emptyList();
            return;
        }

        if (loader == null) {
            MultiClassLoader multi = AccessController
                .doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
            multi.addClassLoader(MultiClassLoader.SYSTEM_LOADER);
            multi.addClassLoader(MultiClassLoader.THREAD_LOADER);
            multi.addClassLoader(getClass().getClassLoader());
            if (cls != null)
            {
                ClassLoader clsLoader = (ClassLoader)
                    AccessController.doPrivileged(
                        J2DoPrivHelper.getClassLoaderAction(cls));
                if (clsLoader != null)
                    multi.addClassLoader(clsLoader);
            }
            loader = multi;
        }
        _loader = loader;
View Full Code Here

     * Constructor; supply the resource to parse.
     */
    public ResourceMetaDataIterator(String rsrc, ClassLoader loader)
        throws IOException {
        if (loader == null) {
            MultiClassLoader multi = AccessController
                .doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
            multi.addClassLoader(MultiClassLoader.SYSTEM_LOADER);
            multi.addClassLoader(MultiClassLoader.THREAD_LOADER);
            multi.addClassLoader(getClass().getClassLoader());
            loader = multi;
        }

        try {
            Enumeration<URL> e = AccessController.doPrivileged(
View Full Code Here

TOP

Related Classes of org.apache.openjpa.lib.util.MultiClassLoader

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.