com.atlassian.jira.service
Interface ServiceManager

All Superinterfaces:
JiraManager
All Known Implementing Classes:
DefaultServiceManager

public interface ServiceManager
extends JiraManager


Nested Class Summary
static interface ServiceManager.ServiceScheduleSkipper
          This interface provides capability for other processes to request a service run.
 
Method Summary
 JiraServiceContainer addService(String name, Class<? extends JiraService> serviceClass, long delay)
          This will add a service configuration to the JIRA DB and the service to the list of services which are running.
 JiraServiceContainer addService(String name, Class<? extends JiraService> serviceClass, 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.
 JiraServiceContainer addService(String name, String className, long delay)
          This will add a service configuration to the JIRA DB and the service to the list of services which are running.
 JiraServiceContainer addService(String name, String className, 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.
 boolean containsServiceWithId(Long id)
          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)
          This will update the service if a service with this id can be found.
 void editServiceByName(String name, long delay, Map<String,String[]> params)
          This will update the service if a service by this name can be found.
 ServiceManager.ServiceScheduleSkipper getScheduleSkipper()
          Returns the service schedule skipper.
 Collection<JiraServiceContainer> getServices()
          This gets all currently registered services with JIRA.
 Iterable<JiraServiceContainer> getServicesForExecution(long currentTime)
          Gets the services that are ready for execution at a particular time.
 JiraServiceContainer getServiceWithId(Long id)
          This will return a JiraServiceContainer for the provided id if one is registered otherwise it will return null.
 JiraServiceContainer getServiceWithName(String name)
          This will returna JiraServiceContainer for the provided name if one is registered, otherwise this will return null.
 void refreshAll()
          This will force a complete re-synch 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.
 

Method Detail

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 org.ofbiz.core.entity.GenericEntityException,
                                       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 by
className - the class defining the service
delay - how often the service should run in milliseconds
Returns:
the JiraServiceContainer that was just created
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB error.
ServiceException - If there is an error creating the Service.
ClassNotFoundException - If the className could not be resolved.
See Also:
addService(String, Class, long), addService(String, String, long, java.util.Map)

addService

JiraServiceContainer addService(String name,
                                Class<? extends JiraService> serviceClass,
                                long delay)
                                throws org.ofbiz.core.entity.GenericEntityException,
                                       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 by
serviceClass - the class defining the service
delay - how often the service should run in milliseconds
Returns:
the JiraServiceContainer that was just created
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB error.
ServiceException - If there is an error creating the Service.
See Also:
addService(String, String, long), addService(String, Class, long, java.util.Map)

addService

JiraServiceContainer addService(String name,
                                String className,
                                long delay,
                                Map<String,String[]> params)
                                throws org.ofbiz.core.entity.GenericEntityException,
                                       ServiceException,
                                       ClassNotFoundException
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 by
className - the class defining the service
delay - how often the service should run in milliseconds
params - Additional params to specify for the service
Returns:
the JiraServiceContainer that was just created
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a Db error.
ServiceException - If there is an error creating the Service.
ClassNotFoundException - If the className could not be resolved.
See Also:
addService(String, Class, long, java.util.Map), addService(String, String, long)

addService

JiraServiceContainer addService(String name,
                                Class<? extends JiraService> serviceClass,
                                long delay,
                                Map<String,String[]> params)
                                throws org.ofbiz.core.entity.GenericEntityException,
                                       ServiceException
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 by
serviceClass - the class defining the service
delay - how often the service should run in milliseconds
params - Additional params to specify for the service
Returns:
the JiraServiceContainer that was just created
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a Db error.
ServiceException - If there is an error creating the Service.
See Also:
addService(String, String, long, java.util.Map), addService(String, Class, long)

getServiceWithId

JiraServiceContainer getServiceWithId(Long id)
                                      throws Exception
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

JiraServiceContainer getServiceWithName(String name)
                                        throws Exception
This will returna 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

boolean containsServiceWithId(Long id)
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

void editServiceByName(String name,
                       long delay,
                       Map<String,String[]> params)
                       throws Exception
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 milliseconds
params - the params to set on the service
Throws:
IllegalArgumentException - if the name can not be resolved
Exception

editService

void editService(Long id,
                 long delay,
                 Map<String,String[]> params)
                 throws Exception
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 milliseconds
params - the params to set on the service
Throws:
Exception - if there is a problem updating the value

refreshServiceByName

void refreshServiceByName(String name)
                          throws Exception
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 resolved
Exception

refreshService

void refreshService(Long id)
                    throws Exception
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

void removeServiceByName(String name)
                         throws Exception
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 resolved
Exception

removeService

void removeService(Long id)
                   throws Exception
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-synch of the service cache with the values stored in the db.


getScheduleSkipper

ServiceManager.ServiceScheduleSkipper getScheduleSkipper()
Returns the service schedule skipper.

Returns:
service schedule skipper
Since:
v3.10

getServicesForExecution

Iterable<JiraServiceContainer> getServicesForExecution(long currentTime)
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


Copyright © 2002-2010 Atlassian. All Rights Reserved.