Interface NodeRegistry


public interface NodeRegistry
A registry of installed node services.
  • Field Details

    • DEFAULT_VERSION

      static final int DEFAULT_VERSION
      The default version of a node service. This can be removed when versioning is fully implemented.
      See Also:
  • Method Details

    • registerNode

      void registerNode(Class<?> nodeClass, Config nodeConfig, Class<?> configClass)
      Notify the NodeFactory that a new type of node is available, and what SMS service contains its configuration.
      Parameters:
      nodeClass - The class that must implement Node.
      nodeConfig - The node config annotation.
      configClass - The node config class.
    • unregisterNode

      void unregisterNode(Config nodeConfig)
      Remove node form the list of cached node services.
      Parameters:
      nodeConfig - the config of the node.
    • getNodeTypeServiceNames

      Set<String> getNodeTypeServiceNames()
      Returns the set of service names for all the available node types.
      Returns:
      Set of service names.
    • isNodeService

      boolean isNodeService(String serviceName)
      Whether the SMS service name matches any node services.
      Parameters:
      serviceName - The candidate service name.
      Returns:
      Whether it's a node service.
    • isNodeService

      boolean isNodeService(String serviceName, Integer version)
      Whether the SMS service name is a node service.
      Parameters:
      serviceName - The candidate service name.
      version - The node type version.
      Returns:
      Whether it's a node service.
    • getNodeType

      Class<? extends Node> getNodeType(String serviceName, Integer version)
      Get the node class from the name of the service.
      Parameters:
      serviceName - The name of the node service.
      version - The node type version.
      Returns:
      The node type.
    • createNodeConfigInstance

      Object createNodeConfigInstance(String serviceName, Integer version, Realm realm, Map<String,Object> config) throws ServiceNotFoundException
      Construct a non-persisted instance of the given service interface.

      The instance is provided with data which has not been read from config and should only be used for validation purposes.

      Parameters:
      serviceName - The name of the service.
      version - The version of the node.
      realm - The realm that the configuration is associated with.
      config - The configuration that the returned instance will use for its method's return values.
      Returns:
      An instance of the service interface.
      Throws:
      ServiceNotFoundException - if a service with the given service name cannot be found.
    • getConfigType

      Class<?> getConfigType(String serviceName, Integer version)
      Get the config class from the name of the service.
      Parameters:
      serviceName - The name of the node service.
      version - The version of the node service.
      Returns:
      The node config type.
    • getNodeServiceName

      String getNodeServiceName(Class<? extends Node> nodeClass)
      Get the name of the service from the node class.
      Parameters:
      nodeClass - The type of the node.
      Returns:
      The node type.
    • getNodeVersion

      Integer getNodeVersion(Class<? extends Node> nodeClass)
      Get the version of the node.
      Parameters:
      nodeClass - The type of the node.
      Returns:
      The version of the node.