1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.opensaml.xml.signature.impl;
18
19 import java.util.ArrayList;
20 import java.util.Collections;
21 import java.util.List;
22
23 import javax.xml.namespace.QName;
24
25 import org.opensaml.xml.XMLObject;
26 import org.opensaml.xml.encryption.AgreementMethod;
27 import org.opensaml.xml.encryption.EncryptedKey;
28 import org.opensaml.xml.signature.KeyInfoType;
29 import org.opensaml.xml.signature.KeyName;
30 import org.opensaml.xml.signature.KeyValue;
31 import org.opensaml.xml.signature.MgmtData;
32 import org.opensaml.xml.signature.PGPData;
33 import org.opensaml.xml.signature.RetrievalMethod;
34 import org.opensaml.xml.signature.SPKIData;
35 import org.opensaml.xml.signature.X509Data;
36 import org.opensaml.xml.util.IndexedXMLObjectChildrenList;
37 import org.opensaml.xml.validation.AbstractValidatingXMLObject;
38
39
40
41
42 public class KeyInfoTypeImpl extends AbstractValidatingXMLObject implements KeyInfoType {
43
44
45 private final IndexedXMLObjectChildrenList indexedChildren;
46
47
48 private String id;
49
50
51
52
53
54
55
56
57 protected KeyInfoTypeImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
58 super(namespaceURI, elementLocalName, namespacePrefix);
59 indexedChildren = new IndexedXMLObjectChildrenList(this);
60 }
61
62
63 public String getID() {
64 return this.id;
65 }
66
67
68 public void setID(String newID) {
69 String oldID = this.id;
70 this.id = prepareForAssignment(this.id, newID);
71 registerOwnID(oldID, this.id);
72 }
73
74
75 public List<XMLObject> getXMLObjects() {
76 return (List<XMLObject>) indexedChildren;
77 }
78
79
80 public List<XMLObject> getXMLObjects(QName typeOrName) {
81 return (List<XMLObject>) indexedChildren.subList(typeOrName);
82 }
83
84
85 public List<KeyName> getKeyNames() {
86 return (List<KeyName>) indexedChildren.subList(KeyName.DEFAULT_ELEMENT_NAME);
87 }
88
89
90 public List<KeyValue> getKeyValues() {
91 return (List<KeyValue>) indexedChildren.subList(KeyValue.DEFAULT_ELEMENT_NAME);
92 }
93
94
95 public List<RetrievalMethod> getRetrievalMethods() {
96 return (List<RetrievalMethod>) indexedChildren.subList(RetrievalMethod.DEFAULT_ELEMENT_NAME);
97 }
98
99
100 public List<X509Data> getX509Datas() {
101 return (List<X509Data>) indexedChildren.subList(X509Data.DEFAULT_ELEMENT_NAME);
102 }
103
104
105 public List<PGPData> getPGPDatas() {
106 return (List<PGPData>) indexedChildren.subList(PGPData.DEFAULT_ELEMENT_NAME);
107 }
108
109
110 public List<SPKIData> getSPKIDatas() {
111 return (List<SPKIData>) indexedChildren.subList(SPKIData.DEFAULT_ELEMENT_NAME);
112 }
113
114
115 public List<MgmtData> getMgmtDatas() {
116 return (List<MgmtData>) indexedChildren.subList(MgmtData.DEFAULT_ELEMENT_NAME);
117 }
118
119
120 public List<AgreementMethod> getAgreementMethods() {
121 return (List<AgreementMethod>) indexedChildren.subList(AgreementMethod.DEFAULT_ELEMENT_NAME);
122 }
123
124
125 public List<EncryptedKey> getEncryptedKeys() {
126 return (List<EncryptedKey>) indexedChildren.subList(EncryptedKey.DEFAULT_ELEMENT_NAME);
127 }
128
129
130 public List<XMLObject> getOrderedChildren() {
131 ArrayList<XMLObject> children = new ArrayList<XMLObject>();
132
133 children.addAll(indexedChildren);
134
135 if (children.size() == 0) {
136 return null;
137 }
138
139 return Collections.unmodifiableList(children);
140 }
141
142 }