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