Top Description Inners Fields Constructors Methods
net.sf.ehcache.config

public final Class DiskStoreConfiguration

extends Object
Class Inheritance
Imports
java.io.File, java.util.regex.Matcher, .Pattern, org.slf4j.Logger, .LoggerFactory

A class to represent DiskStore configuration e.g. <diskStore path="${java.io.tmpdir}" />
Author
Greg Luck
Version
$Id: DiskStoreConfiguration.java 10789 2018-04-26 02:08:13Z adahanne $

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum
DiskStoreConfiguration.Env

A constants class for environment variables used in disk store paths

Field Summary

Modifier and TypeField and Description
private static final Logger
private String
originalPath

The path as specified in the config

private String
path

The path to the directory where .data and .index files will be created.

private static final Pattern

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String
getDefaultPath()

The diskStore default path, which is the system environment variable available on all Java virtual machines java.io.tmpdir

public String

Returns:

the originalPath
getOriginalPath
()

public final String
getPath()

The diskStore path

public final DiskStoreConfiguration

Returns:

this configuration instance
path
(final String path)

Builder method to set the disk store path, see setPath(String)

public final void
setPath(final String
disk store path
path
)

Translates and sets the path.

private static String
private static String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private static final Logger LOG
originalPathback to summary
private String originalPath

The path as specified in the config

pathback to summary
private String path

The path to the directory where .data and .index files will be created.

PROPERTY_SUBSTITUTION_PATTERNback to summary
private static final Pattern PROPERTY_SUBSTITUTION_PATTERN

Constructor Detail

DiskStoreConfigurationback to summary
public DiskStoreConfiguration()

Method Detail

getDefaultPathback to summary
public static String getDefaultPath()

The diskStore default path, which is the system environment variable available on all Java virtual machines java.io.tmpdir

getOriginalPathback to summary
public String getOriginalPath()
Returns:String

the originalPath

getPathback to summary
public final String getPath()

The diskStore path

pathback to summary
public final DiskStoreConfiguration path(final String path)

Builder method to set the disk store path, see setPath(String)

Returns:DiskStoreConfiguration

this configuration instance

setPathback to summary
public final void setPath(final String path)

Translates and sets the path.

Two forms of path substitution are supported:

  1. To support legacy configurations, four explicit string tokens are replaced with their associated Java system property values. This substitution happens for the first matching token only (e.g. java.io.tmpdir/ehcache/java.io.tmpdir → /var/tmp/ehcache/java.io.tmpdir).
    • user.home - the user's home directory
    • user.dir - the current working directory
    • java.io.tmpdir - the default temp file path
    • ehcache.disk.store.dir - a system property you would normally specify on the command line, e.g. java -Dehcache.disk.store.dir=/u01/myapp/diskdir
  2. These, and all other system properties can also be substituted using the familiar syntax: ${property-name}. Using this syntax all token instances are replaced (e.g. ${java.io.tmpdir}/ehcache/${java.io.tmpdir} → /var/tmp/ehcache/var/tmp).
Parameters
path:String

disk store path

substitutePropertiesback to summary
private static String substituteProperties(String string)
translatePathback to summary
private static String translatePath(String path)
net.sf.ehcache.config back to summary

private final Enum DiskStoreConfiguration.Env

extends Enum<DiskStoreConfiguration.Env>
Class Inheritance

A constants class for environment variables used in disk store paths

Field Summary

Modifier and TypeField and Description
public static final DiskStoreConfiguration.Env
public static final DiskStoreConfiguration.Env
public static final DiskStoreConfiguration.Env
public static final DiskStoreConfiguration.Env
private final String

Constructor Summary

AccessConstructor and Description
private
Env(String variable)

Method Summary

Modifier and TypeMethod and Description
pack-priv String
public static DiskStoreConfiguration.Env
public static DiskStoreConfiguration.Env[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

EHCACHE_DISK_STORE_DIRback to summary
public static final DiskStoreConfiguration.Env EHCACHE_DISK_STORE_DIR
JAVA_IO_TMPDIRback to summary
public static final DiskStoreConfiguration.Env JAVA_IO_TMPDIR
USER_DIRback to summary
public static final DiskStoreConfiguration.Env USER_DIR
USER_HOMEback to summary
public static final DiskStoreConfiguration.Env USER_HOME
variableback to summary
private final String variable

Constructor Detail

Envback to summary
private Env(String variable)

Method Detail

substituteback to summary
pack-priv String substitute(String string)
valueOfback to summary
public static DiskStoreConfiguration.Env valueOf(String name)
valuesback to summary
public static DiskStoreConfiguration.Env[] values()