Interface ComponentManager

    • Field Detail

      • SINGLETON_SERVICE_PID

        static final java.lang.String SINGLETON_SERVICE_PID
        See Also:
        Constant Field Values
      • SINGLETON_COMPONENT_ID

        static final java.lang.String SINGLETON_COMPONENT_ID
        See Also:
        Constant Field Values
    • Method Detail

      • getClock

        java.time.Clock getClock()
        Gets the OpenEMS Clock - either the real system clock or a mocked clock for simulations.
        Specified by:
        getClock in interface ClockProvider
        Returns:
        the Clock
      • getEnabledComponents

        java.util.List<OpenemsComponent> getEnabledComponents()
        Gets all enabled OpenEMS-Components.

        Be aware that via this method usage of the Component service is not tracked by the bundle's use count (See BundleContext.getService(org.osgi.framework.ServiceReference)). Make sure to use the references as shortly as possible.

        Returns:
        a List of OpenEMS-Components
        Throws:
        java.lang.IllegalArgumentException - if the Component was not found
      • getEnabledComponentsOfType

        <T extends OpenemsComponent> java.util.List<T> getEnabledComponentsOfType​(java.lang.Class<T> clazz)
        Gets all enabled OpenEMS-Components of the given Type.

        Be aware that via this method usage of the Component service is not tracked by the bundle's use count (See BundleContext.getService(org.osgi.framework.ServiceReference)). Make sure to use the references as shortly as possible.

        Type Parameters:
        T - the given Type, subclass of OpenemsComponent
        Parameters:
        clazz - the given Type, subclass of OpenemsComponent
        Returns:
        a List of OpenEMS-Components
      • getAllComponents

        java.util.List<OpenemsComponent> getAllComponents()
        Gets all OpenEMS-Components.

        Be aware that via this method usage of the Component service is not tracked by the bundle's use count (See BundleContext.getService(org.osgi.framework.ServiceReference)). Make sure to use the references as shortly as possible.

        Returns:
        a List of OpenEMS-Components
        Throws:
        java.lang.IllegalArgumentException - if the Component was not found
      • getComponent

        <T extends OpenemsComponent> T getComponent​(java.lang.String componentId)
                                             throws OpenemsError.OpenemsNamedException
        Gets a OpenEMS-Component by its Component-ID. The Component is guaranteed to be enabled.

        Be aware that via this method usage of the Component service is not tracked by the bundle's use count (See BundleContext.getService(org.osgi.framework.ServiceReference)). Make sure to use the references as shortly as possible.

        Type Parameters:
        T - the typed Component
        Parameters:
        componentId - the Component-ID (e.g. "_sum")
        Returns:
        the OpenEMS-Component
        Throws:
        OpenemsError.OpenemsNamedException - if the Component was not found
      • getPossiblyDisabledComponent

        <T extends OpenemsComponent> T getPossiblyDisabledComponent​(java.lang.String componentId)
                                                             throws OpenemsError.OpenemsNamedException
        Gets a OpenEMS-Component by its Component-ID. Be careful, that the Component might not be 'enabled'. If in doubt, use getComponent(String) instead.

        Be aware that via this method usage of the Component service is not tracked by the bundle's use count (See BundleContext.getService(org.osgi.framework.ServiceReference)). Make sure to use the references as shortly as possible.

        Type Parameters:
        T - the typed Component
        Parameters:
        componentId - the Component-ID (e.g. "_sum")
        Returns:
        the OpenEMS-Component
        Throws:
        OpenemsError.OpenemsNamedException - if the Component was not found
      • getEdgeConfig

        EdgeConfig getEdgeConfig()
        Gets the complete configuration of this OpenEMS Edge.

        Internally updates the cache if necessary and publishes a CONFIG_UPDATE event on update.

        Returns:
        the EdgeConfig object