1 /* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5 /* 6 * Copyright 1999-2004 The Apache Software Foundation. 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 * 20 */ 21 package com.sun.org.apache.xml.internal.security.signature; 22 23 import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException; 24 import com.sun.org.apache.xml.internal.security.utils.Constants; 25 import com.sun.org.apache.xml.internal.security.utils.IdResolver; 26 import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy; 27 import org.w3c.dom.Document; 28 import org.w3c.dom.Element; 29 import org.w3c.dom.Node; 30 31 32 /** 33 * Handles <code><ds:Object></code> elements 34 * <code>Object<code> {@link Element} supply facility which can contain any kind data 35 * 36 * @author Christian Geuer-Pollmann 37 * $todo$ if we remove childen, the boolean values are not updated 38 */ 39 public class ObjectContainer extends SignatureElementProxy { 40 41 /** 42 * Constructs {@link ObjectContainer} 43 * 44 * @param doc the {@link Document} in which <code>Object</code> element is placed 45 */ 46 public ObjectContainer(Document doc) { 47 48 super(doc); 49 } 50 51 /** 52 * Constructs {@link ObjectContainer} from {@link Element} 53 * 54 * @param element is <code>Object</code> element 55 * @param BaseURI the URI of the resource where the XML instance was stored 56 * @throws XMLSecurityException 57 */ 58 public ObjectContainer(Element element, String BaseURI) 59 throws XMLSecurityException { 60 61 super(element, BaseURI); 62 } 63 64 /** 65 * Sets the <code>Id</code> attribute 66 * 67 * @param Id <code>Id</code> attribute 68 */ 69 public void setId(String Id) { 70 71 if (Id != null) { 72 setLocalIdAttribute(Constants._ATT_ID, Id); 73 } 74 } 75 76 /** 77 * Returns the <code>Id</code> attribute 78 * 79 * @return the <code>Id</code> attribute 80 */ 81 public String getId() { 82 return this._constructionElement.getAttributeNS(null, Constants._ATT_ID); 83 } 84 85 /** 86 * Sets the <code>MimeType</code> attribute 87 * 88 * @param MimeType the <code>MimeType</code> attribute 89 */ 90 public void setMimeType(String MimeType) { 91 92 if ( (MimeType != null)) { 93 this._constructionElement.setAttributeNS(null, Constants._ATT_MIMETYPE, 94 MimeType); 95 } 96 } 97 98 /** 99 * Returns the <code>MimeType</code> attribute 100 * 101 * @return the <code>MimeType</code> attribute 102 */ 103 public String getMimeType() { 104 return this._constructionElement.getAttributeNS(null, Constants._ATT_MIMETYPE); 105 } 106 107 /** 108 * Sets the <code>Encoding</code> attribute 109 * 110 * @param Encoding the <code>Encoding</code> attribute 111 */ 112 public void setEncoding(String Encoding) { 113 114 if ((Encoding != null)) { 115 this._constructionElement.setAttributeNS(null, Constants._ATT_ENCODING, 116 Encoding); 117 } 118 } 119 120 /** 121 * Returns the <code>Encoding</code> attribute 122 * 123 * @return the <code>Encoding</code> attribute 124 */ 125 public String getEncoding() { 126 return this._constructionElement.getAttributeNS(null, Constants._ATT_ENCODING); 127 } 128 129 /** 130 * Adds child Node 131 * 132 * @param node child Node 133 * @return the new node in the tree. 134 */ 135 public Node appendChild(Node node) { 136 137 Node result = null; 138 139 result = this._constructionElement.appendChild(node); 140 141 return result; 142 } 143 144 /** @inheritDoc */ 145 public String getBaseLocalName() { 146 return Constants._TAG_OBJECT; 147 } 148 }