View Javadoc

1   /*
2   Copyright 2008 Members of the EGEE Collaboration.
3   Copyright 2008 University Corporation for Advanced Internet Development,
4   Inc.
5   
6   Licensed under the Apache License, Version 2.0 (the "License");
7   you may not use this file except in compliance with the License.
8   You may obtain a copy of the License at
9   
10      http://www.apache.org/licenses/LICENSE-2.0
11  
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  See the License for the specific language governing permissions and
16  limitations under the License.
17   */
18  
19  package org.opensaml.xacml.ctx.impl;
20  
21  import org.opensaml.xacml.ctx.StatusCodeType;
22  import org.opensaml.xacml.ctx.StatusDetailType;
23  import org.opensaml.xacml.ctx.StatusMessageType;
24  import org.opensaml.xacml.ctx.StatusType;
25  import org.opensaml.xml.XMLObject;
26  import org.opensaml.xml.io.AbstractXMLObjectUnmarshaller;
27  import org.opensaml.xml.io.UnmarshallingException;
28  import org.opensaml.xml.schema.XSString;
29  import org.w3c.dom.Attr;
30  
31  /** Unmarshaller for {@link StatusType} objects. */
32  public class StatusTypeUnmarshaller extends AbstractXMLObjectUnmarshaller {
33  
34      /** Constructor. */
35      public StatusTypeUnmarshaller() {
36          super();
37      }
38  
39      /**
40       * Constructor.
41       * 
42       * @param targetNamespaceURI the namespace URI of either the schema type QName or element QName of the elements this
43       *            unmarshaller operates on
44       * @param targetLocalName the local name of either the schema type QName or element QName of the elements this
45       *            unmarshaller operates on
46       */
47      protected StatusTypeUnmarshaller(String targetNamespaceURI, String targetLocalName) {
48          super(targetNamespaceURI, targetLocalName);
49      }
50  
51      /** {@inheritDoc} */
52      protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
53          StatusType status = (StatusType) parentObject;
54  
55          if (childObject instanceof StatusCodeType) {
56              status.setStatusCode((StatusCodeType) childObject);
57          }
58          if (childObject instanceof XSString) {
59              status.setStatusMessage((StatusMessageType) childObject);
60          }
61          if (childObject instanceof StatusDetailType) {
62              status.setStatusDetail((StatusDetailType) childObject);
63          }
64      }
65  
66      /** {@inheritDoc} */
67      protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
68      }
69  
70      /** {@inheritDoc} */
71      protected void processElementContent(XMLObject xmlObject, String elementContent) {
72      }
73  }