Class ServiceComponentRuntimeImpl
- java.lang.Object
-
- org.apache.felix.scr.impl.runtime.ServiceComponentRuntimeImpl
-
- All Implemented Interfaces:
java.util.EventListener,org.osgi.framework.BundleListener,org.osgi.framework.ServiceListener,org.osgi.service.component.runtime.ServiceComponentRuntime
public class ServiceComponentRuntimeImpl extends java.lang.Object implements org.osgi.service.component.runtime.ServiceComponentRuntime, org.osgi.framework.ServiceListener, org.osgi.framework.BundleListener
-
-
Field Summary
Fields Modifier and Type Field Description private ComponentRegistrycomponentRegistryprivate org.osgi.framework.BundleContextcontextprivate java.lang.ref.SoftReference<java.util.concurrent.ConcurrentHashMap<java.lang.Long,org.osgi.framework.dto.ServiceReferenceDTO[]>>dtoCacheprivate static java.lang.String[]EMPTY
-
Constructor Summary
Constructors Constructor Description ServiceComponentRuntimeImpl(org.osgi.framework.BundleContext context, ComponentRegistry componentRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbundleChanged(org.osgi.framework.BundleEvent event)private org.osgi.framework.dto.BundleDTObundleToDTO(org.osgi.framework.BundleContext bundleContext)(package private) booleancheckType(java.lang.Class<?> type)(package private) java.lang.Objectconvert(java.lang.Object source)private java.util.Map<java.lang.String,java.lang.Object>deepCopy(java.util.Map<java.lang.String,java.lang.Object> source)org.osgi.util.promise.Promise<java.lang.Void>disableComponent(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO description)org.osgi.util.promise.Promise<java.lang.Void>enableComponent(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO description)java.util.Collection<org.osgi.service.component.runtime.dto.ComponentConfigurationDTO>getComponentConfigurationDTOs(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO description)org.osgi.service.component.runtime.dto.ComponentDescriptionDTOgetComponentDescriptionDTO(org.osgi.framework.Bundle bundle, java.lang.String name)java.util.Collection<org.osgi.service.component.runtime.dto.ComponentDescriptionDTO>getComponentDescriptionDTOs(org.osgi.framework.Bundle... bundles)private ComponentHolder<?>getHolderFromDescription(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO description)Return the component holderprivate org.osgi.service.component.runtime.dto.ComponentDescriptionDTOholderToDescription(ComponentHolder<?> holder)booleanisComponentEnabled(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO description)private org.osgi.service.component.runtime.dto.ComponentConfigurationDTOmanagerToConfiguration(ComponentManager<?> manager, org.osgi.service.component.runtime.dto.ComponentDescriptionDTO description)private org.osgi.service.component.runtime.dto.ReferenceDTO[]refsToDTO(java.util.List<ReferenceMetadata> dependencies)private org.osgi.service.component.runtime.dto.SatisfiedReferenceDTO[]satisfiedRefManagersToDTO(java.util.List<? extends ReferenceManager<?,?>> referenceManagers)voidserviceChanged(org.osgi.framework.ServiceEvent event)private org.osgi.framework.dto.ServiceReferenceDTOserviceReferenceToDTO(org.osgi.framework.ServiceReference<?> serviceRef)private org.osgi.service.component.runtime.dto.UnsatisfiedReferenceDTO[]unsatisfiedRefManagersToDTO(java.util.List<? extends ReferenceManager<?,?>> referenceManagers)
-
-
-
Field Detail
-
EMPTY
private static final java.lang.String[] EMPTY
-
context
private final org.osgi.framework.BundleContext context
-
componentRegistry
private final ComponentRegistry componentRegistry
-
dtoCache
private volatile java.lang.ref.SoftReference<java.util.concurrent.ConcurrentHashMap<java.lang.Long,org.osgi.framework.dto.ServiceReferenceDTO[]>> dtoCache
-
-
Constructor Detail
-
ServiceComponentRuntimeImpl
public ServiceComponentRuntimeImpl(org.osgi.framework.BundleContext context, ComponentRegistry componentRegistry)
-
-
Method Detail
-
getComponentDescriptionDTOs
public java.util.Collection<org.osgi.service.component.runtime.dto.ComponentDescriptionDTO> getComponentDescriptionDTOs(org.osgi.framework.Bundle... bundles)
- Specified by:
getComponentDescriptionDTOsin interfaceorg.osgi.service.component.runtime.ServiceComponentRuntime- See Also:
ServiceComponentRuntime.getComponentDescriptionDTOs(org.osgi.framework.Bundle[])
-
getComponentDescriptionDTO
public org.osgi.service.component.runtime.dto.ComponentDescriptionDTO getComponentDescriptionDTO(org.osgi.framework.Bundle bundle, java.lang.String name)- Specified by:
getComponentDescriptionDTOin interfaceorg.osgi.service.component.runtime.ServiceComponentRuntime- See Also:
ServiceComponentRuntime.getComponentDescriptionDTO(org.osgi.framework.Bundle, java.lang.String)
-
getComponentConfigurationDTOs
public java.util.Collection<org.osgi.service.component.runtime.dto.ComponentConfigurationDTO> getComponentConfigurationDTOs(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO description)
- Specified by:
getComponentConfigurationDTOsin interfaceorg.osgi.service.component.runtime.ServiceComponentRuntime- See Also:
ServiceComponentRuntime.getComponentConfigurationDTOs(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO)
-
isComponentEnabled
public boolean isComponentEnabled(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO description)
- Specified by:
isComponentEnabledin interfaceorg.osgi.service.component.runtime.ServiceComponentRuntime- See Also:
ServiceComponentRuntime.isComponentEnabled(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO)
-
enableComponent
public org.osgi.util.promise.Promise<java.lang.Void> enableComponent(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO description)
- Specified by:
enableComponentin interfaceorg.osgi.service.component.runtime.ServiceComponentRuntime- See Also:
ServiceComponentRuntime.enableComponent(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO)
-
disableComponent
public org.osgi.util.promise.Promise<java.lang.Void> disableComponent(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO description)
- Specified by:
disableComponentin interfaceorg.osgi.service.component.runtime.ServiceComponentRuntime- See Also:
ServiceComponentRuntime.disableComponent(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO)
-
managerToConfiguration
private org.osgi.service.component.runtime.dto.ComponentConfigurationDTO managerToConfiguration(ComponentManager<?> manager, org.osgi.service.component.runtime.dto.ComponentDescriptionDTO description)
-
satisfiedRefManagersToDTO
private org.osgi.service.component.runtime.dto.SatisfiedReferenceDTO[] satisfiedRefManagersToDTO(java.util.List<? extends ReferenceManager<?,?>> referenceManagers)
-
unsatisfiedRefManagersToDTO
private org.osgi.service.component.runtime.dto.UnsatisfiedReferenceDTO[] unsatisfiedRefManagersToDTO(java.util.List<? extends ReferenceManager<?,?>> referenceManagers)
-
serviceReferenceToDTO
private org.osgi.framework.dto.ServiceReferenceDTO serviceReferenceToDTO(org.osgi.framework.ServiceReference<?> serviceRef)
-
getHolderFromDescription
private ComponentHolder<?> getHolderFromDescription(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO description)
Return the component holder- Parameters:
description- Component description DTO- Returns:
- The component holder
- Throws:
java.lang.IllegalStateException- If the bundle is not active anymore
-
holderToDescription
private org.osgi.service.component.runtime.dto.ComponentDescriptionDTO holderToDescription(ComponentHolder<?> holder)
-
deepCopy
private java.util.Map<java.lang.String,java.lang.Object> deepCopy(java.util.Map<java.lang.String,java.lang.Object> source)
-
convert
java.lang.Object convert(java.lang.Object source)
-
checkType
boolean checkType(java.lang.Class<?> type)
-
refsToDTO
private org.osgi.service.component.runtime.dto.ReferenceDTO[] refsToDTO(java.util.List<ReferenceMetadata> dependencies)
-
bundleToDTO
private org.osgi.framework.dto.BundleDTO bundleToDTO(org.osgi.framework.BundleContext bundleContext)
-
bundleChanged
public void bundleChanged(org.osgi.framework.BundleEvent event)
- Specified by:
bundleChangedin interfaceorg.osgi.framework.BundleListener
-
serviceChanged
public void serviceChanged(org.osgi.framework.ServiceEvent event)
- Specified by:
serviceChangedin interfaceorg.osgi.framework.ServiceListener
-
-