src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java

Print this page




 108             new ArrayList<SignatureProperty>(length);
 109         for (int i = 0; i < length; i++) {
 110             Node child = nodes.item(i);
 111             if (child.getNodeType() == Node.ELEMENT_NODE) {
 112                 String name = child.getLocalName();
 113                 if (!name.equals("SignatureProperty")) {
 114                     throw new MarshalException("Invalid element name: " + name +
 115                                                ", expected SignatureProperty");
 116                 }
 117                 properties.add(new DOMSignatureProperty((Element)child,
 118                                                         context));
 119             }
 120         }
 121         if (properties.isEmpty()) {
 122             throw new MarshalException("properties cannot be empty");
 123         } else {
 124             this.properties = Collections.unmodifiableList(properties);
 125         }
 126     }
 127 
 128     public List getProperties() {
 129         return properties;
 130     }
 131 
 132     public String getId() {
 133         return id;
 134     }
 135 
 136     public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
 137         throws MarshalException
 138     {
 139         Document ownerDoc = DOMUtils.getOwnerDocument(parent);
 140         Element propsElem = DOMUtils.createElement(ownerDoc,
 141                                                    "SignatureProperties",
 142                                                    XMLSignature.XMLNS,
 143                                                    dsPrefix);
 144 
 145         // set attributes
 146         DOMUtils.setAttributeID(propsElem, "Id", id);
 147 
 148         // create and append any properties




 108             new ArrayList<SignatureProperty>(length);
 109         for (int i = 0; i < length; i++) {
 110             Node child = nodes.item(i);
 111             if (child.getNodeType() == Node.ELEMENT_NODE) {
 112                 String name = child.getLocalName();
 113                 if (!name.equals("SignatureProperty")) {
 114                     throw new MarshalException("Invalid element name: " + name +
 115                                                ", expected SignatureProperty");
 116                 }
 117                 properties.add(new DOMSignatureProperty((Element)child,
 118                                                         context));
 119             }
 120         }
 121         if (properties.isEmpty()) {
 122             throw new MarshalException("properties cannot be empty");
 123         } else {
 124             this.properties = Collections.unmodifiableList(properties);
 125         }
 126     }
 127 
 128     public List<SignatureProperty> getProperties() {
 129         return properties;
 130     }
 131 
 132     public String getId() {
 133         return id;
 134     }
 135 
 136     public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
 137         throws MarshalException
 138     {
 139         Document ownerDoc = DOMUtils.getOwnerDocument(parent);
 140         Element propsElem = DOMUtils.createElement(ownerDoc,
 141                                                    "SignatureProperties",
 142                                                    XMLSignature.XMLNS,
 143                                                    dsPrefix);
 144 
 145         // set attributes
 146         DOMUtils.setAttributeID(propsElem, "Id", id);
 147 
 148         // create and append any properties