01: /*
02: * $Id: ClaimsImpl.java,v 1.1 2007/08/23 12:40:56 shyam_rao Exp $
03: */
04:
05: /*
06: * The contents of this file are subject to the terms
07: * of the Common Development and Distribution License
08: * (the License). You may not use this file except in
09: * compliance with the License.
10: *
11: * You can obtain a copy of the license at
12: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
13: * See the License for the specific language governing
14: * permissions and limitations under the License.
15: *
16: * When distributing Covered Code, include this CDDL
17: * Header Notice in each file and include the License file
18: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
19: * If applicable, add the following below the CDDL Header,
20: * with the fields enclosed by brackets [] replaced by
21: * you own identifying information:
22: * "Portions Copyrighted [year] [name of copyright owner]"
23: *
24: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
25: */
26:
27: package com.sun.xml.ws.security.trust.impl.wssx.elements;
28:
29: import java.util.List;
30: import java.util.Map;
31:
32: import org.w3c.dom.Element;
33:
34: import javax.xml.bind.JAXBContext;
35: import javax.xml.bind.JAXBException;
36:
37: import com.sun.xml.ws.api.security.trust.WSTrustException;
38:
39: import com.sun.xml.ws.api.security.trust.Claims;
40: import com.sun.xml.ws.security.trust.impl.wssx.bindings.ClaimsType;
41:
42: /**
43: * Implementation class for Claims.
44: *
45: * @author Manveen Kaur
46: */
47: public class ClaimsImpl extends ClaimsType implements Claims {
48:
49: public ClaimsImpl() {
50: // default constructor
51: }
52:
53: public ClaimsImpl(String dialect) {
54: setDialect(dialect);
55: }
56:
57: public ClaimsImpl(ClaimsType clType) throws Exception {
58: setDialect(clType.getDialect());
59: }
60:
61: public static ClaimsType fromElement(org.w3c.dom.Element element)
62: throws WSTrustException {
63: try {
64: JAXBContext jc = JAXBContext
65: .newInstance("com.sun.xml.ws.security.trust.impl.wssx.elements");
66: javax.xml.bind.Unmarshaller u = jc.createUnmarshaller();
67: return (ClaimsType) u.unmarshal(element);
68: } catch (Exception ex) {
69: throw new WSTrustException(ex.getMessage(), ex);
70: }
71: }
72:
73: }
|