Interface ServiceManager
- All Known Implementing Classes:
DefaultServiceManager
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Deprecated.v6.2 This is no longer used. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionaddService
(String name, Class<? extends JiraService> serviceClass, long delay) Deprecated.UseaddService(String, String, String)
instead.addService
(String name, Class<? extends JiraService> serviceClass, long delay, Map<String, String[]> params) Deprecated.UseaddService(String, Class, String, java.util.Map)
instead.addService
(String name, Class<? extends JiraService> serviceClass, String cronExpression) This will add a service configuration to the JIRA DB and the service to the list of services which are running.addService
(String name, Class<? extends JiraService> serviceClass, String cronExpression, long delay, Map<String, String[]> params) This will add a service configuration to the JIRA DB and the service to the list of services which are running with an optional list of params.addService
(String name, Class<? extends JiraService> serviceClass, String cronExpression, Map<String, String[]> params) This will add a service configuration to the JIRA DB and the service to the list of services which are running with an optional list of params.addService
(String name, String className, long delay) Deprecated.UseaddService(String, String, String)
instead.Deprecated.UseaddService(String, String, String, java.util.Map)
instead.addService
(String name, String className, String cronExpression) This will add a service configuration to the JIRA DB and the service to the list of services which are running.addService
(String name, String className, String cronExpression, long delay, Map<String, String[]> params) This will add a service configuration to the JIRA DB and the service to the list of services which are running with an optional list of params.This will add a service configuration to the JIRA DB and the service to the list of services which are running with an optional list of params.boolean
Quick way of telling whether a service with a specific id is registered or not.void
editService
(Long id, long delay, Map<String, String[]> params) Deprecated.UseeditService(Long, String, java.util.Map)
instead.void
This will update the service if a service with this id can be found.void
editServiceByName
(String name, long delay, Map<String, String[]> params) Deprecated.UseeditServiceByName(String, String, java.util.Map)
instead.void
This will update the service if a service by this name can be found.Deprecated.v6.2 This is no longer used.This gets all currently registered services with JIRA.getServicesForExecution
(long currentTime) Deprecated.since v6.2 This is going away, it was always only meant for internal use.Gets the services that can be managed by an specific user.getServiceWithId
(Long id) This will return a JiraServiceContainer for the provided id if one is registered otherwise it will return null.getServiceWithName
(String name) This will return a JiraServiceContainer for the provided name if one is registered, otherwise this will return null.void
This will force a complete re-sync of the service cache with the values stored in the db.void
refreshService
(Long id) This will update the in-memory cache with the values from the db for the service with the id if it can be resolved.void
refreshServiceByName
(String name) This will update the in-memory cache with the values from the db for the named service if it can be resolved.void
removeService
(Long id) This will remove a service from the db and cache and it will try to resolve the service by id.void
removeServiceByName
(String name) This will remove a service from the db and cache and it will try to resolve the service by name.void
runNow
(long serviceId) Runs the service immediately.
-
Field Details
-
SERVICE_ID_KEY
-
-
Method Details
-
getServices
Collection<JiraServiceContainer> getServices()This gets all currently registered services with JIRA. This is an unmodifiable Collections that is returned, modifications to the services map will be made as a side-effect of calling the edit/refresh/add/remove methods of this manager.- Returns:
- an unmodifiable Collection with JiraServiceContainers as the value
-
addService
JiraServiceContainer addService(String name, String className, long delay) throws ServiceException, ClassNotFoundException Deprecated.UseaddService(String, String, String)
instead. Since v6.4.This will add a service configuration to the JIRA DB and the service to the list of services which are running.It is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
- Parameters:
name
- the key this service is to be known byclassName
- the class defining the servicedelay
- how often the service should run in milliseconds- Returns:
- the JiraServiceContainer that was just created
- Throws:
ServiceException
- If there is an error creating the Service.ClassNotFoundException
- If the className could not be resolved.- See Also:
-
addService
JiraServiceContainer addService(String name, String className, String cronExpression) throws ServiceException, ClassNotFoundException This will add a service configuration to the JIRA DB and the service to the list of services which are running.It is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
- Parameters:
name
- the key this service is to be known byclassName
- the class defining the servicecronExpression
- how the service should be scheduled- Returns:
- the JiraServiceContainer that was just created
- Throws:
ServiceException
- If there is an error creating the Service.ClassNotFoundException
- If the className could not be resolved.- Since:
- v6.4
- See Also:
-
addService
JiraServiceContainer addService(String name, Class<? extends JiraService> serviceClass, long delay) throws ServiceException Deprecated.UseaddService(String, String, String)
instead. Since v6.4.This will add a service configuration to the JIRA DB and the service to the list of services which are running.It is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
- Parameters:
name
- the key this service is to be known byserviceClass
- the class defining the servicedelay
- how often the service should run in milliseconds- Returns:
- the JiraServiceContainer that was just created
- Throws:
ServiceException
- If there is an error creating the Service.- See Also:
-
addService
JiraServiceContainer addService(String name, Class<? extends JiraService> serviceClass, String cronExpression) throws ServiceException This will add a service configuration to the JIRA DB and the service to the list of services which are running.It is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
- Parameters:
name
- the key this service is to be known byserviceClass
- the class defining the servicecronExpression
- how the service should be scheduled- Returns:
- the JiraServiceContainer that was just created
- Throws:
ServiceException
- If there is an error creating the Service.- Since:
- v6.4
- See Also:
-
addService
JiraServiceContainer addService(String name, String className, long delay, Map<String, String[]> params) throws ServiceException, ClassNotFoundExceptionDeprecated.UseaddService(String, String, String, java.util.Map)
instead. Since v6.4.This will add a service configuration to the JIRA DB and the service to the list of services which are running with an optional list of params.It is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
- Parameters:
name
- the key this service is to be known byclassName
- the class defining the servicedelay
- how often the service should run in millisecondsparams
- Additional params to specify for the service- Returns:
- the JiraServiceContainer that was just created
- Throws:
ServiceException
- If there is an error creating the Service.ClassNotFoundException
- If the className could not be resolved.- See Also:
-
addService
JiraServiceContainer addService(String name, String className, String cronExpression, Map<String, String[]> params) throws ServiceException, ClassNotFoundExceptionThis will add a service configuration to the JIRA DB and the service to the list of services which are running with an optional list of params.It is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
- Parameters:
name
- the key this service is to be known byclassName
- the class defining the servicecronExpression
- how the service should be scheduledparams
- Additional params to specify for the service- Returns:
- the JiraServiceContainer that was just created
- Throws:
ServiceException
- If there is an error creating the Service.ClassNotFoundException
- If the className could not be resolved.- Since:
- v6.4
- See Also:
-
addService
JiraServiceContainer addService(String name, String className, String cronExpression, long delay, Map<String, String[]> params) throws ServiceException, ClassNotFoundExceptionThis will add a service configuration to the JIRA DB and the service to the list of services which are running with an optional list of params.It is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
- Parameters:
name
- the key this service is to be known byclassName
- the class defining the servicecronExpression
- how the service should be scheduleddelay
- How often the service should run in milliseconds. This is not used, but the value will be retained and will be used in place of the cron expression if the instance is downgraded to a JIRA version prior to 6.4.params
- Additional params to specify for the service- Returns:
- the JiraServiceContainer that was just created
- Throws:
ServiceException
- If there is an error creating the Service.ClassNotFoundException
- If the className could not be resolved.- Since:
- v6.4
- See Also:
-
addService
JiraServiceContainer addService(String name, Class<? extends JiraService> serviceClass, long delay, Map<String, String[]> params) throws ServiceExceptionDeprecated.UseaddService(String, Class, String, java.util.Map)
instead. Since v6.4.This will add a service configuration to the JIRA DB and the service to the list of services which are running with an optional list of params.It is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
- Parameters:
name
- the key this service is to be known byserviceClass
- the class defining the servicedelay
- how often the service should run in millisecondsparams
- Additional params to specify for the service- Returns:
- the JiraServiceContainer that was just created
- Throws:
ServiceException
- If there is an error creating the Service.- See Also:
-
addService
JiraServiceContainer addService(String name, Class<? extends JiraService> serviceClass, String cronExpression, @Nullable Map<String, String[]> params) throws ServiceExceptionThis will add a service configuration to the JIRA DB and the service to the list of services which are running with an optional list of params.It is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
- Parameters:
name
- the key this service is to be known byserviceClass
- the class defining the servicecronExpression
- how the service should be scheduledparams
- Additional params to specify for the service- Returns:
- the JiraServiceContainer that was just created
- Throws:
ServiceException
- If there is an error creating the Service.- See Also:
-
addService
@Internal JiraServiceContainer addService(String name, Class<? extends JiraService> serviceClass, String cronExpression, long delay, @Nullable Map<String, String[]> params) throws ServiceExceptionThis will add a service configuration to the JIRA DB and the service to the list of services which are running with an optional list of params.It is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
- Parameters:
name
- the key this service is to be known byserviceClass
- the class defining the servicecronExpression
- how the service should be scheduleddelay
- How often the service should run in milliseconds. This is not used, but the value will be retained and will be used in place of the cron expression if the instance is downgraded to a JIRA version prior to 6.4.params
- Additional params to specify for the service- Returns:
- the JiraServiceContainer that was just created
- Throws:
ServiceException
- If there is an error creating the Service.- See Also:
-
getServiceWithId
This will return a JiraServiceContainer for the provided id if one is registered otherwise it will return null.- Parameters:
id
- service id- Returns:
- a JiraServiceContainer that is represented by the unique id.
- Throws:
Exception
- if there is a problem looking up the value in the db.
-
getServiceWithName
This will return a JiraServiceContainer for the provided name if one is registered, otherwise this will return null.- Parameters:
name
- the name of the JiraServiceContainer- Returns:
- a JiraServiceContainer if it is registered otherwise null
- Throws:
Exception
- if there is a problem looking up the value in the db.
-
containsServiceWithId
Quick way of telling whether a service with a specific id is registered or not.- Parameters:
id
- service id- Returns:
- true if the service with the id is registered
-
editServiceByName
Deprecated.UseeditServiceByName(String, String, java.util.Map)
instead. Since v6.4.This will update the service if a service by this name can be found. The delay and the params will be updated.- Parameters:
name
- the name of the service to find.delay
- the delay to set on the service in millisecondsparams
- the params to set on the service- Throws:
IllegalArgumentException
- if the name can not be resolvedException
-
editServiceByName
void editServiceByName(String name, String cronExpression, Map<String, String[]> params) throws ExceptionThis will update the service if a service by this name can be found. The cronExpression and the params will be updated.- Parameters:
name
- the name of the service to find.cronExpression
- how the service should be scheduledparams
- the params to set on the service- Throws:
IllegalArgumentException
- if the name can not be resolvedException
- Since:
- v6.4
-
editService
Deprecated.UseeditService(Long, String, java.util.Map)
instead. Since v6.4.This will update the service if a service with this id can be found. The delay and the params will be updated.- Parameters:
id
- the id of the service to find.delay
- the delay to set on the service in millisecondsparams
- the params to set on the service- Throws:
Exception
- if there is a problem updating the value
-
editService
This will update the service if a service with this id can be found. The cronExpression and the params will be updated.- Parameters:
id
- the id of the service to find.cronExpression
- how the service should be scheduledparams
- the params to set on the service- Throws:
Exception
- if there is a problem updating the value- Since:
- v6.4
-
refreshServiceByName
This will update the in-memory cache with the values from the db for the named service if it can be resolved.- Parameters:
name
- the name of the service to find.- Throws:
IllegalArgumentException
- if the name can not be resolvedException
-
refreshService
This will update the in-memory cache with the values from the db for the service with the id if it can be resolved.- Parameters:
id
- the id of the service to find.- Throws:
Exception
- if the value can not be refreshed
-
removeServiceByName
This will remove a service from the db and cache and it will try to resolve the service by name.- Parameters:
name
- the name of the service to find.- Throws:
IllegalArgumentException
- if the name can not be resolvedException
-
removeService
This will remove a service from the db and cache and it will try to resolve the service by id.- Parameters:
id
- the id of the service to find.- Throws:
Exception
- if there is a problem removing the service
-
refreshAll
void refreshAll()This will force a complete re-sync of the service cache with the values stored in the db. -
getScheduleSkipper
ServiceManager.ServiceScheduleSkipper getScheduleSkipper()Deprecated.v6.2 This is no longer used. Just callrunNow(long)
Returns the service schedule skipper.- Returns:
- service schedule skipper
- Since:
- v3.10
-
getServicesForExecution
Deprecated.since v6.2 This is going away, it was always only meant for internal use.Gets the services that are ready for execution at a particular time.- Parameters:
currentTime
- the time to check for due services.- Returns:
- an immutable collection of services.
- Since:
- v4.0
-
getServicesManageableBy
Gets the services that can be managed by an specific user.- Parameters:
user
- The user in play.- Returns:
- A collection of services.
-
runNow
Runs the service immediately. This call returns once the job is submitted. It does not wait for the service to complete. In a clustered environment the service may run on any node in the cluster.- Parameters:
serviceId
-- Throws:
Exception
-