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