com.atlassian.jira.util
Class JiraUtils

java.lang.Object
  extended by com.atlassian.jira.util.JiraUtils

public class JiraUtils
extends Object

Miscellaneous utility methods. Most have moved into more specific classes.

See Also:
JiraEntityUtils, JiraKeyUtils, JiraTypeUtils, UserUtil, AttachmentUtils

Field Summary
static String AM
           
static String PM
           
 
Constructor Summary
JiraUtils()
           
 
Method Summary
static int get24HourTime(String meridianIndicator, int hours)
          Calculate meridian adjustment add 12 hours if meridian is set to PM - note 12pm is 12:00 in 24 hour time.
static String getHostname()
          Returns the server ip where the vm is running.
static boolean isPublicMode()
          Returns true if JIRA is really running in public mode.
static boolean isSetup()
           
static
<T> T
loadComponent(Class<T> componentClass)
           
static
<T> T
loadComponent(Class<T> componentClass, Collection<Object> extraParameters)
           
static
<T> T
loadComponent(String className, Class<?> callingClass)
          This method will load and construct a class, but also pass it through PicoContainer, to inject any dependencies.
static
<T> T
loadComponent(String className, ClassLoader classLoader)
          Deprecated. This method does not work well with Plugins2 classes and dependency injection. Please use ComponentClassManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AM

public static final String AM
See Also:
Constant Field Values

PM

public static final String PM
See Also:
Constant Field Values
Constructor Detail

JiraUtils

public JiraUtils()
Method Detail

isPublicMode

public static boolean isPublicMode()
Returns true if JIRA is really running in public mode.

That is, JIRA Mode is enabled AND there is at least one writable User Directory.

JRA-15966 Public mode should only be allowed if External User Management is disabled, otherwise we cannot create a new user in JIRA. Older versions of JIRA would allow the admin to set up an invalid combination of both External User Management and Public Mode enabled, and so we need to account for this possibility.

Returns:
true if we allow public signup in this JIRA instance.

loadComponent

public static <T> T loadComponent(String className,
                                  Class<?> callingClass)
                       throws ClassNotFoundException
This method will load and construct a class, but also pass it through PicoContainer, to inject any dependencies.

Parameters:
className - the name of the class to load.
callingClass - the class requesting the class be loaded.
Returns:
the instance of the requested class.
Throws:
ClassNotFoundException - if the class is not found on the classpath of the classloader of the calling class.
See Also:
ClassLoaderUtils.loadClass(java.lang.String,java.lang.Class), ComponentManager

loadComponent

public static <T> T loadComponent(String className,
                                  ClassLoader classLoader)
                       throws ClassNotFoundException
Deprecated. This method does not work well with Plugins2 classes and dependency injection. Please use ComponentClassManager.

This method will load and construct a class, but also pass it through PicoContainer, to inject any dependencies. Please note that this method will only find Plugins2 classes in plugins that are enabled, and cannot inject plugins2 components.

Parameters:
className - the name of the class to load
classLoader - the classloader to use to load the class
Returns:
the instance of the requested class
Throws:
ClassNotFoundException - if the given className was not able to be loaded.

loadComponent

public static <T> T loadComponent(Class<T> componentClass)

loadComponent

public static <T> T loadComponent(Class<T> componentClass,
                                  Collection<Object> extraParameters)

get24HourTime

public static int get24HourTime(String meridianIndicator,
                                int hours)
Calculate meridian adjustment add 12 hours if meridian is set to PM - note 12pm is 12:00 in 24 hour time.

Parameters:
meridianIndicator - am or pm
hours - 1-12
Returns:
1-24

isSetup

public static boolean isSetup()

getHostname

public static String getHostname()
Returns the server ip where the vm is running.

Returns:
the ip or if error 0.0.0.0


Copyright © 2002-2015 Atlassian. All Rights Reserved.