Class SimpleManagedJob
- All Implemented Interfaces:
ManagedJob,ServiceProvider,net.solarnetwork.service.Identifiable,net.solarnetwork.service.ServiceLifecycleObserver,net.solarnetwork.settings.SettingsChangeObserver,net.solarnetwork.settings.SettingSpecifierProvider
ManagedJob.- Version:
- 1.1
- Author:
- matt
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.solarnetwork.node.job.ServiceProvider
ServiceProvider.ServiceConfiguration -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThescheduleSettingKeyproperty default value.Fields inherited from interface net.solarnetwork.service.Identifiable
GROUP_UID_PROPERTY, UID_PROPERTY -
Constructor Summary
ConstructorsConstructorDescriptionSimpleManagedJob(JobService jobService) Constructor.SimpleManagedJob(JobService jobService, String schedule) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigurationChanged(Map<String, Object> properties) A getter property to maintain backwards-compatibility with legacy SolarNode 1.x settings.A getter property to maintain backwards-compatibility with legacy SolarNode 1.x settings.Get the JobDetail.org.springframework.context.MessageSourceGet the desired trigger schedule expression.Get the schedule setting key.Get a collection of service configurations.List<net.solarnetwork.settings.SettingSpecifier>org.springframework.scheduling.TriggerGet the job trigger.voidvoidvoidsetSchedule(String schedule) Set the trigger schedule expression.voidsetScheduleSettingKey(String scheduleSettingKey) Set the schedule setting key.voidsetServiceProviderConfigurations(Map<String, SimpleServiceProviderConfiguration> serviceProviderConfigurations) Set a mapping of service provider configurations.voidsetTriggerCronExpression(String schedule) Set the trigger schedule expression, using the legacy setting property name.toString()Methods inherited from class net.solarnetwork.node.service.support.BaseIdentifiable
baseIdentifiableSettings, baseIdentifiableSettings, getExpressionServices, getPlaceholderService, populateExpressionDatumProperties, resolvePlaceholders, resolvePlaceholders, setExpressionServices, setPlaceholderServiceMethods inherited from class net.solarnetwork.service.support.BasicIdentifiable
basicIdentifiableMetadataSettings, basicIdentifiableSettings, basicIdentifiableSettings, basicIdentifiableSettings, doubleMetadataValue, getGroupUid, getGroupUID, getMetadata, getMetadataCount, getUid, getUID, integerMetadataValue, metadataValue, numberMetadataValue, saveMetadataValue, saveMetadataValue, setDisplayName, setGroupUid, setGroupUID, setMessageSource, setMetadata, setMetadataCount, setUid, setUID, smartMetadataValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.solarnetwork.service.Identifiable
getGroupUid, getUid
-
Field Details
-
DEFAULT_SCHEDULE_SETTING_KEY
ThescheduleSettingKeyproperty default value.- See Also:
-
-
Constructor Details
-
SimpleManagedJob
Constructor.- Parameters:
jobService- the job service- Throws:
IllegalArgumentException- if any argument is null
-
SimpleManagedJob
Constructor.This constructor can be used to configure a default schedule that can be overwritten by either the legacy support method
setTriggerCronExpression(String)or the modern replacementsetSchedule(String).- Parameters:
jobService- the job serviceschedule- the default schedule to set- Throws:
IllegalArgumentException- if any argument is null
-
-
Method Details
-
getJobService
Description copied from interface:ManagedJobGet the JobDetail.- Specified by:
getJobServicein interfaceManagedJob- Returns:
- the jobDetail
-
toString
-
getTrigger
public org.springframework.scheduling.Trigger getTrigger()Get the job trigger.- Returns:
- the trigger
-
getSettingUid
- Specified by:
getSettingUidin interfacenet.solarnetwork.settings.SettingSpecifierProvider
-
getDisplayName
- Specified by:
getDisplayNamein interfacenet.solarnetwork.service.Identifiable- Specified by:
getDisplayNamein interfacenet.solarnetwork.settings.SettingSpecifierProvider- Overrides:
getDisplayNamein classnet.solarnetwork.service.support.BasicIdentifiable
-
getSettingSpecifiers
- Specified by:
getSettingSpecifiersin interfacenet.solarnetwork.settings.SettingSpecifierProvider
-
getMessageSource
public org.springframework.context.MessageSource getMessageSource()- Specified by:
getMessageSourcein interfacenet.solarnetwork.settings.SettingSpecifierProvider- Overrides:
getMessageSourcein classnet.solarnetwork.service.support.BasicIdentifiable
-
configurationChanged
- Specified by:
configurationChangedin interfacenet.solarnetwork.settings.SettingsChangeObserver
-
serviceDidStartup
public void serviceDidStartup()- Specified by:
serviceDidStartupin interfacenet.solarnetwork.service.ServiceLifecycleObserver
-
serviceDidShutdown
public void serviceDidShutdown()- Specified by:
serviceDidShutdownin interfacenet.solarnetwork.service.ServiceLifecycleObserver
-
getServiceConfigurations
Description copied from interface:ManagedJobGet a collection of service configurations.- Specified by:
getServiceConfigurationsin interfaceManagedJob- Specified by:
getServiceConfigurationsin interfaceServiceProvider- 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
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
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
Description copied from interface:ManagedJobGet the desired trigger schedule expression.This might be a cron expression or a plain number representing a millisecond period.
- Specified by:
getSchedulein interfaceManagedJob- Returns:
- the schedule expression, never null
-
setSchedule
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
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
Get the schedule setting key.- Specified by:
getScheduleSettingKeyin interfaceManagedJob- Returns:
- the setting key; defaults to
DEFAULT_SCHEDULE_SETTING_KEY
-
setScheduleSettingKey
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
-