Package org.opencms.db.storage.policy
Class CmsStoragePolicyEngine
java.lang.Object
org.opencms.db.storage.policy.CmsStoragePolicyEngine
Engine for evaluating storage policies to determine the appropriate storage location for binary content.
This engine allows the registration of rules and whitelist exceptions. It evaluates whether a blob should be stored in a specialized storage.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA rule implementation that combines multiple rules using a logical AND operation.static interfaceFunctional interface for a single storage evaluation rule. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStorageRule(CmsStoragePolicyEngine.StorageRule storageRule) Adds a rule that triggers offloading.voidaddWhitelistRule(CmsStoragePolicyEngine.StorageRule storageRule) Adds a whitelist rule.booleanisWhitelisted(CmsStoragePolicyContext context) Returns true if the given content matches any whitelist rule.booleanEvaluates if the given content should be stored in the external storage.
-
Constructor Details
-
CmsStoragePolicyEngine
public CmsStoragePolicyEngine()
-
-
Method Details
-
addStorageRule
Adds a rule that triggers offloading.- Parameters:
storageRule- the rule to add
-
addWhitelistRule
Adds a whitelist rule. If this rule matches, the content is always stored locally.- Parameters:
storageRule- the rule to add
-
isWhitelisted
Returns true if the given content matches any whitelist rule.- Parameters:
context- the storage policy context- Returns:
trueif whitelisted
-
shouldStoreInStorage
Evaluates if the given content should be stored in the external storage.First checks the whitelist. If not whitelisted, it checks if any storage rule applies.
- Parameters:
context- the storage policy context- Returns:
trueif external storage is required
-