You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by no...@apache.org on 2010/10/30 00:08:20 UTC
svn commit: r1028928 - in /incubator/aries/trunk/util: ./
src/main/java/org/apache/aries/util/
src/main/java/org/apache/aries/util/internal/
Author: not
Date: Fri Oct 29 22:08:20 2010
New Revision: 1028928
URL: http://svn.apache.org/viewvc?rev=1028928&view=rev
Log:
ARIES-468 Add a utility to get hold of a ClassLoader for a bundle.
Added:
incubator/aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java
incubator/aries/trunk/util/src/main/java/org/apache/aries/util/SingleServiceTracker.java
incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/DefaultWorker.java
incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/EquinoxWorker.java
incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/FelixWorker.java
incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/FrameworkUtilWorker.java
Modified:
incubator/aries/trunk/util/pom.xml
incubator/aries/trunk/util/src/main/java/org/apache/aries/util/BundleToClassLoaderAdapter.java
Modified: incubator/aries/trunk/util/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/util/pom.xml?rev=1028928&r1=1028927&r2=1028928&view=diff
==============================================================================
--- incubator/aries/trunk/util/pom.xml (original)
+++ incubator/aries/trunk/util/pom.xml Fri Oct 29 22:08:20 2010
@@ -48,6 +48,9 @@
!org.apache.aries.util*,
org.osgi.framework.launch;resolution:=optional,
org.osgi.service.framework;resolution:=optional,
+ org.eclipse.osgi.internal.loader;resolution:=optional,
+ org.eclipse.osgi.framework.internal.core;resolution:=optional,
+ org.eclipse.osgi.framework.adaptor;resolution:=optional,
*
</aries.osgi.import.pkg>
<aries.osgi.private.pkg>
Added: incubator/aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java?rev=1028928&view=auto
==============================================================================
--- incubator/aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java (added)
+++ incubator/aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java Fri Oct 29 22:08:20 2010
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.util;
+
+import org.apache.aries.util.internal.DefaultWorker;
+import org.apache.aries.util.internal.EquinoxWorker;
+import org.apache.aries.util.internal.FelixWorker;
+import org.apache.aries.util.internal.FrameworkUtilWorker;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+
+public final class AriesFrameworkUtil
+{
+ private static FrameworkUtilWorker worker;
+
+ static {
+ Bundle b = FrameworkUtil.getBundle(AriesFrameworkUtil.class);
+ String bundleClassName = b.getClass().getName();
+ if (isEquinox(bundleClassName)) {
+ worker = new EquinoxWorker();
+ } else if (bundleClassName.startsWith("org.apache.felix")) {
+ worker = new FelixWorker();
+ }
+
+ if (worker == null || !!!worker.isValid()) worker = new DefaultWorker();
+ }
+
+
+ /**
+ * This method attempts to get the classloader for a bundle. It may return null if
+ * their is no such classloader, or if it cannot obtain the classloader for the bundle.
+ *
+ * @param b the bundle whose classloader is desired.
+ * @return the classloader if found, or null.
+ */
+ public static ClassLoader getClassLoader(Bundle b)
+ {
+ if (b.getState() != Bundle.UNINSTALLED && b.getState() != Bundle.INSTALLED) {
+ return worker.getClassLoader(b);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns true if we are in equinox, and we can access the interfaces we need.
+ * @param bundleClassName the class name of the bundle implementation.
+ * @return true if we are in equinox, false otherwise.
+ */
+ private static boolean isEquinox(String bundleClassName)
+ {
+ if (bundleClassName.startsWith("org.eclipse.equinox")) {
+ try {
+ Class.forName("org.eclipse.osgi.framework.internal.core.BundleHost");
+ return true;
+ } catch (ClassNotFoundException e) {
+ }
+ }
+ return false;
+ }
+
+ /**
+ * This method attempts to get the classloader for a bundle. It will force the creation
+ * of a classloader, so if no classloader exists. If the bundle is in installed state, but
+ * cannot be resolved the null will be returned.
+ *
+ * @param b the bundle to get a classloader for
+ * @return the classloader.
+ */
+ public static ClassLoader getClassLoaderForced(Bundle b)
+ {
+ try {
+ b.loadClass("java.lang.Object");
+ } catch (ClassNotFoundException e) {
+ }
+ return worker.getClassLoader(b);
+ }
+}
\ No newline at end of file
Modified: incubator/aries/trunk/util/src/main/java/org/apache/aries/util/BundleToClassLoaderAdapter.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/util/src/main/java/org/apache/aries/util/BundleToClassLoaderAdapter.java?rev=1028928&r1=1028927&r2=1028928&view=diff
==============================================================================
--- incubator/aries/trunk/util/src/main/java/org/apache/aries/util/BundleToClassLoaderAdapter.java (original)
+++ incubator/aries/trunk/util/src/main/java/org/apache/aries/util/BundleToClassLoaderAdapter.java Fri Oct 29 22:08:20 2010
@@ -32,6 +32,10 @@ import java.util.Enumeration;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
+/**
+ * @deprecated Please use AriesFrameworkUtil.getClassLoader to get a class loader for a bundle instead of this method
+ */
+@Deprecated
public class BundleToClassLoaderAdapter extends ClassLoader implements BundleReference
{
private Bundle b;
Added: incubator/aries/trunk/util/src/main/java/org/apache/aries/util/SingleServiceTracker.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/util/src/main/java/org/apache/aries/util/SingleServiceTracker.java?rev=1028928&view=auto
==============================================================================
--- incubator/aries/trunk/util/src/main/java/org/apache/aries/util/SingleServiceTracker.java (added)
+++ incubator/aries/trunk/util/src/main/java/org/apache/aries/util/SingleServiceTracker.java Fri Oct 29 22:08:20 2010
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.util;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+
+public final class SingleServiceTracker<T>
+{
+ public static interface SingleServiceListener
+ {
+ public void serviceFound();
+ public void serviceLost();
+ public void serviceReplaced();
+ }
+
+ private final BundleContext ctx;
+ private final String className;
+ private final AtomicReference<T> service = new AtomicReference<T>();
+ private final AtomicReference<ServiceReference> ref = new AtomicReference<ServiceReference>();
+ private final AtomicBoolean open = new AtomicBoolean(false);
+ private final SingleServiceListener serviceListener;
+
+ private final ServiceListener listener = new ServiceListener()
+ {
+ public void serviceChanged(ServiceEvent event)
+ {
+ if (open.get() && event.getType() == ServiceEvent.UNREGISTERING) {
+ ServiceReference deadRef = event.getServiceReference();
+ if (deadRef.equals(ref.get())) {
+ findMatchingReference(deadRef);
+ }
+ }
+ }
+ };
+
+ public SingleServiceTracker(BundleContext context, Class<T> clazz, SingleServiceListener sl)
+ {
+ ctx = context;
+ this.className = clazz.getName();
+ serviceListener = sl;
+ }
+
+ public T getService()
+ {
+ return service.get();
+ }
+
+ public ServiceReference getServiceReference()
+ {
+ return ref.get();
+ }
+
+ public void open()
+ {
+ if (open.compareAndSet(false, true)) {
+ try {
+ ctx.addServiceListener(listener, '(' + Constants.OBJECTCLASS + '=' + className + ')');
+ findMatchingReference(null);
+ } catch (InvalidSyntaxException e) {
+ // this can never happen. (famous last words :)
+ }
+ }
+ }
+
+ private void findMatchingReference(ServiceReference original) {
+ boolean clear = true;
+ ServiceReference ref = ctx.getServiceReference(className);
+ if (ref != null) {
+ @SuppressWarnings("unchecked")
+ T service = (T) ctx.getService(ref);
+ if (service != null) {
+ clear = false;
+
+ // We do the unget out of the lock so we don't exit this class while holding a lock.
+ if (!!!update(original, ref, service)) {
+ ctx.ungetService(ref);
+ }
+ }
+ }
+
+ if (clear) {
+ update(original, null, null);
+ }
+ }
+
+ private boolean update(ServiceReference deadRef, ServiceReference newRef, T service)
+ {
+ boolean result = false;
+ int foundLostReplaced = -1;
+
+ synchronized (newRef) {
+ if (open.get()) {
+ result = this.ref.compareAndSet(deadRef, newRef);
+ if (result) {
+ this.service.set(service);
+
+ if (deadRef == null && newRef != null) foundLostReplaced = 0;
+ if (deadRef != null && newRef == null) foundLostReplaced = 1;
+ if (deadRef != null && newRef != null) foundLostReplaced = 2;
+ }
+ }
+ }
+
+ if (serviceListener != null) {
+ if (foundLostReplaced == 0) serviceListener.serviceFound();
+ else if (foundLostReplaced == 1) serviceListener.serviceLost();
+ else if (foundLostReplaced == 2) serviceListener.serviceReplaced();
+ }
+
+ return result;
+ }
+
+ public void close()
+ {
+ if (open.compareAndSet(true, false)) {
+ ctx.removeServiceListener(listener);
+
+ synchronized (this) {
+ ServiceReference deadRef = ref.getAndSet(null);
+ service.set(null);
+ if (deadRef != null) ctx.ungetService(deadRef);
+ }
+ }
+ }
+}
\ No newline at end of file
Added: incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/DefaultWorker.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/DefaultWorker.java?rev=1028928&view=auto
==============================================================================
--- incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/DefaultWorker.java (added)
+++ incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/DefaultWorker.java Fri Oct 29 22:08:20 2010
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.util.internal;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.IdentityHashMap;
+import java.util.Map;
+
+import org.apache.aries.util.BundleToClassLoaderAdapter;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.FrameworkListener;
+import org.osgi.framework.FrameworkUtil;
+
+public class DefaultWorker implements FrameworkUtilWorker, BundleListener, FrameworkListener
+{
+ private Map<Bundle, ClassLoader> classLoaders = new IdentityHashMap<Bundle, ClassLoader>();
+ private static final Bundle myFrameworkBundle = FrameworkUtil.getBundle(DefaultWorker.class).getBundleContext().getBundle(0);
+
+ public ClassLoader getClassLoader(final Bundle b)
+ {
+ ClassLoader cl = get(b);
+
+ if (cl != null) return cl;
+
+ // so first off try to get the real classloader. We can do this by loading a known class
+ // such as the bundle activator. There is no guarantee this will work, so we have a back door too.
+ String activator = (String) b.getHeaders().get(Constants.BUNDLE_ACTIVATOR);
+ if (activator != null) {
+ try {
+ Class<?> clazz = b.loadClass(activator);
+ // so we have the class, but it could have been imported, so we make sure the two bundles
+ // are the same. A reference check should work here because there will be one.
+ Bundle activatorBundle = FrameworkUtil.getBundle(clazz);
+ if (activatorBundle == b) {
+ cl = clazz.getClassLoader();
+ }
+ } catch (ClassNotFoundException e) {
+ }
+ }
+
+ if (cl == null) {
+ // ok so we haven't found a class loader yet, so we need to create a wapper class loader
+ cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return new BundleToClassLoaderAdapter(b);
+ }
+ });
+ }
+
+ if (cl != null) {
+ setupListener(b);
+ cl = put(b, cl);
+ }
+
+ return cl;
+ }
+
+ private void setupListener(Bundle b)
+ {
+ // So we need to cope with multiple equinox frameworks, so we can't just listen to our
+ // BundleContext. Instead we add a listener to Bundle 0 of the framework bundle associated
+ // with the bundle passed in.
+ BundleContext ctx = b.getBundleContext().getBundle(0).getBundleContext();
+ ctx.addBundleListener(this);
+ ctx.addFrameworkListener(this);
+ }
+
+ private synchronized ClassLoader put(Bundle b, ClassLoader cl)
+ {
+ // If the bundle is uninstalled or installed then there is no classloader so we should
+ // just return null. This is a last second sanity check to avoid memory leaks that could
+ // occur if a bundle is uninstalled or unresolved while someone is calling getClassLoader
+ if (b.getState() == Bundle.UNINSTALLED || b.getState() == Bundle.INSTALLED) return null;
+
+ ClassLoader previous = classLoaders.put(b, cl);
+ // OK, so we could cause a replace to occur here, so we want to check to
+ // see if previous is not null. If it is not null we need to do a replace
+ // and return the previous classloader. This ensures we have one classloader
+ // in use for a bundle.
+ if (previous != null) {
+ cl = previous;
+ classLoaders.put(b, cl);
+ }
+
+ return cl;
+ }
+
+ private synchronized ClassLoader get(Bundle b)
+ {
+ return classLoaders.get(b);
+ }
+
+ private synchronized void remove(Bundle bundle)
+ {
+ classLoaders.remove(bundle);
+ }
+
+ public boolean isValid()
+ {
+ return true;
+ }
+
+ public void bundleChanged(BundleEvent event)
+ {
+ if (event.getType() == BundleEvent.UNINSTALLED || event.getType() == BundleEvent.UNRESOLVED) {
+ Bundle b = event.getBundle();
+
+ remove(b);
+
+ if (b.getBundleId() == 0) {
+ clearBundles(b);
+ }
+ }
+ }
+
+ private void clearBundles(Bundle b) {
+ // we have been told about the system bundle, so we need to clear up any state for this framework.
+ BundleContext ctx = b.getBundleContext();
+ ctx.removeBundleListener(this);
+ Bundle[] bundles = ctx.getBundles();
+ for (Bundle bundle : bundles) {
+ remove(bundle);
+ }
+ }
+
+ public void frameworkEvent(FrameworkEvent event)
+ {
+ if (event.getType() == FrameworkEvent.STOPPED) {
+ Bundle b = event.getBundle();
+ if (b == myFrameworkBundle) {
+ classLoaders.clear();
+ } else if (b != null) {
+ clearBundles(b);
+ }
+
+ b.getBundleContext().removeFrameworkListener(this);
+ }
+ }
+}
\ No newline at end of file
Added: incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/EquinoxWorker.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/EquinoxWorker.java?rev=1028928&view=auto
==============================================================================
--- incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/EquinoxWorker.java (added)
+++ incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/EquinoxWorker.java Fri Oct 29 22:08:20 2010
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.util.internal;
+
+import org.eclipse.osgi.framework.adaptor.BundleClassLoader;
+import org.eclipse.osgi.framework.internal.core.BundleHost;
+import org.eclipse.osgi.internal.loader.BundleLoader;
+import org.eclipse.osgi.internal.loader.BundleLoaderProxy;
+import org.osgi.framework.Bundle;
+
+public class EquinoxWorker extends DefaultWorker implements FrameworkUtilWorker {
+
+ public ClassLoader getClassLoader(Bundle b)
+ {
+ BundleHost host = (BundleHost) b;
+ BundleLoaderProxy lp = host.getLoaderProxy();
+ BundleLoader bl = (lp == null) ? null : lp.getBasicBundleLoader();
+ BundleClassLoader cl = (bl == null) ? null : bl.createClassLoader();
+
+ return ((cl instanceof ClassLoader) ? (ClassLoader)cl : null);
+ }
+}
Added: incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/FelixWorker.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/FelixWorker.java?rev=1028928&view=auto
==============================================================================
--- incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/FelixWorker.java (added)
+++ incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/FelixWorker.java Fri Oct 29 22:08:20 2010
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.util.internal;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+
+public final class FelixWorker extends DefaultWorker implements FrameworkUtilWorker
+{
+ private static Method getCurrentModuleMethod;
+ private static Method getClassLoader;
+
+ static {
+ Bundle b = FrameworkUtil.getBundle(FelixWorker.class);
+ try {
+ getCurrentModuleMethod = b.getClass().getDeclaredMethod("getCurrentModule");
+ Object result = getCurrentModuleMethod.invoke(b);
+ getClassLoader = result.getClass().getDeclaredMethod("getClassLoader");
+
+ getCurrentModuleMethod.setAccessible(true);
+ getClassLoader.setAccessible(true);
+ } catch (SecurityException e) {
+ } catch (NoSuchMethodException e) {
+ } catch (IllegalArgumentException e) {
+ } catch (IllegalAccessException e) {
+ } catch (InvocationTargetException e) {
+ }
+ }
+
+ public ClassLoader getClassLoader(Bundle b)
+ {
+ if (getCurrentModuleMethod != null) {
+ try {
+ Object result = getCurrentModuleMethod.invoke(b);
+ if (result != null) {
+ Object cl = getClassLoader.invoke(result);
+
+ if (cl instanceof ClassLoader) return (ClassLoader) cl;
+ }
+ } catch (IllegalArgumentException e) {
+ } catch (IllegalAccessException e) {
+ } catch (InvocationTargetException e) {
+ }
+ }
+ return null;
+ }
+
+ public boolean isValid()
+ {
+ return getCurrentModuleMethod != null && getClassLoader != null;
+ }
+}
Added: incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/FrameworkUtilWorker.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/FrameworkUtilWorker.java?rev=1028928&view=auto
==============================================================================
--- incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/FrameworkUtilWorker.java (added)
+++ incubator/aries/trunk/util/src/main/java/org/apache/aries/util/internal/FrameworkUtilWorker.java Fri Oct 29 22:08:20 2010
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.util.internal;
+
+import org.osgi.framework.Bundle;
+
+public interface FrameworkUtilWorker {
+
+ ClassLoader getClassLoader(Bundle b);
+
+ boolean isValid();
+
+}