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: Environment.java,v 1.2 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; 034 035/** 036 * The <code>Environment</code> element contains information about the 037 * enviroment of the <code>Request</code> context by listing a 038 * sequence of <code>Attribute</code> elements associated with the 039 * environment. These are the environment attributes which are NOT 040 * associated with any of <code>Subject</code>, <code>Resource</code> 041 * or <code>Action</code> of the request. 042 * <p> 043 * <pre> 044 * <xs:element name="Environment" type="xacml-context:EnvironmentType"/> 045 * <xs:complexType name="EnvironmentType"> 046 * <xs:sequence> 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 Environment { 055 056 /** 057 * Returns zero to many <code>Attribute</code> elements of this object. 058 * If no attributes and present, empty <code>List</code> will be returned. 059 * 060 * @return the <code>Attribute</code> elements of this object 061 */ 062 public List getAttributes(); 063 064 /** 065 * Sets the <code>Attribute</code> elements of this object 066 * 067 * @param attributes <code>Attribute</code> elements of this object 068 * attributes could be an empty <code>List</code>, if no attributes 069 * are present. 070 * 071 * @exception XACMLException if the object is immutable 072 * An object is considered <code>immutable</code> if <code> 073 * makeImmutable()</code> has been invoked on it. It can 074 * be determined by calling <code>isMutable</code> on the object. 075 */ 076 public void setAttributes(List attributes) throws XACMLException; 077 078 /** 079 * Returns a <code>String</code> representation of this object 080 * @param includeNSPrefix Determines whether or not the namespace qualifier 081 * is prepended to the Element when converted 082 * @param declareNS Determines whether or not the namespace is declared 083 * within the Element. 084 * @return a <code>String</code> representation of this object 085 * @exception XACMLException if conversion fails for any reason 086 */ 087 public String toXMLString(boolean includeNSPrefix, boolean declareNS) 088 throws XACMLException; 089 090 /** 091 * Returns a string representation of this object 092 * 093 * @return a string representation of this object 094 * @exception XACMLException if conversion fails for any reason 095 */ 096 public String toXMLString() throws XACMLException; 097 098 /** 099 * Makes the object immutable 100 */ 101 public void makeImmutable(); 102 103 /** 104 * Checks if the object is mutable 105 * 106 * @return <code>true</code> if the object is mutable, 107 * <code>false</code> otherwise 108 */ 109 public boolean isMutable(); 110 111}