Package org.apache.felix.scr.impl
Class Activator
- java.lang.Object
-
- org.apache.felix.scr.impl.AbstractExtender
-
- org.apache.felix.scr.impl.Activator
-
- All Implemented Interfaces:
java.util.EventListener,org.osgi.framework.BundleActivator,org.osgi.framework.BundleListener,org.osgi.framework.SynchronousBundleListener,org.osgi.util.tracker.BundleTrackerCustomizer<org.osgi.framework.Bundle>
public class Activator extends AbstractExtender
This activator is used to cover requirement described in section 112.8.1 @@ -27,14 37,202 @@ in active bundles.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classActivator.ScrExtension
-
Field Summary
Fields Modifier and Type Field Description private ScrLoggerloggerprivate org.osgi.framework.Bundlem_bundleprivate ComponentActorThreadm_componentActorprivate java.util.Map<java.lang.Long,BundleComponentActivator>m_componentBundlesprivate ComponentCommandsm_componentCommandsprivate java.util.concurrent.ConcurrentMap<java.lang.Long,java.util.List<ComponentMetadata>>m_componentMetadataStoreprivate ComponentRegistrym_componentRegistryprivate ScrConfigurationImplm_configurationprivate org.osgi.framework.BundleContextm_contextprivate org.osgi.framework.BundleContextm_globalContextprivate org.osgi.framework.ServiceRegistration<org.osgi.service.component.runtime.ServiceComponentRuntime>m_runtime_reg
-
Constructor Summary
Constructors Constructor Description Activator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbundleChanged(org.osgi.framework.BundleEvent event)protected voiddebug(org.osgi.framework.Bundle bundle, java.lang.String msg)private voiddisposeComponents(org.osgi.framework.Bundle bundle)Unloads components of the given bundle.protected Activator.ScrExtensiondoCreateExtension(org.osgi.framework.Bundle bundle)Create the extension for the given bundle, or null if the bundle is not to be extended.protected voiddoStart()voiddoStop()Unregisters this instance as a bundle listener and unloads all components which have been registered during the active life time of the SCR implementation bundle.private static java.util.concurrent.ConcurrentMap<java.lang.Long,java.util.List<ComponentMetadata>>load(org.osgi.framework.BundleContext context, ScrLogger logger, boolean loadFromCache)private voidloadComponents(org.osgi.framework.Bundle bundle)Loads the components of the given bundle.voidrestart(boolean globalExtender)voidsetLogger()voidstart(org.osgi.framework.BundleContext context)Registers this instance as a (synchronous) bundle listener and loads the components of already registered bundles.voidstop(org.osgi.framework.BundleContext context)private static voidstore(java.util.Map<java.lang.Long,java.util.List<ComponentMetadata>> componentsMap, org.osgi.framework.BundleContext context, ScrLogger logger, boolean storeCache)protected voidwarn(org.osgi.framework.Bundle bundle, java.lang.String msg, java.lang.Throwable t)-
Methods inherited from class org.apache.felix.scr.impl.AbstractExtender
addingBundle, chooseBundlesToDestroy, createExecutor, getBundleContext, isStopping, modifiedBundle, removedBundle, startTracking, stopTracking
-
-
-
-
Field Detail
-
m_configuration
private final ScrConfigurationImpl m_configuration
-
m_context
private org.osgi.framework.BundleContext m_context
-
m_globalContext
private org.osgi.framework.BundleContext m_globalContext
-
m_bundle
private org.osgi.framework.Bundle m_bundle
-
logger
private volatile ScrLogger logger
-
m_componentBundles
private java.util.Map<java.lang.Long,BundleComponentActivator> m_componentBundles
-
m_componentRegistry
private ComponentRegistry m_componentRegistry
-
m_componentActor
private ComponentActorThread m_componentActor
-
m_runtime_reg
private org.osgi.framework.ServiceRegistration<org.osgi.service.component.runtime.ServiceComponentRuntime> m_runtime_reg
-
m_componentCommands
private ComponentCommands m_componentCommands
-
m_componentMetadataStore
private java.util.concurrent.ConcurrentMap<java.lang.Long,java.util.List<ComponentMetadata>> m_componentMetadataStore
-
-
Method Detail
-
start
public void start(org.osgi.framework.BundleContext context) throws java.lang.ExceptionRegisters this instance as a (synchronous) bundle listener and loads the components of already registered bundles.- Specified by:
startin interfaceorg.osgi.framework.BundleActivator- Overrides:
startin classAbstractExtender- Parameters:
context- TheBundleContextof the SCR implementation bundle.- Throws:
java.lang.Exception
-
restart
public void restart(boolean globalExtender)
-
doStart
protected void doStart() throws java.lang.Exception- Overrides:
doStartin classAbstractExtender- Throws:
java.lang.Exception
-
stop
public void stop(org.osgi.framework.BundleContext context) throws java.lang.Exception- Specified by:
stopin interfaceorg.osgi.framework.BundleActivator- Overrides:
stopin classAbstractExtender- Throws:
java.lang.Exception
-
bundleChanged
public void bundleChanged(org.osgi.framework.BundleEvent event)
- Specified by:
bundleChangedin interfaceorg.osgi.framework.BundleListener- Overrides:
bundleChangedin classAbstractExtender
-
load
private static java.util.concurrent.ConcurrentMap<java.lang.Long,java.util.List<ComponentMetadata>> load(org.osgi.framework.BundleContext context, ScrLogger logger, boolean loadFromCache)
-
store
private static void store(java.util.Map<java.lang.Long,java.util.List<ComponentMetadata>> componentsMap, org.osgi.framework.BundleContext context, ScrLogger logger, boolean storeCache)
-
doStop
public void doStop() throws java.lang.ExceptionUnregisters this instance as a bundle listener and unloads all components which have been registered during the active life time of the SCR implementation bundle.- Overrides:
doStopin classAbstractExtender- Throws:
java.lang.Exception
-
doCreateExtension
protected Activator.ScrExtension doCreateExtension(org.osgi.framework.Bundle bundle) throws java.lang.Exception
Description copied from class:AbstractExtenderCreate the extension for the given bundle, or null if the bundle is not to be extended.- Specified by:
doCreateExtensionin classAbstractExtender- Parameters:
bundle- the bundle to extend- Returns:
- The extension
- Throws:
java.lang.Exception- If something goes wrong
-
loadComponents
private void loadComponents(org.osgi.framework.Bundle bundle)
Loads the components of the given bundle. If the bundle has no Service-Component header, this method has no effect. The fragments of a bundle are not checked for the header (112.4.1).This method calls the
Bundle.getBundleContext()method to find theBundleContextof the bundle. If the context cannot be found, this method does not load components for the bundle.
-
disposeComponents
private void disposeComponents(org.osgi.framework.Bundle bundle)
Unloads components of the given bundle. If no components have been loaded for the bundle, this method has no effect.
-
debug
protected void debug(org.osgi.framework.Bundle bundle, java.lang.String msg)- Specified by:
debugin classAbstractExtender
-
warn
protected void warn(org.osgi.framework.Bundle bundle, java.lang.String msg, java.lang.Throwable t)- Specified by:
warnin classAbstractExtender
-
setLogger
public void setLogger()
-
-