1 package com.atlassian.plugin.osgi.hostcomponents.impl;
2
3 import org.osgi.framework.Bundle;
4
5 /**
6 * A store for the current bundle invoking a host component.
7 * <p/>
8 * This should _not_ be used directly. {@link com.atlassian.plugin.osgi.hostcomponents.CallingBundleAccessor} should
9 * be used instead
10 *
11 * @see com.atlassian.plugin.osgi.hostcomponents.CallingBundleAccessor
12 */
13 public class CallingBundleStore
14 {
15
16 private static final ThreadLocal<Bundle> callingBundle = new ThreadLocal<Bundle>();
17
18 public static Bundle get()
19 {
20 return callingBundle.get();
21 }
22
23 static void set(Bundle bundle)
24 {
25 if (bundle == null)
26 {
27 callingBundle.remove();
28 }
29 else
30 {
31 callingBundle.set(bundle);
32 }
33 }
34
35 }