com.atlassian.jira.service.services.file
Class AbstractMessageHandlingService

java.lang.Object
  extended by com.atlassian.jira.service.AbstractService
      extended by com.atlassian.jira.service.services.file.AbstractMessageHandlingService
All Implemented Interfaces:
ObjectConfigurable, JiraService, Runnable
Direct Known Subclasses:
FileService, MailFetcherService

@Internal
public abstract class AbstractMessageHandlingService
extends AbstractService

An abstract service to be subclassed by any service which wants to use MessageHandlers. This clas is goint to be hopefuly moved to JIRA Mail Plugin.


Nested Class Summary
static class AbstractMessageHandlingService.HandlerDisablementListener
          This class only purpose is to respond quickly to possible disablement of a plugin module which defines the handler used by descendants of AbstractMessageHandlingService class.
 
Field Summary
static String KEY_HANDLER
           
static String KEY_HANDLER_PARAMS
           
static int MAX_READ_MESSAGES_DRY_RUN
           
 
Fields inherited from class com.atlassian.jira.service.AbstractService
log, name
 
Fields inherited from interface com.atlassian.jira.service.JiraService
NAME_COMPARATOR
 
Constructor Summary
AbstractMessageHandlingService()
           
 
Method Summary
protected abstract  String addHandlerInfo(String msg)
           
 void destroy()
          This method is not really called when JIRA Service manager discards the instance of this service.
 MessageHandler getHandler()
           
protected abstract  org.apache.log4j.Logger getLogger()
           
 void init(com.opensymphony.module.propertyset.PropertySet props)
          Initialise the service.
 void run()
          This method must be implemented in a subclass, and performs the functionality that the service performs.
protected abstract  void runImpl(MessageHandlerContext context)
           
 void setContext(MessageHandlerContext context)
           
 
Methods inherited from class com.atlassian.jira.service.AbstractService
getDefaultProperty, getDescription, getKey, getLongProperty, getName, getObjectConfiguration, getProperties, getProperty, getTextProperty, hasProperty, isInternal, isUnique, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.configurable.ObjectConfigurable
getObjectConfiguration
 

Field Detail

KEY_HANDLER

public static final String KEY_HANDLER
See Also:
Constant Field Values

KEY_HANDLER_PARAMS

public static final String KEY_HANDLER_PARAMS
See Also:
Constant Field Values

MAX_READ_MESSAGES_DRY_RUN

public static final int MAX_READ_MESSAGES_DRY_RUN
See Also:
Constant Field Values
Constructor Detail

AbstractMessageHandlingService

public AbstractMessageHandlingService()
Method Detail

setContext

public void setContext(MessageHandlerContext context)

destroy

public void destroy()
This method is not really called when JIRA Service manager discards the instance of this service. That's why we have to play with weak references in the disablement listener Anyway, for the sake of completeness, we are cleaning the stuff also here.

Specified by:
destroy in interface JiraService
Overrides:
destroy in class AbstractService

init

public void init(com.opensymphony.module.propertyset.PropertySet props)
          throws ObjectConfigurationException
Description copied from interface: JiraService
Initialise the service. This method is guaranteed to be called before the first call to run().

As the parameters are gained from the user's interaction with the website, it is not guaranteed to be called with the correct, or indeed with any parameters.

init() may be called multiple times during the services lifetime.

Specified by:
init in interface JiraService
Overrides:
init in class AbstractService
Parameters:
props - initialisation parameters
Throws:
ObjectConfigurationException - in case of an error with initialisation parameters

runImpl

protected abstract void runImpl(MessageHandlerContext context)

run

public void run()
Description copied from class: AbstractService
This method must be implemented in a subclass, and performs the functionality that the service performs. This method is called after the duration specified through the administration web interface.

Specified by:
run in interface JiraService
Specified by:
run in interface Runnable
Specified by:
run in class AbstractService
See Also:
JiraService.init(com.opensymphony.module.propertyset.PropertySet)

getHandler

public MessageHandler getHandler()

addHandlerInfo

protected abstract String addHandlerInfo(String msg)

getLogger

protected abstract org.apache.log4j.Logger getLogger()


Copyright © 2002-2012 Atlassian. All Rights Reserved.