Class SimpleManagedJob

java.lang.Object
net.solarnetwork.service.support.BasicIdentifiable
net.solarnetwork.node.service.support.BaseIdentifiable
net.solarnetwork.node.job.SimpleManagedJob
All Implemented Interfaces:
ManagedJob, ServiceProvider, net.solarnetwork.service.Identifiable, net.solarnetwork.service.ServiceLifecycleObserver, net.solarnetwork.settings.SettingsChangeObserver, net.solarnetwork.settings.SettingSpecifierProvider

public class SimpleManagedJob extends BaseIdentifiable implements ManagedJob, net.solarnetwork.settings.SettingsChangeObserver, net.solarnetwork.service.ServiceLifecycleObserver
Simple implementation of ManagedJob.
Version:
1.1
Author:
matt
  • Field Details

    • DEFAULT_SCHEDULE_SETTING_KEY

      public static final String DEFAULT_SCHEDULE_SETTING_KEY
      The scheduleSettingKey property default value.
      See Also:
  • Constructor Details

  • Method Details

    • getJobService

      public JobService getJobService()
      Description copied from interface: ManagedJob
      Get the JobDetail.
      Specified by:
      getJobService in interface ManagedJob
      Returns:
      the jobDetail
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTrigger

      public org.springframework.scheduling.Trigger getTrigger()
      Get the job trigger.
      Returns:
      the trigger
    • getSettingUid

      public String getSettingUid()
      Specified by:
      getSettingUid in interface net.solarnetwork.settings.SettingSpecifierProvider
    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface net.solarnetwork.service.Identifiable
      Specified by:
      getDisplayName in interface net.solarnetwork.settings.SettingSpecifierProvider
      Overrides:
      getDisplayName in class net.solarnetwork.service.support.BasicIdentifiable
    • getSettingSpecifiers

      public List<net.solarnetwork.settings.SettingSpecifier> getSettingSpecifiers()
      Specified by:
      getSettingSpecifiers in interface net.solarnetwork.settings.SettingSpecifierProvider
    • getMessageSource

      public org.springframework.context.MessageSource getMessageSource()
      Specified by:
      getMessageSource in interface net.solarnetwork.settings.SettingSpecifierProvider
      Overrides:
      getMessageSource in class net.solarnetwork.service.support.BasicIdentifiable
    • configurationChanged

      public void configurationChanged(Map<String,Object> properties)
      Specified by:
      configurationChanged in interface net.solarnetwork.settings.SettingsChangeObserver
    • serviceDidStartup

      public void serviceDidStartup()
      Specified by:
      serviceDidStartup in interface net.solarnetwork.service.ServiceLifecycleObserver
    • serviceDidShutdown

      public void serviceDidShutdown()
      Specified by:
      serviceDidShutdown in interface net.solarnetwork.service.ServiceLifecycleObserver
    • getServiceConfigurations

      public Collection<ServiceProvider.ServiceConfiguration> getServiceConfigurations()
      Description copied from interface: ManagedJob
      Get a collection of service configurations.
      Specified by:
      getServiceConfigurations in interface ManagedJob
      Specified by:
      getServiceConfigurations in interface ServiceProvider
      Returns:
      A collection of configuration objects.
    • setServiceProviderConfigurations

      public void setServiceProviderConfigurations(Map<String,SimpleServiceProviderConfiguration> serviceProviderConfigurations)
      Set a mapping of service provider configurations.

      When this job is registered at runtime, these services will also be registered.

      Parameters:
      serviceProviderConfigurations - the configurations to set
    • getJobDetail

      public SimpleManagedJob getJobDetail()
      A getter property to maintain backwards-compatibility with legacy SolarNode 1.x settings.

      This method exists to support SolarNode 1.x settings like jobDetail.x.

      Returns:
      this instance
    • getJobDataMap

      public Map<String,Object> getJobDataMap()
      A getter property to maintain backwards-compatibility with legacy SolarNode 1.x settings.

      This method exists to support SolarNode 1.x settings like jobDetail.jobDataMap['datumDataSource'].x.

      Returns:
      a Map instance that exposes JavaBean properties on the configured JobService
    • getSchedule

      public String getSchedule()
      Description copied from interface: ManagedJob
      Get the desired trigger schedule expression.

      This might be a cron expression or a plain number representing a millisecond period.

      Specified by:
      getSchedule in interface ManagedJob
      Returns:
      the schedule expression, never null
    • setSchedule

      public void setSchedule(String schedule)
      Set the trigger schedule expression.

      Once this method has been called all calls to the legacy schedule setter method setTriggerCronExpression(String) will be ignored.

      Parameters:
      schedule - the trigger schedule expression to set
    • setTriggerCronExpression

      public void setTriggerCronExpression(String schedule)
      Set the trigger schedule expression, using the legacy setting property name.

      This method is to maintain backwards-compatibility with the SolarNode 1.x settings. Note that once setSchedule(String) is called this method will have no effect.

      Parameters:
      schedule - the schedule to set
    • getScheduleSettingKey

      public String getScheduleSettingKey()
      Get the schedule setting key.
      Specified by:
      getScheduleSettingKey in interface ManagedJob
      Returns:
      the setting key; defaults to DEFAULT_SCHEDULE_SETTING_KEY
    • setScheduleSettingKey

      public void setScheduleSettingKey(String scheduleSettingKey)
      Set the schedule setting key.

      This defaults to schedule to match the setSchedule(String) property. However this can be changed to any setting, so that the schedule setting key can be different. This can be used to bundle mutliple job schedules into the same setting UID, using different schedule setting keys for different jobs.

      Parameters:
      scheduleSettingKey - the setting key to set