Interface SpecificCloudServiceProvider

  • All Known Implementing Classes:
    RemoteSpecificCloudServiceProvider

    public interface SpecificCloudServiceProvider
    This 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
      void addServiceDeployment​(@NotNull ServiceDeployment serviceDeployment)
      Adds a deployment to this service, which will be used when deployResources() or deployResources(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 when deployResources() or deployResources(boolean) is called
      void addServiceRemoteInclusion​(@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.
      void addServiceTemplate​(@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 void delete()
      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 void deployResources()
      Writes all deployments to their defined templates of this service and removes them after writing.
      void deployResources​(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 ServiceInfoSnapshot forceUpdateServiceInfo()
      Forces this service to update its ServiceInfoSnapshot, instead of getServiceInfoSnapshot(), 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 its ServiceInfoSnapshot, instead of getServiceInfoSnapshot(), 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 ServiceInfoSnapshot getServiceInfoSnapshot()
      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 for
      void includeWaitingServiceInclusions()
      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 in
      void includeWaitingServiceTemplates()
      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 in
      boolean isValid()
      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.
      void kill()
      Tries to stop this service like stop() 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 like stop() but if the service is still running after 5 seconds, it is destroyed forcibly
      void restart()
      Stops this service like stop() and starts it after it like start().
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> restartAsync()
      Stops this service like stop() and starts it after it like start().
      void runCommand​(@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 running
      void setCloudServiceLifeCycle​(@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 service
      default void start()
      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 void stop()
      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:
        true if it is or false if not
      • forceUpdateServiceInfo

        @Nullable
        @Nullable ServiceInfoSnapshot forceUpdateServiceInfo()
        Forces this service to update its ServiceInfoSnapshot, instead of getServiceInfoSnapshot(), this method always returns the current snapshot with the current e.g. CPU and memory usage.
        Returns:
        the current info or null if 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 when deployResources() or deployResources(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 like kill() 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()
        Stops this service like stop() and starts it after it like start().
      • kill

        void kill()
        Tries to stop this service like stop() 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
      • 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:
        true if it is or false if not
      • forceUpdateServiceInfoAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<ServiceInfoSnapshot> forceUpdateServiceInfoAsync()
        Forces this service to update its ServiceInfoSnapshot, instead of getServiceInfoSnapshot(), this method always returns the current snapshot with the current e.g. CPU and memory usage.
        Returns:
        the current info or null if 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 when deployResources() or deployResources(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 like kill() 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()
        Stops this service like stop() and starts it after it like start().
      • killAsync

        @NotNull
        @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> killAsync()
        Tries to stop this service like stop() 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