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  package org.opensaml.saml2.metadata.impl;
18  
19  import java.util.Collections;
20  import java.util.List;
21  
22  import javax.xml.namespace.QName;
23  
24  import org.opensaml.common.impl.AbstractSAMLObject;
25  import org.opensaml.saml2.metadata.Endpoint;
26  import org.opensaml.xml.XMLObject;
27  import org.opensaml.xml.util.AttributeMap;
28  import org.opensaml.xml.util.IndexedXMLObjectChildrenList;
29  
30  /**
31   * A concrete implementation of {@link org.opensaml.saml2.metadata.Endpoint}
32   */
33  public abstract class EndpointImpl extends AbstractSAMLObject implements Endpoint {
34  
35      /** Binding URI */
36      private String bindingId;
37  
38      /** Endpoint location URI */
39      private String location;
40  
41      /** Response location URI */
42      private String responseLocation;
43      
44      /** "anyAttribute" attributes */
45      private final AttributeMap unknownAttributes;
46      
47      /** child "any" elements */
48      private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
49  
50      /**
51       * Constructor
52       * 
53       * @param namespaceURI the namespace the element is in
54       * @param elementLocalName the local name of the XML element this Object represents
55       * @param namespacePrefix the prefix for the given namespace
56       */
57      protected EndpointImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
58          super(namespaceURI, elementLocalName, namespacePrefix);
59          unknownAttributes = new AttributeMap(this);
60          unknownChildren = new IndexedXMLObjectChildrenList<XMLObject>(this);
61      }
62  
63      /** {@inheritDoc} */
64      public String getBinding() {
65          return bindingId;
66      }
67  
68      /** {@inheritDoc} */
69      public void setBinding(String binding) {
70          bindingId = prepareForAssignment(bindingId, binding);
71      }
72  
73      /** {@inheritDoc} */
74      public String getLocation() {
75          return location;
76      }
77  
78      /** {@inheritDoc} */
79      public void setLocation(String location) {
80          this.location = prepareForAssignment(this.location, location);
81      }
82  
83      /** {@inheritDoc} */
84      public String getResponseLocation() {
85          return responseLocation;
86      }
87  
88      /** {@inheritDoc} */
89      public void setResponseLocation(String location) {
90          responseLocation = prepareForAssignment(responseLocation, location);
91      }
92      
93      /**
94       * {@inheritDoc}
95       */
96      public AttributeMap getUnknownAttributes() {
97          return unknownAttributes;
98      }
99      
100     /**
101      * {@inheritDoc}
102      */
103     public List<XMLObject> getUnknownXMLObjects() {
104         return unknownChildren;
105     }
106     
107     /** {@inheritDoc} */
108     public List<XMLObject> getUnknownXMLObjects(QName typeOrName) {
109         return (List<XMLObject>) unknownChildren.subList(typeOrName);
110     }
111     
112     /**
113      * {@inheritDoc}
114      */
115     public List<XMLObject> getOrderedChildren() {
116         return Collections.unmodifiableList(unknownChildren);
117     }
118 }