ConfigLocation

public class ConfigLocation

Defines a MOTECH configuration location. If the given location starts with a leading file separator character, the location is treated as a file system directory. Otherwise, it is treated as a classpath location.

Constructors

ConfigLocation

public ConfigLocation(String configLocation)

Creates a config location instance.

Parameters:
  • configLocation – the path to the config location

Methods

equals

public boolean equals(Object o)

getExistingConfigFiles

public List<File> getExistingConfigFiles()

getFile

public File getFile(String fileName, FileAccessType accessType)

This method Returns the java.io.File object for the given file name relative to the config location. It also checks for the requested file accessibility. If the requested access type check is org.motechproject.config.core.domain.ConfigLocation.FileAccessType.READABLE, the file’s existence and readability will be checked. Similarly, if the requested access type check is ConfigLocation.FileAccessType.WRITABLE, then the write accessibility to the file will be checked. If the file does not exists, write accessibility of its ancestors will be checked.

Parameters:
Throws:
Returns:

File relative to the config location.

getLocation

public String getLocation()
Returns:the location path

getUrlResource

public UrlResource getUrlResource()
Throws:
  • MalformedURLException – if the location is not a valid url
Returns:

UrlResource instance representing this config location

hasPlatformConfigurationFile

public boolean hasPlatformConfigurationFile()

hashCode

public int hashCode()

toResource

public Resource toResource()

Resource corresponding to the config location.

Returns:resource

toString

public String toString()