View Javadoc

1   /*
2    * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  /**
18   * 
19   */
20  
21  package org.opensaml.saml2.core.impl;
22  
23  import java.util.Collections;
24  import java.util.List;
25  
26  import javax.xml.namespace.QName;
27  
28  import org.opensaml.common.impl.AbstractSAMLObject;
29  import org.opensaml.saml2.core.AuthnContextDecl;
30  import org.opensaml.xml.XMLObject;
31  import org.opensaml.xml.util.AttributeMap;
32  import org.opensaml.xml.util.IndexedXMLObjectChildrenList;
33  
34  /**
35   * A concrete implementation of {@link org.opensaml.saml2.core.AuthnContextDecl}.
36   */
37  public class AuthnContextDeclImpl extends AbstractSAMLObject implements AuthnContextDecl {
38  
39      /** Child XMLObjects. */
40      private IndexedXMLObjectChildrenList<XMLObject> unknownXMLObjects;
41  
42      /** Attributes for this element. */
43      private AttributeMap unknownAttributes;
44  
45      /** Text content of the element. */
46      private String textContent;
47  
48      /**
49       * Constructor.
50       * 
51       * @param namespaceURI the namespace the element is in
52       * @param elementLocalName the local name of the XML element this Object represents
53       * @param namespacePrefix the prefix for the given namespace
54       */
55      protected AuthnContextDeclImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
56          super(namespaceURI, elementLocalName, namespacePrefix);
57  
58          unknownXMLObjects = new IndexedXMLObjectChildrenList<XMLObject>(this);
59          unknownAttributes = new AttributeMap(this);
60      }
61  
62      /** {@inheritDoc} */
63      public String getTextContent() {
64          return textContent;
65      }
66  
67      /** {@inheritDoc} */
68      public void setTextContent(String newContent) {
69          textContent = prepareForAssignment(textContent, newContent);
70      }
71  
72      /** {@inheritDoc} */
73      public List<XMLObject> getUnknownXMLObjects() {
74          return unknownXMLObjects;
75      }
76      
77      /** {@inheritDoc} */
78      public List<XMLObject> getUnknownXMLObjects(QName typeOrName) {
79          return (List<XMLObject>) unknownXMLObjects.subList(typeOrName);
80      }
81  
82      /** {@inheritDoc} */
83      public List<XMLObject> getOrderedChildren() {
84          return Collections.unmodifiableList(unknownXMLObjects);
85      }
86  
87      /** {@inheritDoc} */
88      public AttributeMap getUnknownAttributes() {
89          return unknownAttributes;
90      }
91  }