* @param clientPolicyMap The second policy map to be merged.
* @return merged PolicyMap
* @throws PolicyException If merge failed.
*/
private static PolicyMap mergePolicyMap(PolicyMap policyMap, PolicyMap clientPolicyMap) throws PolicyException {
final PolicyMapExtender mapExtender = PolicyMapExtender.createPolicyMapExtender();
final String clientWsitConfigId = PolicyConstants.CLIENT_CONFIGURATION_IDENTIFIER;
if (policyMap != null) {
mapExtender.connect(policyMap);
try {
for (PolicyMapKey key : clientPolicyMap.getAllServiceScopeKeys()) {
final Policy policy = clientPolicyMap.getServiceEffectivePolicy(key);
// setting subject to provided URL of client WSIT config
mapExtender.putServiceSubject(key, new PolicySubject(clientWsitConfigId, policy));
}
for (PolicyMapKey key : clientPolicyMap.getAllEndpointScopeKeys()) {
final Policy policy = clientPolicyMap.getEndpointEffectivePolicy(key);
// setting subject to provided URL of client WSIT config
mapExtender.putEndpointSubject(key, new PolicySubject(clientWsitConfigId, policy));
}
for (PolicyMapKey key : clientPolicyMap.getAllOperationScopeKeys()) {
final Policy policy = clientPolicyMap.getOperationEffectivePolicy(key);
// setting subject to provided URL of client WSIT config
mapExtender.putOperationSubject(key, new PolicySubject(clientWsitConfigId, policy));
}
for (PolicyMapKey key : clientPolicyMap.getAllInputMessageScopeKeys()) {
final Policy policy = clientPolicyMap.getInputMessageEffectivePolicy(key);
// setting subject to provided URL of client WSIT config
mapExtender.putInputMessageSubject(key, new PolicySubject(clientWsitConfigId, policy));
}
for (PolicyMapKey key : clientPolicyMap.getAllOutputMessageScopeKeys()) {
final Policy policy = clientPolicyMap.getOutputMessageEffectivePolicy(key);
// setting subject to provided URL of client WSIT config
mapExtender.putOutputMessageSubject(key, new PolicySubject(clientWsitConfigId, policy));
}
for (PolicyMapKey key : clientPolicyMap.getAllFaultMessageScopeKeys()) {
final Policy policy = clientPolicyMap.getFaultMessageEffectivePolicy(key);
// setting subject to provided URL of client WSIT config
mapExtender.putFaultMessageSubject(key, new PolicySubject(clientWsitConfigId, policy));
}
LOGGER.fine(LocalizationMessages.WSP_5015_CLIENT_CFG_POLICIES_TRANSFERED_INTO_FINAL_POLICY_MAP(policyMap));
} catch (FactoryConfigurationError ex) {
throw LOGGER.logSevereException(new PolicyException(ex));
}