Interface ServiceInfoHolder
public interface ServiceInfoHolder
Provides information about the current service info, and methods to update it.
- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescription@NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshotCreates 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 theServiceInfoSnapshotConfigureEvent.@NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshotCreates a new service snapshot of this service, copying over the properties of the current service info snapshot.@NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshotcreateServiceInfoSnapshot(@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.ServiceInfoSnapshotGets the last service info snapshot before the current one was created.voidCreates 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.voidpublishServiceInfoUpdate(@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.ServiceInfoSnapshotGet the current service info snapshot which is synced to all components in the network.voidsetup()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
-
lastServiceInfo
-
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 theServiceInfoSnapshotConfigureEvent.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
createServiceInfoSnapshotmethod) 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.
-