/**
* 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: Attribute.java,v 1.4 2008/09/03 22:28:40 weisun2 Exp $
*
*/
/**
* The <code>Attribute</code> element specifies an attribute of the assertion
* subject. The <code>Attribute</code> element is an extension of the
* <code>AttributeDesignator</code> element
* that allows the attribute value to be specified.
*
* @supported.all.api
*/
/**
* Constructs an attribute element from an existing XML block.
*
* @param element representing a DOM tree element.
* @exception SAMLException if there is an error in the sender or in the
* element definition.
*/
// make sure that the input xml block is not null
throw new SAMLRequesterException(
}
// Make sure this is an Attribute.
throw new SAMLRequesterException(
}
int i = 0;
// handle attributes
for (i = 0; i < attrCount; i++) {
}
"Attribute Name is either null or empty.");
}
continue;
//throw new SAMLRequesterException(
// SAMLUtilsCommon.bundle.getString("nullInput"));
}
}
}
}
// AttributeName is required
"AttributeName is required attribute");
}
throw new SAMLRequesterException(
}
// AttributeNamespace is required
"AttributeNamespace is required attribute");
}
throw new SAMLRequesterException(
}
// handle the children of Attribute element
if (nodeCount > 0) {
for (i = 0; i < nodeCount; i++) {
" The tag name or tag namespace of child" +
" element is either null or empty.");
}
throw new SAMLRequesterException(
}
if (_attributeValue == null) {
_attributeValue = new ArrayList();
}
"Attribute: failed to "+
"add to the attribute value list.");
}
throw new SAMLRequesterException(
"addListError"));
}
} else {
"wrong element:" + tagName);
}
throw new SAMLRequesterException(
}
} // end of if (currentNode.getNodeType() == Node.ELEMENT_NODE)
} // end of for loop
} // end of if (nodeCount > 0)
"should contain at least one AttributeValue.");
}
throw new SAMLRequesterException(
}
}
/**
* Constructs an instance of <code>Attribute</code>.
*
* @param name A String representing <code>AttributeName</code> (the name
* of the attribute).
* @param nameSpace A String representing the namespace in which
* <code>AttributeName</code> elements are interpreted.
* @param values A List of DOM element representing the
* <code>AttributeValue</code> object.
* @exception SAMLException if there is an error in the sender or in the
* element definition.
*/
throws SAMLException {
"required.");
}
throw new SAMLRequesterException(
}
if (_attributeValue == null) {
_attributeValue = new ArrayList();
}
// Make sure this is a list of AttributeValue
"AttributeValue: wrong input.");
}
throw new SAMLRequesterException(
}
}
}
/**
* Constructs an instance of <code>Attribute</code>.
*
* @param name The name of the attribute.
* @param nameSpace The namespace in which <code>AttributeName</code>
* elements are interpreted.
* @param attributeValue an <code>AttributeValue</code> object.
* @exception SAMLException if there is an error in the sender or in
* the element definition.
*/
throws SAMLException {
true : false;
if (escapeAtt) {
this.addAttributeValue(XMLUtils.
} else {
this.addAttributeValue(attributeValue);
}
}
/**
* Returns <code>AttributeValue</code> from the Attribute.
*
* @return A list of DOM Element representing the
* <code>AttributeValue</code> block.
* @throws SAMLException
*/
return _attributeValue;
}
/**
* Adds <code>AttributeValue</code> to the Attribute.
*
* @param value A String representing <code>AttributeValue</code>.
* @exception SAMLException
*/
"addAttributeValue: Input is null");
}
throw new SAMLRequesterException(
}
append("AttributeValue").
append("AttributeValue>");
try {
if (_attributeValue == null) {
_attributeValue = new ArrayList();
}
"add to the attribute value list.");
}
throw new SAMLRequesterException(
}
} catch (Exception e) {
throw new SAMLRequesterException("Exception in addAttributeValue" +
e.getMessage());
}
}
/**
* Adds <code>AttributeValue</code> to the Attribute.
*
* @param element An Element object representing
* <code>AttributeValue</code>.
* @exception SAMLException
*/
"addAttributeValue: input is null.");
}
throw new SAMLRequesterException(
}
}
throw new SAMLRequesterException(
}
try {
if (_attributeValue == null) {
_attributeValue = new ArrayList();
}
"add to the attribute value list.");
}
throw new SAMLRequesterException(
}
} catch (Exception e) {
throw new SAMLRequesterException("Exception in addAttributeValue" +
e.getMessage());
}
}
/**
* Returns a String representation of the
* <code><saml:Attribute></code> element,
*
* @return A string containing the valid XML for this element.
*/
return toString(true, false);
}
/**
* Returns a String representation of the
* <code><saml:Attribute></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
*/
if (includeNS) {
}
if (declareNS) {
}
append("\">\n");
}
}
}