Interface ServiceInfoHolder


public interface ServiceInfoHolder
Provides information about the current service info, and methods to update it.
Since:
4.0
  • Method Summary

    Modifier and Type
    Method
    Description
    @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot
    Creates a new service snapshot of this service, copying over the properties of the current service info snapshot, then configuring it using the registered listeners of the ServiceInfoSnapshotConfigureEvent.
    @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot
    Creates a new service snapshot of this service, copying over the properties of the current service info snapshot.
    @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot
    createServiceInfoSnapshot(@NonNull eu.cloudnetservice.driver.document.Document properties)
    Creates a new service snapshot of this service using the provided properties for the new snapshot.
    @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot
    Gets the last service info snapshot before the current one was created.
    void
    Creates a new service snapshot, configures it, updates the current and old one and sends an update to all components which are currently registered within the CloudNet network.
    void
    publishServiceInfoUpdate(@NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot serviceInfoSnapshot)
    Updates the given service snapshot to all components which are currently registered within the CloudNet network.
    @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot
    Get the current service info snapshot which is synced to all components in the network.
    void
    Setups the initial service information, this method can only be called once per lifecycle.
  • Method Details

    • setup

      void setup()
      Setups the initial service information, this method can only be called once per lifecycle.
      Throws:
      IllegalStateException - if called when the provider is already initialized.
    • serviceInfo

      @NonNull @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot serviceInfo()
      Get the current service info snapshot which is synced to all components in the network.
      Returns:
      the current service info snapshot.
    • lastServiceInfo

      @NonNull @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot lastServiceInfo()
      Gets the last service info snapshot before the current one was created.
      Returns:
      the last service info snapshot.
    • createServiceInfoSnapshot

      @NonNull @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot createServiceInfoSnapshot()
      Creates a new service snapshot of this service, copying over the properties of the current service info snapshot. Only the creation time and process snapshot of the new snapshot differ from the old snapshot.
      Returns:
      the newly created service snapshot for this service.
    • createServiceInfoSnapshot

      @NonNull @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot createServiceInfoSnapshot(@NonNull @NonNull eu.cloudnetservice.driver.document.Document properties)
      Creates a new service snapshot of this service using the provided properties for the new snapshot. Only the creation time, process snapshot and properties of the new snapshot differ from the old snapshot.

      Changes made to the current service snapshot (like modifying the properties of it) will not reflect into the snapshot returned by this method.

      Parameters:
      properties - the properties to apply to the new snapshot.
      Returns:
      the newly created service snapshot for this service.
      Throws:
      NullPointerException - if the given properties document is null.
    • configureServiceInfoSnapshot

      @NonNull @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot configureServiceInfoSnapshot()
      Creates a new service snapshot of this service, copying over the properties of the current service info snapshot, then configuring it using the registered listeners of the ServiceInfoSnapshotConfigureEvent.

      Changes made to the current service snapshot (like modifying the properties of it) will not reflect into the snapshot returned by this method.

      This method will (unlike the createServiceInfoSnapshot method) change the current and old service snapshot to the newly created and configured one.

      Returns:
      the newly created service snapshot for this service.
    • publishServiceInfoUpdate

      void publishServiceInfoUpdate()
      Creates a new service snapshot, configures it, updates the current and old one and sends an update to all components which are currently registered within the CloudNet network.
    • publishServiceInfoUpdate

      void publishServiceInfoUpdate(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot serviceInfoSnapshot)
      Updates the given service snapshot to all components which are currently registered within the CloudNet network. This method will configure the given snapshot if it belongs to the current wrapper instance.
      Parameters:
      serviceInfoSnapshot - the service snapshot to update.
      Throws:
      NullPointerException - if the given service snapshot is null.