Class DummyComponentManager

    • Constructor Detail

      • DummyComponentManager

        public DummyComponentManager()
      • DummyComponentManager

        public DummyComponentManager​(java.time.Clock clock)
    • Method Detail

      • getEnabledComponents

        public java.util.List<OpenemsComponent> getEnabledComponents()
        Description copied from interface: ComponentManager
        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.

        Specified by:
        getEnabledComponents in interface ComponentManager
        Returns:
        a List of OpenEMS-Components
      • getAllComponents

        public java.util.List<OpenemsComponent> getAllComponents()
        Description copied from interface: ComponentManager
        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.

        Specified by:
        getAllComponents in interface ComponentManager
        Returns:
        a List of OpenEMS-Components
      • getEnabledComponentsOfType

        public <T extends OpenemsComponent> java.util.List<T> getEnabledComponentsOfType​(java.lang.Class<T> clazz)
        Description copied from interface: ComponentManager
        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.

        Specified by:
        getEnabledComponentsOfType in interface ComponentManager
        Type Parameters:
        T - the given Type, subclass of OpenemsComponent
        Parameters:
        clazz - the given Type, subclass of OpenemsComponent
        Returns:
        a List of OpenEMS-Components
      • getComponent

        public <T extends OpenemsComponent> T getComponent​(java.lang.String componentId)
                                                    throws OpenemsError.OpenemsNamedException
        Description copied from interface: ComponentManager
        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.

        Specified by:
        getComponent in interface ComponentManager
        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
      • addComponent

        public DummyComponentManager addComponent​(OpenemsComponent component)
        Specific for this Dummy implementation.
        Parameters:
        component - the component that should be added
        Returns:
        this
      • setConfigJson

        public void setConfigJson​(com.google.gson.JsonObject json)
        Sets a EdgeConfig json.
        Parameters:
        json - the EdgeConfig json
      • getEdgeConfig

        public EdgeConfig getEdgeConfig()
        Description copied from interface: ComponentManager
        Gets the complete configuration of this OpenEMS Edge.

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

        Specified by:
        getEdgeConfig in interface ComponentManager
        Returns:
        the EdgeConfig object
      • id

        public java.lang.String id()
        Description copied from interface: OpenemsComponent
        Returns a unique ID for this OpenEMS component.
        Specified by:
        id in interface OpenemsComponent
        Returns:
        the unique ID
      • alias

        public java.lang.String alias()
        Description copied from interface: OpenemsComponent
        Returns a human-readable name of this Component..
        Specified by:
        alias in interface OpenemsComponent
        Returns:
        the human-readable name
      • isEnabled

        public boolean isEnabled()
        Description copied from interface: OpenemsComponent
        Returns whether this component is enabled.
        Specified by:
        isEnabled in interface OpenemsComponent
        Returns:
        true if the component is enabled
      • getComponentContext

        public org.osgi.service.component.ComponentContext getComponentContext()
        Description copied from interface: OpenemsComponent
        Returns the ComponentContext.
        Specified by:
        getComponentContext in interface OpenemsComponent
        Returns:
        the OSGi ComponentContext
      • _channel

        @Deprecated
        public Channel<?> _channel​(java.lang.String channelName)
        Deprecated.
        Description copied from interface: OpenemsComponent
        Returns an undefined Channel defined by its ChannelId string representation.

        Note: It is preferred to use the typed channel()-method, that's why it is marked as @Deprecated.

        Specified by:
        _channel in interface OpenemsComponent
        Parameters:
        channelName - the Channel-ID as a string
        Returns:
        the Channel or null
      • getClock

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

        public void setConfigurationAdmin​(org.osgi.service.cm.ConfigurationAdmin configurationAdmin)