001/** 002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 003 * 004 * Copyright (c) 2007 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: Resource.java,v 1.3 2008/06/25 05:48:11 qcheng Exp $ 026 * 027 */ 028 029package com.sun.identity.xacml.context; 030 031import com.sun.identity.xacml.common.XACMLException; 032 033import java.util.List; 034import org.w3c.dom.Element; 035 036/** 037 * The <code>Resource</code> element specifies information about the 038 * resource to which access is requested by listing a 039 * sequence of <code>Attribute</code> elements associated with the 040 * resource. it may include <code>ResourceContent</code> 041 * <p> 042 * <pre> 043 * <xs:element name="Resource" type="xacml-context:ResourceType"/> 044 * <xs:complexType name="ResourceType"> 045 * <xs:sequence> 046 * <xs:element ref="xacml-context:ResourceContent" minOccurs="0"/> 047 * <xs:element ref="xacml-context:Attribute" minOccurs="0" 048 * maxOccurs="unbounded"/> 049 * <xs:sequence> 050 * <xs:complexType> 051 * </pre> 052 *@supported.all.api 053 */ 054public interface Resource { 055 056 /** 057 * Returns the resource content of the <code>Resource</code> 058 * 059 * @return <code>String</code> representing the contents 060 * of the <code>Resource</code>. 061 */ 062 public Element getResourceContent(); 063 064 /** 065 * Sets the resource content of this object 066 * 067 * @param resourceContent Resource Content of this resource 068 * resource content is optional so could be null. 069 * 070 * @exception XACMLException if the object is immutable 071 * An object is considered <code>immutable</code> if <code> 072 * makeImmutable()</code> has been invoked on it. It can 073 * be determined by calling <code>isMutable</code> on the object. 074 */ 075 public void setResourceContent(Element resourceContent) 076 throws XACMLException; 077 078 /** 079 * Returns zero to many <code>Attribute</code> elements of this object 080 * If no attributes and present, empty <code>List</code> will be returned. 081 * Typically a <code>Resource</code> element will contain an <code> 082 * Attribute</code> with an <code>AttributeId</code> of 083 * "urn:oasis:names:tc:xacml:1.0:resource:resource-id". Each such 084 * <code>Attribute</code> SHALL be an absolute abd fully resolved 085 * representation of the identity of the single resource to which 086 * access is requested. 087 * 088 * @return <code>List</code> containing the <code>Attribute</code> 089 * elements of this object 090 */ 091 public List getAttributes(); 092 093 /** 094 * Sets the <code>Attribute</code> elements of this object 095 * 096 * @param attributes <code>Attribute</code> elements of this object 097 * attributes could be an empty <code>List</code>, if no attributes 098 * are present. 099 * 100 * @exception XACMLException if the object is immutable 101 * An object is considered <code>immutable</code> if <code> 102 * makeImmutable()</code> has been invoked on it. It can 103 * be determined by calling <code>isMutable</code> on the object. 104 */ 105 public void setAttributes(List attributes) throws XACMLException; 106 107 /** 108 * Returns a <code>String</code> representation of this object 109 * @param includeNSPrefix Determines whether or not the namespace qualifier 110 * is prepended to the Element when converted 111 * @param declareNS Determines whether or not the namespace is declared 112 * within the Element. 113 * @return a string representation of this object 114 * @exception XACMLException if conversion fails for any reason 115 */ 116 public String toXMLString(boolean includeNSPrefix, boolean declareNS) 117 throws XACMLException; 118 119 /** 120 * Returns a string representation of this object 121 * 122 * @return a string representation of this object 123 * @exception XACMLException if conversion fails for any reason 124 */ 125 public String toXMLString() throws XACMLException; 126 127 /** 128 * Makes the object immutable 129 */ 130 public void makeImmutable(); 131 132 /** 133 * Checks if the object is mutable 134 * 135 * @return <code>true</code> if the object is mutable, 136 * <code>false</code> otherwise 137 */ 138 public boolean isMutable(); 139 140}
Copyright © 2010-2017, ForgeRock All Rights Reserved.