/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2007 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: ResultImpl.java,v 1.4 2008/11/10 22:57:05 veiming Exp $
*
*/
/**
* The <code>Result</code> element contains decision, status and obligations
* per resource id
*
* <p/>
* schema
* <pre>
* <xs:complexType name="ResultType">
* <xs:sequence>
* <xs:element ref="xacml-context:Decision"/>
* <xs:element ref="xacml-context:Status" minOccurs="0"/>
* <xs:element ref="xacml:Obligations" minOccurs="0"/>
* <xs:sequence>
* <xs:attribute name="ResourceId" type="xs:string" use="optional"/>
* <xs:complexType>
*
* </pre>
*/
private boolean mutable = true;
/**
* Constructs a <code>Result</code> object
*/
}
/**
* Constructs a <code>Result</code> object from an XML string
*
* @param xml string representing a <code>Result</code> object
* @throws SAMLException if the XML string could not be processed
*/
} else {
"ResultImpl.processElement(): invalid XML input");
throw new XACMLException(
"errorObtainingElement"));
}
}
/**
* Constructs a <code>Result</code> object from an XML DOM element
*
* @param element XML DOM element representing a <code>Result</code>
* object
*
* @throws SAMLException if the DOM element could not be processed
*/
}
/**
* Returns <code>resourceId</code> of this object
* @return <code>resourceId</code> of this object
*/
return resourceId;
}
/**
* Sets <code>resourceId</code> of this object
* @param resourceId <code>resourceId</code> of this object
* @exception XACMLException if the object is immutable
*/
if (!mutable) {
throw new XACMLException(
}
this.resourceId = resourceId;
}
/**
* Returns the <code>Decision</code> of this object
*
* @return the <code>Decision</code> of this object
*/
return decision;
}
/**
* Sets the <code>Decision</code> of this object
*
* @exception XACMLException if the object is immutable
*
*/
if (!mutable) {
throw new XACMLException(
}
throw new XACMLException(
}
}
/**
* Returns the <code>Status</code> of this object
*
* @return the <code>Status</code> of this object
*/
return status;
}
/**
* Sets the <code>Status</code> of this object
*
* @exception XACMLException if the object is immutable
*/
if (!mutable) {
throw new XACMLException(
}
}
/**
* Returns the <code>Obligations</code> of this object
*
* @return the <code>Obligations</code> of this object
*/
return obligations;
}
/**
* Sets the <code>Obligations</code> of this object
* @param obligations <code>Obligations</code> to set
*
* @exception XACMLException if the object is immutable
*/
this.obligations = obligations;
}
/**
* Returns a string representation of this object
*
* @return a string representation of this object
* @exception XACMLException if conversion fails for any reason
*/
return this.toXMLString(true, false);
}
/**
* Returns a string representation of this object
* @param includeNSPrefix 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 representation of this object
* @exception XACMLException if conversion fails for any reason
*/
throws XACMLException {
if (declareNS) {
}
if (includeNSPrefix) {
}
if (resourceId != null) {
.append("=")
}
}
}
if (obligations != null) {
}
.append(">\n");
}
/**
* Checks if the object is mutable
*
* @return <code>true</code> if the object is mutable,
* <code>false</code> otherwise
*/
public boolean isMutable() {
return mutable;
}
/**
* Makes the object immutable
*/
public void makeImmutable() {
if (mutable) {
}
}
mutable = false;
}
}
"ResultImpl.processElement(): invalid root element");
throw new XACMLException(
"invalid_element"));
}
"ResultImpl.processElement(): local name missing");
"missing_local_name"));
}
"ResultImpl.processElement(): invalid local name " + elemName);
"invalid_local_name"));
}
}
int i = 0;
while (i < numOfNodes) {
}
i++;
}
if (childCount < 1) {
"ResultImpl.processElement(): invalid child element count: "
+ childCount);
"invalid_child_count")); //FIXME: add i18n key
} else if (childCount > 3) {
"ResultImpl.processElement(): invalid child element count: "
+ childCount);
"invalid_child_count")); //FIXME: add i18n key
}
//process decision element
} else {
"ResultImpl.processElement(): invalid first child element: "
+ firstChildName);
"invalid_first_child")); //FIXME: add i18n key
}
//process status element
if (childCount > 1) {
} else {
"ResultImpl.processElement(): invalid second child element: "
+ secondChildName);
throw new XACMLException(
"invalid_second_child")); //FIXME: add i18n key
}
if (childCount > 2) {
&& (obligations == null) ) {
} else {
"ResultImpl.processElement(): invalid third child element: "
+ thirdChildName);
throw new XACMLException(
"invalid_third_child")); //FIXME: add i18n key
}
}
if (childCount > 3) {
"ResultImpl.processElement(): invalid third child element: "
+ thirdChildName);
throw new XACMLException(
"invalid_third_child")); //FIXME: add i18n key
}
}
}
}