Interface Metadata

    • Method Detail

      • isInitialized

        boolean isInitialized()
        Was the Metadata service fully initialized?.

        The service might take some time in the beginning to establish a connection or to cache data from an external database.

        Returns:
        true if it is initialized
      • addOnIsInitializedListener

        void addOnIsInitializedListener​(java.lang.Runnable callback)
        Parameters:
        callback - the callback on 'isInitialized'
      • removeOnIsInitializedListener

        void removeOnIsInitializedListener​(java.lang.Runnable callback)
        Parameters:
        callback - the callback on 'isInitialized'
      • logout

        void logout​(User user)
        Closes a session for a User.
        Parameters:
        user - the User
      • getEdgeIdForApikey

        java.util.Optional<java.lang.String> getEdgeIdForApikey​(java.lang.String apikey)
        Gets the Edge-ID for an API-Key, i.e. authenticates the API-Key.
        Parameters:
        apikey - the API-Key
        Returns:
        the Edge-ID or Empty
      • getEdge

        java.util.Optional<Edge> getEdge​(java.lang.String edgeId)
        Get an Edge by its unique Edge-ID.
        Parameters:
        edgeId - the Edge-ID
        Returns:
        the Edge as Optional
      • getEdgeOrError

        default Edge getEdgeOrError​(java.lang.String edgeId)
                             throws OpenemsException
        Get an Edge by its unique Edge-ID. Throws an Exception if there is no Edge with this ID.
        Parameters:
        edgeId - the Edge-ID
        Returns:
        the Edge
        Throws:
        OpenemsException - on error
      • getEdgeBySetupPassword

        java.util.Optional<Edge> getEdgeBySetupPassword​(java.lang.String setupPassword)
        Get an Edge by Edge-SetupPassword.
        Parameters:
        setupPassword - to find Edge
        Returns:
        Edge as a Optional
      • getUser

        java.util.Optional<User> getUser​(java.lang.String userId)
        Gets the User for the given User-ID.
        Parameters:
        userId - the User-ID
        Returns:
        the User, or Empty
      • getAllEdges

        java.util.Collection<Edge> getAllEdges()
        Gets all Edges.
        Returns:
        collection of Edges.
      • addEdgeToUser

        default Edge addEdgeToUser​(User user,
                                   java.lang.String setupPassword)
                            throws OpenemsError.OpenemsNamedException
        Assigns Edge with given setupPassword to the logged in user and returns it.

        If the setupPassword is invalid, an OpenemsNamedException is thrown.

        Parameters:
        user - the User
        setupPassword - the Setup-Password
        Returns:
        the Edge for the given Setup-Password
        Throws:
        OpenemsError.OpenemsNamedException - on error
      • activeStateChannelsToString

        static java.lang.String activeStateChannelsToString​(java.util.Map<ChannelAddress,​EdgeConfig.Component.Channel> activeStateChannels)
        Helper method for creating a String of all active State-Channels by Level.
        Parameters:
        activeStateChannels - Map of ChannelAddress and EdgeConfig.Component.Channel; as returned by Edge.onSetSumState()
        Returns:
        a string