1 package com.atlassian.plugin.osgi.factory;
2
3 import com.atlassian.plugin.IllegalPluginStateException;
4 import com.atlassian.plugin.Plugin;
5 import org.osgi.framework.Bundle;
6
7 /**
8 * Interface for plugins backed by OSGi {@link Bundle}
9 * <p>
10 * There are a few implementations of {@link Plugin} interface that are backed by OSGi bundles,
11 * to identify a such implementations all of them should implement current interface
12 */
13 public interface OsgiBackedPlugin extends Plugin {
14 /**
15 * Returns <code>OSGi Bundle</code> that corresponds to the current plugin
16 * <p>
17 * Note that <code>Bundle</code> could be not available on some of {@code Plugin} lifecycle
18 * stages. In that case method call results in {@code IllegalPluginStateException}
19 *
20 * @return <code>OSGi</code> representation of the current plugin
21 * @throws IllegalPluginStateException if plugin has no <code>OSGi</code> representation yet
22 */
23 public Bundle getBundle() throws IllegalPluginStateException;
24 }