X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fconfig%2Factor_system_provider%2Fimpl%2Ffactory%2Fosgi%2FBundleClassLoaderFactory.java;fp=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fconfig%2Factor_system_provider%2Fimpl%2Ffactory%2Fosgi%2FBundleClassLoaderFactory.java;h=d47b47bb60dcd2dd7888e027382b5b688d14c92a;hp=0000000000000000000000000000000000000000;hb=88620eacdbb3a8e4b8c3114f0628ff95a5c8b5f6;hpb=30535bcc4c2770cb8500469fe40bdfb37d8ade4d diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/factory/osgi/BundleClassLoaderFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/factory/osgi/BundleClassLoaderFactory.java new file mode 100644 index 0000000000..d47b47bb60 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/factory/osgi/BundleClassLoaderFactory.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.config.yang.config.actor_system_provider.impl.factory.osgi; + +import akka.osgi.BundleDelegatingClassLoader; +import java.security.AccessController; +import java.security.PrivilegedAction; +import org.osgi.framework.BundleContext; + +public class BundleClassLoaderFactory { + + public static ClassLoader createClassLoader(final BundleContext bundleContext) { + return AccessController + .doPrivileged((PrivilegedAction) () -> new BundleDelegatingClassLoader( + bundleContext.getBundle(), Thread.currentThread().getContextClassLoader())); + } +}