Class ComponentCommands

  • All Implemented Interfaces:
    org.osgi.util.tracker.ServiceTrackerCustomizer<java.lang.Object,​org.osgi.framework.ServiceRegistration<?>>

    public class ComponentCommands
    extends java.lang.Object
    implements org.osgi.util.tracker.ServiceTrackerCustomizer<java.lang.Object,​org.osgi.framework.ServiceRegistration<?>>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.osgi.framework.ServiceRegistration<ComponentCommands> commandsReg  
      private java.util.Comparator<org.osgi.service.component.runtime.dto.ComponentConfigurationDTO> configDtoComparator  
      private org.osgi.framework.BundleContext context  
      private org.osgi.util.tracker.ServiceTracker<java.lang.Object,​org.osgi.framework.ServiceRegistration<?>> gogoRuntimeTracker  
      private static java.lang.String INDENT_1  
      private static java.lang.String INDENT_2  
      private org.osgi.service.component.runtime.ServiceComponentRuntime scr  
      private ScrConfiguration scrConfig  
      private org.osgi.framework.ServiceRegistration<ScrInfo> scrInfoReg  
      private java.util.Comparator<org.osgi.framework.dto.ServiceReferenceDTO> serviceRefDtoComparator  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ComponentCommands​(org.osgi.framework.BundleContext context, org.osgi.service.component.runtime.ServiceComponentRuntime scr, ScrConfiguration scrConfig)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.osgi.framework.ServiceRegistration<?> addingService​(org.osgi.framework.ServiceReference<java.lang.Object> reference)  
      private java.lang.String arrayToString​(java.lang.String[] array)  
      java.lang.String config()  
      java.lang.Object convert​(java.lang.Class<?> desiredType, java.lang.Object in)  
      private java.lang.Object createConverter​(org.osgi.framework.Bundle bundle)  
      boolean disable​(java.lang.String name)  
      boolean enable​(java.lang.String name)  
      private java.util.List<org.osgi.service.component.runtime.dto.ComponentDescriptionDTO> findComponents​(java.lang.String name)  
      java.lang.CharSequence format​(java.lang.Object target, int level)  
      (package private) java.lang.CharSequence format​(org.osgi.service.component.runtime.dto.ComponentConfigurationDTO dto, int level)  
      (package private) java.lang.CharSequence format​(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO[] dtoArray, int level)  
      (package private) java.lang.CharSequence format​(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO dto, int level)  
      private static java.lang.String[] getStringArray​(java.util.Map<java.lang.String,​?> map, java.lang.String name, java.lang.String[] defaultValue)  
      org.osgi.service.component.runtime.dto.ComponentConfigurationDTO info​(long id)  
      org.osgi.service.component.runtime.dto.ComponentDescriptionDTO info​(java.lang.String name)  
      org.osgi.service.component.runtime.dto.ComponentDescriptionDTO[] list()  
      org.osgi.service.component.runtime.dto.ComponentDescriptionDTO[] list​(long bundleId)  
      void modifiedService​(org.osgi.framework.ServiceReference<java.lang.Object> reference, org.osgi.framework.ServiceRegistration<?> reg)  
      (package private) static void printColumnsAligned​(java.lang.String title, java.util.Map<java.lang.String,​java.lang.String> properties, char underlineChar, java.lang.StringBuilder builder)  
      (package private) void printComponentDescriptionAndConfigs​(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO descDto, org.osgi.service.component.runtime.dto.ComponentConfigurationDTO[] configs, java.lang.StringBuilder builder)  
      (package private) static java.lang.String printProperties​(java.util.Map<java.lang.String,​?> props, java.lang.String indent)  
      (package private) java.lang.String printPublishedServices​(org.osgi.framework.ServiceReference<?>[] serviceRefs)  
      (package private) void printServiceReference​(org.osgi.service.component.runtime.dto.ReferenceDTO reference, java.lang.String state, org.osgi.framework.dto.ServiceReferenceDTO[] bindings, java.lang.StringBuilder builder)  
      (package private) java.lang.String printServiceReferences​(org.osgi.service.component.runtime.dto.SatisfiedReferenceDTO[] satisfiedReferences, org.osgi.service.component.runtime.dto.UnsatisfiedReferenceDTO[] unsatisfiedReferences, org.osgi.service.component.runtime.dto.ReferenceDTO[] references)  
      (package private) void register()  
      void removedService​(org.osgi.framework.ServiceReference<java.lang.Object> reference, org.osgi.framework.ServiceRegistration<?> reg)  
      private void safeUnregister​(org.osgi.framework.ServiceRegistration<?> registration)  
      (package private) static java.lang.String stateToString​(int state)  
      (package private) void unregister()  
      void updateProvideScrInfoService​(boolean register)  
      • Methods inherited from class java.lang.Object

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

      • context

        private final org.osgi.framework.BundleContext context
      • scr

        private final org.osgi.service.component.runtime.ServiceComponentRuntime scr
      • gogoRuntimeTracker

        private final org.osgi.util.tracker.ServiceTracker<java.lang.Object,​org.osgi.framework.ServiceRegistration<?>> gogoRuntimeTracker
      • configDtoComparator

        private final java.util.Comparator<org.osgi.service.component.runtime.dto.ComponentConfigurationDTO> configDtoComparator
      • serviceRefDtoComparator

        private final java.util.Comparator<org.osgi.framework.dto.ServiceReferenceDTO> serviceRefDtoComparator
      • commandsReg

        private org.osgi.framework.ServiceRegistration<ComponentCommands> commandsReg
      • scrInfoReg

        private org.osgi.framework.ServiceRegistration<ScrInfo> scrInfoReg
    • Constructor Detail

      • ComponentCommands

        protected ComponentCommands​(org.osgi.framework.BundleContext context,
                                    org.osgi.service.component.runtime.ServiceComponentRuntime scr,
                                    ScrConfiguration scrConfig)
    • Method Detail

      • register

        void register()
      • unregister

        void unregister()
      • updateProvideScrInfoService

        public void updateProvideScrInfoService​(boolean register)
      • list

        public org.osgi.service.component.runtime.dto.ComponentDescriptionDTO[] list()
      • list

        public org.osgi.service.component.runtime.dto.ComponentDescriptionDTO[] list​(long bundleId)
      • findComponents

        private java.util.List<org.osgi.service.component.runtime.dto.ComponentDescriptionDTO> findComponents​(java.lang.String name)
      • info

        public org.osgi.service.component.runtime.dto.ComponentDescriptionDTO info​(java.lang.String name)
      • info

        public org.osgi.service.component.runtime.dto.ComponentConfigurationDTO info​(long id)
      • enable

        public boolean enable​(java.lang.String name)
      • disable

        public boolean disable​(java.lang.String name)
      • config

        public java.lang.String config()
      • convert

        public java.lang.Object convert​(java.lang.Class<?> desiredType,
                                        java.lang.Object in)
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • format

        public java.lang.CharSequence format​(java.lang.Object target,
                                             int level)
                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • format

        java.lang.CharSequence format​(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO[] dtoArray,
                                      int level)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • format

        java.lang.CharSequence format​(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO dto,
                                      int level)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • format

        java.lang.CharSequence format​(org.osgi.service.component.runtime.dto.ComponentConfigurationDTO dto,
                                      int level)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • printComponentDescriptionAndConfigs

        void printComponentDescriptionAndConfigs​(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO descDto,
                                                 org.osgi.service.component.runtime.dto.ComponentConfigurationDTO[] configs,
                                                 java.lang.StringBuilder builder)
      • printPublishedServices

        java.lang.String printPublishedServices​(org.osgi.framework.ServiceReference<?>[] serviceRefs)
      • arrayToString

        private java.lang.String arrayToString​(java.lang.String[] array)
      • stateToString

        static final java.lang.String stateToString​(int state)
      • printProperties

        static java.lang.String printProperties​(java.util.Map<java.lang.String,​?> props,
                                                java.lang.String indent)
      • printServiceReferences

        java.lang.String printServiceReferences​(org.osgi.service.component.runtime.dto.SatisfiedReferenceDTO[] satisfiedReferences,
                                                org.osgi.service.component.runtime.dto.UnsatisfiedReferenceDTO[] unsatisfiedReferences,
                                                org.osgi.service.component.runtime.dto.ReferenceDTO[] references)
      • printServiceReference

        void printServiceReference​(org.osgi.service.component.runtime.dto.ReferenceDTO reference,
                                   java.lang.String state,
                                   org.osgi.framework.dto.ServiceReferenceDTO[] bindings,
                                   java.lang.StringBuilder builder)
      • printColumnsAligned

        static void printColumnsAligned​(java.lang.String title,
                                        java.util.Map<java.lang.String,​java.lang.String> properties,
                                        char underlineChar,
                                        java.lang.StringBuilder builder)
      • getStringArray

        private static java.lang.String[] getStringArray​(java.util.Map<java.lang.String,​?> map,
                                                         java.lang.String name,
                                                         java.lang.String[] defaultValue)
                                                  throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • safeUnregister

        private void safeUnregister​(org.osgi.framework.ServiceRegistration<?> registration)
      • addingService

        public org.osgi.framework.ServiceRegistration<?> addingService​(org.osgi.framework.ServiceReference<java.lang.Object> reference)
        Specified by:
        addingService in interface org.osgi.util.tracker.ServiceTrackerCustomizer<java.lang.Object,​org.osgi.framework.ServiceRegistration<?>>
      • createConverter

        private java.lang.Object createConverter​(org.osgi.framework.Bundle bundle)
      • modifiedService

        public void modifiedService​(org.osgi.framework.ServiceReference<java.lang.Object> reference,
                                    org.osgi.framework.ServiceRegistration<?> reg)
        Specified by:
        modifiedService in interface org.osgi.util.tracker.ServiceTrackerCustomizer<java.lang.Object,​org.osgi.framework.ServiceRegistration<?>>
      • removedService

        public void removedService​(org.osgi.framework.ServiceReference<java.lang.Object> reference,
                                   org.osgi.framework.ServiceRegistration<?> reg)
        Specified by:
        removedService in interface org.osgi.util.tracker.ServiceTrackerCustomizer<java.lang.Object,​org.osgi.framework.ServiceRegistration<?>>