public class ConfigFileUtil
extends java.lang.Object
implements org.springframework.context.EnvironmentAware
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CDM_CONFIGFILE_OVERRIDE |
protected org.springframework.core.env.Environment |
env |
static java.lang.String |
SUBFOLDER_WEBAPP
suggested sub folder for web app related data and configurations.
|
Constructor and Description |
---|
ConfigFileUtil() |
Modifier and Type | Method and Description |
---|---|
java.io.File |
getCdmHomeDir()
Deprecated.
use
perUserCdmFolder() instead |
static java.io.File |
getCdmHomeDirFallback()
Deprecated.
use
perUserCdmFolderFallback() instead |
java.io.File |
getCdmHomeSubDir(java.lang.String subFolderName)
Returns specified the sub folder of
CDM_FOLDER_NAME . |
static java.io.File |
getCdmHomeSubDirFallback(java.lang.String subFolderName)
Deprecated.
Marked as deprecated as warning sign in the hope developers will
read the java doc for this method when using it.
|
java.io.File |
getCdmInstanceSubDir(java.lang.String subFolderName,
java.lang.String instanceName)
Returns an instance specific folder folder in
CDM_FOLDER_NAME /subFolderName
Non existing folders will be created. |
java.util.Properties |
getProperties(java.lang.String instanceName,
java.lang.String propertiesName)
Per default the
propertiesSet is loaded from a file located in
~/.cdmLibrary/remote-webapp/{instanceName}/{propertiesSet}.properties . |
java.io.File |
getPropertiesFile(java.lang.String instanceName,
java.lang.String propertiesSet)
Per default the
propertiesSet is loaded from a file located in
~/.cdmLibrary/remote-webapp/{instanceName}/{propertiesSet}.properties . |
java.io.File |
perUserCdmFolder() |
static java.io.File |
perUserCdmFolderFallback()
Deprecated.
Marked as deprecated as warning sign in the hope developers will
read the java doc for this method when using it.
|
ConfigFileUtil |
setDefaultContent(java.lang.String content) |
void |
setEnvironment(org.springframework.core.env.Environment environment) |
public static final java.lang.String SUBFOLDER_WEBAPP
protected org.springframework.core.env.Environment env
public static final java.lang.String CDM_CONFIGFILE_OVERRIDE
public java.io.File perUserCdmFolder()
@Deprecated public java.io.File getCdmHomeDir()
perUserCdmFolder()
instead@Deprecated public static java.io.File perUserCdmFolderFallback()
${user.home}./cdmLibrary
folder without taking
additional property sources into account which could be configured in
the Spring application context.
This method can be used if an application context is not (yet) available, but
should be used with caution, since this location might differ from the location
used by other components of the application which make use of the
perUserCdmFolder()
method.
@Deprecated public static java.io.File getCdmHomeDirFallback()
perUserCdmFolderFallback()
insteadpublic void setEnvironment(org.springframework.core.env.Environment environment)
setEnvironment
in interface org.springframework.context.EnvironmentAware
public java.io.File getCdmHomeSubDir(java.lang.String subFolderName)
CDM_FOLDER_NAME
.
If the sub folder does not exist it will be created.subFolderName
- #SUBFOLDER_WEBAPP}
@Deprecated public static java.io.File getCdmHomeSubDirFallback(java.lang.String subFolderName)
${user.home}./cdmLibrary
folder without taking
additional property sources into account which could be configured in
the Spring application context.
This method can be used if an application context is not (yet) available, but
should be used with caution, since this location might differ from the location
used by other components of the application which make use of the
perUserCdmFolder()
method.
public java.io.File getCdmInstanceSubDir(java.lang.String subFolderName, java.lang.String instanceName)
CDM_FOLDER_NAME
/subFolderName
Non existing folders will be created.subFolderName
- The name of a sub-folder. In most cases this will be SUBFOLDER_WEBAPP
instanceName
- The name of the application instance. The name should be related to the data source id.#SUBFOLDER_WEBAPP}
public ConfigFileUtil setDefaultContent(java.lang.String content)
public java.io.File getPropertiesFile(java.lang.String instanceName, java.lang.String propertiesSet)
propertiesSet
is loaded from a file located in
~/.cdmLibrary/remote-webapp/{instanceName}/{propertiesSet}.properties
.
This behavior can be overwritten by setting the java System property
cdm.configfile.override.{propertiesSet}
to an alternative file location.
This mechanism should only be used for unit and integration tests.
instanceName
- the name of the cdm instance. This value can be retrieved from the
Spring environment with the key DataSourceConfigurer.CDM_DATA_SOURCE_ID ("")propertiesSet
- The base name of the properties file to be loaded. This name is extended with
".properties" to form the actual filenamepublic java.util.Properties getProperties(java.lang.String instanceName, java.lang.String propertiesName) throws java.io.IOException
propertiesSet
is loaded from a file located in
~/.cdmLibrary/remote-webapp/{instanceName}/{propertiesSet}.properties
.
This behavior can be overwritten by setting the java System property
cdm.configfile.override.{propertiesSet}
to an alternative file location.
This mechanism should only be used for unit and integration tests.
instanceName
- the name of the cdm instance. This value can be retrieved from the
Spring environment with the key DataSourceConfigurer.CDM_DATA_SOURCE_ID ("")propertiesSet
- The base name of the properties file to be loaded. This name is extended with
".properties" to form the actual filenamejava.io.IOException
Copyright © 2007-2020 EDIT. All Rights Reserved.