Class 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 ComponentRegistry componentRegistry  
      private org.osgi.framework.BundleContext context  
      private java.lang.ref.SoftReference<java.util.concurrent.ConcurrentHashMap<java.lang.Long,​org.osgi.framework.dto.ServiceReferenceDTO[]>> dtoCache  
      private static java.lang.String[] EMPTY  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void bundleChanged​(org.osgi.framework.BundleEvent event)  
      private org.osgi.framework.dto.BundleDTO bundleToDTO​(org.osgi.framework.BundleContext bundleContext)  
      (package private) boolean checkType​(java.lang.Class<?> type)  
      (package private) java.lang.Object convert​(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.ComponentDescriptionDTO getComponentDescriptionDTO​(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 holder
      private org.osgi.service.component.runtime.dto.ComponentDescriptionDTO holderToDescription​(ComponentHolder<?> holder)  
      boolean isComponentEnabled​(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO description)  
      private org.osgi.service.component.runtime.dto.ComponentConfigurationDTO managerToConfiguration​(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)  
      void serviceChanged​(org.osgi.framework.ServiceEvent event)  
      private org.osgi.framework.dto.ServiceReferenceDTO serviceReferenceToDTO​(org.osgi.framework.ServiceReference<?> serviceRef)  
      private org.osgi.service.component.runtime.dto.UnsatisfiedReferenceDTO[] unsatisfiedRefManagersToDTO​(java.util.List<? extends ReferenceManager<?,​?>> referenceManagers)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EMPTY

        private static final java.lang.String[] EMPTY
      • context

        private final org.osgi.framework.BundleContext context
      • 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:
        getComponentDescriptionDTOs in interface org.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:
        getComponentDescriptionDTO in interface org.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:
        getComponentConfigurationDTOs in interface org.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:
        isComponentEnabled in interface org.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:
        enableComponent in interface org.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:
        disableComponent in interface org.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:
        bundleChanged in interface org.osgi.framework.BundleListener
      • serviceChanged

        public void serviceChanged​(org.osgi.framework.ServiceEvent event)
        Specified by:
        serviceChanged in interface org.osgi.framework.ServiceListener