1 package com.atlassian.plugin.osgi.container;
2
3 import org.osgi.framework.Bundle;
4 import org.osgi.framework.ServiceReference;
5 import org.twdata.pkgscanner.ExportPackage;
6
7 import java.io.File;
8 import java.util.Collection;
9 import java.util.List;
10
11 import com.atlassian.plugin.osgi.hostcomponents.HostComponentProvider;
12 import com.atlassian.plugin.osgi.hostcomponents.HostComponentRegistration;
13
14 /**
15 * Manages the OSGi container and handles any interactions with it
16 */
17 public interface OsgiContainerManager
18 {
19 /**
20 * Starts the OSGi container
21 *
22 * @param provider The host component provider to use when registering host services
23 * @throws OsgiContainerException If the container cannot be started
24 */
25 void start(HostComponentProvider provider) throws OsgiContainerException;
26
27 /**
28 * Stops the OSGi container
29 *
30 * @throws OsgiContainerException If the container cannot be stopped
31 */
32 void stop() throws OsgiContainerException;
33
34 /**
35 * Installs a bundle into a running OSGI container
36 * @param file The bundle file to install
37 * @return The created bundle
38 * @throws OsgiContainerException If the bundle cannot be loaded
39 */
40 Bundle installBundle(File file) throws OsgiContainerException;
41
42 /**
43 * Reloads all host components used
44 * @param provider The host component provider to use when registering host services
45 */
46 void reloadHostComponents(HostComponentProvider provider);
47
48 /**
49 * @return If the container is running or not
50 */
51 boolean isRunning();
52
53 /**
54 * Gets a list of installed bundles
55 *
56 * @return An array of bundles
57 */
58 Bundle[] getBundles();
59
60 /**
61 * Gets a list of service references
62 * @return An array of service references
63 */
64 ServiceReference[] getRegisteredServices();
65
66 /**
67 * Gets a list of host component registrations
68 *
69 * @return A list of host component registrations
70 */
71 List<HostComponentRegistration> getHostComponentRegistrations();
72 }