ApplicationEnvironment

public final class ApplicationEnvironment

Utility class for handling the ENVIRONMENT system variable. The only meaningful value for the variable at the moment DEVELOPMENT, which will cause MOTECH to load static resources from disk paths instead of jar classpaths. It also allows resolving of these disk paths for given bundle name.

Fields

DEVELOPMENT

public static final String DEVELOPMENT

The value representing development mode.

ENVIRONMENT

public static final String ENVIRONMENT

The name of the variable controlling whether we are in development mode.

Methods

getEnvironment

public static String getEnvironment()
Returns:the value of the environment variable

getModulePath

public static String getModulePath(BundleName bundleName)

Returns the root disk path from which resources for the bundle with a given name should be loaded. This is controlled by system variables with names equal to bundle symbolic names with dots and dashes replaced with underscores. For example, the path for a bundle with the symbolic name org.motechproject.cms-lite is controlled by the system variable org_motechproject_cms_lite.

Parameters:
  • bundleName – the name of bundle
Returns:

the root path from which to load bundle resources or null if it is not set

isInDevelopmentMode

public static boolean isInDevelopmentMode()

Checks whether we are in development mode, meaning that the ENVIRONMENT system variable was set to DEVELOPMENT.

Returns:true if we are in development mode, false otherwise