All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.petals.se.jsr181.utils.Jsr181ClassLoaderUtils Maven / Gradle / Ivy

There is a newer version: 1.6.0
Show newest version
/**
 * Copyright (c) 2008-2012 EBM WebSourcing, 2012-2016 Linagora
 * 
 * This program/library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or (at your
 * option) any later version.
 * 
 * This program/library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program/library; If not, see http://www.gnu.org/licenses/
 * for the GNU Lesser General Public License version 2.1.
 */
package org.ow2.petals.se.jsr181.utils;

import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;

import org.apache.axis2.classloader.JarFileClassLoader;

/**
 * A class loader that puts all the JARs and the root directory in the class path.
 * 

* This class is a partial copy of org.ow2.petals.se.talend.utils.TalendClassLoaderUtils, * except we use a class loader from Axis2 libraries. *

* * @author Vincent Zurczak - EBM WebSourcing */ public class Jsr181ClassLoaderUtils { /** * As all methods of this class are static, no constructor is available. */ private Jsr181ClassLoaderUtils() { // Nothing } /** * Return an URLClassLoader object, with all Jar contained in the given directory path. * * @param urls the URLs to load * @param parent the parent class loader to use * @return a classLoader */ public static JarFileClassLoader createClassLoader(final URL[] urls, final ClassLoader parent) { return AccessController.doPrivileged(new PrivilegedAction() { @Override public JarFileClassLoader run() { return new JarFileClassLoader(urls, parent); } }); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy