Class AbstractService

java.lang.Object
eu.cloudnetservice.node.impl.service.defaults.AbstractService
All Implemented Interfaces:
eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider, InternalCloudService, eu.cloudnetservice.node.service.CloudService
Direct Known Subclasses:
JVMService

public abstract class AbstractService extends Object implements InternalCloudService
  • Field Details

    • LOGGER

      protected static final org.slf4j.Logger LOGGER
    • INCLUSION_TEMP_DIR

      protected static final Path INCLUSION_TEMP_DIR
    • WRAPPER_CONFIG_PATH

      protected static final Path WRAPPER_CONFIG_PATH
    • FILE_MATCHER_PREDICATE

      protected static final BiPredicate<String,Pattern> FILE_MATCHER_PREDICATE
    • connectionKey

      protected final String connectionKey
    • pluginDirectory

      protected final Path pluginDirectory
    • serviceDirectory

      protected final Path serviceDirectory
    • i18n

      protected final eu.cloudnetservice.driver.language.I18n i18n
    • mainThread

      protected final DefaultTickLoop mainThread
    • eventManager

      protected final eu.cloudnetservice.driver.event.EventManager eventManager
    • configuration

      protected final eu.cloudnetservice.node.config.Configuration configuration
    • logCache

      protected final eu.cloudnetservice.node.service.ServiceConsoleLogCache logCache
    • cloudServiceManager

      protected final InternalCloudServiceManager cloudServiceManager
    • serviceConfiguration

      protected final eu.cloudnetservice.driver.service.ServiceConfiguration serviceConfiguration
    • serviceVersionProvider

      protected final ServiceVersionProvider serviceVersionProvider
    • serviceConfigurationPreparer

      protected final eu.cloudnetservice.node.service.ServiceConfigurationPreparer serviceConfigurationPreparer
    • lifecycleLock

      protected final Lock lifecycleLock
    • logTargets

      protected final Set<Tuple2<eu.cloudnetservice.driver.channel.ChannelMessageTarget, String>> logTargets
    • waitingTemplates

      protected final Queue<eu.cloudnetservice.driver.service.ServiceTemplate> waitingTemplates
    • waitingDeployments

      protected final Queue<eu.cloudnetservice.driver.service.ServiceDeployment> waitingDeployments
    • waitingRemoteInclusions

      protected final Queue<eu.cloudnetservice.driver.service.ServiceRemoteInclusion> waitingRemoteInclusions
    • installedTemplates

      protected final Collection<eu.cloudnetservice.driver.service.ServiceTemplate> installedTemplates
    • installedInclusions

      protected final Collection<eu.cloudnetservice.driver.service.ServiceRemoteInclusion> installedInclusions
    • installedDeployments

      protected final Collection<eu.cloudnetservice.driver.service.ServiceDeployment> installedDeployments
    • networkChannel

      protected volatile eu.cloudnetservice.driver.network.NetworkChannel networkChannel
    • connectionTimestamp

      protected volatile long connectionTimestamp
    • lastServiceInfo

      protected volatile eu.cloudnetservice.driver.service.ServiceInfoSnapshot lastServiceInfo
    • currentServiceInfo

      protected volatile eu.cloudnetservice.driver.service.ServiceInfoSnapshot currentServiceInfo
  • Constructor Details

  • Method Details

    • resolveServicePath

      @NonNull protected static @NonNull Path resolveServicePath(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceId serviceId, @NonNull @NonNull eu.cloudnetservice.node.service.CloudServiceManager manager, boolean staticService)
    • serviceInfo

      @NonNull public @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot serviceInfo()
      Specified by:
      serviceInfo in interface eu.cloudnetservice.node.service.CloudService
      Specified by:
      serviceInfo in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • valid

      public boolean valid()
      Specified by:
      valid in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • forceUpdateServiceInfo

      @Nullable public @Nullable eu.cloudnetservice.driver.service.ServiceInfoSnapshot forceUpdateServiceInfo()
      Specified by:
      forceUpdateServiceInfo in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • addServiceTemplate

      public void addServiceTemplate(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate serviceTemplate)
      Specified by:
      addServiceTemplate in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • addServiceRemoteInclusion

      public void addServiceRemoteInclusion(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceRemoteInclusion serviceRemoteInclusion)
      Specified by:
      addServiceRemoteInclusion in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • addServiceDeployment

      public void addServiceDeployment(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceDeployment serviceDeployment)
      Specified by:
      addServiceDeployment in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • serviceConsoleLogCache

      @NonNull public @NonNull eu.cloudnetservice.node.service.ServiceConsoleLogCache serviceConsoleLogCache()
      Specified by:
      serviceConsoleLogCache in interface eu.cloudnetservice.node.service.CloudService
    • deleteFiles

      public void deleteFiles()
      Specified by:
      deleteFiles in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • updateLifecycle

      public void updateLifecycle(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceLifeCycle lifeCycle)
      Specified by:
      updateLifecycle in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • serviceInfoAsync

      @NonNull public @NonNull CompletableFuture<eu.cloudnetservice.driver.service.ServiceInfoSnapshot> serviceInfoAsync()
      Specified by:
      serviceInfoAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • validAsync

      Specified by:
      validAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • forceUpdateServiceInfoAsync

      @NonNull public @NonNull CompletableFuture<eu.cloudnetservice.driver.service.ServiceInfoSnapshot> forceUpdateServiceInfoAsync()
      Specified by:
      forceUpdateServiceInfoAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • addServiceTemplateAsync

      @NonNull public @NonNull CompletableFuture<Void> addServiceTemplateAsync(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate serviceTemplate)
      Specified by:
      addServiceTemplateAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • addServiceRemoteInclusionAsync

      @NonNull public @NonNull CompletableFuture<Void> addServiceRemoteInclusionAsync(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceRemoteInclusion serviceRemoteInclusion)
      Specified by:
      addServiceRemoteInclusionAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • addServiceDeploymentAsync

      @NonNull public @NonNull CompletableFuture<Void> addServiceDeploymentAsync(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceDeployment serviceDeployment)
      Specified by:
      addServiceDeploymentAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • cachedLogMessagesAsync

      @NonNull public @NonNull CompletableFuture<Queue<String>> cachedLogMessagesAsync()
      Specified by:
      cachedLogMessagesAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • toggleScreenEventsAsync

      @NonNull public @NonNull CompletableFuture<Boolean> toggleScreenEventsAsync(@NonNull @NonNull eu.cloudnetservice.driver.channel.ChannelMessageSender sender, @NonNull @NonNull String channel)
      Specified by:
      toggleScreenEventsAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • restartAsync

      @NonNull public @NonNull CompletableFuture<Void> restartAsync()
      Specified by:
      restartAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • updateLifecycleAsync

      @NonNull public @NonNull CompletableFuture<Void> updateLifecycleAsync(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceLifeCycle lifeCycle)
      Specified by:
      updateLifecycleAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • deleteFilesAsync

      @NonNull public @NonNull CompletableFuture<Void> deleteFilesAsync()
      Specified by:
      deleteFilesAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • runCommandAsync

      @NonNull public @NonNull CompletableFuture<Void> runCommandAsync(@NonNull @NonNull String command)
      Specified by:
      runCommandAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • includeWaitingServiceTemplatesAsync

      @NonNull public @NonNull CompletableFuture<Void> includeWaitingServiceTemplatesAsync()
      Specified by:
      includeWaitingServiceTemplatesAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • includeWaitingServiceTemplatesAsync

      @NonNull public @NonNull CompletableFuture<Void> includeWaitingServiceTemplatesAsync(boolean force)
      Specified by:
      includeWaitingServiceTemplatesAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • includeWaitingServiceInclusionsAsync

      @NonNull public @NonNull CompletableFuture<Void> includeWaitingServiceInclusionsAsync()
      Specified by:
      includeWaitingServiceInclusionsAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • deployResourcesAsync

      @NonNull public @NonNull CompletableFuture<Void> deployResourcesAsync(boolean removeDeployments)
      Specified by:
      deployResourcesAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • removeAndExecuteDeploymentsAsync

      @NonNull public @NonNull CompletableFuture<Void> removeAndExecuteDeploymentsAsync()
      Specified by:
      removeAndExecuteDeploymentsAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • updatePropertiesAsync

      @NonNull public @NonNull CompletableFuture<Void> updatePropertiesAsync(@NonNull @NonNull eu.cloudnetservice.driver.document.Document properties)
      Specified by:
      updatePropertiesAsync in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • updateLifecycle

      protected void updateLifecycle(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceLifeCycle lifeCycle, boolean switchToDeletedOnStop)
    • restart

      public void restart()
      Specified by:
      restart in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • installedTemplates

      @NonNull public @NonNull Collection<eu.cloudnetservice.driver.service.ServiceTemplate> installedTemplates()
      Specified by:
      installedTemplates in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • installedInclusions

      @NonNull public @NonNull Collection<eu.cloudnetservice.driver.service.ServiceRemoteInclusion> installedInclusions()
      Specified by:
      installedInclusions in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • installedDeployments

      @NonNull public @NonNull Collection<eu.cloudnetservice.driver.service.ServiceDeployment> installedDeployments()
      Specified by:
      installedDeployments in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • includeWaitingServiceTemplates

      public void includeWaitingServiceTemplates()
      Specified by:
      includeWaitingServiceTemplates in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • includeWaitingServiceTemplates

      public void includeWaitingServiceTemplates(boolean force)
      Specified by:
      includeWaitingServiceTemplates in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • includeWaitingServiceInclusions

      public void includeWaitingServiceInclusions()
      Specified by:
      includeWaitingServiceInclusions in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • deployResources

      public void deployResources(boolean removeDeployments)
      Specified by:
      deployResources in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • updateProperties

      public void updateProperties(@NonNull @NonNull eu.cloudnetservice.driver.document.Document properties)
      Specified by:
      updateProperties in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • doDelete

      protected void doDelete()
    • waitingIncludes

      @NonNull public @NonNull Queue<eu.cloudnetservice.driver.service.ServiceRemoteInclusion> waitingIncludes()
      Specified by:
      waitingIncludes in interface eu.cloudnetservice.node.service.CloudService
    • waitingTemplates

      @NonNull public @NonNull Queue<eu.cloudnetservice.driver.service.ServiceTemplate> waitingTemplates()
      Specified by:
      waitingTemplates in interface eu.cloudnetservice.node.service.CloudService
    • waitingDeployments

      @NonNull public @NonNull Queue<eu.cloudnetservice.driver.service.ServiceDeployment> waitingDeployments()
      Specified by:
      waitingDeployments in interface eu.cloudnetservice.node.service.CloudService
    • lifeCycle

      @NonNull public @NonNull eu.cloudnetservice.driver.service.ServiceLifeCycle lifeCycle()
      Specified by:
      lifeCycle in interface eu.cloudnetservice.node.service.CloudService
    • cloudServiceManager

      @NonNull public @NonNull eu.cloudnetservice.node.service.CloudServiceManager cloudServiceManager()
      Specified by:
      cloudServiceManager in interface eu.cloudnetservice.node.service.CloudService
    • serviceConfiguration

      @NonNull public @NonNull eu.cloudnetservice.driver.service.ServiceConfiguration serviceConfiguration()
      Specified by:
      serviceConfiguration in interface eu.cloudnetservice.node.service.CloudService
    • serviceId

      @NonNull public @NonNull eu.cloudnetservice.driver.service.ServiceId serviceId()
      Specified by:
      serviceId in interface eu.cloudnetservice.node.service.CloudService
    • connectionKey

      @NonNull public @NonNull String connectionKey()
      Specified by:
      connectionKey in interface eu.cloudnetservice.node.service.CloudService
    • directory

      @NonNull public @NonNull Path directory()
      Specified by:
      directory in interface eu.cloudnetservice.node.service.CloudService
    • pluginDirectory

      @NonNull public @NonNull Path pluginDirectory()
      Specified by:
      pluginDirectory in interface eu.cloudnetservice.node.service.CloudService
    • networkChannel

      @Nullable public @Nullable eu.cloudnetservice.driver.network.NetworkChannel networkChannel()
      Specified by:
      networkChannel in interface eu.cloudnetservice.node.service.CloudService
    • networkChannel

      public void networkChannel(@Nullable @Nullable eu.cloudnetservice.driver.network.NetworkChannel channel)
      Specified by:
      networkChannel in interface InternalCloudService
    • lastServiceInfoSnapshot

      @NonNull public @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot lastServiceInfoSnapshot()
      Specified by:
      lastServiceInfoSnapshot in interface eu.cloudnetservice.node.service.CloudService
    • publishServiceInfoSnapshot

      public void publishServiceInfoSnapshot()
      Specified by:
      publishServiceInfoSnapshot in interface eu.cloudnetservice.node.service.CloudService
    • handleServiceRegister

      public void handleServiceRegister()
      Specified by:
      handleServiceRegister in interface InternalCloudService
    • updateServiceInfoSnapshot

      public void updateServiceInfoSnapshot(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceInfoSnapshot serviceInfoSnapshot)
      Specified by:
      updateServiceInfoSnapshot in interface InternalCloudService
    • cachedLogMessages

      @NonNull public @NonNull Queue<String> cachedLogMessages()
      Specified by:
      cachedLogMessages in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • toggleScreenEvents

      public boolean toggleScreenEvents(@NonNull @NonNull eu.cloudnetservice.driver.channel.ChannelMessageSender channelMessageSender, @NonNull @NonNull String channel)
      Specified by:
      toggleScreenEvents in interface eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider
    • executeDeployment

      protected void executeDeployment(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceDeployment deployment)
    • relativizePath

      @NonNull protected @NonNull String relativizePath(@NonNull @NonNull Path input)
    • doRemoveFilesAfterStop

      protected void doRemoveFilesAfterStop()
    • preLifecycleChange

      protected boolean preLifecycleChange(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceLifeCycle targetLifecycle)
    • pushServiceInfoSnapshotUpdate

      protected void pushServiceInfoSnapshotUpdate(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceLifeCycle lifeCycle)
    • pushServiceInfoSnapshotUpdate

      protected void pushServiceInfoSnapshotUpdate(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceLifeCycle lifeCycle, boolean sendUpdate)
    • pushServiceInfoSnapshotUpdate

      protected void pushServiceInfoSnapshotUpdate(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceLifeCycle lifeCycle, @Nullable @Nullable eu.cloudnetservice.driver.document.Document properties, boolean sendUpdate)
    • canStartNow

      protected boolean canStartNow()
    • prepareService

      protected void prepareService()
    • selectConnectListener

      @NonNull protected @NonNull eu.cloudnetservice.driver.network.HostAndPort selectConnectListener(@NonNull @NonNull List<eu.cloudnetservice.driver.network.HostAndPort> listeners)
    • prepareSslConfiguration

      @NonNull protected @NonNull eu.cloudnetservice.driver.document.Document prepareSslConfiguration(@NonNull @NonNull eu.cloudnetservice.driver.network.ssl.SSLConfiguration configuration)
    • downloadInclusionFile

      protected void downloadInclusionFile(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceRemoteInclusion inclusion, @NonNull @NonNull Path destination)
    • serviceReplacement

      @NonNull protected @NonNull Object[] serviceReplacement()
    • initStandardServiceLogHandler

      protected void initStandardServiceLogHandler()
    • startProcess

      protected abstract void startProcess()
    • stopProcess

      protected abstract void stopProcess()