// No duplicate message security providers found. So add one.
try {
ConfigSupport.apply(new SingleConfigCode<MessageSecurityConfig>() {
public Object run(MessageSecurityConfig param)
throws PropertyVetoException, TransactionFailure {
ProviderConfig newPC = param.createChild(ProviderConfig.class);
populateProviderConfigElement(newPC);
param.getProviderConfig().add(newPC);
// Depending on the providerType of the new provider
// the isDefaultProvider=true results in creation of
// either default-provider attribute or
// default-client-provider or BOTH in the message
// security config object
if (isDefaultProvider) {
if (providerType.equals(SERVER) ||
providerType.equals(CLIENT_SERVER) )
param.setDefaultProvider(providerId);
if (providerType.equals(CLIENT) ||
providerType.equals(CLIENT_SERVER) )
param.setDefaultClientProvider(providerId);
}
return newPC;
}
}, msgSecCfg);
} catch(TransactionFailure e) {
report.setMessage(localStrings.getLocalString(
"create.message.security.provider.fail",
"Creation of message security provider named {0} failed",
providerId));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setFailureCause(e);
return;
}
report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
report.setMessage(localStrings.getLocalString(
"create.message.security.provider.success",
"Creation of message security provider named {0} completed " +
"successfully", providerId));
}
// Now if there is NO message security config for this type of layer
// then, first add a message security config for the layer and then
// add a provider config under this message security config
else {
try {
ConfigSupport.apply(new SingleConfigCode<SecurityService>() {
public Object run(SecurityService param)
throws PropertyVetoException, TransactionFailure {
MessageSecurityConfig newMSC = param.createChild(MessageSecurityConfig.class);
newMSC.setAuthLayer(authLayer);
param.getMessageSecurityConfig().add(newMSC);
ProviderConfig newPC = newMSC.createChild(ProviderConfig.class);
populateProviderConfigElement(newPC);
newMSC.getProviderConfig().add(newPC);
// Depending on the providerType of the new provider
// the isDefaultProvider=true results in creation of