Interface SpecificCloudServiceProvider
-
- All Known Implementing Classes:
RemoteSpecificCloudServiceProvider
public interface SpecificCloudServiceProviderThis class provides access to a specific service in the cluster.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddServiceDeployment(@NotNull ServiceDeployment serviceDeployment)Adds a deployment to this service, which will be used whendeployResources()ordeployResources(boolean)is called.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>addServiceDeploymentAsync(@NotNull ServiceDeployment serviceDeployment)Adds a deployment to this service, which will be used whendeployResources()ordeployResources(boolean)is calledvoidaddServiceRemoteInclusion(@NotNull ServiceRemoteInclusion serviceRemoteInclusion)Adds a remote inclusion to this service.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>addServiceRemoteInclusionAsync(@NotNull ServiceRemoteInclusion serviceRemoteInclusion)Adds a remote inclusion to this service.voidaddServiceTemplate(@NotNull ServiceTemplate serviceTemplate)Adds a service template to this service.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>addServiceTemplateAsync(@NotNull ServiceTemplate serviceTemplate)Adds a service template to this service.default voiddelete()Deletes this service if it is not deleted yet.default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>deleteAsync()Deletes this service if it is not deleted yet.default voiddeployResources()Writes all deployments to their defined templates of this service and removes them after writing.voiddeployResources(boolean removeDeployments)Writes all deployments to their defined templates of this service.default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>deployResourcesAsync()Writes all deployments to their defined templates of this service and removes them after writing.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>deployResourcesAsync(boolean removeDeployments)Writes all deployments to their defined templates of this service.@Nullable ServiceInfoSnapshotforceUpdateServiceInfo()Forces this service to update itsServiceInfoSnapshot, instead ofgetServiceInfoSnapshot(), this method always returns the current snapshot with the current e.g.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<ServiceInfoSnapshot>forceUpdateServiceInfoAsync()Forces this service to update itsServiceInfoSnapshot, instead ofgetServiceInfoSnapshot(), this method always returns the current snapshot with the current e.g.java.util.Queue<java.lang.String>getCachedLogMessages()Gets a queue containing the last messages of this services console.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Queue<java.lang.String>>getCachedLogMessagesAsync()Gets a queue containing the last messages of this services console.@Nullable ServiceInfoSnapshotgetServiceInfoSnapshot()Gets the info of the service this provider is for.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<ServiceInfoSnapshot>getServiceInfoSnapshotAsync()Gets the info of the service this provider is forvoidincludeWaitingServiceInclusions()Copies all inclusions of this service into the directory where this service is located in@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>includeWaitingServiceInclusionsAsync()Copies all inclusions of this service into the directory where this service is located invoidincludeWaitingServiceTemplates()Copies all templates of this service into the directory where this service is located in@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>includeWaitingServiceTemplatesAsync()Copies all templates of this service into the directory where this service is located inbooleanisValid()Checks whether the service info on this provider is available or not.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean>isValidAsync()Checks whether the service info on this provider is available or not.voidkill()Tries to stop this service likestop()but if the service is still running after 5 seconds, it is destroyed forcibly@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>killAsync()Tries to stop this service likestop()but if the service is still running after 5 seconds, it is destroyed forciblyvoidrestart()@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>restartAsync()voidrunCommand(@NotNull java.lang.String command)Executes the given command in the console of this service if it is running@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>runCommandAsync(@NotNull java.lang.String command)Executes the given command in the console of this service if it is runningvoidsetCloudServiceLifeCycle(@NotNull ServiceLifeCycle lifeCycle)Sets the life cycle of this service and starts, prepares, stops or deletes this service.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>setCloudServiceLifeCycleAsync(@NotNull ServiceLifeCycle lifeCycle)Sets the life cycle of this service and starts, prepares, stops or deletes this servicedefault voidstart()Starts this service if it is prepared or stopped.default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>startAsync()Starts this service if it is prepared or stopped.default voidstop()Stops this service by executing the "stop" and "end" commands in its console if it is running.default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>stopAsync()Stops this service by executing the "stop" and "end" commands in its console if it is running.
-
-
-
Method Detail
-
getServiceInfoSnapshot
@Nullable @Nullable ServiceInfoSnapshot getServiceInfoSnapshot()
Gets the info of the service this provider is for.- Returns:
- the info or
null, if the service doesn't exist - Throws:
java.lang.IllegalArgumentException- if no uniqueId/name/serviceInfo was given on creating this provider
-
isValid
boolean isValid()
Checks whether the service info on this provider is available or not.- Returns:
trueif it is orfalseif not
-
forceUpdateServiceInfo
@Nullable @Nullable ServiceInfoSnapshot forceUpdateServiceInfo()
Forces this service to update itsServiceInfoSnapshot, instead ofgetServiceInfoSnapshot(), this method always returns the current snapshot with the current e.g. CPU and memory usage.- Returns:
- the current info or
nullif the service is not connected - Throws:
java.lang.IllegalArgumentException- if no uniqueId/name/serviceInfo was given on creating this provider
-
addServiceTemplate
void addServiceTemplate(@NotNull @NotNull ServiceTemplate serviceTemplate)Adds a service template to this service. This template won't be copied directly after adding it but when the service is prepared.- Parameters:
serviceTemplate- the template to be added to the list of templates of this service
-
addServiceRemoteInclusion
void addServiceRemoteInclusion(@NotNull @NotNull ServiceRemoteInclusion serviceRemoteInclusion)Adds a remote inclusion to this service. This remote inclusion won't be included directly after adding it but when the service is prepared.- Parameters:
serviceRemoteInclusion- the inclusion to be added to the list of inclusions of this service
-
addServiceDeployment
void addServiceDeployment(@NotNull @NotNull ServiceDeployment serviceDeployment)Adds a deployment to this service, which will be used whendeployResources()ordeployResources(boolean)is called.- Parameters:
serviceDeployment- the deployment to be added to the list of deployments of this service
-
getCachedLogMessages
java.util.Queue<java.lang.String> getCachedLogMessages()
Gets a queue containing the last messages of this services console. The max size of this queue can be configured in the nodes config.json.- Returns:
- a queue with the cached messages of this services console
-
stop
default void stop()
Stops this service by executing the "stop" and "end" commands in its console if it is running.
-
start
default void start()
Starts this service if it is prepared or stopped.
-
delete
default void delete()
Deletes this service if it is not deleted yet. If this service is running, it will be stopped likekill()does.
-
setCloudServiceLifeCycle
void setCloudServiceLifeCycle(@NotNull @NotNull ServiceLifeCycle lifeCycle)Sets the life cycle of this service and starts, prepares, stops or deletes this service.- Parameters:
lifeCycle- the lifeCycle to be set
-
restart
void restart()
-
kill
void kill()
Tries to stop this service likestop()but if the service is still running after 5 seconds, it is destroyed forcibly
-
runCommand
void runCommand(@NotNull @NotNull java.lang.String command)Executes the given command in the console of this service if it is running- Parameters:
command- the command to be executed
-
includeWaitingServiceTemplates
void includeWaitingServiceTemplates()
Copies all templates of this service into the directory where this service is located in
-
includeWaitingServiceInclusions
void includeWaitingServiceInclusions()
Copies all inclusions of this service into the directory where this service is located in
-
deployResources
void deployResources(boolean removeDeployments)
Writes all deployments to their defined templates of this service.- Parameters:
removeDeployments- whether the deployments should be removed after deploying or not- See Also:
addServiceDeployment(ServiceDeployment),addServiceDeploymentAsync(ServiceDeployment)
-
deployResources
default void deployResources()
Writes all deployments to their defined templates of this service and removes them after writing.
-
getServiceInfoSnapshotAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<ServiceInfoSnapshot> getServiceInfoSnapshotAsync()
Gets the info of the service this provider is for- Returns:
- the info or
null, if the service doesn't exist - Throws:
java.lang.IllegalArgumentException- if no uniqueId/name/serviceInfo was given on creating this provider
-
isValidAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> isValidAsync()
Checks whether the service info on this provider is available or not.- Returns:
trueif it is orfalseif not
-
forceUpdateServiceInfoAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<ServiceInfoSnapshot> forceUpdateServiceInfoAsync()
Forces this service to update itsServiceInfoSnapshot, instead ofgetServiceInfoSnapshot(), this method always returns the current snapshot with the current e.g. CPU and memory usage.- Returns:
- the current info or
nullif the service is not connected - Throws:
java.lang.IllegalArgumentException- if no uniqueId/name/serviceInfo was given on creating this provider
-
addServiceTemplateAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> addServiceTemplateAsync(@NotNull @NotNull ServiceTemplate serviceTemplate)Adds a service template to this service. This template won't be copied directly after adding it but when the service is prepared- Parameters:
serviceTemplate- the template to be added to the list of templates of this service
-
addServiceRemoteInclusionAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> addServiceRemoteInclusionAsync(@NotNull @NotNull ServiceRemoteInclusion serviceRemoteInclusion)Adds a remote inclusion to this service. This remote inclusion won't be included directly after adding it but when the service is prepared- Parameters:
serviceRemoteInclusion- the inclusion to be added to the list of inclusions of this service
-
addServiceDeploymentAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> addServiceDeploymentAsync(@NotNull @NotNull ServiceDeployment serviceDeployment)Adds a deployment to this service, which will be used whendeployResources()ordeployResources(boolean)is called- Parameters:
serviceDeployment- the deployment to be added to the list of deployments of this service
-
getCachedLogMessagesAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Queue<java.lang.String>> getCachedLogMessagesAsync()
Gets a queue containing the last messages of this services console. The max size of this queue can be configured in the nodes config.json.- Returns:
- a queue with the cached messages of this services console
-
stopAsync
@NotNull default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> stopAsync()
Stops this service by executing the "stop" and "end" commands in its console if it is running.
-
startAsync
@NotNull default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> startAsync()
Starts this service if it is prepared or stopped.
-
deleteAsync
@NotNull default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> deleteAsync()
Deletes this service if it is not deleted yet. If this service is running, it will be stopped likekill()does.
-
setCloudServiceLifeCycleAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> setCloudServiceLifeCycleAsync(@NotNull @NotNull ServiceLifeCycle lifeCycle)Sets the life cycle of this service and starts, prepares, stops or deletes this service- Parameters:
lifeCycle- the lifeCycle to be set
-
restartAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> restartAsync()
-
killAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> killAsync()
Tries to stop this service likestop()but if the service is still running after 5 seconds, it is destroyed forcibly
-
runCommandAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> runCommandAsync(@NotNull @NotNull java.lang.String command)Executes the given command in the console of this service if it is running- Parameters:
command- the command to be executed
-
includeWaitingServiceTemplatesAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> includeWaitingServiceTemplatesAsync()
Copies all templates of this service into the directory where this service is located in
-
includeWaitingServiceInclusionsAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> includeWaitingServiceInclusionsAsync()
Copies all inclusions of this service into the directory where this service is located in
-
deployResourcesAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> deployResourcesAsync(boolean removeDeployments)
Writes all deployments to their defined templates of this service.- Parameters:
removeDeployments- whether the deployments should be removed after deploying or not- See Also:
addServiceDeployment(ServiceDeployment),addServiceDeploymentAsync(ServiceDeployment)
-
deployResourcesAsync
@NotNull default @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> deployResourcesAsync()
Writes all deployments to their defined templates of this service and removes them after writing.
-
-