Package org.cyclos.server.utils
Class CyclosProperties
- java.lang.Object
-
- org.cyclos.server.utils.CyclosProperties
-
public class CyclosProperties extends Object
Contains helpers to read from cyclos.properties
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description CyclosProperties(Properties properties, Map<String,String> pathMappings)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetArchiveAccountFeesDays()intgetArchiveBulkActionsDays()Returns the number of days before bulk actions are archived.intgetArchiveImportsDays()Returns the number of days before archiving processed imports, or removing failed ones.intgetBackgroundTaskCapacity()Returns 60% of thegetMaxBackgroundTasks()settingcom.google.common.cache.CacheBuilderSpecgetCacheSpec(String name)Returns theCacheBuilderSpecfor the cache with the given nameStringgetClusterHandlerClass()Returns the class which handles clustering tasksList<String>getCorsOrigins()Map<String,String>getCyclosProperties()Returns only those properties explicitly defined (in the file or as a system property) that starts withPROPERTY_PREFIXStringgetDataSourceProviderClass()Returns the data source provider classPropertiesgetDataSourceProviderProperties()Returns the properties which are passed to the data source providerStringgetDbPopulatorClass()Returns the populator class for the initial databaseStringgetDbQueryHandlerClass()Returns the native query handler classintgetExpireExternalPaymentsDays()Returns the number of days a pending external payment remains in the system until it's expired.StringgetIdMaskClass()Returns the class for the id maskStringgetLicenseUrl()Returns the URL of the license serverStringgetLogDataSourceProviderClass()Returns the class name to use as log data source provider when logging to an external databasePropertiesgetLogDataSourceProviderProperties()Returns the configuration properties for the log data source provider when logging to an external databaseStringgetLogDir()Returns the directory where logs should be saved.intgetLogMaxFiles()intgetLogMaxFileSize()StringgetLogProviderClass()intgetLogThreads()Returns the number of threads which will process logs, or 0 if not threadedintgetMailSleepSeconds()Returns the number of seconds the e-mail sending should sleepintgetMaxBackgroundTasks()Returns the maximum background tasks to execute in this Cyclos instance.intgetMaxBCryptStrength()Returns the maximum BCrypt strength allowed for password types in any networkStringgetNFCTokenTypeKey()Returns the NFC Token Principal type keyintgetPollingTaskCapacity()Returns 40% of thegetMaxBackgroundTasks()settingPropertiesgetProperties()Returns the entirePropertiesobjectStringgetProtocolHeader()Returns the header which is used to read the original connection protocol (to the proxy / load balancer)intgetPurgeMessagesOnTrashDays()Returns the number of days messages should be left on trash before being permanently removed.intgetPurgeNotificationsDays()Returns the number of days notifications should be kept before being permanently removed.intgetPurgeUnconfirmedUsersDays()Returns the number of days users pending e-mail confirmation should be kept before being permanently removed.intgetRateLimitGlobal()The rate limit, in request per second, for all clientsintgetRateLimitIp()The rate limit, in requests per second, per IP addressStringgetRateLimitWhitelist()The list of IP addresses to which the rate limit is not appliedStringgetRemoteAddressHeader()Returns the header which is used to read the remote address instead of reading directly from requestsintgetRemoteAddressHeaderIndex()Returns the index used to retrieve the remote address from comma-separated list associated to thegetRemoteAddressHeader()Map<String,String>getResponseHeaders()Headers that should be sent on HTTP responsesStringgetSassExecutable()StringgetSearchHandlerClass()Returns the class name used to handle searchesPropertiesgetSearchHandlerProperties()Returns the properties for the search handlerstatic StringgetStoredFileContentManagerAlias(String className)StringgetStoredFileContentManagerClass()Returns the class which handles the file's contents storage.PropertiesgetStoredFileContentManagerProperties()static Map<String,String>getStoredFileContentManagers()FilegetTempDir()Returns the directory where temporary / cached files are storedbooleanisCacheQueries()Returns whether the queries cache is enabledbooleanisDbManaged()Returns whether the database is managed automaticallybooleanisDebuggableEnv()Returns whether the runtime environment is debuggable or not.
When in dev or running the tests it returns truebooleanisDevelopment()Indicates whether Cyclos is running in development modebooleanisDisableSearchEnginesIndexing()Returns whether indexing by search engines should be disabledbooleanisDumpAllErrors()Returns whether all errors should be dumped to the error logbooleanisForceFlushOnEveryTransaction()Returns whether to force flush on every transaction or not.booleanisLicenseIgnoreIssueReports()booleanisRestReference()Returns whether the REST API reference page (at _root_/api is enabled)booleanisSessionsAnyAddress()Returns whether sessions can be validated from any IP address (true) or only for the original IP address (false)booleanisSkipEmails()Returns whether emails must be skippedbooleanisSkipInitializations()booleanisTestingEnv()Indicates whether Cyclos is running the JUnit testsbooleanisUsingElasticsearch()Return if it is using elasticsearch as search handlerstatic booleanisUsingElasticsearch(String searchHandler)booleanisWebServicesGzip()Returns whether to gzip web services responses larger than a thresholdFileresolveFile(String path)Resolves the physical file descriptor for the given path, replacing variables like %t by the temp dir
-
-
-
Field Detail
-
PROPERTY_PREFIX
public static final String PROPERTY_PREFIX
- See Also:
- Constant Field Values
-
CYCLOS_PROPERTIES
public static final String CYCLOS_PROPERTIES
- See Also:
- Constant Field Values
-
DEVELOPMENT
public static final String DEVELOPMENT
- See Also:
- Constant Field Values
-
DATASOURCE_PREFIX
public static final String DATASOURCE_PREFIX
- See Also:
- Constant Field Values
-
DATASOURCE_PROVIDER_SUFFIX
public static final String DATASOURCE_PROVIDER_SUFFIX
- See Also:
- Constant Field Values
-
C3P0_CONNECTION_TESTER_KEY
public static final String C3P0_CONNECTION_TESTER_KEY
- See Also:
- Constant Field Values
-
C3P0_CONNECTION_TESTER_CLASS
public static final String C3P0_CONNECTION_TESTER_CLASS
- See Also:
- Constant Field Values
-
ID_MASK
public static final String ID_MASK
- See Also:
- Constant Field Values
-
NFC_TOKEN_TYPE_KEY
public static final String NFC_TOKEN_TYPE_KEY
- See Also:
- Constant Field Values
-
MAX_BCRYPT_STRENGTH
public static final String MAX_BCRYPT_STRENGTH
- See Also:
- Constant Field Values
-
DB_MANAGED
public static final String DB_MANAGED
- See Also:
- Constant Field Values
-
DB_POPULATOR
public static final String DB_POPULATOR
- See Also:
- Constant Field Values
-
DB_QUERY_HANDLER
public static final String DB_QUERY_HANDLER
- See Also:
- Constant Field Values
-
SEARCH_HANDLER
public static final String SEARCH_HANDLER
- See Also:
- Constant Field Values
-
FORCE_FLUSH_ON_EVERY_TRANSACTION
public static final String FORCE_FLUSH_ON_EVERY_TRANSACTION
- See Also:
- Constant Field Values
-
LICENSE_URL
public static final String LICENSE_URL
- See Also:
- Constant Field Values
-
LICENSE_IGNORE_ISSUE_REPORTS
public static final String LICENSE_IGNORE_ISSUE_REPORTS
- See Also:
- Constant Field Values
-
CLUSTER_HANDLER
public static final String CLUSTER_HANDLER
- See Also:
- Constant Field Values
-
STORED_FILE_CONTENT_MANAGER
public static final String STORED_FILE_CONTENT_MANAGER
- See Also:
- Constant Field Values
-
TEMP_DIR
public static final String TEMP_DIR
- See Also:
- Constant Field Values
-
CACHE_PREFIX
public static final String CACHE_PREFIX
- See Also:
- Constant Field Values
-
LOG_THREADS
public static final String LOG_THREADS
- See Also:
- Constant Field Values
-
LOG_PROVIDER
public static final String LOG_PROVIDER
- See Also:
- Constant Field Values
-
LOG_DIR
public static final String LOG_DIR
- See Also:
- Constant Field Values
-
LOG_MAX_FILES
public static final String LOG_MAX_FILES
- See Also:
- Constant Field Values
-
LOG_MAX_FILE_SIZE
public static final String LOG_MAX_FILE_SIZE
- See Also:
- Constant Field Values
-
LOG_DATASOURCE_PREFIX
public static final String LOG_DATASOURCE_PREFIX
- See Also:
- Constant Field Values
-
MAIL_SLEEP_SECONDS
public static final String MAIL_SLEEP_SECONDS
- See Also:
- Constant Field Values
-
QUERY_CACHE
public static final String QUERY_CACHE
- See Also:
- Constant Field Values
-
CORS_ORIGIN
public static final String CORS_ORIGIN
- See Also:
- Constant Field Values
-
REST_REFERENCE
public static final String REST_REFERENCE
- See Also:
- Constant Field Values
-
MAX_BACKGROUND_TASKS
public static final String MAX_BACKGROUND_TASKS
- See Also:
- Constant Field Values
-
SKIP_INITIALIZATIONS
public static final String SKIP_INITIALIZATIONS
- See Also:
- Constant Field Values
-
DUMP_ALL_ERRORS
public static final String DUMP_ALL_ERRORS
- See Also:
- Constant Field Values
-
SKIP_EMAILS
public static final String SKIP_EMAILS
- See Also:
- Constant Field Values
-
DISABLE_SEARCH_ENGINES_INDEXING
public static final String DISABLE_SEARCH_ENGINES_INDEXING
- See Also:
- Constant Field Values
-
PURGE_MESSAGES_ON_TRASH_DAYS
public static final String PURGE_MESSAGES_ON_TRASH_DAYS
- See Also:
- Constant Field Values
-
PURGE_NOTIFICATIONS_DAYS
public static final String PURGE_NOTIFICATIONS_DAYS
- See Also:
- Constant Field Values
-
PURGE_UNCONFIRMED_USERS_DAYS
public static final String PURGE_UNCONFIRMED_USERS_DAYS
- See Also:
- Constant Field Values
-
ARCHIVE_IMPORTS_DAYS
public static final String ARCHIVE_IMPORTS_DAYS
- See Also:
- Constant Field Values
-
ARCHIVE_ACCOUNT_FEES_DAYS
public static final String ARCHIVE_ACCOUNT_FEES_DAYS
- See Also:
- Constant Field Values
-
ARCHIVE_BULK_ACTIONS_DAYS
public static final String ARCHIVE_BULK_ACTIONS_DAYS
- See Also:
- Constant Field Values
-
EXPIRE_EXTERNAL_PAYMENTS_DAYS
public static final String EXPIRE_EXTERNAL_PAYMENTS_DAYS
- See Also:
- Constant Field Values
-
HEADER_REMOTE_ADDRESS
public static final String HEADER_REMOTE_ADDRESS
- See Also:
- Constant Field Values
-
HEADER_REMOTE_ADDRESS_INDEX
public static final String HEADER_REMOTE_ADDRESS_INDEX
- See Also:
- Constant Field Values
-
HEADER_PROTOCOL
public static final String HEADER_PROTOCOL
- See Also:
- Constant Field Values
-
SESSIONS_ANY_ADDRESS
public static final String SESSIONS_ANY_ADDRESS
- See Also:
- Constant Field Values
-
WEB_SERVICES_GZIP
public static final String WEB_SERVICES_GZIP
- See Also:
- Constant Field Values
-
RATE_LIMIT_GLOBAL
public static final String RATE_LIMIT_GLOBAL
- See Also:
- Constant Field Values
-
RATE_LIMIT_IP
public static final String RATE_LIMIT_IP
- See Also:
- Constant Field Values
-
RATE_LIMIT_WHITELIST
public static final String RATE_LIMIT_WHITELIST
- See Also:
- Constant Field Values
-
RESPONSE_HEADERS_PREFIX
public static final String RESPONSE_HEADERS_PREFIX
- See Also:
- Constant Field Values
-
SASS_EXECUTABLE
public static final String SASS_EXECUTABLE
- See Also:
- Constant Field Values
-
NFC_TOKEN_TYPE_KEY_ZERO_VALUE
public static final String NFC_TOKEN_TYPE_KEY_ZERO_VALUE
The following are the possible values for the property linkNFC_TOKEN_TYPE_KEY- See Also:
- Constant Field Values
-
NFC_TOKEN_TYPE_KEY_RANDOM_VALUE
public static final String NFC_TOKEN_TYPE_KEY_RANDOM_VALUE
- See Also:
- Constant Field Values
-
DEFAULT_NFC_TOKEN_TYPE_KEY
public static final String DEFAULT_NFC_TOKEN_TYPE_KEY
This is the default value for the property linkNFC_TOKEN_TYPE_KEY- See Also:
- Constant Field Values
-
DEFAULT_MAX_BACKGROUND_TASKS
public static final int DEFAULT_MAX_BACKGROUND_TASKS
- See Also:
- Constant Field Values
-
DEFAULT_MAX_BCRYPT_STRENGTH
public static final int DEFAULT_MAX_BCRYPT_STRENGTH
- See Also:
- Constant Field Values
-
DEFAULT_PURGE_MESSAGES_ON_TRASH_DAYS
public static final int DEFAULT_PURGE_MESSAGES_ON_TRASH_DAYS
- See Also:
- Constant Field Values
-
DEFAULT_PURGE_NOTIFICATIONS_DAYS
public static final int DEFAULT_PURGE_NOTIFICATIONS_DAYS
- See Also:
- Constant Field Values
-
DEFAULT_PURGE_UNCONFIRMED_USERS_DAYS
public static final int DEFAULT_PURGE_UNCONFIRMED_USERS_DAYS
- See Also:
- Constant Field Values
-
DEFAULT_EXPIRE_EXTERNAL_PAYMENTS_DAYS
public static final int DEFAULT_EXPIRE_EXTERNAL_PAYMENTS_DAYS
- See Also:
- Constant Field Values
-
DEFAULT_ARCHIVE_IMPORTS_DAYS
public static final int DEFAULT_ARCHIVE_IMPORTS_DAYS
- See Also:
- Constant Field Values
-
DEFAULT_ARCHIVE_ACCOUNT_FEES_DAYS
public static final int DEFAULT_ARCHIVE_ACCOUNT_FEES_DAYS
- See Also:
- Constant Field Values
-
DEFAULT_ARCHIVE_BULK_ACTIONS_DAYS
public static final int DEFAULT_ARCHIVE_BULK_ACTIONS_DAYS
- See Also:
- Constant Field Values
-
DEFAULT_LOG_THREADS
public static final int DEFAULT_LOG_THREADS
- See Also:
- Constant Field Values
-
DEFAULT_LOG_DIR
public static final String DEFAULT_LOG_DIR
- See Also:
- Constant Field Values
-
DEFAULT_MAX_LOG_FILES
public static final int DEFAULT_MAX_LOG_FILES
- See Also:
- Constant Field Values
-
DEFAULT_MAX_LOG_FILE_SIZE
public static final String DEFAULT_MAX_LOG_FILE_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_CACHE_NAME
public static final String DEFAULT_CACHE_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CyclosProperties
public CyclosProperties(Properties properties, Map<String,String> pathMappings)
-
-
Method Detail
-
getStoredFileContentManagerAlias
public static String getStoredFileContentManagerAlias(String className)
-
isUsingElasticsearch
public static boolean isUsingElasticsearch(String searchHandler)
-
getArchiveAccountFeesDays
public int getArchiveAccountFeesDays()
-
getArchiveBulkActionsDays
public int getArchiveBulkActionsDays()
Returns the number of days before bulk actions are archived.
-
getArchiveImportsDays
public int getArchiveImportsDays()
Returns the number of days before archiving processed imports, or removing failed ones. Zero means never.
-
getBackgroundTaskCapacity
public int getBackgroundTaskCapacity()
Returns 60% of thegetMaxBackgroundTasks()setting
-
getCacheSpec
@Nonnull public com.google.common.cache.CacheBuilderSpec getCacheSpec(String name)
Returns theCacheBuilderSpecfor the cache with the given name
-
getClusterHandlerClass
@Nonnull public String getClusterHandlerClass()
Returns the class which handles clustering tasks
-
getCyclosProperties
@Nonnull public Map<String,String> getCyclosProperties()
Returns only those properties explicitly defined (in the file or as a system property) that starts withPROPERTY_PREFIX
-
getDataSourceProviderClass
@Nonnull public String getDataSourceProviderClass()
Returns the data source provider class
-
getDataSourceProviderProperties
@Nonnull public Properties getDataSourceProviderProperties()
Returns the properties which are passed to the data source provider
-
getDbPopulatorClass
@Nonnull public String getDbPopulatorClass()
Returns the populator class for the initial database
-
getDbQueryHandlerClass
@Nonnull public String getDbQueryHandlerClass()
Returns the native query handler class
-
getExpireExternalPaymentsDays
@Nonnull public int getExpireExternalPaymentsDays()
Returns the number of days a pending external payment remains in the system until it's expired.
-
getIdMaskClass
@Nonnull public String getIdMaskClass()
Returns the class for the id mask
-
getLicenseUrl
@Nonnull public String getLicenseUrl()
Returns the URL of the license server
-
getLogDataSourceProviderClass
public String getLogDataSourceProviderClass()
Returns the class name to use as log data source provider when logging to an external database
-
getLogDataSourceProviderProperties
public Properties getLogDataSourceProviderProperties()
Returns the configuration properties for the log data source provider when logging to an external database
-
getLogDir
@Nonnull public String getLogDir()
Returns the directory where logs should be saved. If set the configuration option will be ignored. If not set, will take into account the configuration option.
-
getLogMaxFiles
public int getLogMaxFiles()
-
getLogMaxFileSize
public int getLogMaxFileSize()
-
getLogProviderClass
public String getLogProviderClass()
-
getLogThreads
public int getLogThreads()
Returns the number of threads which will process logs, or 0 if not threaded
-
getMailSleepSeconds
public int getMailSleepSeconds()
Returns the number of seconds the e-mail sending should sleep
-
getMaxBackgroundTasks
public int getMaxBackgroundTasks()
Returns the maximum background tasks to execute in this Cyclos instance. Setting this to zero effectively disables background tasks
-
getMaxBCryptStrength
public int getMaxBCryptStrength()
Returns the maximum BCrypt strength allowed for password types in any network
-
getNFCTokenTypeKey
@Nonnull public String getNFCTokenTypeKey()
Returns the NFC Token Principal type key
-
getPollingTaskCapacity
public int getPollingTaskCapacity()
Returns 40% of thegetMaxBackgroundTasks()setting
-
getProperties
@Nonnull public Properties getProperties()
Returns the entirePropertiesobject
-
getProtocolHeader
public String getProtocolHeader()
Returns the header which is used to read the original connection protocol (to the proxy / load balancer)
-
getPurgeMessagesOnTrashDays
public int getPurgeMessagesOnTrashDays()
Returns the number of days messages should be left on trash before being permanently removed. Zero means never remove.
-
getPurgeNotificationsDays
public int getPurgeNotificationsDays()
Returns the number of days notifications should be kept before being permanently removed. Zero means never remove.
-
getPurgeUnconfirmedUsersDays
public int getPurgeUnconfirmedUsersDays()
Returns the number of days users pending e-mail confirmation should be kept before being permanently removed. Zero means never remove.
-
getRateLimitGlobal
public int getRateLimitGlobal()
The rate limit, in request per second, for all clients
-
getRateLimitIp
public int getRateLimitIp()
The rate limit, in requests per second, per IP address
-
getRateLimitWhitelist
@Nonnull public String getRateLimitWhitelist()
The list of IP addresses to which the rate limit is not applied
-
getRemoteAddressHeader
public String getRemoteAddressHeader()
Returns the header which is used to read the remote address instead of reading directly from requests
-
getRemoteAddressHeaderIndex
public int getRemoteAddressHeaderIndex()
Returns the index used to retrieve the remote address from comma-separated list associated to thegetRemoteAddressHeader()
-
getResponseHeaders
public Map<String,String> getResponseHeaders()
Headers that should be sent on HTTP responses
-
getSassExecutable
public String getSassExecutable()
-
getSearchHandlerClass
@Nonnull public String getSearchHandlerClass()
Returns the class name used to handle searches
-
getSearchHandlerProperties
@Nonnull public Properties getSearchHandlerProperties()
Returns the properties for the search handler
-
getStoredFileContentManagerClass
@Nonnull public String getStoredFileContentManagerClass()
Returns the class which handles the file's contents storage.
-
getStoredFileContentManagerProperties
@Nonnull public Properties getStoredFileContentManagerProperties()
-
getTempDir
@Nonnull public File getTempDir()
Returns the directory where temporary / cached files are stored
-
isCacheQueries
public boolean isCacheQueries()
Returns whether the queries cache is enabled
-
isDbManaged
public boolean isDbManaged()
Returns whether the database is managed automatically
-
isDebuggableEnv
public boolean isDebuggableEnv()
Returns whether the runtime environment is debuggable or not.
When in dev or running the tests it returns true
-
isDevelopment
public boolean isDevelopment()
Indicates whether Cyclos is running in development mode
-
isDisableSearchEnginesIndexing
public boolean isDisableSearchEnginesIndexing()
Returns whether indexing by search engines should be disabled
-
isDumpAllErrors
public boolean isDumpAllErrors()
Returns whether all errors should be dumped to the error log
-
isForceFlushOnEveryTransaction
public boolean isForceFlushOnEveryTransaction()
Returns whether to force flush on every transaction or not.
-
isLicenseIgnoreIssueReports
public boolean isLicenseIgnoreIssueReports()
-
isRestReference
public boolean isRestReference()
Returns whether the REST API reference page (at _root_/api is enabled)
-
isSessionsAnyAddress
public boolean isSessionsAnyAddress()
Returns whether sessions can be validated from any IP address (true) or only for the original IP address (false)
-
isSkipEmails
public boolean isSkipEmails()
Returns whether emails must be skipped
-
isSkipInitializations
public boolean isSkipInitializations()
-
isTestingEnv
public boolean isTestingEnv()
Indicates whether Cyclos is running the JUnit tests
-
isUsingElasticsearch
public boolean isUsingElasticsearch()
Return if it is using elasticsearch as search handler
-
isWebServicesGzip
public boolean isWebServicesGzip()
Returns whether to gzip web services responses larger than a threshold
-
-