1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package edu.internet2.middleware.shibboleth.common.xmlobject.impl;
19
20 import javax.xml.namespace.QName;
21
22 import org.opensaml.xml.XMLObject;
23 import org.opensaml.xml.io.AbstractXMLObjectUnmarshaller;
24 import org.opensaml.xml.io.UnmarshallingException;
25 import org.opensaml.xml.signature.KeyInfo;
26 import org.opensaml.xml.util.XMLHelper;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29 import org.w3c.dom.Attr;
30
31 import edu.internet2.middleware.shibboleth.common.xmlobject.ShibbolethMetadataKeyAuthority;
32
33
34
35
36 public class ShibbolethMetadataKeyAuthorityUnmarshaller extends AbstractXMLObjectUnmarshaller {
37
38
39 private final Logger log = LoggerFactory.getLogger(ShibbolethMetadataKeyAuthorityUnmarshaller.class);
40
41
42 protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
43 ShibbolethMetadataKeyAuthority authority = (ShibbolethMetadataKeyAuthority) xmlObject;
44
45 if (attribute.getLocalName().equals(ShibbolethMetadataKeyAuthority.VERIFY_DEPTH_ATTRIB_NAME)) {
46 authority.setVerifyDepth(Integer.valueOf(attribute.getValue()));
47 } else {
48 QName attribQName = XMLHelper.getNodeQName(attribute);
49 if (attribute.isId()) {
50 authority.getUnknownAttributes().registerID(attribQName);
51 }
52 authority.getUnknownAttributes().put(attribQName, attribute.getValue());
53 }
54
55 }
56
57
58 protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
59 throws UnmarshallingException {
60 ShibbolethMetadataKeyAuthority authority = (ShibbolethMetadataKeyAuthority) parentXMLObject;
61
62 if (childXMLObject instanceof KeyInfo) {
63 authority.getKeyInfos().add((KeyInfo) childXMLObject);
64 } else {
65 log.debug("Ignorning unknown child element {}", childXMLObject.getElementQName());
66 }
67
68 }
69
70
71 protected void processElementContent(XMLObject xmlObject, String elementContent) {
72 log.debug("Ignorning unsupported element text content");
73 }
74 }