{
if (m_state == Bundle.ACTIVE)
{
return;
}
throw new BundleException("Bundle is in wrong state for start");
}
try
{
m_state = Bundle.STARTING;
m_context = new PojoSRBundleContext(this, m_reg, m_dispatcher,
m_bundles, m_config);
m_dispatcher.fireBundleEvent(new BundleEvent(BundleEvent.STARTING,
this));
if (m_activatorClass != null)
{
m_activator = (BundleActivator) m_loader.loadClass(
m_activatorClass).newInstance();
m_activator.start(m_context);
}
m_state = Bundle.ACTIVE;
m_dispatcher.fireBundleEvent(new BundleEvent(BundleEvent.STARTED,
this));
}
catch (Throwable ex)
{
m_state = Bundle.RESOLVED;
m_activator = null;
m_dispatcher.fireBundleEvent(new BundleEvent(BundleEvent.STOPPED,
this));
throw new BundleException("Unable to start bundle", ex);
}
}