View Javadoc

1   /*
2    * Copyright [2006] [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.xml.signature.impl;
18  
19  import java.util.ArrayList;
20  import java.util.Collections;
21  import java.util.List;
22  
23  import org.opensaml.xml.XMLObject;
24  import org.opensaml.xml.signature.DSAKeyValue;
25  import org.opensaml.xml.signature.G;
26  import org.opensaml.xml.signature.J;
27  import org.opensaml.xml.signature.P;
28  import org.opensaml.xml.signature.PgenCounter;
29  import org.opensaml.xml.signature.Q;
30  import org.opensaml.xml.signature.Seed;
31  import org.opensaml.xml.signature.Y;
32  import org.opensaml.xml.validation.AbstractValidatingXMLObject;
33  
34  /**
35   * Concrete implementation of {@link org.opensaml.xml.signature.DSAKeyValue}
36   */
37  public class DSAKeyValueImpl extends AbstractValidatingXMLObject implements DSAKeyValue {
38      
39      /** P child element */
40      private P p;
41      
42      /** Q child element */
43      private Q q;
44      
45      /** G child element */
46      private G g;
47      
48      /** Y child element */
49      private Y y;
50      
51      /** J child element */
52      private J j;
53      
54      /** Seed child element */
55      private Seed seed;
56      
57      /** PgenCounter child element */
58      private PgenCounter pgenCounter;
59  
60      /**
61       * Constructor
62       *
63       * @param namespaceURI
64       * @param elementLocalName
65       * @param namespacePrefix
66       */
67      protected DSAKeyValueImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
68          super(namespaceURI, elementLocalName, namespacePrefix);
69      }
70  
71      /** {@inheritDoc} */
72      public P getP() {
73          return this.p;
74      }
75  
76      /** {@inheritDoc} */
77      public void setP(P newP) {
78          this.p = prepareForAssignment(this.p, newP);
79      }
80  
81      /** {@inheritDoc} */
82      public Q getQ() {
83          return this.q;
84      }
85  
86      /** {@inheritDoc} */
87      public void setQ(Q newQ) {
88          this.q = prepareForAssignment(this.q, newQ);
89      }
90  
91      /** {@inheritDoc} */
92      public G getG() {
93          return this.g;
94      }
95  
96      /** {@inheritDoc} */
97      public void setG(G newG) {
98          this.g = prepareForAssignment(this.g, newG);
99      }
100 
101     /** {@inheritDoc} */
102     public Y getY() {
103         return this.y;
104     }
105 
106     /** {@inheritDoc} */
107     public void setY(Y newY) {
108         this.y = prepareForAssignment(this.y, newY);
109     }
110 
111     /** {@inheritDoc} */
112     public J getJ() {
113         return this.j;
114     }
115 
116     /** {@inheritDoc} */
117     public void setJ(J newJ) {
118         this.j = prepareForAssignment(this.j, newJ);
119     }
120 
121     /** {@inheritDoc} */
122     public Seed getSeed() {
123         return this.seed;
124     }
125 
126     /** {@inheritDoc} */
127     public void setSeed(Seed newSeed) {
128         this.seed = prepareForAssignment(this.seed, newSeed);
129     }
130 
131     /** {@inheritDoc} */
132     public PgenCounter getPgenCounter() {
133         return this.pgenCounter;
134     }
135 
136     /** {@inheritDoc} */
137     public void setPgenCounter(PgenCounter newPgenCounter) {
138         this.pgenCounter = prepareForAssignment(this.pgenCounter, newPgenCounter);
139     }
140 
141     /** {@inheritDoc} */
142     public List<XMLObject> getOrderedChildren() {
143         ArrayList<XMLObject> children = new ArrayList<XMLObject>();
144         
145         if (p != null) {
146             children.add(p);
147         }
148         if (q!= null) {
149             children.add(q);
150         }
151         if (g != null) {
152             children.add(g);
153         }
154         if (y != null) {
155             children.add(y);
156         }
157         if (j != null) {
158             children.add(j);
159         }
160         if (seed!= null) {
161             children.add(seed);
162         }
163         if (pgenCounter != null) {
164             children.add(pgenCounter);
165         }
166         
167         if (children.size() == 0) {
168             return null;
169         }
170         
171         return Collections.unmodifiableList(children);
172     }
173 
174 }