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 java.util.Map.Entry;
21
22 import javax.xml.namespace.QName;
23
24 import org.opensaml.xml.Configuration;
25 import org.opensaml.xml.XMLObject;
26 import org.opensaml.xml.io.AbstractXMLObjectMarshaller;
27 import org.opensaml.xml.io.MarshallingException;
28 import org.opensaml.xml.util.XMLHelper;
29 import org.w3c.dom.Attr;
30 import org.w3c.dom.Element;
31
32 import edu.internet2.middleware.shibboleth.common.ShibbolethConstants;
33 import edu.internet2.middleware.shibboleth.common.xmlobject.ShibbolethMetadataKeyAuthority;
34
35
36
37
38 public class ShibbolethMetadataKeyAuthorityMarshaller extends AbstractXMLObjectMarshaller {
39
40
41 public ShibbolethMetadataKeyAuthorityMarshaller() {
42 super(ShibbolethConstants.SHIB_MDEXT10_NS, ShibbolethMetadataKeyAuthority.DEFAULT_ELEMENT_LOCAL_NAME);
43 }
44
45
46
47
48
49
50
51 protected ShibbolethMetadataKeyAuthorityMarshaller(String namespaceURI, String elementLocalName) {
52 super(namespaceURI, elementLocalName);
53 }
54
55
56 protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
57 ShibbolethMetadataKeyAuthority keyAuthority = (ShibbolethMetadataKeyAuthority) xmlObject;
58
59 if (keyAuthority.getVerifyDepth() != null) {
60 domElement.setAttributeNS(null, ShibbolethMetadataKeyAuthority.VERIFY_DEPTH_ATTRIB_NAME,
61 keyAuthority.getVerifyDepth().toString());
62 }
63
64 Attr attr;
65 for(Entry<QName, String> entry: keyAuthority.getUnknownAttributes().entrySet()){
66 attr = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
67 attr.setValue(entry.getValue());
68 domElement.setAttributeNodeNS(attr);
69 if (Configuration.isIDAttribute(entry.getKey())
70 || keyAuthority.getUnknownAttributes().isIDAttribute(entry.getKey())) {
71 attr.getOwnerElement().setIdAttributeNode(attr, true);
72 }
73 }
74
75 }
76
77
78 protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException {
79
80 }
81
82
83 }