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.signature.PGPData;
27 import org.opensaml.xml.signature.PGPKeyID;
28 import org.opensaml.xml.signature.PGPKeyPacket;
29 import org.opensaml.xml.util.IndexedXMLObjectChildrenList;
30 import org.opensaml.xml.util.XMLObjectChildrenList;
31 import org.opensaml.xml.validation.AbstractValidatingXMLObject;
32
33
34
35
36 public class PGPDataImpl extends AbstractValidatingXMLObject implements PGPData {
37
38
39 private PGPKeyID pgpKeyID;
40
41
42 private PGPKeyPacket pgpKeyPacket;
43
44
45 private final IndexedXMLObjectChildrenList xmlChildren;
46
47
48
49
50
51
52
53
54 protected PGPDataImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
55 super(namespaceURI, elementLocalName, namespacePrefix);
56 xmlChildren = new IndexedXMLObjectChildrenList(this);
57 }
58
59
60 public PGPKeyID getPGPKeyID() {
61 return this.pgpKeyID;
62 }
63
64
65 public void setPGPKeyID(PGPKeyID newPGPKeyID) {
66 this.pgpKeyID = prepareForAssignment(this.pgpKeyID, newPGPKeyID);
67 }
68
69
70 public PGPKeyPacket getPGPKeyPacket() {
71 return this.pgpKeyPacket;
72 }
73
74
75 public void setPGPKeyPacket(PGPKeyPacket newPGPKeyPacket) {
76 this.pgpKeyPacket = prepareForAssignment(this.pgpKeyPacket, newPGPKeyPacket);
77 }
78
79
80 public List<XMLObject> getUnknownXMLObjects() {
81 return (List<XMLObject>) xmlChildren;
82 }
83
84 public List<XMLObject> getUnknownXMLObjects(QName typeOrName) {
85 return (List<XMLObject>) xmlChildren.subList(typeOrName);
86 }
87
88
89 public List<XMLObject> getOrderedChildren() {
90 ArrayList<XMLObject> children = new ArrayList<XMLObject>();
91
92 if (pgpKeyID != null) {
93 children.add(pgpKeyID);
94 }
95 if (pgpKeyPacket != null) {
96 children.add(pgpKeyPacket);
97 }
98 children.addAll((List<XMLObject>) xmlChildren);
99
100 if (children.size() == 0) {
101 return null;
102 }
103
104 return Collections.unmodifiableList(children);
105 }
106
107 }