/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: AudienceRestrictionCondition.java,v 1.2 2008/06/25 05:47:31 qcheng Exp $
*
*/
/**
*This is an implementation of the abstract <code>Condition</code> class, which
*specifes that the assertion this AuthenticationCondition is part of, is
*addressed to one or more specific audience.
*@supported.all.api
*/
/**
_audience is a list of all the audience this condition is addressed to.
Its implemented as a list of <code>String</code> objects each of them
containing an audience ( String). This list needs to have at least one
audience specified. An audience is actually a URI. The URI MAY identify a
document that describes the terms and conditions of audience membership
*/
/**
* Constructs an <code>AudienceRestrictionCondition</code> element from an
* existing XML block.
*
* @param audienceRestrictionConditionElement A
* <code>org.w3c.dom.Element</code> representing DOM tree for
* <code>AudienceRestrictionCondition</code> object.
* @exception SAMLException if it could not process the
* <code>org.w3c.dom.Element</code> properly, implying that there
* is an error in the sender or in the element definition.
*/
public AudienceRestrictionCondition(
throws SAMLException
{
+ "null condition ");
}
"nullInput"));
}
"AudienceRestrictionCondition: "
+ "unsupported condition ");
}
throw new SAMLRequesterException(
"unsupportedCondition"));
}
}
"AudienceRestrictionCondition: invalid condition");
}
throw new SAMLRequesterException(
"invalidElement"));
}
}
+ "no Audience in this Element");
}
throw new SAMLRequesterException(
}
for (int n=0; n<length; n++) {
continue;
}
} else {
"AudienceRestrictionCondition:"
+" invalid element found");
}
throw new SAMLRequesterException(
}
}
}
/**
*Constructs <code>AudienceRestrictionCondition</code> with a
*<code>List</code> of audience for this condition, each of them
*being a String.
*@param audience A List of audience to be included within this condition
*@exception SAMLException if the <code>List</code> is empty or if there is
*some error in processing the contents of the <code>List</code>
*/
+ "null input specified");
}
"nullInput")) ;
}
}
/**
*Adds an audience to this Condition element
*@param audience audience to be added
*@return boolean indicating success or failure of operation
*/
return true;
} else {
return false;
}
}
/**
*Adds a <code>List</code> of audience held within this Condition element
*@param audience A <code>List</code> of audience to be included within
*this condition
*@return boolean indicating success or failure of operation.
*/
return true;
}
/**
*Returns list of Audience held within this Condition element
*@return An the <code>List</code> of Audience within this Condition element
*/
return _audience;
}
/**
* Returns true if a particular audience string is contained within this
* <code>AudienceRestrictionCondition</code> object
*
* @param audience audience to be checked
* @return true if the audience exists.
*/
return true;
} else {
return false;
}
} else {
return false;
}
}
/**
* Removes an audience from the <code>List</code> within this Condition
* element
* @param audience A string representing the value of the Audience
* the operation
*/
return true;
} else return false;
}
/**
* Returns a String representation of the element.
*
* @return A string containing the valid XML for this element
* By default name space name is prepended to the element name
* example <code><saml:AudienceRestrictionCondition></code>.
*/
// call toString() with includeNS true by default and declareNS false
return xml;
}
/**
* Returns a String representation of the
* <code><AudienceRestrictionCondition></code> element.
*
* @param includeNS Determines whether or not the namespace qualifier is
* prepended to the Element when converted
* @param declareNS Determines whether or not the namespace is declared
* within the Element.
* @return A string containing the valid XML for this element
*/
"Audience",includeNS, false);
}
"AudienceRestrictionCondition",includeNS);
}
/**
* Evaluates this condition
* This method can be overridden by a plug-in which provides
* means of evaluating this condition
*
* @return evaluation status.
*/
public int evaluate() {
return Condition.INDETERMINATE;
}
}