Interface StorkServiceRegistry


public interface StorkServiceRegistry
The central API of Stork
  • Method Details

    • getService

      Service getService(String serviceName)
      Retrieves the Service associated with the given name.
      Parameters:
      serviceName - the service name, must not be null
      Returns:
      the service
      Throws:
      NoSuchServiceDefinitionException - if there is no service associated with the given name.
    • getServiceOptional

      Optional<Service> getServiceOptional(String serviceName)
      Retrieves the Service associated with the given name. Unlike getService(String) this method returns an Optional and so does not throw a NoSuchServiceDefinitionException if there is no Service associated with the given name.
      Parameters:
      serviceName - the service name, must not be null
      Returns:
      an Optional containing the Service if any, empty otherwise.
    • defineIfAbsent

      StorkServiceRegistry defineIfAbsent(String name, ServiceDefinition definition)
      Adds a service to the list of services managed by Stork. The service is only added if there is no service with that name already defined. Otherwise, the service definition is ignored.
      Parameters:
      name - the service name, must not be null or blank
      definition - the definition, must not be null
      Returns:
      the Stork instance. // TODO Define exception.
    • getServices

      Map<String,Service> getServices()
      Returns:
      all the services managed by Stork. The returned map is immutable.