* @return a TSSConfig object
* @throws org.apache.geronimo.common.propertyeditor.PropertyEditorException
* An IOException occured.
*/
public Object getValue(XmlObject xmlObject, String type, ClassLoader cl) throws DeploymentException {
TSSTssType tss;
if (xmlObject instanceof TSSTssType) {
tss = (TSSTssType) xmlObject;
} else {
tss = (TSSTssType) xmlObject.copy().changeType(TSSTssType.type);
}
try {
XmlBeansUtil.validateDD(tss);
} catch (XmlException e) {
throw new DeploymentException(e);
}
TSSConfig tssConfig = new TSSConfig();
tssConfig.setInherit(tss.getInherit());
if (tss.isSetDefaultPrincipal()) {
DefaultPrincipal defaultPrincipal = new DefaultPrincipal();
GerDefaultPrincipalType defaultPrincipalType = tss.getDefaultPrincipal();
defaultPrincipal.setPrincipal(new GeronimoSecurityBuilderImpl().buildPrincipal(defaultPrincipalType.getPrincipal()));
tssConfig.setDefaultPrincipal(defaultPrincipal);
}
if (tss.isSetSSL()) {
tssConfig.setTransport_mech(extractSSL(tss.getSSL()));
} else if (tss.isSetSECIOP()) {
throw new PropertyEditorException("SECIOP processing not implemented");
} else {
tssConfig.setTransport_mech(new TSSNULLTransportConfig());
}
if (tss.isSetCompoundSecMechTypeList()) {
TSSCompoundSecMechListConfig mechListConfig = tssConfig.getMechListConfig();
mechListConfig.setStateful(tss.getCompoundSecMechTypeList().getStateful());
TSSCompoundSecMechType[] mechList = tss.getCompoundSecMechTypeList().getCompoundSecMechArray();
for (int i = 0; i < mechList.length; i++) {
TSSCompoundSecMechConfig cMech = extractCompoundSecMech(mechList[i], cl);
cMech.setTransport_mech(tssConfig.getTransport_mech());
mechListConfig.add(cMech);
}