com.atlassian.jira.service
Class UnloadableJiraServiceContainer

java.lang.Object
  extended by com.atlassian.jira.service.UnloadableJiraServiceContainer
All Implemented Interfaces:
com.atlassian.configurable.ObjectConfigurable, JiraService, JiraServiceContainer

public class UnloadableJiraServiceContainer
extends Object
implements JiraServiceContainer

Used to represent a ServiceContainer that could not be properly loaded. This is used to represent database values that are left behind from old services that are no longer deployed. We need this so that the users can remove this service if need be.


Field Summary
 
Fields inherited from interface com.atlassian.jira.service.JiraService
NAME_COMPARATOR
 
Constructor Summary
UnloadableJiraServiceContainer(Long id, String name, String clazz, long delay)
           
 
Method Summary
 void destroy()
          This method is called when the service is unloaded (usually when the web application or server is being shut down).
 String getDefaultProperty(String propertyKey)
           
 long getDelay()
           
 String getDescription()
          A textual description of the service.
 Long getId()
           
 String getKey()
           
 long getLastRun()
           
 Long getLongProperty(String propertyKey)
           
 String getName()
          A textual name of the service as entered by the user from the web interface.
 com.atlassian.configurable.ObjectConfiguration getObjectConfiguration()
           
 com.opensymphony.module.propertyset.PropertySet getProperties()
           
 String getProperty(String propertyKey)
           
 String getServiceClass()
           
 String getTextProperty(String propertyKey)
           
 boolean hasProperty(String propertyKey)
           
 void init(com.opensymphony.module.propertyset.PropertySet props)
          Initialise the service.
 boolean isInternal()
          Indicates whether administrators can delete this service from within the web interface.
 boolean isRunning()
           
 boolean isUnique()
          Whether this service class should be unique.
 boolean isUsable()
           
 void run()
          Perform the action of this service.
 void setDelay(long delay)
           
 void setLastRun()
           
 void setName(String name)
          Used to set the service's name.
 void setRunning(boolean running)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnloadableJiraServiceContainer

public UnloadableJiraServiceContainer(Long id,
                                      String name,
                                      String clazz,
                                      long delay)
Method Detail

getName

public String getName()
Description copied from interface: JiraService
A textual name of the service as entered by the user from the web interface.

The name should be unique to identify services of the same class.
This is enforced when adding new services via the web interface.

The value of name does not effect the service, hence can be set to null

Specified by:
getName in interface JiraService
Returns:
The name of the service

setName

public void setName(String name)
Description copied from interface: JiraService
Used to set the service's name. For details on the services name see JiraService.getName()

Specified by:
setName in interface JiraService

getDelay

public long getDelay()
Specified by:
getDelay in interface JiraServiceContainer

setDelay

public void setDelay(long delay)
Specified by:
setDelay in interface JiraServiceContainer

getServiceClass

public String getServiceClass()
Specified by:
getServiceClass in interface JiraServiceContainer

isUsable

public boolean isUsable()
Specified by:
isUsable in interface JiraServiceContainer

getId

public Long getId()
Specified by:
getId in interface JiraServiceContainer

getLastRun

public long getLastRun()
Specified by:
getLastRun in interface JiraServiceContainer

setLastRun

public void setLastRun()
Specified by:
setLastRun in interface JiraServiceContainer

isRunning

public boolean isRunning()
Specified by:
isRunning in interface JiraServiceContainer

setRunning

public void setRunning(boolean running)
Specified by:
setRunning in interface JiraServiceContainer

init

public void init(com.opensymphony.module.propertyset.PropertySet props)
          throws com.atlassian.configurable.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
Throws:
com.atlassian.configurable.ObjectConfigurationException

run

public void run()
Description copied from interface: JiraService
Perform the action of this service. The caller of this method assumes that no housekeeping has been done, and will call setLastRun() after the run() method.

init() is guaranteed to be called before run(), but the parameters passed to init() are not guaranteed to be correct. Any parameters expected to be set by init() should be checked in this method upon each invocation.

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

destroy

public void destroy()
Description copied from interface: JiraService
This method is called when the service is unloaded (usually when the web application or server is being shut down).

You may wish to remove any connections that you have established, eg. database connections.

Specified by:
destroy in interface JiraService

isInternal

public boolean isInternal()
Description copied from interface: JiraService
Indicates whether administrators can delete this service from within the web interface.

Generally only Atlassian services should return true from this.

Specified by:
isInternal in interface JiraService

isUnique

public boolean isUnique()
Description copied from interface: JiraService
Whether this service class should be unique. Some service are fine to have multiples, and some are not.

Having multiple backup services could be fine - perhaps you want to backup once an hour, and also once a day.

With other services, you may wish to enforce their uniqueness

Specified by:
isUnique in interface JiraService
Returns:
Whether this service class should be unique.

getDescription

public String getDescription()
Description copied from interface: JiraService
A textual description of the service. You can include HTML if required, but do not use tables, or DHTML, as the description may be displayed inside tables / frames.

A good description will describe what this service does, and then explains the parameters required for configuring the service.

If no description is appropriate, return null.

Specified by:
getDescription in interface JiraService
Returns:
A HTML description of the service

getObjectConfiguration

public com.atlassian.configurable.ObjectConfiguration getObjectConfiguration()
                                                                      throws com.atlassian.configurable.ObjectConfigurationException
Specified by:
getObjectConfiguration in interface com.atlassian.configurable.ObjectConfigurable
Throws:
com.atlassian.configurable.ObjectConfigurationException

hasProperty

public boolean hasProperty(String propertyKey)
                    throws com.atlassian.configurable.ObjectConfigurationException
Specified by:
hasProperty in interface com.atlassian.configurable.ObjectConfigurable
Throws:
com.atlassian.configurable.ObjectConfigurationException

getProperty

public String getProperty(String propertyKey)
                   throws com.atlassian.configurable.ObjectConfigurationException
Specified by:
getProperty in interface com.atlassian.configurable.ObjectConfigurable
Throws:
com.atlassian.configurable.ObjectConfigurationException

getTextProperty

public String getTextProperty(String propertyKey)
                       throws com.atlassian.configurable.ObjectConfigurationException
Specified by:
getTextProperty in interface com.atlassian.configurable.ObjectConfigurable
Throws:
com.atlassian.configurable.ObjectConfigurationException

getLongProperty

public Long getLongProperty(String propertyKey)
                     throws com.atlassian.configurable.ObjectConfigurationException
Specified by:
getLongProperty in interface com.atlassian.configurable.ObjectConfigurable
Throws:
com.atlassian.configurable.ObjectConfigurationException

getDefaultProperty

public String getDefaultProperty(String propertyKey)
                          throws com.atlassian.configurable.ObjectConfigurationException
Specified by:
getDefaultProperty in interface com.atlassian.configurable.ObjectConfigurable
Throws:
com.atlassian.configurable.ObjectConfigurationException

getProperties

public com.opensymphony.module.propertyset.PropertySet getProperties()
                                                              throws com.atlassian.configurable.ObjectConfigurationException
Specified by:
getProperties in interface com.atlassian.configurable.ObjectConfigurable
Throws:
com.atlassian.configurable.ObjectConfigurationException

getKey

public String getKey()
Specified by:
getKey in interface com.atlassian.configurable.ObjectConfigurable


Copyright © 2002-2007 Atlassian. All Rights Reserved.