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

Print this page




 110             String localName = refElem.getLocalName();
 111             if (!localName.equals("Reference")) {
 112                 throw new MarshalException("Invalid element name: " +
 113                                            localName + ", expected Reference");
 114             }
 115             refs.add(new DOMReference(refElem, context, provider));
 116             if (secVal && (refs.size() > DOMSignedInfo.MAXIMUM_REFERENCE_COUNT)) {
 117                 String error = "A maxiumum of " + DOMSignedInfo.MAXIMUM_REFERENCE_COUNT + " "
 118                     + "references per Manifest are allowed with secure validation";
 119                 throw new MarshalException(error);
 120             }
 121             refElem = DOMUtils.getNextSiblingElement(refElem);
 122         }
 123         this.references = Collections.unmodifiableList(refs);
 124     }
 125 
 126     public String getId() {
 127         return id;
 128     }
 129 
 130     public List getReferences() {





 131         return references;
 132     }
 133 
 134     public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
 135         throws MarshalException
 136     {
 137         Document ownerDoc = DOMUtils.getOwnerDocument(parent);
 138         Element manElem = DOMUtils.createElement(ownerDoc, "Manifest",
 139                                                  XMLSignature.XMLNS, dsPrefix);
 140 
 141         DOMUtils.setAttributeID(manElem, "Id", id);
 142 
 143         // add references
 144         for (Reference ref : references) {
 145             ((DOMReference)ref).marshal(manElem, dsPrefix, context);
 146         }
 147         parent.appendChild(manElem);
 148     }
 149 
 150     @Override




 110             String localName = refElem.getLocalName();
 111             if (!localName.equals("Reference")) {
 112                 throw new MarshalException("Invalid element name: " +
 113                                            localName + ", expected Reference");
 114             }
 115             refs.add(new DOMReference(refElem, context, provider));
 116             if (secVal && (refs.size() > DOMSignedInfo.MAXIMUM_REFERENCE_COUNT)) {
 117                 String error = "A maxiumum of " + DOMSignedInfo.MAXIMUM_REFERENCE_COUNT + " "
 118                     + "references per Manifest are allowed with secure validation";
 119                 throw new MarshalException(error);
 120             }
 121             refElem = DOMUtils.getNextSiblingElement(refElem);
 122         }
 123         this.references = Collections.unmodifiableList(refs);
 124     }
 125 
 126     public String getId() {
 127         return id;
 128     }
 129 
 130     @SuppressWarnings("unchecked")
 131     static List<Reference> getManifestReferences(Manifest mf) {
 132         return mf.getReferences();
 133     }
 134 
 135     public List<Reference> getReferences() {
 136         return references;
 137     }
 138 
 139     public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
 140         throws MarshalException
 141     {
 142         Document ownerDoc = DOMUtils.getOwnerDocument(parent);
 143         Element manElem = DOMUtils.createElement(ownerDoc, "Manifest",
 144                                                  XMLSignature.XMLNS, dsPrefix);
 145 
 146         DOMUtils.setAttributeID(manElem, "Id", id);
 147 
 148         // add references
 149         for (Reference ref : references) {
 150             ((DOMReference)ref).marshal(manElem, dsPrefix, context);
 151         }
 152         parent.appendChild(manElem);
 153     }
 154 
 155     @Override