001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
005 *
006 * The contents of this file are subject to the terms
007 * of the Common Development and Distribution License
008 * (the License). You may not use this file except in
009 * compliance with the License.
010 *
011 * You can obtain a copy of the License at
012 * https://opensso.dev.java.net/public/CDDLv1.0.html or
013 * opensso/legal/CDDLv1.0.txt
014 * See the License for the specific language governing
015 * permission and limitations under the License.
016 *
017 * When distributing Covered Code, include this CDDL
018 * Header Notice in each file and include the License file
019 * at opensso/legal/CDDLv1.0.txt.
020 * If applicable, add the following below the CDDL Header,
021 * with the fields enclosed by brackets [] replaced by
022 * your own identifying information:
023 * "Portions Copyrighted [year] [name of copyright owner]"
024 *
025 * $Id: Evidence.java,v 1.2 2008/06/25 05:47:32 qcheng Exp $
026 *
027 */
028
029package com.sun.identity.saml.assertion;
030
031import com.sun.identity.saml.common.SAMLException;
032import org.w3c.dom.Element;
033import java.util.Set;
034
035/**
036 *The <code>Evidence</code> element specifies an assertion either by 
037 *reference or by value. An assertion is specified by reference to the value of 
038 *the assertion's  <code>AssertionIDReference</code> element.
039 *An assertion is specified by value by including the entire 
040 *<code>Assertion</code> object 
041 *@supported.all.api
042 */
043
044public class Evidence extends EvidenceBase {
045
046    /**
047     * Constructs an <code>Evidence</code> object from a block of existing XML
048     * that has already been built into a DOM.
049     *
050     * @param assertionSpecifierElement A <code>org.w3c.dom.Element</code> 
051     *        representing DOM tree for <code>Evidence</code> object.
052     * @exception SAMLException if it could not process the Element properly, 
053     *            implying that there is an error in the sender or in the
054     *            element definition.
055     */
056    public Evidence(org.w3c.dom.Element assertionSpecifierElement) 
057        throws SAMLException 
058    {
059        super(assertionSpecifierElement);
060    }    
061    
062    /**
063     * Constructs a new <code>Evidence></code> element containing a
064     * set of <code>Assertion</code> objects.
065     *
066     * @param evidenceContent A set of <code>Assertion</code> and
067     *        <code>AssertionIDReference</code> objects to be put within the
068     *        <code>Evidence</code> element. The same Set contains both type
069     *        of elements.
070     * @exception SAMLException if the Set is empty or has invalid object.
071     */
072    public Evidence(Set evidenceContent ) throws SAMLException {
073        super(evidenceContent);
074    }
075  
076    /**
077     * Constructs an Evidence from a Set of <code>Assertion</code> and
078     * <code>AssertionIDReference</code> objects.
079     * 
080     * @param assertionIDRef Set of <code>AssertionIDReference</code> objects.
081     * @param assertion Set of <code>Assertion</code> objects.
082     * @exception SAMLException if either Set is empty or has invalid object.
083     */
084    public Evidence(Set assertionIDRef, Set assertion)  throws SAMLException {
085         super(assertionIDRef, assertion);
086    }
087
088    protected  AssertionBase
089        createAssertion(Element assertionElement) throws SAMLException {
090        return new Assertion(assertionElement);
091    }
092      
093    protected  AssertionIDReference
094        createAssertionIDReference(String assertionID) throws SAMLException {
095        return new AssertionIDReference(assertionID);
096    }
097
098}