}
m_state = Bundle.ACTIVE;
m_dispatcher.fireBundleEvent(new BundleEvent(BundleEvent.STARTED,
this));
m_dispatcher.fireFrameworkEvent(new FrameworkEvent(FrameworkEvent.STARTED, this, null));
super.start();
};
@Override
public synchronized void stop() throws BundleException
{
if ((m_state == Bundle.STOPPING) || m_state == Bundle.RESOLVED) {
return;
}
else if (m_state != Bundle.ACTIVE) {
throw new BundleException("Can't stop pojosr because it is not ACTIVE");
}
final Bundle systemBundle = this;
Runnable r = new Runnable() {
public void run() {
m_dispatcher.fireBundleEvent(new BundleEvent(BundleEvent.STOPPING,
systemBundle));
for (Bundle b : m_bundles.values())
{
try
{
if (b != systemBundle)
{
b.stop();
}
}
catch (Throwable t)
{
t.printStackTrace();
}
}
m_dispatcher.fireBundleEvent(new BundleEvent(BundleEvent.STOPPED,
systemBundle));
m_state = Bundle.RESOLVED;
m_dispatcher.stopDispatching();
}
};
m_state = Bundle.STOPPING;
if ("true".equalsIgnoreCase(System.getProperty("org.apache.felix.connect.events.sync"))) {
r.run();
}
else {
new Thread(r).start();
}
}
};
m_symbolicNameToBundle.put(b.getSymbolicName(), b);
b.start();
b.getBundleContext().registerService(StartLevel.class.getName(),
new StartLevel()
{
public void setStartLevel(int startlevel)
{
// TODO Auto-generated method stub
}
public void setInitialBundleStartLevel(int startlevel)
{
// TODO Auto-generated method stub
}
public void setBundleStartLevel(Bundle bundle,
int startlevel)
{
// TODO Auto-generated method stub
}
public boolean isBundlePersistentlyStarted(Bundle bundle)
{
// TODO Auto-generated method stub
return true;
}
public boolean isBundleActivationPolicyUsed(Bundle bundle)
{
// TODO Auto-generated method stub
return false;
}
public int getStartLevel()
{
// TODO Auto-generated method stub
return 1;
}
public int getInitialBundleStartLevel()
{
// TODO Auto-generated method stub
return 1;
}
public int getBundleStartLevel(Bundle bundle)
{
// TODO Auto-generated method stub
return 1;
}
}, null);
b.getBundleContext().registerService(PackageAdmin.class.getName(),
new PackageAdmin()
{
public boolean resolveBundles(Bundle[] bundles)
{
// TODO Auto-generated method stub
return true;
}
public void refreshPackages(Bundle[] bundles)
{
m_dispatcher.fireFrameworkEvent(new FrameworkEvent(
FrameworkEvent.PACKAGES_REFRESHED, b, null));
}
public RequiredBundle[] getRequiredBundles(
String symbolicName)