java.lang.Object
org.sentrysoftware.metricshub.engine.connector.model.ConnectorStore
All Implemented Interfaces:
Serializable

public class ConnectorStore extends Object implements Serializable
Manages the storage and retrieval of Connector instances. The instances are stored in a map where the key is the connector file name, and the value is the corresponding Connector object.
See Also:
  • Constructor Details

    • ConnectorStore

      public ConnectorStore(Path connectorDirectory)
      Constructs a ConnectorStore using the specified connector directory.
      Parameters:
      connectorDirectory - The path to the directory containing connector files.
  • Method Details

    • addOne

      public void addOne(@NonNull @NonNull String id, @NonNull @NonNull Connector connector)
      Add a new Connector instance
      Parameters:
      id - the id of the connector
      connector - the Connector instance to add
    • addMany

      public void addMany(@NonNull @NonNull Map<String,Connector> connectors)
      Adds multiple instances of Connector to the connector store. The connectors are provided as a Map where each entry represents a connector with its unique identifier.
      Parameters:
      connectors - A Map containing connectors to be added, keyed by their unique identifiers.
    • newConnectorStore

      public ConnectorStore newConnectorStore()
      Creates and returns a new instance of ConnectorStore, initialized with a copy of the current connectors. This method is useful for creating a snapshot of the current state of the ConnectorStore used for each resource. Changes made to the new ConnectorStore will not affect the original one.
      Returns:
      A new ConnectorStore instance with the same connectors as the current store.