public class RampartConfigBuilder implements AssertionBuilder {
public Assertion build(OMElement element, AssertionBuilderFactory factory)
throws IllegalArgumentException {
RampartConfig rampartConfig = new RampartConfig();
OMElement childElement;
childElement = element.getFirstChildWithName(new QName(
RampartConfig.NS, RampartConfig.USER_LN));
if (childElement != null) {
rampartConfig.setUser(childElement.getText().trim());
}
childElement = element.getFirstChildWithName(new QName(
RampartConfig.NS, RampartConfig.USER_CERT_ALIAS_LN));
if (childElement != null) {
rampartConfig.setUserCertAlias(childElement.getText().trim());
}
childElement = element.getFirstChildWithName(new QName(
RampartConfig.NS, RampartConfig.ENCRYPTION_USER_LN));
if (childElement != null) {
rampartConfig.setEncryptionUser(childElement.getText().trim());
}
childElement = element.getFirstChildWithName(new QName(
RampartConfig.NS, RampartConfig.STS_ALIAS_LN));
if (childElement != null) {
rampartConfig.setStsAlias(childElement.getText().trim());
}
childElement = element.getFirstChildWithName(new QName(
RampartConfig.NS, RampartConfig.PW_CB_CLASS_LN));
if (childElement != null) {
rampartConfig.setPwCbClass(childElement.getText().trim());
}
childElement = element.getFirstChildWithName(new QName(
RampartConfig.NS, RampartConfig.POLICY_VALIDATOR_CB_CLASS_LN));
if (childElement != null) {
rampartConfig.setPolicyValidatorCbClass(childElement.getText().trim());
}
// handle ssl config
childElement = element.getFirstChildWithName(new QName(
RampartConfig.NS, RampartConfig.SSL_CONFIG));
if (childElement != null) {
SSLConfig sslConfig = (SSLConfig)new SSLConfigBuilder().
build(childElement,
factory);
rampartConfig.setSSLConfig(sslConfig);
}
childElement = element.getFirstChildWithName(new QName(
RampartConfig.NS, RampartConfig.SIG_CRYPTO_LN));
if (childElement != null) {
rampartConfig.setSigCryptoConfig((CryptoConfig) factory
.build(childElement.getFirstElement()));
}
childElement = element.getFirstChildWithName(new QName(
RampartConfig.NS, RampartConfig.ENCR_CRYPTO_LN));
if (childElement != null) {
rampartConfig.setEncrCryptoConfig((CryptoConfig) factory
.build(childElement.getFirstElement()));
}
childElement = element.getFirstChildWithName(new QName(
RampartConfig.NS, RampartConfig.STS_CRYPTO_LN));
if (childElement != null) {
rampartConfig.setStsCryptoConfig((CryptoConfig) factory
.build(childElement.getFirstElement()));
}
childElement = element.getFirstChildWithName(new QName(
RampartConfig.NS, RampartConfig.TS_PRECISION_IN_MS_LN));
if (childElement != null) {
rampartConfig.setTimestampPrecisionInMilliseconds(childElement.getText().trim());
}
childElement = element.getFirstChildWithName(new QName(
RampartConfig.NS, RampartConfig.TS_TTL_LN));
if (childElement != null) {
rampartConfig.setTimestampTTL(childElement.getText().trim());
}
childElement = element.getFirstChildWithName(new QName(
RampartConfig.NS, RampartConfig.TS_MAX_SKEW_LN));
if (childElement != null) {
rampartConfig.setTimestampMaxSkew(childElement.getText().trim());
}
childElement = element.getFirstChildWithName(new QName(
RampartConfig.NS, RampartConfig.OPTIMISE_PARTS));
if (childElement != null) {
OptimizePartsConfig config = (OptimizePartsConfig)new OptimizePartsBuilder().
build(childElement, factory);
rampartConfig.setOptimizeParts(config);
}
return rampartConfig;
}