Class ConfigServiceReflectionBridge
java.lang.Object
org.bloomreach.forge.brut.resources.bootstrap.ConfigServiceReflectionBridge
Bridge for invoking package-private methods in ConfigurationConfigService via reflection.
brXM's ConfigurationConfigService has several methods that are package-private but are needed for test environment bootstrap. This class encapsulates the reflection logic needed to access these methods.
Method references are resolved once at class-load time to avoid per-invocation getDeclaredMethod() overhead and to surface Java module-system failures deterministically at class load rather than at runtime per test.
Methods accessed via reflection:
- applyNamespacesAndNodeTypes(ConfigurationModel, ConfigurationModel, Session)
- computeAndWriteDelta(ConfigurationModel, ConfigurationModel, Session, boolean)
- Since:
- 5.2.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyConfigDeltaWithRetries(org.onehippo.cm.engine.ConfigurationConfigService configService, org.onehippo.cm.model.impl.ConfigurationModelImpl baseline, org.onehippo.cm.model.impl.ConfigurationModelImpl update, Session session) Applies configuration delta with automatic retry on ItemExistsException.static StringextractItemExistsPath(Throwable error) Extracts the path from an ItemExistsException message.static ItemExistsExceptionfindItemExistsException(Throwable error) Finds an ItemExistsException in the exception chain.static voidinvokeApplyNamespacesAndNodeTypes(org.onehippo.cm.engine.ConfigurationConfigService configService, org.onehippo.cm.model.impl.ConfigurationModelImpl baseline, org.onehippo.cm.model.impl.ConfigurationModelImpl update, Session session) Invokes package-private applyNamespacesAndNodeTypes method via reflection.static voidinvokeComputeAndWriteDelta(org.onehippo.cm.engine.ConfigurationConfigService configService, org.onehippo.cm.model.impl.ConfigurationModelImpl baseline, org.onehippo.cm.model.impl.ConfigurationModelImpl update, Session session, boolean forceApply) Invokes package-private computeAndWriteDelta method via reflection.static booleanremoveExistingNode(Session session, String path) Removes an existing node at the given path.
-
Method Details
-
invokeApplyNamespacesAndNodeTypes
public static void invokeApplyNamespacesAndNodeTypes(org.onehippo.cm.engine.ConfigurationConfigService configService, org.onehippo.cm.model.impl.ConfigurationModelImpl baseline, org.onehippo.cm.model.impl.ConfigurationModelImpl update, Session session) throws Exception Invokes package-private applyNamespacesAndNodeTypes method via reflection.- Parameters:
configService- the ConfigurationConfigService instancebaseline- the baseline configuration modelupdate- the update configuration modelsession- the JCR session- Throws:
Exception- if invocation fails
-
invokeComputeAndWriteDelta
public static void invokeComputeAndWriteDelta(org.onehippo.cm.engine.ConfigurationConfigService configService, org.onehippo.cm.model.impl.ConfigurationModelImpl baseline, org.onehippo.cm.model.impl.ConfigurationModelImpl update, Session session, boolean forceApply) throws Exception Invokes package-private computeAndWriteDelta method via reflection.- Parameters:
configService- the ConfigurationConfigService instancebaseline- the baseline configuration modelupdate- the update configuration modelsession- the JCR sessionforceApply- whether to force apply changes- Throws:
Exception- if invocation fails
-
applyConfigDeltaWithRetries
public static void applyConfigDeltaWithRetries(org.onehippo.cm.engine.ConfigurationConfigService configService, org.onehippo.cm.model.impl.ConfigurationModelImpl baseline, org.onehippo.cm.model.impl.ConfigurationModelImpl update, Session session) throws RepositoryException Applies configuration delta with automatic retry on ItemExistsException.When ConfigService encounters a node that already exists, this method removes the conflicting node and retries the operation.
- Parameters:
configService- the ConfigurationConfigService instancebaseline- the baseline configuration modelupdate- the update configuration modelsession- the JCR session- Throws:
RepositoryException- if the operation fails after all retries
-
extractItemExistsPath
Extracts the path from an ItemExistsException message.- Parameters:
error- the exception to extract from- Returns:
- the path, or null if not found
-
findItemExistsException
Finds an ItemExistsException in the exception chain.- Parameters:
error- the exception to search- Returns:
- the ItemExistsException, or null if not found
-
removeExistingNode
Removes an existing node at the given path.- Parameters:
session- the JCR sessionpath- the path to remove- Returns:
- true if the node was removed, false otherwise
- Throws:
RepositoryException- if operation fails
-