public class

MockJiraServiceContainer

extends Object
implements JiraServiceContainer
java.lang.Object
   ↳ com.atlassian.jira.service.MockJiraServiceContainer

Summary

Nested Classes
class MockJiraServiceContainer.Builder  
[Expand]
Inherited Fields
From interface com.atlassian.jira.service.JiraService
Public Methods
void destroy()
This method is called when the service is unloaded (usually when the web application or server is being shut down).
boolean equals(Object obj)
String getDefaultProperty(String propertyKey)
Returns the default property value for a key
long getDelay()
String getDescription()
A textual description of the service.
Long getId()
String getKey()
Return the key of this object
long getLastRun()
Long getLongProperty(String propertyKey)
Returns a property of this object with the specified key as a long
String getName()
A textual name of the service as entered by the user from the web interface.
ObjectConfiguration getObjectConfiguration()
Retrieves an object configuration object with properties that can be set
PropertySet getProperties()
Retrieve all the specified Properties for this object
String getProperty(String propertyKey)
Returns a property of this object with the specified key
String getServiceClass()
Class getServiceClassObject()
String getTextProperty(String propertyKey)
Returns a property of this object with the specified key, the property is of type text
boolean hasProperty(String propertyKey)
Checks if this object has a particular property
void init(PropertySet props)
Initialise the service.
boolean isDueAt(long time)
Is this service due to run at the specified time.
boolean isInternal()
Indicates whether administrators can delete this service from within the web interface.
boolean isLocalService()
Returns true if in a clustered environment this service should run locally on every node.
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()
Record when run.
void setName(String name)
Used to set the service's name.
void setRunning(boolean running)
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.configurable.ObjectConfigurable
From interface com.atlassian.jira.service.JiraService
From interface com.atlassian.jira.service.JiraServiceContainer
From interface java.lang.Runnable

Public Methods

public void destroy ()

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.

public boolean equals (Object obj)

public String getDefaultProperty (String propertyKey)

Returns the default property value for a key

Parameters
propertyKey String key used to retrieve the properties default value
Returns
  • Default property key

public long getDelay ()

public String getDescription ()

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.

Returns
  • A HTML description of the service

public Long getId ()

public String getKey ()

Return the key of this object

Returns
  • Key of object

public long getLastRun ()

public Long getLongProperty (String propertyKey)

Returns a property of this object with the specified key as a long

Parameters
propertyKey String key used to retrieve the property value
Returns
  • Property value

public String getName ()

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

Returns
  • The name of the service

public ObjectConfiguration getObjectConfiguration ()

Retrieves an object configuration object with properties that can be set

Returns
  • ObjectConfiguration object

public PropertySet getProperties ()

Retrieve all the specified Properties for this object

Returns
  • Set of properties for this object

public String getProperty (String propertyKey)

Returns a property of this object with the specified key

Parameters
propertyKey String key used to retrieve the property value
Returns
  • Property value

public String getServiceClass ()

public Class getServiceClassObject ()

public String getTextProperty (String propertyKey)

Returns a property of this object with the specified key, the property is of type text

Parameters
propertyKey String key used to retrieve the property value
Returns
  • Property value

public boolean hasProperty (String propertyKey)

Checks if this object has a particular property

Parameters
propertyKey to look for
Returns
  • true If there is a value

public void init (PropertySet props)

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.

Parameters
props initialisation parameters

public boolean isDueAt (long time)

Is this service due to run at the specified time.

Parameters
time the time to check whether it is due.
Returns
  • true if due.

public boolean isInternal ()

Indicates whether administrators can delete this service from within the web interface.

Generally only Atlassian services should return true from this.

Returns
  • true if this service is internal to JIRA, false otherwise

public boolean isLocalService ()

Returns true if in a clustered environment this service should run locally on every node.

Returns
  • true if in a clustered environment this service should run locally on every node.

public boolean isRunning ()

public boolean isUnique ()

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

Returns
  • Whether this service class should be unique.

public boolean isUsable ()

public void run ()

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.

public void setDelay (long delay)

public void setLastRun ()

Record when run.

public void setName (String name)

Used to set the service's name. For details on the services name see getName()

Parameters
name service name to set

public void setRunning (boolean running)

public String toString ()